[vlc-devel] [PATCH 13/16] qt: add playlist width factor setting to maininterface

Fatih Uzunoglu fuzun54 at outlook.com
Wed Jul 29 23:04:36 CEST 2020


---
 modules/gui/qt/maininterface/main_interface.cpp | 12 ++++++++++++
 modules/gui/qt/maininterface/main_interface.hpp |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/modules/gui/qt/maininterface/main_interface.cpp b/modules/gui/qt/maininterface/main_interface.cpp
index b821007d0f..de06ec0058 100644
--- a/modules/gui/qt/maininterface/main_interface.cpp
+++ b/modules/gui/qt/maininterface/main_interface.cpp
@@ -108,6 +108,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf )
 
     b_hideAfterCreation  = false; // --qt-start-minimized
     playlistVisible      = false;
+    playlistWidthFactor  = 4.0;
     b_interfaceFullScreen= false;
     b_hasPausedWhenMinimized = false;
     i_kc_offset          = false;
@@ -147,6 +148,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf )
     /* playlist settings */
     b_playlistDocked = getSettings()->value( "MainWindow/pl-dock-status", true ).toBool();
     playlistVisible  = getSettings()->value( "MainWindow/playlist-visible", false ).toBool();
+    playlistWidthFactor = getSettings()->value( "MainWindow/playlist-width-factor", 4.0 ).toDouble();
 
     m_showRemainingTime = getSettings()->value( "MainWindow/ShowRemainingTime", false ).toBool();
 
@@ -249,6 +251,7 @@ MainInterface::~MainInterface()
 
     /* Save playlist state */
     settings->setValue( "playlist-visible", playlistVisible );
+    settings->setValue( "playlist-width-factor", playlistWidthFactor);
 
     /* Save the stackCentralW sizes */
     settings->endGroup();
@@ -444,6 +447,15 @@ void MainInterface::setPlaylistVisible( bool visible )
     emit playlistVisibleChanged(visible);
 }
 
+void MainInterface::setPlaylistWidthFactor( double factor )
+{
+    if (factor > 0.0)
+    {
+        playlistWidthFactor = factor;
+        emit playlistWidthFactorChanged(factor);
+    }
+}
+
 void MainInterface::setShowRemainingTime( bool show )
 {
     m_showRemainingTime = show;
diff --git a/modules/gui/qt/maininterface/main_interface.hpp b/modules/gui/qt/maininterface/main_interface.hpp
index cd05b8353b..cbb45300e2 100644
--- a/modules/gui/qt/maininterface/main_interface.hpp
+++ b/modules/gui/qt/maininterface/main_interface.hpp
@@ -64,6 +64,7 @@ class MainInterface : public QVLCMW
 
     Q_PROPERTY(bool playlistDocked READ isPlaylistDocked WRITE setPlaylistDocked NOTIFY playlistDockedChanged)
     Q_PROPERTY(bool playlistVisible READ isPlaylistVisible WRITE setPlaylistVisible NOTIFY playlistVisibleChanged)
+    Q_PROPERTY(double playlistWidthFactor READ getPlaylistWidthFactor WRITE setPlaylistWidthFactor NOTIFY playlistWidthFactorChanged)
     Q_PROPERTY(bool interfaceAlwaysOnTop READ isInterfaceAlwaysOnTop WRITE setInterfaceAlwaysOnTop NOTIFY interfaceAlwaysOnTopChanged)
     Q_PROPERTY(bool interfaceFullScreen READ isInterfaceFullScreen WRITE setInterfaceFullScreen NOTIFY interfaceFullScreenChanged)
     Q_PROPERTY(bool hasEmbededVideo READ hasEmbededVideo NOTIFY hasEmbededVideoChanged)
@@ -104,6 +105,7 @@ public:
     bool isInterfaceFullScreen() { return b_interfaceFullScreen; }
     bool isPlaylistDocked() { return b_playlistDocked; }
     bool isPlaylistVisible() { return playlistVisible; }
+    inline double getPlaylistWidthFactor() const { return playlistWidthFactor; }
     bool isInterfaceAlwaysOnTop() { return b_interfaceOnTop; }
     inline bool isShowRemainingTime() const  { return m_showRemainingTime; }
     inline float getIntfScaleFactor() const { return m_intfScaleFactor; }
@@ -178,6 +180,7 @@ protected:
     bool                 b_hasMedialibrary = false;
     /* States */
     bool                 playlistVisible;       ///< Is the playlist visible ?
+    double               playlistWidthFactor;   ///< playlist size: root.width / playlistScaleFactor
 
     bool                 b_hasPausedWhenMinimized;
 
@@ -193,6 +196,7 @@ public slots:
     void toggleInterfaceFullScreen();
     void setPlaylistDocked( bool );
     void setPlaylistVisible( bool );
+    void setPlaylistWidthFactor( double );
     void setInterfaceAlwaysOnTop( bool );
     void setShowRemainingTime( bool );
 
@@ -238,6 +242,7 @@ signals:
 
     void playlistDockedChanged(bool);
     void playlistVisibleChanged(bool);
+    void playlistWidthFactorChanged(double);
     void interfaceAlwaysOnTopChanged(bool);
     void interfaceFullScreenChanged(bool);
     void hasEmbededVideoChanged(bool);
-- 
2.25.1



More information about the vlc-devel mailing list