[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: improve color scheme interface

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Mon Jul 11 06:43:45 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
497bca5a by Prince Gupta at 2022-07-11T06:28:40+00:00
qt: improve color scheme interface

remove ColorScheme::setCurrentScheme, current scheme depends on
underlying implementation and two index can have same color scheme

- - - - -
5051da02 by Prince Gupta at 2022-07-11T06:28:40+00:00
qt: fix color scheme assignment in first run wizard

- - - - -


4 changed files:

- modules/gui/qt/dialogs/firstrun/firstrunwizard.cpp
- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/util/color_scheme_model.cpp
- modules/gui/qt/util/color_scheme_model.hpp


Changes:

=====================================
modules/gui/qt/dialogs/firstrun/firstrunwizard.cpp
=====================================
@@ -308,7 +308,7 @@ void FirstRunWizard::reject()
     config_PutInt( "qt-privacy-ask", 0 );
 
     /* Colour Page settings */
-    p_intf->p_mi->getColorScheme()->setCurrentIndex( p_intf->p_mi->getColorScheme()->getSchemes().at(0).scheme );
+    p_intf->p_mi->getColorScheme()->setCurrentIndex( 0 );
 
     /* Layout Page settings */
     config_PutInt( "qt-menubar", 0 );


=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -208,7 +208,7 @@ MainCtx::~MainCtx()
     settings->setValue( "grid-view", m_gridView );
     settings->setValue( "grouping", m_grouping );
 
-    settings->setValue( "color-scheme", m_colorScheme->currentScheme() );
+    settings->setValue( "color-scheme-index", m_colorScheme->currentIndex() );
     /* Save the stackCentralW sizes */
     settings->endGroup();
 
@@ -330,9 +330,8 @@ void MainCtx::loadFromSettingsImpl(const bool callSignals)
 
     loadFromSettings(m_showRemainingTime, "MainWindow/ShowRemainingTime", false, &MainCtx::showRemainingTimeChanged);
 
-    const auto colorScheme = static_cast<ColorSchemeModel::ColorScheme>(getSettings()->value( "MainWindow/color-scheme", ColorSchemeModel::System ).toInt());
-    if (m_colorScheme->currentScheme() != colorScheme)
-        m_colorScheme->setCurrentScheme(colorScheme);
+    const auto colorSchemeIndex = getSettings()->value( "MainWindow/color-scheme-index", 0 ).toInt();
+    m_colorScheme->setCurrentIndex(colorSchemeIndex);
 
     /* user interface scale factor */
     auto userIntfScaleFactor = var_InheritFloat(p_intf, "qt-interface-scale");


=====================================
modules/gui/qt/util/color_scheme_model.cpp
=====================================
@@ -219,18 +219,6 @@ QVector<ColorSchemeModel::Item> ColorSchemeModel::getSchemes() const
     return vec;
 }
 
-void ColorSchemeModel::setCurrentScheme(const ColorScheme scheme)
-{
-    for (int i = 0; i < m_list->size(); ++i)
-    {
-        if (m_list->scheme(i) == scheme)
-        {
-            setCurrentIndex(i);
-            break;
-        }
-    }
-}
-
 ColorSchemeModel::ColorScheme ColorSchemeModel::currentScheme() const
 {
     return m_list->scheme(m_currentIndex);


=====================================
modules/gui/qt/util/color_scheme_model.hpp
=====================================
@@ -27,7 +27,7 @@ class ColorSchemeModel : public QAbstractListModel
 {
     Q_OBJECT
     Q_PROPERTY(QString current READ currentText NOTIFY currentChanged FINAL)
-    Q_PROPERTY(ColorScheme scheme READ currentScheme WRITE setCurrentScheme NOTIFY currentChanged FINAL)
+    Q_PROPERTY(ColorScheme scheme READ currentScheme NOTIFY currentChanged FINAL)
 
 public:
     enum ColorScheme
@@ -60,7 +60,6 @@ public:
     QString currentText() const;
     QVector<Item> getSchemes() const;
 
-    void setCurrentScheme(ColorScheme scheme);
     ColorScheme currentScheme() const;
 
 signals:



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cf049ad4ab715f342d727fbc724d2b0dd702c21f...5051da023727f649eb03ef6e1a54bdb9c165091f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cf049ad4ab715f342d727fbc724d2b0dd702c21f...5051da023727f649eb03ef6e1a54bdb9c165091f
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