[vlc-commits] [Git][videolan/vlc][master] 7 commits: qt/pixmaps/toolbar: Add bookmark icon

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Apr 1 10:28:39 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
1f61542b by Benjamin Arnaud at 2022-04-01T09:52:14+00:00
qt/pixmaps/toolbar: Add bookmark icon

- - - - -
cd3dfa4e by Benjamin Arnaud at 2022-04-01T09:52:14+00:00
qt/custom_menus: Create ListMenuHelper

Co-authored-by: Pierre Lamot <pierre at videolabs.io>

- - - - -
b4ad095f by Benjamin Arnaud at 2022-04-01T09:52:14+00:00
qt/player_controller: Add the 'getPlayer' function

- - - - -
c58c340d by Benjamin Arnaud at 2022-04-01T09:52:14+00:00
qt/qml_menu_wrapper: Create QmlBookmarkMenu

- - - - -
cc16cb9b by Benjamin Arnaud at 2022-04-01T09:52:14+00:00
qt/BookmarkMenu: Update to ListMenuHelper implementation

- - - - -
6074a429 by Benjamin Arnaud at 2022-04-01T09:52:14+00:00
qml/controlbarcontrols: Create BookmarkButton

- - - - -
7ab09b01 by Benjamin Arnaud at 2022-04-01T09:52:14+00:00
qml/ControlbarControls: Add BOOKMARK_BUTTON

- - - - -


18 changed files:

- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/mainui.cpp
- modules/gui/qt/menus/custom_menus.cpp
- modules/gui/qt/menus/custom_menus.hpp
- modules/gui/qt/menus/menus.cpp
- modules/gui/qt/menus/menus.hpp
- modules/gui/qt/menus/qml_menu_wrapper.cpp
- modules/gui/qt/menus/qml_menu_wrapper.hpp
- modules/gui/qt/pixmaps/VLCIcons.json
- modules/gui/qt/pixmaps/VLCIcons.ttf
- + modules/gui/qt/pixmaps/toolbar/bookmark.svg
- modules/gui/qt/player/control_list_model.hpp
- modules/gui/qt/player/player_controller.cpp
- modules/gui/qt/player/player_controller.hpp
- modules/gui/qt/player/qml/ControlbarControls.qml
- + modules/gui/qt/player/qml/controlbarcontrols/BookmarkButton.qml
- modules/gui/qt/style/VLCIcons.qml
- modules/gui/qt/vlc.qrc


Changes:

=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -823,6 +823,7 @@ libqt_plugin_la_QML = \
 	gui/qt/player/qml/controlbarcontrols/AspectRatioWidget.qml \
 	gui/qt/player/qml/controlbarcontrols/AtoBButton.qml \
 	gui/qt/player/qml/controlbarcontrols/BackButton.qml \
+	gui/qt/player/qml/controlbarcontrols/BookmarkButton.qml \
 	gui/qt/player/qml/controlbarcontrols/ChapterNextButton.qml \
 	gui/qt/player/qml/controlbarcontrols/ChapterPreviousButton.qml \
 	gui/qt/player/qml/controlbarcontrols/DvdMenuButton.qml \


=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -264,6 +264,7 @@ void MainUI::registerQMLTypes()
         qmlRegisterType<SortMenuVideo>( uri, versionMajor, versionMinor, "SortMenuVideo" );
         qmlRegisterType<QmlGlobalMenu>( uri, versionMajor, versionMinor, "QmlGlobalMenu" );
         qmlRegisterType<QmlMenuBar>( uri, versionMajor, versionMinor, "QmlMenuBar" );
+        qmlRegisterType<QmlBookmarkMenu>( uri, versionMajor, versionMinor, "QmlBookmarkMenu" );
         qmlRegisterType<NetworkMediaContextMenu>( uri, versionMajor, versionMinor, "NetworkMediaContextMenu" );
         qmlRegisterType<NetworkDeviceContextMenu>( uri, versionMajor, versionMinor, "NetworkDeviceContextMenu" );
         qmlRegisterType<PlaylistContextMenu>( uri, versionMajor, versionMinor, "PlaylistContextMenu" );


=====================================
modules/gui/qt/menus/custom_menus.cpp
=====================================
@@ -34,6 +34,9 @@
 // Dialogs includes
 #include "dialogs/dialogs_provider.hpp"
 
+// Menus includes
+#include "menus/menus.hpp"
+
 // Qt includes
 #include <QMenu>
 #include <QAction>
@@ -298,6 +301,130 @@ void CheckableListMenu::onModelReset()
         onRowInserted({}, 0, nb_rows - 1);
 }
 
