From 41e84a0f8b817b5840ceaefff22871854e08d060 Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu <fuzun54@outlook.com> Date: Thu, 22 Jul 2021 20:04:10 +0300 Subject: [PATCH] qml: obey naming conventions --- modules/gui/qt/Makefile.am | 2 +- .../qt/dialogs/toolbar/qml/EditorDNDDelegate.qml | 2 +- .../toolbar/qml/ToolbarEditorButtonList.qml | 10 +++++----- modules/gui/qt/player/qml/ButtonsLayout.qml | 2 +- ...ControlButtons.qml => ControlbarControls.qml} | 16 +++++++--------- modules/gui/qt/player/qml/qmldir | 2 +- modules/gui/qt/vlc.qrc | 2 +- po/POTFILES.in | 2 +- 8 files changed, 18 insertions(+), 20 deletions(-) rename modules/gui/qt/player/qml/{ControlButtons.qml => ControlbarControls.qml} (93%) diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index 9b31026ada84..f8b104b0ad32 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -740,7 +740,7 @@ libqt_plugin_la_QML = \ gui/qt/network/qml/ServicesHomeDisplay.qml \ gui/qt/player/qml/qmldir \ gui/qt/player/qml/ControlBar.qml \ - gui/qt/player/qml/ControlButtons.qml \ + gui/qt/player/qml/ControlbarControls.qml \ gui/qt/player/qml/LanguageMenu.qml \ gui/qt/player/qml/PlaybackSpeed.qml \ gui/qt/player/qml/MiniPlayer.qml \ diff --git a/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml b/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml index 5245a5465bf6..05bf8a4633e4 100644 --- a/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml +++ b/modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml @@ -117,7 +117,7 @@ MouseArea { horizontalCenter: parent.horizontalCenter verticalCenter: parent.verticalCenter } - source: PlayerControlButtons.button(model.id).source + source: PlayerControlbarControls.control(model.id).source onLoaded: { buttonloader.item.paintOnly = true buttonloader.item.enabled = false diff --git a/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml b/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml index 3c0833af5a2d..fe19700e3dc6 100644 --- a/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml +++ b/modules/gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml @@ -31,7 +31,7 @@ GridView{ clip: true ScrollBar.vertical: ScrollBar { policy: ScrollBar.AlwaysOn } - model: PlayerControlButtons.buttonList.length + model: PlayerControlbarControls.controlList.length highlightFollowsCurrentItem: false @@ -111,13 +111,13 @@ GridView{ height: cellHeight property bool held: false - property int mIndex: PlayerControlButtons.buttonList[model.index].id + property int mIndex: PlayerControlbarControls.controlList[model.index].id drag.target: held ? buttonDragItem : undefined cursorShape: Qt.OpenHandCursor onPressed: { buttonDragItem.visible = true - buttonDragItem.text = PlayerControlButtons.buttonList[model.index].label + buttonDragItem.text = PlayerControlbarControls.controlList[model.index].label buttonDragItem.Drag.source = dragArea held = true root._held = true @@ -155,7 +155,7 @@ GridView{ Layout.preferredWidth: VLCStyle.icon_medium Layout.preferredHeight: VLCStyle.icon_medium Layout.alignment: Qt.AlignHCenter - text: PlayerControlButtons.buttonList[model.index].label + text: PlayerControlbarControls.controlList[model.index].label } Widgets.ListSubtitleLabel { @@ -164,7 +164,7 @@ GridView{ Layout.fillHeight: true elide: Text.ElideNone - text: PlayerControlButtons.buttonList[model.index].text + text: PlayerControlbarControls.controlList[model.index].text wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter } diff --git a/modules/gui/qt/player/qml/ButtonsLayout.qml b/modules/gui/qt/player/qml/ButtonsLayout.qml index 2ff09bb8cdf4..4ddacf822595 100644 --- a/modules/gui/qt/player/qml/ButtonsLayout.qml +++ b/modules/gui/qt/player/qml/ButtonsLayout.qml @@ -97,7 +97,7 @@ FocusScope { delegate: Loader { id: buttonloader - source: PlayerControlButtons.button(model.id).source + source: PlayerControlbarControls.control(model.id).source focus: (index === 0) diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlbarControls.qml similarity index 93% rename from modules/gui/qt/player/qml/ControlButtons.qml rename to modules/gui/qt/player/qml/ControlbarControls.qml index 791edcc79cfe..58674f2b9f17 100644 --- a/modules/gui/qt/player/qml/ControlButtons.qml +++ b/modules/gui/qt/player/qml/ControlbarControls.qml @@ -27,11 +27,9 @@ import "qrc:///widgets/" as Widgets import "qrc:///style/" QtObject { - id: controlButtons - readonly property string controlPath : "qrc:///player/controlbarcontrols/" - readonly property var buttonList: [ + readonly property var controlList: [ { id: ControlListModel.PLAY_BUTTON, file: "PlayButton.qml", label: VLCIcons.play, text: i18n.qtr("Play") }, { id: ControlListModel.STOP_BUTTON, file: "StopButton.qml", label: VLCIcons.stop, text: i18n.qtr("Stop") }, { id: ControlListModel.OPEN_BUTTON, file: "OpenButton.qml", label: VLCIcons.eject, text: i18n.qtr("Open") }, @@ -67,16 +65,16 @@ QtObject { { id: ControlListModel.PLAYBACK_SPEED_BUTTON, file: "PlaybackSpeedButton.qml", label: "1x", text: i18n.qtr("Playback Speed") } ] - function button(id) { - var button = buttonList.find( function(button) { return ( button.id === id ) } ) + function control(id) { + var control = controlList.find( function(control) { return ( control.id === id ) } ) - if (button === undefined) { - console.log("button delegate id " + id + " doesn't exist") + if (control === undefined) { + console.log("control delegate id " + id + " doesn't exist") return { source: controlPath + "Fallback.qml" } } - button.source = controlPath + button.file + control.source = controlPath + control.file - return button + return control } } diff --git a/modules/gui/qt/player/qml/qmldir b/modules/gui/qt/player/qml/qmldir index 63ef3e4325ef..b367e66d0457 100644 --- a/modules/gui/qt/player/qml/qmldir +++ b/modules/gui/qt/player/qml/qmldir @@ -1 +1 @@ -singleton PlayerControlButtons 1.0 ControlButtons.qml +singleton PlayerControlbarControls 1.0 ControlbarControls.qml diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc index 8f763a81fd64..166393246b51 100644 --- a/modules/gui/qt/vlc.qrc +++ b/modules/gui/qt/vlc.qrc @@ -334,7 +334,7 @@ <file alias="ResumeDialog.qml">player/qml/ResumeDialog.qml</file> <file alias="SliderBar.qml">player/qml/SliderBar.qml</file> <file alias="TrackInfo.qml">player/qml/TrackInfo.qml</file> - <file alias="ControlButtons.qml">player/qml/ControlButtons.qml</file> + <file alias="ControlbarControls.qml">player/qml/ControlbarControls.qml</file> <file alias="MiniPlayer.qml">player/qml/MiniPlayer.qml</file> <file alias="TopBar.qml">player/qml/TopBar.qml</file> <file alias="PIPPlayer.qml">player/qml/PIPPlayer.qml</file> diff --git a/po/POTFILES.in b/po/POTFILES.in index 696eb4832f8d..5b31464ddd56 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -860,7 +860,7 @@ modules/gui/qt/network/qml/NetworkGridItem.qml modules/gui/qt/network/qml/NetworkHomeDisplay.qml modules/gui/qt/network/qml/NetworkListItem.qml modules/gui/qt/network/qml/ServicesHomeDisplay.qml -modules/gui/qt/player/qml/ControlButtons.qml +modules/gui/qt/player/qml/ControlbarControls.qml modules/gui/qt/player/qml/LanguageMenu.qml modules/gui/qt/player/qml/Player.qml modules/gui/qt/player/qml/ResumeDialog.qml -- GitLab