[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix intf scale factor adjustment

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Oct 15 17:11:05 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
2ec7370b by Fatih Uzunoglu at 2021-10-15T16:51:38+00:00
qt: fix intf scale factor adjustment

- - - - -
768bb549 by Fatih Uzunoglu at 2021-10-15T16:51:38+00:00
qt: change type of intf scale factor to double

- - - - -


2 changed files:

- modules/gui/qt/maininterface/main_interface.cpp
- modules/gui/qt/maininterface/main_interface.hpp


Changes:

=====================================
modules/gui/qt/maininterface/main_interface.cpp
=====================================
@@ -123,7 +123,7 @@ MainInterface::MainInterface(qt_intf_t *_p_intf)
     /* */
     m_intfUserScaleFactor = var_InheritFloat(p_intf, "qt-interface-scale");
     if (m_intfUserScaleFactor == -1)
-        m_intfUserScaleFactor = getSettings()->value( "MainWindow/interface-scale", 1.0).toFloat();
+        m_intfUserScaleFactor = getSettings()->value( "MainWindow/interface-scale", 1.0).toDouble();
 
     /* Get the available interfaces */
     m_extraInterfaces = new VLCVarChoiceModel(VLC_OBJECT(p_intf->intf), "intf-add", this);
@@ -363,14 +363,14 @@ void MainInterface::setHasAcrylicSurface(const bool v)
 void MainInterface::incrementIntfUserScaleFactor(bool increment)
 {
     if (increment)
-        setIntfUserScaleFactor(m_intfScaleFactor + .1f);
+        setIntfUserScaleFactor(m_intfUserScaleFactor + 0.1);
     else
-        setIntfUserScaleFactor(m_intfScaleFactor - .1f);
+        setIntfUserScaleFactor(m_intfUserScaleFactor - 0.1);
 }
 
-void MainInterface::setIntfUserScaleFactor(float newValue)
+void MainInterface::setIntfUserScaleFactor(double newValue)
 {
-    m_intfUserScaleFactor = std::max(std::min(newValue, getMaxIntfUserScaleFactor()), getMinIntfUserScaleFactor());
+    m_intfUserScaleFactor = qBound(getMinIntfUserScaleFactor(), newValue, getMaxIntfUserScaleFactor());
     updateIntfScaleFactor();
 }
 


=====================================
modules/gui/qt/maininterface/main_interface.hpp
=====================================
@@ -150,7 +150,7 @@ class MainInterface : public QObject
     Q_PROPERTY(bool hasEmbededVideo READ hasEmbededVideo NOTIFY hasEmbededVideoChanged FINAL)
     Q_PROPERTY(bool showRemainingTime READ isShowRemainingTime WRITE setShowRemainingTime NOTIFY showRemainingTimeChanged FINAL)
     Q_PROPERTY(VLCVarChoiceModel* extraInterfaces READ getExtraInterfaces CONSTANT FINAL)
-    Q_PROPERTY(float intfScaleFactor READ getIntfScaleFactor NOTIFY intfScaleFactorChanged FINAL)
+    Q_PROPERTY(double intfScaleFactor READ getIntfScaleFactor NOTIFY intfScaleFactorChanged FINAL)
     Q_PROPERTY(bool mediaLibraryAvailable READ hasMediaLibrary CONSTANT FINAL)
     Q_PROPERTY(MediaLib* mediaLibrary READ getMediaLibrary CONSTANT FINAL)
     Q_PROPERTY(bool gridView READ hasGridView WRITE setGridView NOTIFY gridViewChanged FINAL)
@@ -172,8 +172,8 @@ public:
     virtual ~MainInterface();
 
     static const QEvent::Type ToolbarsNeedRebuild;
-    static constexpr float MIN_INTF_USER_SCALE_FACTOR = .3f;
-    static constexpr float MAX_INTF_USER_SCALE_FACTOR = 3.f;
+    static constexpr double MIN_INTF_USER_SCALE_FACTOR = 0.3;
+    static constexpr double MAX_INTF_USER_SCALE_FACTOR = 3.0;
 
 public:
     /* Getters */
@@ -200,11 +200,11 @@ public:
     bool isInterfaceAlwaysOnTop() { return b_interfaceOnTop; }
     inline bool isHideAfterCreation() const { return b_hideAfterCreation; }
     inline bool isShowRemainingTime() const  { return m_showRemainingTime; }
-    inline float getIntfScaleFactor() const { return m_intfScaleFactor; }
-    inline float getIntfUserScaleFactor() const { return m_intfUserScaleFactor; }
+    inline double getIntfScaleFactor() const { return m_intfScaleFactor; }
+    inline double getIntfUserScaleFactor() const { return m_intfUserScaleFactor; }
     inline int CSDBorderSize() const { return 5 * getIntfScaleFactor(); }
-    inline float getMinIntfUserScaleFactor() const { return MIN_INTF_USER_SCALE_FACTOR; }
-    inline float getMaxIntfUserScaleFactor() const { return MAX_INTF_USER_SCALE_FACTOR; }
+    inline double getMinIntfUserScaleFactor() const { return MIN_INTF_USER_SCALE_FACTOR; }
+    inline double getMaxIntfUserScaleFactor() const { return MAX_INTF_USER_SCALE_FACTOR; }
     inline bool hasMediaLibrary() const { return b_hasMedialibrary; }
     inline MediaLib* getMediaLibrary() const { return m_medialib; }
     inline bool hasGridView() const { return m_gridView; }
@@ -265,8 +265,8 @@ protected:
     QMap<QWidget *, QSize> stackWidgetsSizes;
 
     /* Flags */
-    float                m_intfUserScaleFactor;
-    float                m_intfScaleFactor;
+    double                m_intfUserScaleFactor;
+    double                m_intfScaleFactor;
     unsigned             i_notificationSetting; /// Systray Notifications
     bool                 b_hideAfterCreation;
     bool                 b_minimalView;         ///< Minimal video
@@ -309,7 +309,7 @@ public slots:
     void setShowRemainingTime( bool );
     void setGridView( bool );
     void incrementIntfUserScaleFactor( bool increment);
-    void setIntfUserScaleFactor( float );
+    void setIntfUserScaleFactor( double );
     void setPinVideoControls( bool );
     void updateIntfScaleFactor();
     void onWindowVisibilityChanged(QWindow::Visibility);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e24e9473031e0c9a3316130c0995d2250e5ef55d...768bb549d7b3078ff6c8aaf956ecf8ad17db15e2

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e24e9473031e0c9a3316130c0995d2250e5ef55d...768bb549d7b3078ff6c8aaf956ecf8ad17db15e2
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list