+// ListMenuHelper
+
+ListMenuHelper::ListMenuHelper(QMenu * menu, QAbstractListModel * model, QAction * before,
+                               QObject * parent)
+    : QObject(parent), m_menu(menu), m_model(model), m_before(before)
+{
+    m_group = new QActionGroup(this);
+
+    onModelReset();
+
+    connect(m_model, &QAbstractListModel::rowsInserted, this, &ListMenuHelper::onRowsInserted);
+    connect(m_model, &QAbstractListModel::rowsRemoved,  this, &ListMenuHelper::onRowsRemoved);
+
+    connect(m_model, &QAbstractListModel::dataChanged, this, &ListMenuHelper::onDataChanged);
+
+    connect(m_model, &QAbstractListModel::modelReset, this, &ListMenuHelper::onModelReset);
+}
+
+// Interface
+
+int ListMenuHelper::count() const
+{
+    return m_actions.count();
+}
+
+// Private slots
+
+void ListMenuHelper::onRowsInserted(const QModelIndex &, int first, int last)
+{
+    QAction * before;
+
+    if (first < m_actions.count())
+        before = m_actions.at(first);
+    else
+        before = m_before;
+
+    for (int i = first; i <= last; i++)
+    {
+        QModelIndex index = m_model->index(i, 0);
+
+        QString name = m_model->data(index, Qt::DisplayRole).toString();
+
+        QAction * action = new QAction(name, this);
+
+        action->setCheckable(true);
+
+        bool checked = m_model->data(index, Qt::CheckStateRole).toBool();
+
+        action->setChecked(checked);
+
+        // NOTE: We are adding sequentially *before* the next action in the list.
+        m_menu->insertAction(before, action);
+
+        m_group->addAction(action);
+
+        m_actions.insert(i, action);
+
+        connect(action, &QAction::triggered, this, &ListMenuHelper::onTriggered);
+    }
+
+    emit countChanged(m_actions.count());
+}
+
+void ListMenuHelper::onRowsRemoved(const QModelIndex &, int first, int last)
+{
+    for (int i = first; i <= last; i++)
+    {
+        QAction * action = m_actions.at(i);
+
+        m_group->removeAction(action);
+
+        delete action;
+    }
+
+    QList<QAction *>::iterator begin = m_actions.begin();
+
+    m_actions.erase(begin + first, begin + last);
+
+    emit countChanged(m_actions.count());
+}
+
+void ListMenuHelper::onDataChanged(const QModelIndex & topLeft,
+                                   const QModelIndex & bottomRight, const QVector<int> &)
+{
+    for (int i = topLeft.row(); i <= bottomRight.row(); i++)
+    {
+        QAction * action = m_actions.at(i);
+
+        QModelIndex index = m_model->index(i, 0);
+
+        QString name = m_model->data(index, Qt::DisplayRole).toString();
+
+        action->setText(name);
+
+        bool checked = m_model->data(index, Qt::CheckStateRole).toBool();
+
+        action->setChecked(checked);
+    }
+}
+
+void ListMenuHelper::onModelReset()
+{
+    for (QAction * action : m_actions)
+    {
+        m_group->removeAction(action);
+
+        delete action;
+    }
+
+    m_actions.clear();
+
+    int count = m_model->rowCount();
+
+    if (count)
+        onRowsInserted(QModelIndex(), 0, count - 1);
+}
+
+void ListMenuHelper::onTriggered(bool checked)
+{
+    QAction * action = static_cast<QAction *> (sender());
+
+    emit select(m_actions.indexOf(action));
+}
+
 /*     BooleanPropertyAction    */
 
 BooleanPropertyAction::BooleanPropertyAction(QString title, QObject *model, QString propertyName, QWidget *parent)
@@ -419,95 +546,22 @@ void RecentMenu::onModelReset()
 
 // BookmarkMenu
 
