Commit 09b288e3 authored by Pierre Lamot's avatar Pierre Lamot
Browse files

qml: use menubar in the interface

parent 8922bbb0
......@@ -161,6 +161,7 @@ MainInterface::MainInterface(intf_thread_t *_p_intf , QWidget* parent, Qt::Windo
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
m_clientSideDecoration = ! var_InheritBool( p_intf, "qt-titlebar" );
#endif
m_hasToolbarMenu = var_InheritBool( p_intf, "qt-menubar" );
QString platformName = QGuiApplication::platformName();
......
......@@ -154,6 +154,7 @@ class MainInterface : public QVLCMW
Q_PROPERTY(ColorSchemeModel* colorScheme READ getColorScheme CONSTANT)
Q_PROPERTY(bool hasVLM READ hasVLM CONSTANT)
Q_PROPERTY(bool clientSideDecoration READ useClientSideDecoration NOTIFY useClientSideDecorationChanged)
Q_PROPERTY(bool hasToolbarMenu READ hasToolbarMenu NOTIFY hasToolbarMenuChanged)
public:
/* tors */
......@@ -192,6 +193,7 @@ public:
inline ColorSchemeModel* getColorScheme() const { return m_colorScheme; }
bool hasVLM() const;
bool useClientSideDecoration() const;
inline bool hasToolbarMenu() const { return m_hasToolbarMenu; }
bool hasEmbededVideo() const;
VideoSurfaceProvider* getVideoSurfaceProvider() const;
......@@ -256,6 +258,7 @@ protected:
bool m_gridView;
ColorSchemeModel* m_colorScheme;
bool m_clientSideDecoration = false;
bool m_hasToolbarMenu = false;
/* States */
bool playlistVisible; ///< Is the playlist visible ?
......@@ -321,6 +324,7 @@ signals:
void gridViewChanged( bool );
void colorSchemeChanged( QString );
void useClientSideDecorationChanged();
void hasToolbarMenuChanged();
/// forward window maximise query to the actual window or widget
void requestInterfaceMaximized();
......
......@@ -31,7 +31,11 @@ import "qrc:///menus/" as Menus
Widgets.NavigableFocusScope {
id: root
height: VLCStyle.globalToolbar_height + VLCStyle.localToolbar_height + VLCStyle.applicationVerticalMargin
height: VLCStyle.applicationVerticalMargin
+ (menubar.visible ? menubar.height : 0)
+ VLCStyle.globalToolbar_height
+ VLCStyle.localToolbar_height
property int selectedIndex: 0
property int subSelectedIndex: 0
......@@ -93,7 +97,6 @@ Widgets.NavigableFocusScope {
property alias model: globalMenuGroup.model
Column {
id: col
anchors {
fill: parent
......@@ -104,6 +107,8 @@ Widgets.NavigableFocusScope {
id: globalToolbar
width: parent.width
height: VLCStyle.globalToolbar_height
+ (menubar.visible ? menubar.height : 0)
anchors.rightMargin: VLCStyle.applicationHorizontalMargin
property bool colapseTabButtons: globalToolbar.width > (Math.max(globalToolbarLeft.width, globalToolbarRight.width) + VLCStyle.applicationHorizontalMargin)* 2
+ globalMenuGroup.model.count * VLCStyle.bannerTabButton_width_large
......@@ -115,54 +120,71 @@ Widgets.NavigableFocusScope {
source: "qrc:///widgets/CSDTitlebarTapNDrapHandler.qml"
}
RowLayout {
id: globalToolbarLeft
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
Column {
anchors.fill: parent
anchors.leftMargin: VLCStyle.applicationHorizontalMargin
spacing: VLCStyle.margin_xxxsmall
anchors.rightMargin: VLCStyle.applicationHorizontalMargin
Widgets.IconToolButton {
id: history_back
size: VLCStyle.banner_icon_size
iconText: VLCIcons.topbar_previous
text: i18n.qtr("Previous")
height: localToolbar.height
colorDisabled: VLCStyle.colors.textDisabled
onClicked: history.previous()
enabled: !history.previousEmpty
}
Image {
sourceSize.width: VLCStyle.icon_small
sourceSize.height: VLCStyle.icon_small
source: "qrc:///logo/cone.svg"
enabled: false
Menus.Menubar {
id: menubar
width: parent.width
height: implicitHeight
visible: mainInterface.hasToolbarMenu
}
}
Item {
width: parent.width
height: VLCStyle.globalToolbar_height
RowLayout {
id: globalToolbarLeft
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
spacing: VLCStyle.margin_xxxsmall
Widgets.IconToolButton {
id: history_back
size: VLCStyle.banner_icon_size
iconText: VLCIcons.topbar_previous
text: i18n.qtr("Previous")
height: localToolbar.height
colorDisabled: VLCStyle.colors.textDisabled
onClicked: history.previous()
enabled: !history.previousEmpty
}
Image {
sourceSize.width: VLCStyle.icon_small
sourceSize.height: VLCStyle.icon_small
source: "qrc:///logo/cone.svg"
enabled: false
}
/* Button for the sources */
Widgets.NavigableRow {
id: globalMenuGroup
}
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
/* Button for the sources */
Widgets.NavigableRow {
id: globalMenuGroup
focus: true
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
navigationParent: root
navigationDownItem: localMenuGroup.visible ? localMenuGroup : playlistGroup
focus: true
delegate: Widgets.BannerTabButton {
iconTxt: model.icon
showText: globalToolbar.colapseTabButtons
selected: model.index === selectedIndex
onClicked: root.itemClicked(model.index)
height: globalMenuGroup.height
navigationParent: root
navigationDownItem: localMenuGroup.visible ? localMenuGroup : playlistGroup
delegate: Widgets.BannerTabButton {
iconTxt: model.icon
showText: globalToolbar.colapseTabButtons
selected: model.index === selectedIndex
onClicked: root.itemClicked(model.index)
height: globalMenuGroup.height
}
}
}
}
......@@ -170,10 +192,10 @@ Widgets.NavigableFocusScope {
id: globalToolbarRight
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
rightMargin: VLCStyle.applicationHorizontalMargin
}
height: VLCStyle.globalToolbar_height
active: mainInterface.clientSideDecoration
source: "qrc:///widgets/CSDWindowButtonSet.qml"
}
......
......@@ -24,6 +24,7 @@ import org.videolan.vlc 0.1
import "qrc:///style/"
import "qrc:///widgets/" as Widgets
import "qrc:///menus/" as Menus
Widgets.NavigableFocusScope{
id: topFocusScope
......@@ -81,7 +82,18 @@ Widgets.NavigableFocusScope{
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
spacing: VLCStyle.margin_xsmall
spacing: 0
Menus.Menubar {
id: menubar
width: parent.width
height: VLCStyle.icon_normal
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
visible: mainInterface.hasToolbarMenu
}
RowLayout {
anchors.left: parent.left
......@@ -137,7 +149,7 @@ Widgets.NavigableFocusScope{
id: windowAndGlobalButtonsLayout
Layout.alignment: Qt.AlignTop | Qt.AlignRight
spacing: VLCStyle.margin_xsmall
spacing: 0
Loader {
//Layout.alignment: Qt.AlignRight | Qt.AlignTop
......
......@@ -36,8 +36,9 @@ Widgets.NavigableFocusScope {
ColumnLayout {
anchors.fill: parent
spacing: 0
Menus.MainMenubar {
Menus.Menubar {
Layout.fillWidth: true
}
......
......@@ -238,6 +238,10 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
#define QT_CLIENT_SIDE_DECORATION_LONGTEXT N_( "This option enables the title bar. Disabling it will remove " \
"the titlebar and move window buttons within the interface (Client Side Decoration)" )
#define QT_MENUBAR_TEXT N_( "Show the menu bar" )
#define QT_MENUBAR_LONGTEXT N_( "This option displays the classic menu bar" )
#define FULLSCREEN_CONTROL_PIXELS N_( "Fullscreen controller mouse sensitivity" )
#define CONTINUE_PLAYBACK_TEXT N_("Continue playback?")
......@@ -342,6 +346,8 @@ vlc_module_begin ()
QT_CLIENT_SIDE_DECORATION_TEXT, QT_CLIENT_SIDE_DECORATION_LONGTEXT, false )
#endif
add_bool( "qt-menubar", false, QT_MENUBAR_TEXT, QT_MENUBAR_LONGTEXT, false )
add_bool( "qt-embedded-open", false, QT_NATIVEOPEN_TEXT,
QT_NATIVEOPEN_TEXT, false )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment