[vlc-devel] [PATCH 07/16] qt: add functions to change user scale factor in maininterface
Prince Gupta
guptaprince8832 at gmail.com
Tue Feb 23 10:05:57 UTC 2021
---
modules/gui/qt/maininterface/main_interface.cpp | 9 +++++++--
modules/gui/qt/maininterface/main_interface.hpp | 6 ++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt/maininterface/main_interface.cpp b/modules/gui/qt/maininterface/main_interface.cpp
index 1475282486..a112632dce 100644
--- a/modules/gui/qt/maininterface/main_interface.cpp
+++ b/modules/gui/qt/maininterface/main_interface.cpp
@@ -361,9 +361,14 @@ void MainInterface::updateIntfScaleFactor()
void MainInterface::incrementIntfUserScaleFactor(bool increment)
{
if (increment)
- m_intfUserScaleFactor = std::min(m_intfUserScaleFactor + 0.1, 3.0);
+ setIntfUserScaleFactor(m_intfScaleFactor + .1f);
else
- m_intfUserScaleFactor = std::max(m_intfUserScaleFactor - 0.1, 0.3);
+ setIntfUserScaleFactor(m_intfScaleFactor - .1f);
+}
+
+void MainInterface::setIntfUserScaleFactor(float newValue)
+{
+ m_intfUserScaleFactor = std::max(std::min(newValue, getMaxIntfUserScaleFactor()), getMinIntfUserScaleFactor());
updateIntfScaleFactor();
}
diff --git a/modules/gui/qt/maininterface/main_interface.hpp b/modules/gui/qt/maininterface/main_interface.hpp
index 5b480c7944..3672ce000c 100644
--- a/modules/gui/qt/maininterface/main_interface.hpp
+++ b/modules/gui/qt/maininterface/main_interface.hpp
@@ -165,6 +165,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;
public:
/* Getters */
@@ -191,6 +193,9 @@ public:
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 float getMinIntfUserScaleFactor() const { return MIN_INTF_USER_SCALE_FACTOR; }
+ inline float 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; }
@@ -294,6 +299,7 @@ public slots:
void setShowRemainingTime( bool );
void setGridView( bool );
void incrementIntfUserScaleFactor( bool increment);
+ void setIntfUserScaleFactor( float );
void emitBoss();
void emitRaise();
--
2.25.1
More information about the vlc-devel
mailing list