-BookmarkMenu::BookmarkMenu(MLBookmarkModel * model, MediaLib * ml, QWidget * parent)
-    : QMenu(parent), m_model(model), m_ml(ml)
+BookmarkMenu::BookmarkMenu(MediaLib * mediaLib, vlc_player_t * player, QWidget * parent)
+    : QMenu(parent)
 {
-    setTearOffEnabled(true);
-
     // FIXME: Do we really need a translation call for the string shortcut ?
     addAction(qtr("&Manage"), THEDP, &DialogsProvider::bookmarksDialog, qtr("Ctrl+B"));
 
     addSeparator();
 
-    onModelReset();
-
-    connect(m_model, &MLBookmarkModel::rowsInserted, this, &BookmarkMenu::onRowsInserted);
-    connect(m_model, &MLBookmarkModel::rowsRemoved,  this, &BookmarkMenu::onRowsRemoved);
-
-    connect(m_model, &MLBookmarkModel::dataChanged, this, &BookmarkMenu::onDataChanged);
-
-    connect(m_model, &MLBookmarkModel::modelReset, this, &BookmarkMenu::onModelReset);
-}
-
-// Private slots
-
-void BookmarkMenu::onRowsInserted(const QModelIndex &, int first, int last)
-{
-    QAction * before;
-
-    if (first < m_actions.count())
-        before = m_actions.at(first);
-    else
-        before = nullptr;
-
-    for (int i = first; i <= last; i++)
-    {
-        QModelIndex index = m_model->index(i, 0);
-
-        QString name = m_model->data(index, Qt::DisplayRole).toString();
-
-        QAction * action = new QAction(name, this);
-
-        // NOTE: We are adding sequentially *before* the next action in the list.
-        insertAction(before, action);
-
-        m_actions.insert(i, action);
+    MLBookmarkModel * model = new MLBookmarkModel(mediaLib, player, this);
 
-        connect(action, &QAction::triggered, [this, action]()
-        {
-            QModelIndex index = m_model->index(m_actions.indexOf(action), 0);
-
-            m_model->select(index);
-        });
-    }
-}
+    ListMenuHelper * helper = new ListMenuHelper(this, model, nullptr, this);
 
-void BookmarkMenu::onRowsRemoved(const QModelIndex &, int first, int last)
-{
-    for (int i = first; i <= last; i++)
+    connect(helper, &ListMenuHelper::select, [model](int index)
     {
-        delete m_actions.at(i);
-    }
-
-    QList<QAction *>::iterator begin = m_actions.begin();
-
-    m_actions.erase(begin + first, begin + last);
-}
+        model->select(model->index(index, 0));
+    });
 
-void BookmarkMenu::onDataChanged(const QModelIndex & topLeft,
-                                 const QModelIndex & bottomRight, const QVector<int> &)
-{
-    for (int i = topLeft.row(); i <= bottomRight.row(); i++)
-    {
-        QModelIndex index = m_model->index(i, 0);
-
-        QString name = m_model->data(index, Qt::DisplayRole).toString();
-
-        m_actions.at(i)->setText(name);
-    }
-}
-
-void BookmarkMenu::onModelReset()
-{
-    for (QAction * action : m_actions)
-    {
-        delete action;
-    }
-
-    m_actions.clear();
-
-    int count = m_model->rowCount();
-
-    if (count)
-        onRowsInserted(QModelIndex(), 0, count - 1);
+    setTearOffEnabled(true);
 }


=====================================
modules/gui/qt/menus/custom_menus.hpp
=====================================
@@ -27,7 +27,6 @@
 #include "medialibrary/mlrecentsmodel.hpp"
 
 class QAbstractListModel;
-class MLBookmarkModel;
 
 class RendererAction : public QAction
 {
@@ -102,6 +101,46 @@ private:
     QActionGroup* m_actionGroup = nullptr;
 };
 
