[vlc-commits] [Git][videolan/vlc][master] 12 commits: qt/control_list_model: Deprecate MENU_BUTTON and BACK_BUTTON
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Fri Apr 15 08:27:19 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
2d886b18 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/control_list_model: Deprecate MENU_BUTTON and BACK_BUTTON
- - - - -
02b7d249 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qml/ControlLayout: Update the 'defaultSize' binding
- - - - -
76942f71 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qml/controlbarcontrols: Create NavigationWidget
- - - - -
387892cc by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/controlbar_profile_model: Replace TELETEXT_BUTTONS with NAVIGATION_BUTTONS
- - - - -
7b801110 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qml/ControlbarControls: Add NAVIGATION_BUTTONS
- - - - -
406a08e2 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/control_list_filter: Add NAVIGATION_BUTTONS support
- - - - -
ac5e7388 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/player_controlbar_model: Add 'Audio Player' and presets
- - - - -
335b019a by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/player_controlbar_model: Update dictionnary labels
- - - - -
999a8e9a by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qml/Player: Add 'Audio Player' custom toolbar support
- - - - -
282e6ac5 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/player_controlbar_model: Rename 'Mainplayer' to 'Videoplayer'
- - - - -
98163130 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/controlbar_profile: Update Videoplayer default preset
- - - - -
93626af8 by Benjamin Arnaud at 2022-04-15T08:12:09+00:00
qt/controlbar_profile_model: Update presets
- - - - -
12 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/dialogs/toolbar/controlbar_profile.cpp
- modules/gui/qt/dialogs/toolbar/controlbar_profile_model.cpp
- modules/gui/qt/player/control_list_filter.cpp
- modules/gui/qt/player/control_list_model.hpp
- modules/gui/qt/player/player_controlbar_model.cpp
- modules/gui/qt/player/player_controlbar_model.hpp
- modules/gui/qt/player/qml/ControlLayout.qml
- modules/gui/qt/player/qml/ControlbarControls.qml
- modules/gui/qt/player/qml/Player.qml
- + modules/gui/qt/player/qml/controlbarcontrols/NavigationWidget.qml
- modules/gui/qt/vlc.qrc
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -836,6 +836,7 @@ libqt_plugin_la_QML = \
gui/qt/player/qml/controlbarcontrols/LangButton.qml \
gui/qt/player/qml/controlbarcontrols/LoopButton.qml \
gui/qt/player/qml/controlbarcontrols/MenuButton.qml \
+ gui/qt/player/qml/controlbarcontrols/NavigationWidget.qml \
gui/qt/player/qml/controlbarcontrols/NextButton.qml \
gui/qt/player/qml/controlbarcontrols/OpenButton.qml \
gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml \
=====================================
modules/gui/qt/dialogs/toolbar/controlbar_profile.cpp
=====================================
@@ -27,12 +27,38 @@ decltype(ControlbarProfile::m_defaults)
ControlbarProfile::m_defaults =
{
{
- PlayerControlbarModel::Mainplayer,
+ PlayerControlbarModel::Videoplayer,
{
{
{
ControlListModel::LANG_BUTTON,
- ControlListModel::MENU_BUTTON
+ ControlListModel::BOOKMARK_BUTTON,
+ ControlListModel::EXTENDED_BUTTON,
+ ControlListModel::NAVIGATION_BUTTONS
+ },
+ {
+ ControlListModel::SKIP_BACK_BUTTON,
+ ControlListModel::PREVIOUS_BUTTON,
+ ControlListModel::PLAY_BUTTON,
+ ControlListModel::NEXT_BUTTON,
+ ControlListModel::SKIP_FW_BUTTON
+ },
+ {
+ ControlListModel::VOLUME,
+ ControlListModel::RENDERER_BUTTON,
+ ControlListModel::FULLSCREEN_BUTTON
+ }
+ }
+ }
+ },
+ {
+ PlayerControlbarModel::Audioplayer,
+ {
+ {
+ {
+ ControlListModel::LANG_BUTTON,
+ ControlListModel::BOOKMARK_BUTTON,
+ ControlListModel::EXTENDED_BUTTON
},
{
ControlListModel::RANDOM_BUTTON,
@@ -43,6 +69,7 @@ decltype(ControlbarProfile::m_defaults)
},
{
ControlListModel::VOLUME,
+ ControlListModel::RENDERER_BUTTON,
ControlListModel::FULLSCREEN_BUTTON
}
}
=====================================
modules/gui/qt/dialogs/toolbar/controlbar_profile_model.cpp
=====================================
@@ -42,7 +42,7 @@ decltype (ControlbarProfileModel::m_defaults)
N_("Minimalist Style"),
{
{
- PlayerControlbarModel::Mainplayer,
+ PlayerControlbarModel::Videoplayer,
{
{
{
@@ -54,17 +54,35 @@ decltype (ControlbarProfileModel::m_defaults)
ControlListModel::WIDGET_SPACER,
ControlListModel::RECORD_BUTTON,
ControlListModel::WIDGET_SPACER,
- ControlListModel::TELETEXT_BUTTONS,
- ControlListModel::WIDGET_SPACER,
- ControlListModel::PLAYLIST_BUTTON,
+ ControlListModel::NAVIGATION_BUTTONS,
ControlListModel::WIDGET_SPACER,
+ ControlListModel::PLAYLIST_BUTTON
+ }, {},
+ {
ControlListModel::VOLUME
- },
+ }
+ }
+ }
+ },
+ {
+ PlayerControlbarModel::Audioplayer,
+ {
+ {
{
-
- },
+ ControlListModel::PLAY_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::PREVIOUS_BUTTON,
+ ControlListModel::STOP_BUTTON,
+ ControlListModel::NEXT_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::RECORD_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::NAVIGATION_BUTTONS,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::PLAYLIST_BUTTON
+ }, {},
{
-
+ ControlListModel::VOLUME
}
}
}
@@ -73,18 +91,15 @@ decltype (ControlbarProfileModel::m_defaults)
PlayerControlbarModel::Miniplayer,
{
{
+ {
+ ControlListModel::ARTWORK_INFO
+ },
{
ControlListModel::PREVIOUS_BUTTON,
ControlListModel::PLAY_BUTTON,
ControlListModel::STOP_BUTTON,
ControlListModel::NEXT_BUTTON
- },
- {
-
- },
- {
-
- }
+ }, {}
}
}
}
@@ -95,7 +110,7 @@ decltype (ControlbarProfileModel::m_defaults)
N_("One-liner Style"),
{
{
- PlayerControlbarModel::Mainplayer,
+ PlayerControlbarModel::Videoplayer,
{
{
{
@@ -109,17 +124,41 @@ decltype (ControlbarProfileModel::m_defaults)
ControlListModel::PLAYLIST_BUTTON,
ControlListModel::EXTENDED_BUTTON,
ControlListModel::WIDGET_SPACER,
- ControlListModel::WIDGET_SPACER,
ControlListModel::RECORD_BUTTON,
ControlListModel::SNAPSHOT_BUTTON,
ControlListModel::ATOB_BUTTON,
ControlListModel::FRAME_BUTTON
},
+ {},
{
ControlListModel::VOLUME
+ }
+ }
+ }
+ },
+ {
+ PlayerControlbarModel::Audioplayer,
+ {
+ {
+ {
+ ControlListModel::PLAY_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::PREVIOUS_BUTTON,
+ ControlListModel::STOP_BUTTON,
+ ControlListModel::NEXT_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::FULLSCREEN_BUTTON,
+ ControlListModel::PLAYLIST_BUTTON,
+ ControlListModel::EXTENDED_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::RECORD_BUTTON,
+ ControlListModel::SNAPSHOT_BUTTON,
+ ControlListModel::ATOB_BUTTON,
+ ControlListModel::FRAME_BUTTON
},
+ {},
{
-
+ ControlListModel::VOLUME
}
}
}
@@ -128,6 +167,9 @@ decltype (ControlbarProfileModel::m_defaults)
PlayerControlbarModel::Miniplayer,
{
{
+ {
+ ControlListModel::ARTWORK_INFO
+ },
{
ControlListModel::RANDOM_BUTTON,
ControlListModel::PREVIOUS_BUTTON,
@@ -135,13 +177,7 @@ decltype (ControlbarProfileModel::m_defaults)
ControlListModel::STOP_BUTTON,
ControlListModel::NEXT_BUTTON,
ControlListModel::LOOP_BUTTON
- },
- {
-
- },
- {
-
- }
+ }, {}
}
}
}
@@ -152,7 +188,7 @@ decltype (ControlbarProfileModel::m_defaults)
N_("Simplest Style"),
{
{
- PlayerControlbarModel::Mainplayer,
+ PlayerControlbarModel::Videoplayer,
{
{
{
@@ -170,22 +206,37 @@ decltype (ControlbarProfileModel::m_defaults)
}
},
{
- PlayerControlbarModel::Miniplayer,
+ PlayerControlbarModel::Audioplayer,
{
{
{
- ControlListModel::PREVIOUS_BUTTON,
- ControlListModel::PLAY_BUTTON,
- ControlListModel::NEXT_BUTTON
+ ControlListModel::VOLUME
},
{
-
+ ControlListModel::PLAY_BUTTON,
+ ControlListModel::NEXT_BUTTON,
+ ControlListModel::STOP_BUTTON
},
{
-
+ ControlListModel::FULLSCREEN_BUTTON
}
}
}
+ },
+ {
+ PlayerControlbarModel::Miniplayer,
+ {
+ {
+ {
+ ControlListModel::ARTWORK_INFO
+ },
+ {
+ ControlListModel::PREVIOUS_BUTTON,
+ ControlListModel::PLAY_BUTTON,
+ ControlListModel::NEXT_BUTTON
+ }, {}
+ }
+ }
}
}
},
@@ -194,7 +245,7 @@ decltype (ControlbarProfileModel::m_defaults)
N_("Classic Style"),
{
{
- PlayerControlbarModel::Mainplayer,
+ PlayerControlbarModel::Videoplayer,
{
{
{
@@ -211,9 +262,32 @@ decltype (ControlbarProfileModel::m_defaults)
ControlListModel::LOOP_BUTTON,
ControlListModel::RANDOM_BUTTON
},
+ {},
{
-
+ ControlListModel::VOLUME
+ }
+ }
+ }
+ },
+ {
+ PlayerControlbarModel::Audioplayer,
+ {
+ {
+ {
+ ControlListModel::PLAY_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::PREVIOUS_BUTTON,
+ ControlListModel::STOP_BUTTON,
+ ControlListModel::NEXT_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::FULLSCREEN_BUTTON,
+ ControlListModel::EXTENDED_BUTTON,
+ ControlListModel::WIDGET_SPACER,
+ ControlListModel::PLAYLIST_BUTTON,
+ ControlListModel::LOOP_BUTTON,
+ ControlListModel::RANDOM_BUTTON
},
+ {},
{
ControlListModel::VOLUME
}
@@ -224,6 +298,9 @@ decltype (ControlbarProfileModel::m_defaults)
PlayerControlbarModel::Miniplayer,
{
{
+ {
+ ControlListModel::ARTWORK_INFO
+ },
{
ControlListModel::PLAY_BUTTON,
ControlListModel::WIDGET_SPACER,
@@ -237,9 +314,6 @@ decltype (ControlbarProfileModel::m_defaults)
ControlListModel::PLAYLIST_BUTTON,
ControlListModel::LOOP_BUTTON,
ControlListModel::RANDOM_BUTTON
- },
- {
-
},
{
ControlListModel::VOLUME
=====================================
modules/gui/qt/player/control_list_filter.cpp
=====================================
@@ -56,13 +56,9 @@ bool ControlListFilter::filterAcceptsRow(int source_row, const QModelIndex &) co
= static_cast<ControlListModel::ControlType> (variant.toInt());
// NOTE: These controls are completely hidden when the current media does not support them.
- if (type == ControlListModel::TELETEXT_BUTTONS)
+ if (type == ControlListModel::NAVIGATION_BUTTONS)
{
- return m_player->isTeletextAvailable();
- }
- else if (type == ControlListModel::DVD_MENUS_BUTTON)
- {
- return m_player->hasMenu();
+ return (m_player->hasMenu() || m_player->isTeletextAvailable());
}
return true;
=====================================
modules/gui/qt/player/control_list_model.hpp
=====================================
@@ -57,8 +57,8 @@ public:
LOOP_BUTTON,
INFO_BUTTON,
LANG_BUTTON,
- MENU_BUTTON,
- BACK_BUTTON,
+ MENU_BUTTON, // deprecated
+ BACK_BUTTON, // deprecated
CHAPTER_PREVIOUS_BUTTON,
CHAPTER_NEXT_BUTTON,
BUTTON_MAX,
@@ -75,6 +75,7 @@ public:
REVERSE_BUTTON,
BOOKMARK_BUTTON,
RENDERER_BUTTON,
+ NAVIGATION_BUTTONS,
SPECIAL_MAX,
WIDGET_SPACER = 0x40,
=====================================
modules/gui/qt/player/player_controlbar_model.cpp
=====================================
@@ -26,8 +26,9 @@
decltype (PlayerControlbarModel::playerIdentifierDictionary)
PlayerControlbarModel::playerIdentifierDictionary {
- {Mainplayer, N_("Mainplayer")},
- {Miniplayer, N_("Miniplayer")}
+ {Videoplayer, N_("Video player")},
+ {Audioplayer, N_("Audio player")},
+ {Miniplayer, N_("Mini player")}
};
QJSValue PlayerControlbarModel::getPlaylistIdentifierListModel(QQmlEngine *engine, QJSEngine *scriptEngine)
=====================================
modules/gui/qt/player/player_controlbar_model.hpp
=====================================
@@ -41,12 +41,13 @@ public:
// When there is a need to add a new Player, just
// add its identifier in this enum and set QML buttons layout
// identifier to it. Such as `property int identifier =
- // PlayerControlbarModel.Mainplayer`.
+ // PlayerControlbarModel.Videoplayer`.
// To make it translatable, add a corresponding entry to
// the static member playerIdentifierDictionary which is
// initialized in the source file.
enum PlayerIdentifier {
- Mainplayer = 0,
+ Videoplayer = 0,
+ Audioplayer,
Miniplayer
};
Q_ENUM(PlayerIdentifier)
=====================================
modules/gui/qt/player/qml/ControlLayout.qml
=====================================
@@ -167,7 +167,8 @@ FocusScope {
// so it can be set here unlike leftItem and rightItem:
item.Navigation.parentItem = controlLayout
- if (item instanceof Widgets.IconToolButton)
+ // FIXME: Do we really need to enforce a defaultSize ?
+ if (item.size !== undefined)
item.size = Qt.binding(function() { return defaultSize; })
// force colors:
=====================================
modules/gui/qt/player/qml/ControlbarControls.qml
=====================================
@@ -52,12 +52,11 @@ QtObject {
{ id: ControlListModel.LOOP_BUTTON, file: "LoopButton.qml", label: VLCIcons.repeat_all, text: I18n.qtr("Loop") },
{ id: ControlListModel.INFO_BUTTON, file: "InfoButton.qml", label: VLCIcons.info, text: I18n.qtr("Information") },
{ id: ControlListModel.LANG_BUTTON, file: "LangButton.qml", label: VLCIcons.audiosub, text: I18n.qtr("Open subtitles") },
- { id: ControlListModel.MENU_BUTTON, file: "MenuButton.qml", label: VLCIcons.menu, text: I18n.qtr("Menu Button") },
{ id: ControlListModel.BOOKMARK_BUTTON, file: "BookmarkButton.qml", label: VLCIcons.bookmark, text: I18n.qtr("Bookmark Button") },
- { id: ControlListModel.BACK_BUTTON, file: "BackButton.qml", label: VLCIcons.exit, text: I18n.qtr("Back Button") },
{ id: ControlListModel.CHAPTER_PREVIOUS_BUTTON, file: "ChapterPreviousButton.qml", label: VLCIcons.dvd_prev, text: I18n.qtr("Previous chapter") },
{ id: ControlListModel.CHAPTER_NEXT_BUTTON, file: "ChapterNextButton.qml", label: VLCIcons.dvd_next, text: I18n.qtr("Next chapter") },
{ id: ControlListModel.VOLUME, file: "VolumeWidget.qml", label: VLCIcons.volume_high, text: I18n.qtr("Volume Widget") },
+ { id: ControlListModel.NAVIGATION_BUTTONS, file: "NavigationWidget.qml", label: VLCIcons.dvd_menu, text: I18n.qtr("Navigation") },
{ id: ControlListModel.DVD_MENUS_BUTTON, file: "DvdMenuButton.qml", label: VLCIcons.dvd_menu, text: I18n.qtr("DVD menus") },
{ id: ControlListModel.TELETEXT_BUTTONS, file: "TeletextWidget.qml", label: VLCIcons.tvtelx, text: I18n.qtr("Teletext") },
{ id: ControlListModel.RENDERER_BUTTON, file: "RendererButton.qml", label: VLCIcons.renderer, text: I18n.qtr("Renderer Button") },
=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -547,7 +547,8 @@ FocusScope {
onRequestLockUnlockAutoHide: rootPlayer.lockUnlockAutoHide(lock, source)
- identifier: PlayerControlbarModel.Mainplayer
+ identifier: (Player.hasVideoOutput) ? PlayerControlbarModel.Videoplayer
+ : PlayerControlbarModel.Audioplayer
}
}
}
=====================================
modules/gui/qt/player/qml/controlbarcontrols/NavigationWidget.qml
=====================================
@@ -0,0 +1,114 @@
+/*****************************************************************************
+ * Copyright (C) 2022 VLC authors and VideoLAN
+ *
+ * Authors: Benjamin Arnaud <bunjee at omega.gg>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+import QtQuick 2.11
+import QtQuick.Templates 2.4 as Templates
+
+import org.videolan.vlc 0.1
+
+import "qrc:///widgets/" as Widgets
+import "qrc:///style/"
+
+Templates.Pane {
+ id: root
+
+ // Properties
+
+ property int size: VLCStyle.icon_medium
+
+ property VLCColors colors: VLCStyle.colors
+
+ property bool paintOnly: false
+
+ // Private
+
+ readonly property string _controlPath : "qrc:///player/controlbarcontrols/"
+
+ // Settings
+
+ implicitWidth: contentWidth + leftPadding + rightPadding
+ implicitHeight: contentHeight + topPadding + bottomPadding
+
+ contentWidth: row.implicitWidth
+ contentHeight: row.implicitHeight
+
+ // Keys
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: Navigation.defaultKeyAction(event)
+
+ // Functions private
+
+ function _applyItem(loader, item) {
+ item.focus = true
+
+ item.colors = Qt.binding(function() { return colors })
+ item.paintOnly = Qt.binding(function() { return paintOnly })
+
+ item.Navigation.parentItem = Qt.binding(function() { return loader })
+ }
+
+ // Children
+
+ Row {
+ id: row
+
+ anchors.fill: parent
+
+ Loader {
+ id: loaderA
+
+ anchors.verticalCenter: parent.verticalCenter
+
+ focus: (item && item.enabled)
+
+ // NOTE: We display the 'menu button' as a placeholder for the customize dialog.
+ source: (Player.hasMenu || root.paintOnly) ? _controlPath + "DvdMenuButton.qml" : ""
+
+ Navigation.parentItem: root
+ Navigation.rightItem: loaderB.item
+
+ onLoaded: {
+ if (item === null) return
+
+ _applyItem(loaderA, item)
+
+ item.size = Qt.binding(function() { return root.size })
+ }
+ }
+
+ Loader {
+ id: loaderB
+
+ anchors.verticalCenter: parent.verticalCenter
+
+ focus: (item && item.enabled && loaderA.focus === false)
+
+ source: (Player.isTeletextAvailable
+ &&
+ root.paintOnly == false) ? _controlPath + "TeletextWidget.qml" : ""
+
+ Navigation.parentItem: root
+ Navigation.leftItem: loaderA.item
+
+ onLoaded: if (item) _applyItem(loaderB, item)
+ }
+ }
+}
=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -373,6 +373,7 @@
<file alias="LangButton.qml">player/qml/controlbarcontrols/LangButton.qml</file>
<file alias="LoopButton.qml">player/qml/controlbarcontrols/LoopButton.qml</file>
<file alias="MenuButton.qml">player/qml/controlbarcontrols/MenuButton.qml</file>
+ <file alias="NavigationWidget.qml">player/qml/controlbarcontrols/NavigationWidget.qml</file>
<file alias="NextButton.qml">player/qml/controlbarcontrols/NextButton.qml</file>
<file alias="OpenButton.qml">player/qml/controlbarcontrols/OpenButton.qml</file>
<file alias="PlaybackSpeedButton.qml">player/qml/controlbarcontrols/PlaybackSpeedButton.qml</file>
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/627ab4febb94291f427a5f7584d5051c64548649...93626af8239e99a2d513ff1c5a26130783494b21
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/627ab4febb94291f427a5f7584d5051c64548649...93626af8239e99a2d513ff1c5a26130783494b21
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list