[vlc-devel] [PATCH 40/49] qml: add chapter next/previous player button

Pierre Lamot pierre at videolabs.io
Fri Oct 11 15:18:04 CEST 2019


---
 .../qt/components/playercontrolbarmodel.hpp   |  2 ++
 modules/gui/qt/qml/player/ControlButtons.qml  | 34 +++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/modules/gui/qt/components/playercontrolbarmodel.hpp b/modules/gui/qt/components/playercontrolbarmodel.hpp
index b8fe81f5c2..2a6f1e1219 100644
--- a/modules/gui/qt/components/playercontrolbarmodel.hpp
+++ b/modules/gui/qt/components/playercontrolbarmodel.hpp
@@ -66,6 +66,8 @@ public:
         LANG_BUTTON,
         MENU_BUTTON,
         BACK_BUTTON,
+        CHAPTER_PREVIOUS_BUTTON,
+        CHAPTER_NEXT_BUTTON,
         BUTTON_MAX,
 
         SPLITTER = 0x20,
diff --git a/modules/gui/qt/qml/player/ControlButtons.qml b/modules/gui/qt/qml/player/ControlButtons.qml
index 2b06705066..5f7da1c3b9 100644
--- a/modules/gui/qt/qml/player/ControlButtons.qml
+++ b/modules/gui/qt/qml/player/ControlButtons.qml
@@ -51,6 +51,8 @@ Item{
         { id:  PlayerControlBarModel.LANG_BUTTON, label: VLCIcons.audiosub, text: qsTr("Open subtitles")},
         { id:  PlayerControlBarModel.MENU_BUTTON, label: VLCIcons.menu, text: qsTr("Menu Button")},
         { id:  PlayerControlBarModel.BACK_BUTTON, label: VLCIcons.exit, text: qsTr("Back Button")},
+        { id:  PlayerControlBarModel.CHAPTER_PREVIOUS_BUTTON, label: VLCIcons.dvd_prev, text: qsTr("Previous chapter")},
+        { id:  PlayerControlBarModel.CHAPTER_NEXT_BUTTON, label: VLCIcons.dvd_next, text: qsTr("Next chapter")},
         { id:  PlayerControlBarModel.VOLUME, label: VLCIcons.volume_high, text: qsTr("Volume Widget")},
         { id:  PlayerControlBarModel.TELETEXT_BUTTONS, label: VLCIcons.tvtelx, text: qsTr("Teletext")},
         { id:  PlayerControlBarModel.ASPECT_RATIO_COMBOBOX, label: VLCIcons.aspect_ratio, text: qsTr("Aspect Ratio")},
@@ -68,6 +70,8 @@ Item{
         case PlayerControlBarModel.LANG_BUTTON: return langBtnDelegate
         case PlayerControlBarModel.PLAYLIST_BUTTON:return playlistBtnDelegate
         case PlayerControlBarModel.MENU_BUTTON:return  menuBtnDelegate
+        case PlayerControlBarModel.CHAPTER_PREVIOUS_BUTTON:return  chapterPreviousBtnDelegate
+        case PlayerControlBarModel.CHAPTER_NEXT_BUTTON:return  chapterNextBtnDelegate
         case PlayerControlBarModel.BACK_BUTTON:return  backBtnDelegate
         case PlayerControlBarModel.WIDGET_SPACER:return  spacerDelegate
         case PlayerControlBarModel.WIDGET_SPACER_EXTEND:return  extendiblespacerDelegate
@@ -152,6 +156,36 @@ Item{
         }
     }
 
+    Component{
+        id: chapterPreviousBtnDelegate
+        Utils.IconToolButton {
+            id: chapterPreviousBtnDelegate
+            size: VLCStyle.icon_medium
+            width: visible? VLCStyle.icon_medium : 0
+            text: VLCIcons.dvd_prev
+            onClicked: player.chapterPrev()
+            visible: player.hasChapters
+            enabled: visible
+            property bool acceptFocus: visible
+        }
+    }
+
+
+    Component{
+        id: chapterNextBtnDelegate
+        Utils.IconToolButton {
+            id: chapterPreviousBtnDelegate
+            size: VLCStyle.icon_medium
+            width: visible? VLCStyle.icon_medium : 0
+            text: VLCIcons.dvd_next
+            onClicked: player.chapterNext()
+            visible: player.hasChapters
+            enabled: visible
+            property bool acceptFocus: visible
+        }
+    }
+
+
     Component{
         id: repeatBtnDelegate
         Utils.IconToolButton {
-- 
2.20.1



More information about the vlc-devel mailing list