[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: add playerPlaylistWidthFactor in mainctx

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Sep 17 08:13:40 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e99f224d by Prince Gupta at 2023-09-17T07:21:18+00:00
qt: add playerPlaylistWidthFactor in mainctx

- - - - -
b78379b8 by Prince Gupta at 2023-09-17T07:21:18+00:00
qml: remember player playlist width

closes #28069

- - - - -
17d89bc6 by Prince Gupta at 2023-09-17T07:21:18+00:00
qt: fix variable names

- - - - -


3 changed files:

- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/player/qml/Player.qml


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -217,8 +217,9 @@ MainCtx::~MainCtx()
     settings->setValue( "interface-scale", m_intfUserScaleFactor );
 
     /* Save playlist state */
-    settings->setValue( "playlist-visible", playlistVisible );
-    settings->setValue( "playlist-width-factor", playlistWidthFactor);
+    settings->setValue( "playlist-visible", m_playlistVisible );
+    settings->setValue( "playlist-width-factor", m_playlistWidthFactor);
+    settings->setValue( "player-playlist-width-factor", m_playerPlaylistWidthFactor);
 
     settings->setValue( "grid-view", m_gridView );
     settings->setValue( "grouping", m_grouping );
@@ -352,9 +353,11 @@ void MainCtx::loadFromSettingsImpl(const bool callSignals)
 
     loadFromSettings(b_playlistDocked, "MainWindow/pl-dock-status", true, &MainCtx::playlistDockedChanged);
 
-    loadFromSettings(playlistVisible, "MainWindow/playlist-visible", false, &MainCtx::playlistVisibleChanged);
+    loadFromSettings(m_playlistVisible, "MainWindow/playlist-visible", false, &MainCtx::playlistVisibleChanged);
 
-    loadFromSettings(playlistWidthFactor, "MainWindow/playlist-width-factor", 4.0 , &MainCtx::playlistWidthFactorChanged);
+    loadFromSettings(m_playlistWidthFactor, "MainWindow/playlist-width-factor", 4.0 , &MainCtx::playlistWidthFactorChanged);
+
+    loadFromSettings(m_playerPlaylistWidthFactor, "MainWindow/player-playlist-width-factor", 4.0 , &MainCtx::playerPlaylistFactorChanged);
 
     loadFromSettings(m_gridView, "MainWindow/grid-view", true, &MainCtx::gridViewChanged);
 
@@ -521,7 +524,7 @@ void MainCtx::setPlaylistDocked( bool docked )
 
 void MainCtx::setPlaylistVisible( bool visible )
 {
-    playlistVisible = visible;
+    m_playlistVisible = visible;
 
     emit playlistVisibleChanged(visible);
 }
@@ -530,11 +533,20 @@ void MainCtx::setPlaylistWidthFactor( double factor )
 {
     if (factor > 0.0)
     {
-        playlistWidthFactor = factor;
+        m_playlistWidthFactor = factor;
         emit playlistWidthFactorChanged(factor);
     }
 }
 
+void MainCtx::setPlayerPlaylistWidthFactor( double factor )
+{
+    if (factor > 0.0)
+    {
+        m_playerPlaylistWidthFactor = factor;
+        emit playerPlaylistFactorChanged(factor);
+    }
+}
+
 void MainCtx::setShowRemainingTime( bool show )
 {
     m_showRemainingTime = show;


=====================================
modules/gui/qt/maininterface/mainctx.hpp
=====================================
@@ -152,6 +152,7 @@ class MainCtx : public QObject
     Q_PROPERTY(bool playlistDocked READ isPlaylistDocked WRITE setPlaylistDocked NOTIFY playlistDockedChanged FINAL)
     Q_PROPERTY(bool playlistVisible READ isPlaylistVisible WRITE setPlaylistVisible NOTIFY playlistVisibleChanged FINAL)
     Q_PROPERTY(double playlistWidthFactor READ getPlaylistWidthFactor WRITE setPlaylistWidthFactor NOTIFY playlistWidthFactorChanged FINAL)
+    Q_PROPERTY(double playerPlaylistWidthFactor READ getPlayerPlaylistWidthFactor WRITE setPlayerPlaylistWidthFactor NOTIFY playerPlaylistFactorChanged FINAL)
     Q_PROPERTY(bool interfaceAlwaysOnTop READ isInterfaceAlwaysOnTop WRITE setInterfaceAlwaysOnTop NOTIFY interfaceAlwaysOnTopChanged FINAL)
     Q_PROPERTY(bool hasEmbededVideo READ hasEmbededVideo NOTIFY hasEmbededVideoChanged FINAL)
     Q_PROPERTY(bool showRemainingTime READ isShowRemainingTime WRITE setShowRemainingTime NOTIFY showRemainingTimeChanged FINAL)
@@ -233,8 +234,9 @@ public:
     inline bool isInterfaceVisible() const { return m_windowVisibility != QWindow::Hidden; }
     bool isMediaLibraryVisible() { return m_mediaLibraryVisible; }
     bool isPlaylistDocked() { return b_playlistDocked; }
-    bool isPlaylistVisible() { return playlistVisible; }
-    inline double getPlaylistWidthFactor() const { return playlistWidthFactor; }
+    bool isPlaylistVisible() { return m_playlistVisible; }
+    inline double getPlaylistWidthFactor() const { return m_playlistWidthFactor; }
+    inline double getPlayerPlaylistWidthFactor() const { return m_playerPlaylistWidthFactor; }
     bool isInterfaceAlwaysOnTop() { return b_interfaceOnTop; }
     inline bool isHideAfterCreation() const { return b_hideAfterCreation; }
     inline bool isShowRemainingTime() const  { return m_showRemainingTime; }
@@ -371,8 +373,9 @@ protected:
 
     /* States */
     bool                 m_mediaLibraryVisible = true;
-    bool                 playlistVisible = false;       ///< Is the playlist visible ?
-    double               playlistWidthFactor = 4.;   ///< playlist size: root.width / playlistScaleFactor
+    bool                 m_playlistVisible = false;       ///< Is the playlist visible ?
+    double               m_playlistWidthFactor = 4.;   ///< playlist size: root.width / playlistScaleFactor
+    double               m_playerPlaylistWidthFactor = 4.;
 
     VLCVarChoiceModel* m_extraInterfaces = nullptr;
 
@@ -404,6 +407,7 @@ public slots:
     void setPlaylistDocked( bool );
     void setPlaylistVisible( bool );
     void setPlaylistWidthFactor( double );
+    void setPlayerPlaylistWidthFactor( double factor );
     void setInterfaceAlwaysOnTop( bool );
     void setShowRemainingTime( bool );
     void setGridView( bool );
@@ -451,6 +455,7 @@ signals:
     void playlistDockedChanged(bool);
     void playlistVisibleChanged(bool);
     void playlistWidthFactorChanged(double);
+    void playerPlaylistFactorChanged(double);
     void interfaceAlwaysOnTopChanged(bool);
     void hasEmbededVideoChanged(bool);
     void showRemainingTimeChanged(bool);


=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -621,10 +621,12 @@ FocusScope {
                         controlBarView.forceActiveFocus()
                 }
 
-                // TODO: remember width factor?
+
                 Widgets.HorizontalResizeHandle {
                     id: resizeHandle
 
+                    property bool _inhibitMainCtxUpdate: false
+
                     parent: playlistView
 
                     anchors {
@@ -636,6 +638,30 @@ FocusScope {
                     atRight: false
                     targetWidth: playlistpopup.width
                     sourceWidth: rootPlayer.width
+
+                    onWidthFactorChanged: {
+                        if (!_inhibitMainCtxUpdate)
+                            MainCtx.playerPlaylistWidthFactor = widthFactor
+                    }
+
+                    Component.onCompleted:  _updateFromMainCtx()
+
+                    function _updateFromMainCtx() {
+                        if (widthFactor == MainCtx.playerPlaylistWidthFactor)
+                            return
+
+                        _inhibitMainCtxUpdate = true
+                        widthFactor = MainCtx.playerPlaylistWidthFactor
+                        _inhibitMainCtxUpdate = false
+                    }
+
+                    Connections {
+                        target: MainCtx
+
+                        onPlaylistWidthFactorChanged: {
+                            resizeHandle._updateFromMainCtx()
+                        }
+                    }
                 }
             }
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aba49cd161490c2a7bb46ae5e8cd948ee9bd4883...17d89bc6972f94df174c589971ead3519739ffcd

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