[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: Add the 'qt-safe-area' option

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Apr 6 08:35:34 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
0f784508 by Benjamin Arnaud at 2023-04-06T08:14:26+00:00
qt: Add the 'qt-safe-area' option

- - - - -
bba3eed2 by Benjamin Arnaud at 2023-04-06T08:14:26+00:00
qt/mainctx: Add the 'safeArea' property

- - - - -
5d7fa7f6 by Benjamin Arnaud at 2023-04-06T08:14:26+00:00
qml/VLCStyle: Add the 'safeArea' support

- - - - -


4 changed files:

- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/qt.cpp
- modules/gui/qt/style/VLCStyle.qml


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -310,6 +310,8 @@ void MainCtx::loadPrefs(const bool callSignals)
     loadFromVLCOption(m_pinVideoControls, "qt-pin-controls", &MainCtx::pinVideoControlsChanged);
 
     loadFromVLCOption(m_pinOpacity, "qt-fs-opacity", &MainCtx::pinOpacityChanged);
+
+    loadFromVLCOption(m_safeArea, "qt-safe-area", &MainCtx::safeAreaChanged);
 }
 
 void MainCtx::loadFromSettingsImpl(const bool callSignals)


=====================================
modules/gui/qt/maininterface/mainctx.hpp
=====================================
@@ -178,6 +178,7 @@ class MainCtx : public QObject
     Q_PROPERTY(QScreen* screen READ screen NOTIFY screenChanged)
     Q_PROPERTY(bool useGlobalShortcuts READ getUseGlobalShortcuts WRITE setUseGlobalShortcuts NOTIFY useGlobalShortcutsChanged FINAL)
     Q_PROPERTY(int maxVolume READ maxVolume NOTIFY maxVolumeChanged FINAL)
+    Q_PROPERTY(float safeArea READ safeArea NOTIFY safeAreaChanged FINAL)
 
     Q_PROPERTY(CSDButtonModel *csdButtonModel READ csdButtonModel CONSTANT FINAL)
 
@@ -266,6 +267,8 @@ public:
     void setUseGlobalShortcuts(bool useGlobalShortcuts );
     inline int maxVolume() const { return m_maxVolume; };
 
+    inline float safeArea() const { return m_safeArea; };
+
     bool hasEmbededVideo() const;
     VideoSurfaceProvider* getVideoSurfaceProvider() const;
     void setVideoSurfaceProvider(VideoSurfaceProvider* videoSurfaceProvider);;
@@ -377,6 +380,8 @@ protected:
 
     int m_maxVolume = 125;
 
+    float m_safeArea = 0.0;
+
     std::unique_ptr<CSDButtonModel> m_csdButtonModel;
 
 public slots:
@@ -469,6 +474,8 @@ signals:
     
     void maxVolumeChanged();
 
+    void safeAreaChanged();
+
 private:
     void loadPrefs(bool callSignals);
     void loadFromSettingsImpl(bool callSignals);


=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -227,6 +227,11 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 #define SMOOTH_SCROLLING_TEXT N_( "Use smooth scrolling in Flickable based views" )
 #define SMOOTH_SCROLLING_LONGTEXT N_( "Deactivating this option will disable smooth scrolling in Flickable based views (such as the Playqueue)" )
 
+#define SAFE_AREA_TEXT N_( "Safe area for the user interface" )
+#define SAFE_AREA_LONGTEXT N_( "Sets the safe area percentage between 0.0 and 100 when you want " \
+                               "to ensure the visibility of the user interface on a constrained " \
+                               "viewport" )
+
 static const int initial_prefs_view_list[] = { 0, 1, 2 };
 static const char *const initial_prefs_view_list_texts[] =
     { N_("Simple"), N_("Advanced"), N_("Expert") };
@@ -393,6 +398,8 @@ vlc_module_begin ()
 
     add_bool( "qt-smooth-scrolling", true, SMOOTH_SCROLLING_TEXT, SMOOTH_SCROLLING_LONGTEXT )
 
+    add_float_with_range( "qt-safe-area", 0, 0, 100.0, SAFE_AREA_TEXT, SAFE_AREA_LONGTEXT )
+
     cannot_unload_broken_library()
 
     add_submodule ()


=====================================
modules/gui/qt/style/VLCStyle.qml
=====================================
@@ -230,8 +230,8 @@ QtObject {
     readonly property bool isScreenSmall: appWidth <= smallWidth
 
     //global application margin "safe area"
-    readonly property int applicationHorizontalMargin: 0
-    readonly property int applicationVerticalMargin: 0
+    readonly property int applicationHorizontalMargin: MainCtx.safeArea * appWidth / 100
+    readonly property int applicationVerticalMargin: applicationHorizontalMargin
 
     readonly property int globalToolbar_height: dp(40, scale)
     readonly property int localToolbar_height: dp(48, scale)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7ffc36f0e946cc49d8aed83a702f9e77a1e7061d...5d7fa7f67afeea843a031e90aa90433ba4eee7fb

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7ffc36f0e946cc49d8aed83a702f9e77a1e7061d...5d7fa7f67afeea843a031e90aa90433ba4eee7fb
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