[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: add 'artistAlbumsWidthFactor' settings property

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Sep 2 09:14:38 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
de408a9a by Prince Gupta at 2024-09-02T09:00:35+00:00
qt: add 'artistAlbumsWidthFactor' settings property

- - - - -
1aa2d804 by Prince Gupta at 2024-09-02T09:00:35+00:00
qml: remember width factor in artist albums view

- - - - -


3 changed files:

- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -234,6 +234,8 @@ MainCtx::~MainCtx()
     settings->setValue( "playlist-width-factor", QString::number( m_playlistWidthFactor ) );
     settings->setValue( "player-playlist-width-factor", QString::number( m_playerPlaylistWidthFactor ) );
 
+    settings->setValue( "artist-albums-width-factor", QString::number( m_artistAlbumsWidthFactor ) );
+
     settings->setValue( "grid-view", m_gridView );
     settings->setValue( "grouping", m_grouping );
 
@@ -367,6 +369,9 @@ void MainCtx::loadFromSettingsImpl(const bool callSignals)
 
     loadFromSettings(m_playerPlaylistWidthFactor, "MainWindow/player-playlist-width-factor", 4.0 , &MainCtx::playerPlaylistFactorChanged);
 
+    loadFromSettings(m_artistAlbumsWidthFactor, "MainWindow/artist-albums-width-factor"
+                     , 4.0 , &MainCtx::artistAlbumsWidthFactorChanged);
+
     loadFromSettings(m_gridView, "MainWindow/grid-view", true, &MainCtx::gridViewChanged);
 
     loadFromSettings(m_grouping, "MainWindow/grouping", GROUPING_NONE, &MainCtx::groupingChanged);
@@ -907,3 +912,17 @@ bool WindowStateHolder::holdOnTop(QWindow *window, Source source, bool hold)
 
     return onTopCounter != 0;
 }
+
+double MainCtx::artistAlbumsWidthFactor() const
+{
+    return m_artistAlbumsWidthFactor;
+}
+
+void MainCtx::setArtistAlbumsWidthFactor(double newArtistAlbumsWidthFactor)
+{
+    if (qFuzzyCompare(m_artistAlbumsWidthFactor, newArtistAlbumsWidthFactor))
+        return;
+
+    m_artistAlbumsWidthFactor = newArtistAlbumsWidthFactor;
+    emit artistAlbumsWidthFactorChanged( m_artistAlbumsWidthFactor );
+}


=====================================
modules/gui/qt/maininterface/mainctx.hpp
=====================================
@@ -98,6 +98,7 @@ class MainCtx : public QObject
     Q_PROPERTY(bool playlistVisible READ isPlaylistVisible WRITE setPlaylistVisible NOTIFY playlistVisibleChanged FINAL)
     Q_PROPERTY(double playlistWidthFactor READ getPlaylistWidthFactor WRITE setPlaylistWidthFactor NOTIFY playlistWidthFactorChanged FINAL)
     Q_PROPERTY(double playerPlaylistWidthFactor READ getPlayerPlaylistWidthFactor WRITE setPlayerPlaylistWidthFactor NOTIFY playerPlaylistFactorChanged FINAL)
+    Q_PROPERTY(double artistAlbumsWidthFactor READ artistAlbumsWidthFactor WRITE setArtistAlbumsWidthFactor NOTIFY artistAlbumsWidthFactorChanged FINAL)
     Q_PROPERTY(bool interfaceAlwaysOnTop READ isInterfaceAlwaysOnTop WRITE setInterfaceAlwaysOnTop NOTIFY interfaceAlwaysOnTopChanged FINAL)
     Q_PROPERTY(bool hasEmbededVideo READ hasEmbededVideo NOTIFY hasEmbededVideoChanged FINAL)
     Q_PROPERTY(bool showRemainingTime READ isShowRemainingTime WRITE setShowRemainingTime NOTIFY showRemainingTimeChanged FINAL)
@@ -291,6 +292,9 @@ public:
 
     Q_INVOKABLE QString displayMRL(const QUrl &mrl) const;
 
+    double artistAlbumsWidthFactor() const;
+    void setArtistAlbumsWidthFactor(double newArtistAlbumsWidthFactor);
+
 protected:
     /* Systray */
     void initSystray();
@@ -339,6 +343,8 @@ protected:
     double               m_playlistWidthFactor = 4.;   ///< playlist size: root.width / playlistScaleFactor
     double               m_playerPlaylistWidthFactor = 4.;
 
+    double               m_artistAlbumsWidthFactor = 4.;
+
     VLCVarChoiceModel* m_extraInterfaces = nullptr;
 
     ControlbarProfileModel* m_controlbarProfileModel = nullptr;
@@ -461,6 +467,8 @@ signals:
     void requestShowMainView();
     void requestShowPlayerView();
 
+    void artistAlbumsWidthFactorChanged( double );
+
 private:
     void loadPrefs(bool callSignals);
     void loadFromSettingsImpl(bool callSignals);


=====================================
modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
=====================================
@@ -214,13 +214,40 @@ FocusScope {
             Widgets.HorizontalResizeHandle {
                 id: resizeHandle
 
+                property bool _inhibitMainCtxUpdate: false
+
                 anchors {
                     top: parent.top
                     bottom: parent.bottom
                     right: parent.right
                 }
+
                 sourceWidth: root.width
                 targetWidth: artistList.width
+
+                onWidthFactorChanged: {
+                    if (!_inhibitMainCtxUpdate)
+                        MainCtx.artistAlbumsWidthFactor = widthFactor
+                }
+
+                Component.onCompleted:  _updateFromMainCtx()
+
+                function _updateFromMainCtx() {
+                    if (widthFactor == MainCtx.artistAlbumsWidthFactor)
+                        return
+
+                    _inhibitMainCtxUpdate = true
+                    widthFactor = MainCtx.artistAlbumsWidthFactor
+                    _inhibitMainCtxUpdate = false
+                }
+
+                Connections {
+                    target: MainCtx
+
+                    function onArtistAlbumsWidthFactorChanged() {
+                        resizeHandle._updateFromMainCtx()
+                    }
+                }
             }
         }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/57f263708180f36cb7ab32ea06f22425a5aa97cc...1aa2d8047f4ca0d422b203c4f936241b76b1065a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/57f263708180f36cb7ab32ea06f22425a5aa97cc...1aa2d8047f4ca0d422b203c4f936241b76b1065a
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