[vlc-devel] [PATCH v2 02/12] qml: rename rootWindow to mainInterface
Pierre Lamot
pierre at videolabs.io
Thu May 14 14:05:21 CEST 2020
the variable points to the MainInterface and not its actual window
---
.../gui/qt/maininterface/main_interface.cpp | 2 +-
.../qt/maininterface/qml/BannerSources.qml | 2 +-
.../qt/maininterface/qml/MainInterface.qml | 4 ++--
.../gui/qt/medialibrary/qml/MainDisplay.qml | 8 ++++----
modules/gui/qt/menus/qml/PopupMenu.qml | 2 +-
modules/gui/qt/menus/qml/ViewMenu.qml | 16 +++++++--------
modules/gui/qt/player/qml/ControlBar.qml | 6 +++---
modules/gui/qt/player/qml/ControlButtons.qml | 10 +++++-----
modules/gui/qt/player/qml/MiniPlayer.qml | 4 ++--
modules/gui/qt/player/qml/Player.qml | 20 +++++++++----------
modules/gui/qt/player/qml/TopBar.qml | 2 +-
11 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/modules/gui/qt/maininterface/main_interface.cpp b/modules/gui/qt/maininterface/main_interface.cpp
index 1d573de419..5a830c6e7e 100644
--- a/modules/gui/qt/maininterface/main_interface.cpp
+++ b/modules/gui/qt/maininterface/main_interface.cpp
@@ -420,7 +420,7 @@ void MainInterface::createMainWidget( QSettings * )
rootCtx->setContextProperty( "i18n", i18n );
rootCtx->setContextProperty( "mainctx", mainCtx);
rootCtx->setContextProperty( "rootQMLView", mediacenterView);
- rootCtx->setContextProperty( "rootWindow", this);
+ rootCtx->setContextProperty( "mainInterface", this);
rootCtx->setContextProperty( "dialogProvider", DialogsProvider::getInstance());
rootCtx->setContextProperty( "recentsMedias", new VLCRecentMediaModel( p_intf, this ));
rootCtx->setContextProperty( "settings", new Settings( p_intf, this ));
diff --git a/modules/gui/qt/maininterface/qml/BannerSources.qml b/modules/gui/qt/maininterface/qml/BannerSources.qml
index 614ad7d107..9c32b57619 100644
--- a/modules/gui/qt/maininterface/qml/BannerSources.qml
+++ b/modules/gui/qt/maininterface/qml/BannerSources.qml
@@ -303,7 +303,7 @@ Widgets.NavigableFocusScope {
iconText: VLCIcons.playlist
text: i18n.qtr("Playlist")
- onClicked: rootWindow.playlistVisible = !rootWindow.playlistVisible
+ onClicked: mainInterface.playlistVisible = !mainInterface.playlistVisible
}
}
diff --git a/modules/gui/qt/maininterface/qml/MainInterface.qml b/modules/gui/qt/maininterface/qml/MainInterface.qml
index 97ba129bd8..2344ef91c9 100644
--- a/modules/gui/qt/maininterface/qml/MainInterface.qml
+++ b/modules/gui/qt/maininterface/qml/MainInterface.qml
@@ -38,12 +38,12 @@ Rectangle {
Loader {
id: playlistWindowLoader
- active: !rootWindow.playlistDocked && rootWindow.playlistVisible
+ active: !mainInterface.playlistDocked && mainInterface.playlistVisible
sourceComponent: Window {
visible: true
title: i18n.qtr("Playlist")
color: VLCStyle.colors.bg
- onClosing: rootWindow.playlistVisible = false
+ onClosing: mainInterface.playlistVisible = false
PL.PlaylistListView {
id: playlistView
focus: true
diff --git a/modules/gui/qt/medialibrary/qml/MainDisplay.qml b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
index 96b5a9fd70..f5e4d8ee5c 100644
--- a/modules/gui/qt/medialibrary/qml/MainDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
@@ -80,7 +80,7 @@ Widgets.NavigableFocusScope {
}
//unhandled keys are forwarded as hotkeys
if (!event.accepted)
- rootWindow.sendHotkey(event.key, event.modifiers);
+ mainInterface.sendHotkey(event.key, event.modifiers);
}
readonly property var pageModel: [
@@ -186,7 +186,7 @@ Widgets.NavigableFocusScope {
left: parent.left
bottom: parent.bottom
right: playlist.visible ? playlist.left : parent.right
- rightMargin: (rootWindow.playlistDocked && rootWindow.playlistVisible)
+ rightMargin: (mainInterface.playlistDocked && mainInterface.playlistVisible)
? 0
: VLCStyle.applicationHorizontalMargin
leftMargin: VLCStyle.applicationHorizontalMargin
@@ -209,7 +209,7 @@ Widgets.NavigableFocusScope {
id: playlist
focus: true
width: root.width/4
- visible: rootWindow.playlistDocked && rootWindow.playlistVisible
+ visible: mainInterface.playlistDocked && mainInterface.playlistVisible
anchors {
top: parent.top
right: parent.right
@@ -223,7 +223,7 @@ Widgets.NavigableFocusScope {
navigationUpItem: sourcesBanner
navigationDownItem: miniPlayer.expanded ? miniPlayer : undefined
navigationCancel: function() {
- rootWindow.playlistVisible = false
+ mainInterface.playlistVisible = false
stackView.forceActiveFocus()
}
diff --git a/modules/gui/qt/menus/qml/PopupMenu.qml b/modules/gui/qt/menus/qml/PopupMenu.qml
index 0e439816d5..636b1212cf 100644
--- a/modules/gui/qt/menus/qml/PopupMenu.qml
+++ b/modules/gui/qt/menus/qml/PopupMenu.qml
@@ -36,7 +36,7 @@ Widgets.MenuExt {
Action { text: i18n.qtr("Record"); enabled: player.isPlaying ; onTriggered: player.toggleRecord(); icon.source: "qrc:/toolbar/record.svg"; }
MenuSeparator {}
- Action { text: i18n.qtr("&Fullscreen Interface"); checkable: true; checked: rootWindow.interfaceFullScreen; onTriggered: rootWindow.interfaceFullScreen = !rootWindow.interfaceFullScreen }
+ Action { text: i18n.qtr("&Fullscreen Interface"); checkable: true; checked: mainInterface.interfaceFullScreen; onTriggered: mainInterface.interfaceFullScreen = !mainInterface.interfaceFullScreen }
MenuSeparator {}
AudioMenu { title: i18n.qtr("&Audio") }
diff --git a/modules/gui/qt/menus/qml/ViewMenu.qml b/modules/gui/qt/menus/qml/ViewMenu.qml
index 031543e613..67e6b26516 100644
--- a/modules/gui/qt/menus/qml/ViewMenu.qml
+++ b/modules/gui/qt/menus/qml/ViewMenu.qml
@@ -25,26 +25,26 @@ Widgets.MenuExt {
id: viewMenu
Action {
text: i18n.qtr("Play&list")
- onTriggered: rootWindow.playlistVisible = !rootWindow.playlistVisible
+ onTriggered: mainInterface.playlistVisible = !mainInterface.playlistVisible
}
Action {
text: i18n.qtr("Docked Playlist")
checkable: true
- checked: rootWindow.playlistDocked
- onTriggered: rootWindow.playlistDocked = !rootWindow.playlistDocked
+ checked: mainInterface.playlistDocked
+ onTriggered: mainInterface.playlistDocked = !mainInterface.playlistDocked
}
Action {
text: i18n.qtr("&Always on Top")
checkable: true
- checked: rootWindow.interfaceAlwaysOnTop
- onTriggered: rootWindow.interfaceAlwaysOnTop = !rootWindow.interfaceAlwaysOnTop
+ checked: mainInterface.interfaceAlwaysOnTop
+ onTriggered: mainInterface.interfaceAlwaysOnTop = !mainInterface.interfaceAlwaysOnTop
}
Action {
text: i18n.qtr("&Fullscreen Interface")
checkable: true
- checked: rootWindow.interfaceFullScreen
- onTriggered: rootWindow.interfaceFullScreen = !rootWindow.interfaceFullScreen
+ checked: mainInterface.interfaceFullScreen
+ onTriggered: mainInterface.interfaceFullScreen = !mainInterface.interfaceFullScreen
}
Loader {
@@ -74,7 +74,7 @@ Widgets.MenuExt {
CheckableModelSubMenu{
title: i18n.qtr("Add Interface")
- model: rootWindow.extraInterfaces
+ model: mainInterface.extraInterfaces
}
/* FIXME unimplemented
diff --git a/modules/gui/qt/player/qml/ControlBar.qml b/modules/gui/qt/player/qml/ControlBar.qml
index 9c5ea06e73..be292653c4 100644
--- a/modules/gui/qt/player/qml/ControlBar.qml
+++ b/modules/gui/qt/player/qml/ControlBar.qml
@@ -66,7 +66,7 @@ Widgets.NavigableFocusScope {
Text {
- text: (rootWindow.showRemainingTime && player.remainingTime.valid())
+ text: (mainInterface.showRemainingTime && player.remainingTime.valid())
? "-" + player.remainingTime.toString()
: player.length.toString()
color: VLCStyle.colors.playerFg
@@ -75,7 +75,7 @@ Widgets.NavigableFocusScope {
Layout.alignment: Qt.AlignRight
MouseArea {
anchors.fill: parent
- onClicked: rootWindow.showRemainingTime = !rootWindow.showRemainingTime
+ onClicked: mainInterface.showRemainingTime = !mainInterface.showRemainingTime
}
}
@@ -115,7 +115,7 @@ Widgets.NavigableFocusScope {
}
Connections{
- target: rootWindow
+ target: mainInterface
onToolBarConfUpdated: playerControlBarModel.reloadModel()
}
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 0811812b7d..5f10ed0e4f 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -321,8 +321,8 @@ Item{
size: VLCStyle.icon_medium
iconText: VLCIcons.playlist
onClicked: {
- rootWindow.playlistVisible = !rootWindow.playlistVisible
- if (rootWindow.playlistVisible && rootWindow.playlistDocked) {
+ mainInterface.playlistVisible = !mainInterface.playlistVisible
+ if (mainInterface.playlistVisible && mainInterface.playlistDocked) {
playlistWidget.gainFocus(playlistBtn)
}
}
@@ -417,8 +417,8 @@ Item{
Widgets.IconToolButton{
id: fullScreenBtn
size: VLCStyle.icon_medium
- iconText: rootWindow.interfaceFullScreen ?VLCIcons.defullscreen :VLCIcons.fullscreen
- onClicked: rootWindow.interfaceFullScreen = !rootWindow.interfaceFullScreen
+ iconText: mainInterface.interfaceFullScreen ?VLCIcons.defullscreen :VLCIcons.fullscreen
+ onClicked: mainInterface.interfaceFullScreen = !mainInterface.interfaceFullScreen
property bool acceptFocus: true
text: i18n.qtr("fullscreen")
}
@@ -596,7 +596,7 @@ Item{
id: quitBtn
size: VLCStyle.icon_medium
iconText: VLCIcons.clear
- onClicked: rootWindow.close()
+ onClicked: mainInterface.close()
property bool acceptFocus: true
text: i18n.qtr("Quit")
}
diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 6629b19151..5bee416abc 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -147,7 +147,7 @@ Widgets.NavigableFocusScope {
}
Connections{
- target: rootWindow
+ target: mainInterface
onToolBarConfUpdated: {
miniPlayerModel.reloadModel()
}
@@ -167,7 +167,7 @@ Widgets.NavigableFocusScope {
if (!event.accepted)
defaultKeyAction(event, 0)
if (!event.accepted)
- rootWindow.sendHotkey(event.key, event.modifiers);
+ mainInterface.sendHotkey(event.key, event.modifiers);
}
}
diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index aa5a4e499d..6e094a1f60 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -47,7 +47,7 @@ Widgets.NavigableFocusScope {
//unhandled keys are forwarded as hotkeys
if (!event.accepted || controlBarView.state !== "visible")
- rootWindow.sendHotkey(event.key, event.modifiers);
+ mainInterface.sendHotkey(event.key, event.modifiers);
}
Keys.onReleased: {
@@ -61,7 +61,7 @@ Widgets.NavigableFocusScope {
}
navigationCancel: function() {
- if (rootWindow.hasEmbededVideo && controlBarView.state === "visible") {
+ if (mainInterface.hasEmbededVideo && controlBarView.state === "visible") {
toolbarAutoHide._setVisibleControlBar(false)
} else {
if (player.hasVideoOutput) {
@@ -111,10 +111,10 @@ Widgets.NavigableFocusScope {
lockAutoHide: playlistpopup.state === "visible"
onTogglePlaylistVisiblity: {
- if (rootWindow.playlistDocked)
+ if (mainInterface.playlistDocked)
playlistpopup.showPlaylist = !playlistpopup.showPlaylist
else
- rootWindow.playlistVisible = !rootWindow.playlistVisible
+ mainInterface.playlistVisible = !mainInterface.playlistVisible
}
title: mainPlaylistController.currentItem.title
@@ -151,7 +151,7 @@ Widgets.NavigableFocusScope {
spacing: VLCStyle.margin_small
- visible: !rootWindow.hasEmbededVideo
+ visible: !mainInterface.hasEmbededVideo
Item {
Layout.fillHeight: true
@@ -239,7 +239,7 @@ Widgets.NavigableFocusScope {
property var previousFocus: undefined
focus: false
edge: Widgets.DrawerExt.Edges.Right
- state: showPlaylist && rootWindow.playlistDocked ? "visible" : "hidden"
+ state: showPlaylist && mainInterface.playlistDocked ? "visible" : "hidden"
component: Rectangle {
color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.banner, 0.8)
width: rootPlayer.width/4
@@ -310,7 +310,7 @@ Widgets.NavigableFocusScope {
lockAutoHide: playlistpopup.state === "visible"
|| !player.hasVideoOutput
- || !rootWindow.hasEmbededVideo
+ || !mainInterface.hasEmbededVideo
|| controllerMouseArea.containsMouse
onAutoHideChanged: {
if (autoHide)
@@ -328,7 +328,7 @@ Widgets.NavigableFocusScope {
//center image
Rectangle {
- visible: !rootWindow.hasEmbededVideo
+ visible: !mainInterface.hasEmbededVideo
focus: false
color: VLCStyle.colors.bg
anchors.fill: parent
@@ -359,7 +359,7 @@ Widgets.NavigableFocusScope {
z: 0
ctx: mainctx
- visible: rootWindow.hasEmbededVideo
+ visible: mainInterface.hasEmbededVideo
anchors.fill: parent
property point mousePosition: Qt.point(0,0)
@@ -429,7 +429,7 @@ Widgets.NavigableFocusScope {
}
Connections {
- target: rootWindow
+ target: mainInterface
onAskShow: {
toolbarAutoHide.toggleForceVisible()
}
diff --git a/modules/gui/qt/player/qml/TopBar.qml b/modules/gui/qt/player/qml/TopBar.qml
index a041aff58d..37df6dcc6a 100644
--- a/modules/gui/qt/player/qml/TopBar.qml
+++ b/modules/gui/qt/player/qml/TopBar.qml
@@ -31,7 +31,7 @@ Widgets.NavigableFocusScope{
implicitHeight: topcontrolContent.implicitHeight
property bool autoHide: player.hasVideoOutput
- && rootWindow.hasEmbededVideo
+ && mainInterface.hasEmbededVideo
&& !topcontrollerMouseArea.containsMouse
&& !lockAutoHide
--
2.25.1
More information about the vlc-devel
mailing list