[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: add `empty` property to PlayerControlbarModel

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 16 14:56:25 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
86db4cad by Fatih Uzunoglu at 2024-05-16T14:26:26+00:00
qt: add `empty` property to PlayerControlbarModel

- - - - -
c2bd5559 by Fatih Uzunoglu at 2024-05-16T14:26:26+00:00
qml: hide PlayerControlLayout when the model is empty

- - - - -
5a5cd550 by Fatih Uzunoglu at 2024-05-16T14:26:26+00:00
qml: consider `loaderLeftRight` in PlayerControlLayout implicit height calculation

- - - - -


4 changed files:

- modules/gui/qt/player/player_controlbar_model.cpp
- modules/gui/qt/player/player_controlbar_model.hpp
- modules/gui/qt/player/qml/ControlBar.qml
- modules/gui/qt/player/qml/PlayerControlLayout.qml


Changes:

=====================================
modules/gui/qt/player/player_controlbar_model.cpp
=====================================
@@ -92,6 +92,11 @@ bool PlayerControlbarModel::dirty() const
     return m_dirty;
 }
 
+bool PlayerControlbarModel::empty() const
+{
+    return m_empty;
+}
+
 std::array<QVector<int>, 3> PlayerControlbarModel::serializeModels() const
 {
     return { left()->getControls(),
@@ -134,5 +139,19 @@ void PlayerControlbarModel::contentChanged()
 {
     setDirty(true);
 
+    {
+        bool empty = true;
+        if ((m_left && m_left->rowCount() > 0) ||
+            (m_center && m_center->rowCount() > 0) ||
+            (m_right && m_right->rowCount() > 0))
+            empty = false;
+
+        if (empty != m_empty)
+        {
+            m_empty = empty;
+            emit emptyChanged(empty);
+        }
+    }
+
     emit controlListChanged();
 }


=====================================
modules/gui/qt/player/player_controlbar_model.hpp
=====================================
@@ -34,6 +34,7 @@ class PlayerControlbarModel : public QObject
     Q_OBJECT
 
     Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged FINAL)
+    Q_PROPERTY(bool empty READ empty NOTIFY emptyChanged FINAL)
 
     Q_PROPERTY(ControlListModel* left READ left CONSTANT FINAL)
     Q_PROPERTY(ControlListModel* center READ center CONSTANT FINAL)
@@ -70,6 +71,7 @@ public:
     ~PlayerControlbarModel();
 
     bool dirty() const;
+    bool empty() const;
 
     std::array<QVector<int>, 3> serializeModels() const;
     void loadModels(const std::array<QVector<int>, 3>& array);
@@ -83,10 +85,12 @@ public slots:
 
 signals:
     void dirtyChanged(bool dirty);
+    void emptyChanged(bool);
     void controlListChanged();
 
 private:
     bool m_dirty = false;
+    bool m_empty = true;
 
     ControlListModel* m_left = nullptr;
     ControlListModel* m_center = nullptr;


=====================================
modules/gui/qt/player/qml/ControlBar.qml
=====================================
@@ -246,6 +246,8 @@ T.Pane {
             implicitHeight: MainCtx.pinVideoControls ? VLCStyle.controlLayoutHeightPinned
                                                      : VLCStyle.controlLayoutHeight
 
+            visible: !model?.empty ?? false
+
             Navigation.upItem: trackPositionSlider.enabled ? trackPositionSlider : root.Navigation.upItem
 
             onRequestLockUnlockAutoHide: (lock) => root.requestLockUnlockAutoHide(lock)


=====================================
modules/gui/qt/player/qml/PlayerControlLayout.qml
=====================================
@@ -59,7 +59,8 @@ FocusScope {
     implicitWidth: loaderLeftRight.active ? loaderLeftRight.implicitWidth
                                           : (loaderLeft.implicitWidth + loaderCenter.implicitWidth + loaderRight.implicitWidth)
 
-    implicitHeight: Math.max(loaderLeft.implicitHeight, loaderCenter.implicitHeight, loaderRight.implicitHeight)
+    implicitHeight: loaderLeftRight.active ? loaderLeftRight.implicitHeight
+                                           : Math.max(loaderLeft.implicitHeight, loaderCenter.implicitHeight, loaderRight.implicitHeight)
 
     // Events
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/10cee7560668590a59715d0b1bd769350e713a9d...5a5cd5505644d3765ab966b055374ad15e16a58e

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/10cee7560668590a59715d0b1bd769350e713a9d...5a5cd5505644d3765ab966b055374ad15e16a58e
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