+// NOTE: This class is a helper to populate and maintain a QMenu from an QAbstractListModel.
+class ListMenuHelper : public QObject
+{
+    Q_OBJECT
+
+public:
+    // NOTE: The model actions will be inserted before 'before' or at the end if it's NULL.
+    ListMenuHelper(QMenu * menu, QAbstractListModel * model, QAction * before = nullptr,
+                   QObject * parent = nullptr);
+
+public: // Interface
+    int count() const;
+
+private slots:
+    void onRowsInserted(const QModelIndex & parent, int first, int last);
+    void onRowsRemoved (const QModelIndex & parent, int first, int last);
+
+    void onDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight,
+                       const QVector<int> & roles = QVector<int>());
+
+    void onModelReset();
+
+    void onTriggered(bool checked);
+
+signals:
+    void select(int index);
+
+    void countChanged(int count);
+
+private:
+    QMenu * m_menu = nullptr;
+
+    QActionGroup * m_group = nullptr;
+
+    QAbstractListModel * m_model = nullptr;
+
+    QList<QAction *> m_actions;
+
+    QAction * m_before = nullptr;
+};
 
 /**
  * @brief The BooleanPropertyAction class allows to bind a boolean Q_PROPRERTY to a QAction
@@ -151,23 +190,7 @@ class BookmarkMenu : public QMenu
     Q_OBJECT
 
 public:
-    BookmarkMenu(MLBookmarkModel * model, MediaLib * ml, QWidget * parent = nullptr);
-
-private slots:
-    void onRowsInserted(const QModelIndex & parent, int first, int last);
-    void onRowsRemoved (const QModelIndex & parent, int first, int last);
-
-    void onDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight,
-                       const QVector<int> & roles = QVector<int>());
-
-    void onModelReset();
-
-private:
-    MLBookmarkModel * m_model = nullptr;
-
-    MediaLib * m_ml = nullptr;
-
-    QList<QAction *> m_actions;
+    BookmarkMenu(MediaLib * mediaLib, vlc_player_t * player, QWidget * parent = nullptr);
 };
 
 #endif // CUSTOM_MENUS_HPP


=====================================
modules/gui/qt/menus/menus.cpp
=====================================
@@ -487,11 +487,7 @@ void VLCMenuBar::NavigMenu( qt_intf_t *p_intf, QMenu *menu )
     {
         MediaLib * mediaLib = mi->getMediaLibrary();
 
-        MLBookmarkModel * model = new MLBookmarkModel(mediaLib, p_intf->p_player, nullptr);
-
-        BookmarkMenu * bookmarks = new BookmarkMenu(model, mediaLib, menu);
-
-        model->setParent(bookmarks);
+        BookmarkMenu * bookmarks = new BookmarkMenu(mediaLib, p_intf->p_player, menu);
 
         bookmarks->setTitle(qfut(I_MENU_BOOKMARK));
 


=====================================
modules/gui/qt/menus/menus.hpp
=====================================
@@ -30,8 +30,6 @@
 
 #include <QObject>
 
-class QMenu;
-
 class VLCMenuBar : public QObject
 {
     Q_OBJECT


=====================================
modules/gui/qt/menus/qml_menu_wrapper.cpp
=====================================
@@ -28,6 +28,7 @@
 #include "medialibrary/mlgenremodel.hpp"
 #include "medialibrary/mlalbumtrackmodel.hpp"
 #include "medialibrary/mlurlmodel.hpp"
+#include "medialibrary/mlbookmarkmodel.hpp"
 #include "network/networkdevicemodel.hpp"
 #include "network/networkmediamodel.hpp"
 #include "playlist/playlist_controller.hpp"
@@ -383,6 +384,93 @@ void QmlMenuBar::onMenuClosed()
         emit menuClosed();
 }
 
+// QmlBookmarkMenu
+
+/* explicit */ QmlBookmarkMenu::QmlBookmarkMenu(QObject * parent) : QObject(parent) {}
+
+QmlBookmarkMenu::~QmlBookmarkMenu()
+{
+    if (m_menu)
+        delete m_menu;
+}
+
+// Interface
+
+/* Q_INVOKABLE */ void QmlBookmarkMenu::popup(QPoint pos)
+{
+    if (m_ctx == nullptr || m_player == nullptr)
+        return;
+
+    if (m_menu)
+        delete m_menu;
+
+    m_menu = new QMenu;
+
+    connect(m_menu, &QMenu::aboutToHide, this, &QmlBookmarkMenu::aboutToHide);
+    connect(m_menu, &QMenu::aboutToShow, this, &QmlBookmarkMenu::aboutToShow);
+
+    QAction * sectionTitles    = m_menu->addSection(qtr("Titles"));
+    QAction * sectionChapters  = m_menu->addSection(qtr("Chapters"));
+    QAction * sectionBookmarks = m_menu->addSection(qtr("Bookmarks"));
+
+    // Titles
+
+    TitleListModel * titles = m_player->getTitles();
+
+    sectionTitles->setVisible(titles->rowCount() != 0);
+
+    ListMenuHelper * helper = new ListMenuHelper(m_menu, titles, sectionChapters, m_menu);
+
+    connect(helper, &ListMenuHelper::select, [titles](int index)
+    {
+        titles->setData(titles->index(index), true, Qt::CheckStateRole);
+    });
+
+    connect(helper, &ListMenuHelper::countChanged, [sectionTitles](int count)
+    {
+        // NOTE: The section should only be visible when the model has content.
+        sectionTitles->setVisible(count != 0);
+    });
+
+    // Chapters
+
+    ChapterListModel * chapters = m_player->getChapters();
+
+    sectionChapters->setVisible(chapters->rowCount() != 0);
+
+    helper = new ListMenuHelper(m_menu, chapters, sectionBookmarks, m_menu);
+
+    connect(helper, &ListMenuHelper::select, [chapters](int index)
+    {
+        chapters->setData(chapters->index(index), true, Qt::CheckStateRole);
+    });
+
+    connect(helper, &ListMenuHelper::countChanged, [sectionChapters](int count)
+    {
+        // NOTE: The section should only be visible when the model has content.
+        sectionChapters->setVisible(count != 0);
+    });
+
+    // Bookmarks
+
+    // FIXME: Do we really need a translation call for the string shortcut ?
+    m_menu->addAction(qtr("&Manage"), THEDP, &DialogsProvider::bookmarksDialog, qtr("Ctrl+B"));
+
+    m_menu->addSeparator();
+
+    MLBookmarkModel * bookmarks = new MLBookmarkModel(m_ctx->getMediaLibrary(),
+                                                      m_player->getPlayer(), m_menu);
+
+    helper = new ListMenuHelper(m_menu, bookmarks, nullptr, m_menu);
+
+    connect(helper, &ListMenuHelper::select, [bookmarks](int index)
+    {
+        bookmarks->select(bookmarks->index(index, 0));
+    });
+
+    m_menu->popup(pos);
+}
+
 BaseMedialibMenu::BaseMedialibMenu(QObject* parent)
     : QObject(parent)
 {}


