[vlc-devel] [PATCH 2/5] qt: store the user interface scale factor in Qt configuration file

Pierre Lamot pierre at videolabs.io
Tue Sep 1 18:33:28 CEST 2020


---
 modules/gui/qt/maininterface/main_interface.cpp | 3 +++
 modules/gui/qt/qt.cpp                           | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/maininterface/main_interface.cpp b/modules/gui/qt/maininterface/main_interface.cpp
index 4c714bf559..69ef7bb40b 100644
--- a/modules/gui/qt/maininterface/main_interface.cpp
+++ b/modules/gui/qt/maininterface/main_interface.cpp
@@ -125,6 +125,8 @@ MainInterface::MainInterface(intf_thread_t *_p_intf , QWidget* parent, Qt::Windo
 
     /* */
     m_intfUserScaleFactor = var_InheritFloat(p_intf, "qt-interface-scale");
+    if (m_intfUserScaleFactor == -1)
+        m_intfUserScaleFactor = getSettings()->value( "MainWindow/interface-scale", 1.0).toFloat();
     winId(); //force window creation
     QWindow* window = windowHandle();
     if (window)
@@ -221,6 +223,7 @@ MainInterface::~MainInterface()
     settings->beginGroup("MainWindow");
     settings->setValue( "pl-dock-status", b_playlistDocked );
     settings->setValue( "ShowRemainingTime", m_showRemainingTime );
+    settings->setValue( "interface-scale", m_intfUserScaleFactor );
 
     /* Save playlist state */
     settings->setValue( "playlist-visible", playlistVisible );
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index 804a8a9408..2698dc8226 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -153,7 +153,7 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
                              " This option only works with Windows and " \
                              "X11 with composite extensions." )
 
-#define INTERFACE_SCALE_TEXT N_( "User scale factor for the interface, betwwen 0.1 and 10.0" )
+#define INTERFACE_SCALE_TEXT N_( "Initial user scale factor for the interface, betwwen 0.3 and 3.0" )
 
 #define ERROR_TEXT N_( "Show unimportant error and warnings dialogs" )
 
@@ -283,8 +283,11 @@ vlc_module_begin ()
     add_float_with_range( "qt-fs-opacity", 0.8, 0.1, 1., OPACITY_FS_TEXT,
                           OPACITY_FS_LONGTEXT, false )
 
-    add_float_with_range( "qt-interface-scale", 1.0, 0.1, 10., INTERFACE_SCALE_TEXT,
+    //qt-interface-scale is stored in Qt config file
+    //this option is here to force an initial scale factor at startup
+    add_float_with_range( "qt-interface-scale", -1.0, 0.3, 3.0, INTERFACE_SCALE_TEXT,
                           INTERFACE_SCALE_TEXT, false )
+        change_volatile()
 
     add_bool( "qt-video-autoresize", true, KEEPSIZE_TEXT,
               KEEPSIZE_LONGTEXT, false )
-- 
2.25.1



More information about the vlc-devel mailing list