=====================================
modules/gui/qt/menus/qml_menu_wrapper.hpp
=====================================
@@ -180,6 +180,30 @@ private:
     QmlMenuBar* m_menubar = nullptr;
 };
 
+class QmlBookmarkMenu : public QObject
+{
+    Q_OBJECT
+
+    SIMPLE_MENU_PROPERTY(MainCtx *, ctx, nullptr)
+
+    SIMPLE_MENU_PROPERTY(PlayerController *, player, nullptr)
+
+public:
+    explicit QmlBookmarkMenu(QObject * parent = nullptr);
+
+    ~QmlBookmarkMenu();
+
+public: // Interface
+    Q_INVOKABLE void popup(QPoint pos);
+
+signals:
+    void aboutToHide();
+    void aboutToShow();
+
+private:
+    QMenu * m_menu = nullptr;
+};
+
 class BaseMedialibMenu : public QObject
 {
     Q_OBJECT


=====================================
modules/gui/qt/pixmaps/VLCIcons.json
=====================================
@@ -46,6 +46,7 @@
 		{"key":"volume_high", "path": "./toolbar/volume-high.svg"},
 		{"key":"volume_slider_inside", "path": "./toolbar/volume-slider-inside.svg"},
 		{"key":"volume_muted", "path": "./toolbar/volume-muted.svg"},
+		{"key":"bookmark", "path": "./toolbar/bookmark.svg"},
 		{"key":"previous", "path": "./previous.svg"},
 		{"key":"type_node", "path": "./types/type_node.svg"},
 		{"key":"type_unknown", "path": "./types/type_unknown.svg"},


=====================================
modules/gui/qt/pixmaps/VLCIcons.ttf
=====================================
Binary files a/modules/gui/qt/pixmaps/VLCIcons.ttf and b/modules/gui/qt/pixmaps/VLCIcons.ttf differ


=====================================
modules/gui/qt/pixmaps/toolbar/bookmark.svg
=====================================
@@ -0,0 +1,3 @@
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M6 7.2C6 4.8804 7.8804 3 10.2 3H21.8C24.1196 3 26 4.88041 26 7.2V28C26 28.3755 25.7896 28.7194 25.4553 28.8904C25.1209 29.0613 24.7189 29.0305 24.4145 28.8107L16 22.7335L7.58549 28.8107C7.28106 29.0305 6.87911 29.0613 6.54475 28.8904C6.21039 28.7194 6 28.3755 6 28V7.2ZM10.2 5C8.98497 5 8 5.98497 8 7.2V26.0442L15.4145 20.6893C15.764 20.4369 16.2359 20.4369 16.5854 20.6893L24 26.0442V7.2C24 5.98497 23.015 5 21.8 5H10.2Z" fill="#212121"/>
+</svg>


=====================================
modules/gui/qt/player/control_list_model.hpp
=====================================
@@ -73,6 +73,7 @@ public:
         ASPECT_RATIO_COMBOBOX,
         DVD_MENUS_BUTTON,
         REVERSE_BUTTON,
+        BOOKMARK_BUTTON,
         SPECIAL_MAX,
 
         WIDGET_SPACER = 0x40,


=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -1108,6 +1108,13 @@ PlayerController::~PlayerController()
 
 // PLAYBACK
 
+vlc_player_t * PlayerController::getPlayer() const
+{
+    Q_D(const PlayerController);
+
+    return d->m_player;
+}
+
 input_item_t *PlayerController::getInput()
 {
     Q_D(PlayerController);


=====================================
modules/gui/qt/player/player_controller.hpp
=====================================
@@ -250,6 +250,8 @@ public:
 
 
 public:
+    vlc_player_t * getPlayer() const;
+
     input_item_t *getInput();
 
     VoutPtr getVout();


=====================================
modules/gui/qt/player/qml/ControlbarControls.qml
=====================================
@@ -53,6 +53,7 @@ QtObject {
         { 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") },


=====================================
modules/gui/qt/player/qml/controlbarcontrols/BookmarkButton.qml
=====================================
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (C) 2021 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 org.videolan.vlc 0.1
+
+import "qrc:///widgets/" as Widgets
+import "qrc:///style/"
+
+Widgets.IconControlButton {
+    size: VLCStyle.icon_medium
+
+    iconText: VLCIcons.bookmark
+    text: I18n.qtr("Bookmarks")
+
+    // NOTE: We want to pop the menu after the button.
+    onClicked: menu.popup(this.mapToGlobal(width, 0))
+
+    QmlBookmarkMenu {
+        id: menu
+
+        ctx: MainCtx
+
+        player: Player
+
+        onAboutToShow: playerControlLayout.requestLockUnlockAutoHide(true, menu)
+        onAboutToHide: playerControlLayout.requestLockUnlockAutoHide(false, menu)
+    }
+}


=====================================
modules/gui/qt/style/VLCIcons.qml
=====================================
@@ -59,122 +59,123 @@ QtObject {
     readonly property string volume_high : "\ue027"
     readonly property string volume_slider_inside : "\ue028"
     readonly property string volume_muted : "\ue029"
-    readonly property string previous : "\ue02a"
-    readonly property string type_node : "\ue02b"
-    readonly property string type_unknown : "\ue02c"
-    readonly property string file_asym : "\ue02d"
-    readonly property string folder_grey : "\ue02e"
-    readonly property string type_file : "\ue02f"
-    readonly property string file_wide : "\ue030"
-    readonly property string harddisk : "\ue031"
-    readonly property string type_playlist : "\ue032"
-    readonly property string folder_blue : "\ue033"
-    readonly property string capture_card : "\ue034"
-    readonly property string tape : "\ue035"
-    readonly property string type_stream : "\ue036"
-    readonly property string type_directory : "\ue037"
-    readonly property string disc : "\ue038"
-    readonly property string repeat_one : "\ue039"
-    readonly property string repeat_off : "\ue03a"
-    readonly property string dropzone : "\ue03b"
-    readonly property string remove : "\ue03c"
-    readonly property string add : "\ue03d"
-    readonly property string shuffle_on : "\ue03e"
-    readonly property string appletrailers : "\ue03f"
-    readonly property string metachannels : "\ue040"
-    readonly property string assembleenationale : "\ue041"
-    readonly property string fmc : "\ue042"
-    readonly property string jamendo : "\ue043"
-    readonly property string icecast : "\ue044"
-    readonly property string katsomo : "\ue045"
-    readonly property string frenchtv : "\ue046"
-    readonly property string mtp : "\ue047"
-    readonly property string network : "\ue048"
-    readonly property string movie : "\ue049"
-    readonly property string pictures : "\ue04a"
-    readonly property string screen : "\ue04b"
-    readonly property string library : "\ue04c"
-    readonly property string music : "\ue04d"
-    readonly property string lan : "\ue04e"
-    readonly property string capture : "\ue04f"
-    readonly property string podcast : "\ue050"
-    readonly property string playlist : "\ue051"
-    readonly property string playlist_clear : "\ue052"
-    readonly property string repeat_all : "\ue053"
-    readonly property string active_indicator : "\ue054"
-    readonly property string lock : "\ue055"
-    readonly property string slower : "\ue056"
-    readonly property string clear : "\ue057"
-    readonly property string profile_new : "\ue058"
-    readonly property string addon_green : "\ue059"
-    readonly property string addon_broken : "\ue05a"
-    readonly property string addon_magenta : "\ue05b"
-    readonly property string addon_cyan : "\ue05c"
-    readonly property string score : "\ue05d"
-    readonly property string addon_yellow : "\ue05e"
-    readonly property string addon_blue : "\ue05f"
-    readonly property string addon : "\ue060"
-    readonly property string addon_red : "\ue061"
-    readonly property string advprefs_playlist : "\ue062"
-    readonly property string advprefs_audio : "\ue063"
-    readonly property string advprefs_video : "\ue064"
-    readonly property string advprefs_extended : "\ue065"
-    readonly property string advprefs_codec : "\ue066"
-    readonly property string advprefs_intf : "\ue067"
-    readonly property string advprefs_sout : "\ue068"
-    readonly property string win7thumbnail_next : "\ue069"
-    readonly property string win7thumbnail_play : "\ue06a"
-    readonly property string win7thumbnail_pause : "\ue06b"
-    readonly property string win7thumbnail_prev : "\ue06c"
-    readonly property string next : "\ue06d"
-    readonly property string play : "\ue06e"
-    readonly property string space : "\ue06f"
-    readonly property string pause : "\ue070"
-    readonly property string faster2 : "\ue071"
-    readonly property string wait1 : "\ue072"
-    readonly property string wait2 : "\ue073"
-    readonly property string wait3 : "\ue074"
-    readonly property string wait4 : "\ue075"
-    readonly property string slower2 : "\ue076"
-    readonly property string messages : "\ue077"
-    readonly property string settings : "\ue078"
-    readonly property string info : "\ue079"
-    readonly property string preferences : "\ue07a"
-    readonly property string exit : "\ue07b"
-    readonly property string help : "\ue07c"
-    readonly property string stream : "\ue07d"
-    readonly property string valid : "\ue07e"
-    readonly property string search_clear : "\ue07f"
-    readonly property string menu : "\ue080"
-    readonly property string topbar_video : "\ue081"
-    readonly property string topbar_music : "\ue082"
-    readonly property string topbar_network : "\ue083"
-    readonly property string topbar_previous : "\ue084"
-    readonly property string topbar_next : "\ue085"
-    readonly property string topbar_filter : "\ue086"
-    readonly property string topbar_sort : "\ue087"
-    readonly property string topbar_discover : "\ue088"
-    readonly property string rename : "\ue089"
-    readonly property string del : "\ue08a"
-    readonly property string close : "\ue08b"
-    readonly property string ellipsis : "\ue08c"
-    readonly property string grid : "\ue08d"
-    readonly property string list : "\ue08e"
-    readonly property string album_cover : "\ue08f"
-    readonly property string time : "\ue090"
-    readonly property string play_outline : "\ue091"
-    readonly property string enqueue : "\ue092"
-    readonly property string back : "\ue093"
-    readonly property string history : "\ue094"
-    readonly property string window_close : "\ue095"
-    readonly property string window_maximize : "\ue096"
-    readonly property string window_minimize : "\ue097"
-    readonly property string window_restore : "\ue098"
-    readonly property string home : "\ue099"
-    readonly property string download : "\ue09a"
-    readonly property string multiselect : "\ue09b"
-    readonly property string sync : "\ue09c"
-    readonly property string check : "\ue09d"
-    readonly property string visualization : "\ue09e"
+    readonly property string bookmark : "\ue02a"
+    readonly property string previous : "\ue02b"
+    readonly property string type_node : "\ue02c"
+    readonly property string type_unknown : "\ue02d"
+    readonly property string file_asym : "\ue02e"
+    readonly property string folder_grey : "\ue02f"
+    readonly property string type_file : "\ue030"
+    readonly property string file_wide : "\ue031"
+    readonly property string harddisk : "\ue032"
+    readonly property string type_playlist : "\ue033"
+    readonly property string folder_blue : "\ue034"
+    readonly property string capture_card : "\ue035"
+    readonly property string tape : "\ue036"
+    readonly property string type_stream : "\ue037"
+    readonly property string type_directory : "\ue038"
+    readonly property string disc : "\ue039"
+    readonly property string repeat_one : "\ue03a"
+    readonly property string repeat_off : "\ue03b"
+    readonly property string dropzone : "\ue03c"
+    readonly property string remove : "\ue03d"
+    readonly property string add : "\ue03e"
+    readonly property string shuffle_on : "\ue03f"
+    readonly property string appletrailers : "\ue040"
+    readonly property string metachannels : "\ue041"
+    readonly property string assembleenationale : "\ue042"
+    readonly property string fmc : "\ue043"
+    readonly property string jamendo : "\ue044"
+    readonly property string icecast : "\ue045"
+    readonly property string katsomo : "\ue046"
+    readonly property string frenchtv : "\ue047"
+    readonly property string mtp : "\ue048"
+    readonly property string network : "\ue049"
+    readonly property string movie : "\ue04a"
+    readonly property string pictures : "\ue04b"
+    readonly property string screen : "\ue04c"
+    readonly property string library : "\ue04d"
+    readonly property string music : "\ue04e"
+    readonly property string lan : "\ue04f"
+    readonly property string capture : "\ue050"
+    readonly property string podcast : "\ue051"
+    readonly property string playlist : "\ue052"
+    readonly property string playlist_clear : "\ue053"
+    readonly property string repeat_all : "\ue054"
+    readonly property string active_indicator : "\ue055"
+    readonly property string lock : "\ue056"
+    readonly property string slower : "\ue057"
+    readonly property string clear : "\ue058"
+    readonly property string profile_new : "\ue059"
+    readonly property string addon_green : "\ue05a"
+    readonly property string addon_broken : "\ue05b"
+    readonly property string addon_magenta : "\ue05c"
+    readonly property string addon_cyan : "\ue05d"
+    readonly property string score : "\ue05e"
+    readonly property string addon_yellow : "\ue05f"
+    readonly property string addon_blue : "\ue060"
+    readonly property string addon : "\ue061"
+    readonly property string addon_red : "\ue062"
+    readonly property string advprefs_playlist : "\ue063"
+    readonly property string advprefs_audio : "\ue064"
+    readonly property string advprefs_video : "\ue065"
+    readonly property string advprefs_extended : "\ue066"
+    readonly property string advprefs_codec : "\ue067"
+    readonly property string advprefs_intf : "\ue068"
+    readonly property string advprefs_sout : "\ue069"
+    readonly property string win7thumbnail_next : "\ue06a"
+    readonly property string win7thumbnail_play : "\ue06b"
+    readonly property string win7thumbnail_pause : "\ue06c"
+    readonly property string win7thumbnail_prev : "\ue06d"
+    readonly property string next : "\ue06e"
+    readonly property string play : "\ue06f"
+    readonly property string space : "\ue070"
+    readonly property string pause : "\ue071"
+    readonly property string faster2 : "\ue072"
+    readonly property string wait1 : "\ue073"
+    readonly property string wait2 : "\ue074"
+    readonly property string wait3 : "\ue075"
+    readonly property string wait4 : "\ue076"
+    readonly property string slower2 : "\ue077"
+    readonly property string messages : "\ue078"
+    readonly property string settings : "\ue079"
+    readonly property string info : "\ue07a"
+    readonly property string preferences : "\ue07b"
+    readonly property string exit : "\ue07c"
+    readonly property string help : "\ue07d"
+    readonly property string stream : "\ue07e"
+    readonly property string valid : "\ue07f"
+    readonly property string search_clear : "\ue080"
+    readonly property string menu : "\ue081"
+    readonly property string topbar_video : "\ue082"
+    readonly property string topbar_music : "\ue083"
+    readonly property string topbar_network : "\ue084"
+    readonly property string topbar_previous : "\ue085"
+    readonly property string topbar_next : "\ue086"
+    readonly property string topbar_filter : "\ue087"
+    readonly property string topbar_sort : "\ue088"
+    readonly property string topbar_discover : "\ue089"
+    readonly property string rename : "\ue08a"
+    readonly property string del : "\ue08b"
+    readonly property string close : "\ue08c"
+    readonly property string ellipsis : "\ue08d"
+    readonly property string grid : "\ue08e"
+    readonly property string list : "\ue08f"
+    readonly property string album_cover : "\ue090"
+    readonly property string time : "\ue091"
+    readonly property string play_outline : "\ue092"
+    readonly property string enqueue : "\ue093"
+    readonly property string back : "\ue094"
+    readonly property string history : "\ue095"
+    readonly property string window_close : "\ue096"
+    readonly property string window_maximize : "\ue097"
+    readonly property string window_minimize : "\ue098"
+    readonly property string window_restore : "\ue099"
+    readonly property string home : "\ue09a"
+    readonly property string download : "\ue09b"
+    readonly property string multiselect : "\ue09c"
+    readonly property string sync : "\ue09d"
+    readonly property string check : "\ue09e"
+    readonly property string visualization : "\ue09f"
 
 }


=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -360,6 +360,7 @@
         <file alias="AspectRatioWidget.qml">player/qml/controlbarcontrols/AspectRatioWidget.qml</file>
         <file alias="AtoBButton.qml">player/qml/controlbarcontrols/AtoBButton.qml</file>
         <file alias="BackButton.qml">player/qml/controlbarcontrols/BackButton.qml</file>
+        <file alias="BookmarkButton.qml">player/qml/controlbarcontrols/BookmarkButton.qml</file>
         <file alias="ChapterNextButton.qml">player/qml/controlbarcontrols/ChapterNextButton.qml</file>
         <file alias="ChapterPreviousButton.qml">player/qml/controlbarcontrols/ChapterPreviousButton.qml</file>
         <file alias="DvdMenuButton.qml">player/qml/controlbarcontrols/DvdMenuButton.qml</file>



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bd124a414750401e37aff2a5e51d84440635a5e5...7ab09b01b3d462bbcd1b58747ee1606f3ad0eaf6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bd124a414750401e37aff2a5e51d84440635a5e5...7ab09b01b3d462bbcd1b58747ee1606f3ad0eaf6
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