[vlc-devel] [PATCH 07/18] qt: remove obsolete settings class

Pierre Lamot pierre at videolabs.io
Wed Sep 23 14:27:41 CEST 2020


---
 modules/gui/qt/Makefile.am                    |  3 --
 .../gui/qt/dialogs/toolbar/toolbareditor.cpp  |  2 -
 modules/gui/qt/maininterface/mainui.cpp       |  2 -
 modules/gui/qt/util/settings.cpp              | 37 -------------
 modules/gui/qt/util/settings.hpp              | 52 -------------------
 5 files changed, 96 deletions(-)
 delete mode 100644 modules/gui/qt/util/settings.cpp
 delete mode 100644 modules/gui/qt/util/settings.hpp

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 8d9e614253..17796729d5 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -203,8 +203,6 @@ libqt_plugin_la_SOURCES = \
 	gui/qt/util/renderer_manager.cpp gui/qt/util/renderer_manager.hpp \
 	gui/qt/util/selectable_list_model.cpp \
 	gui/qt/util/selectable_list_model.hpp \
-	gui/qt/util/settings.cpp \
-	gui/qt/util/settings.hpp \
 	gui/qt/util/singleton.hpp \
 	gui/qt/util/soutchain.cpp gui/qt/util/soutchain.hpp \
 	gui/qt/util/systempalette.cpp gui/qt/util/systempalette.hpp \
@@ -335,7 +333,6 @@ nodist_libqt_plugin_la_SOURCES = \
 	gui/qt/util/recents.moc.cpp \
 	gui/qt/util/renderer_manager.moc.cpp \
 	gui/qt/util/selectable_list_model.moc.cpp \
-	gui/qt/util/settings.moc.cpp \
 	gui/qt/util/systempalette.moc.cpp \
 	gui/qt/util/validators.moc.cpp \
 	gui/qt/util/varchoicemodel.moc.cpp \
diff --git a/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp b/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
index a314cff59d..c0927f8058 100644
--- a/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
+++ b/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
@@ -23,7 +23,6 @@
 #include "toolbareditor.hpp"
 #include "util/i18n.hpp"
 #include "util/recent_media_model.hpp"
-#include "util/settings.hpp"
 #include "util/systempalette.hpp"
 #include "util/qml_main_context.hpp"
 #include "player/playercontrolbarmodel.hpp"
@@ -102,7 +101,6 @@ ToolbarEditorDialog::ToolbarEditorDialog( QWidget *_w, intf_thread_t *_p_intf)
     rootCtx->setContextProperty( "mainctx", new QmlMainContext(p_intf, mainInterface, engine));
     rootCtx->setContextProperty( "mainInterface", mainInterface);
     rootCtx->setContextProperty( "topWindow", mainInterface->windowHandle());
-    rootCtx->setContextProperty( "settings",  new Settings( p_intf, engine));
     rootCtx->setContextProperty( "systemPalette", new SystemPalette(engine));
     rootCtx->setContextProperty( "medialib", nullptr );
     rootCtx->setContextProperty( "recentsMedias",  new VLCRecentMediaModel( p_intf, engine ));
diff --git a/modules/gui/qt/maininterface/mainui.cpp b/modules/gui/qt/maininterface/mainui.cpp
index da026c1408..7dad487c13 100644
--- a/modules/gui/qt/maininterface/mainui.cpp
+++ b/modules/gui/qt/maininterface/mainui.cpp
@@ -23,7 +23,6 @@
 #include "util/i18n.hpp"
 #include "util/systempalette.hpp"
 #include "util/recent_media_model.hpp"
-#include "util/settings.hpp"
 #include "util/navigation_history.hpp"
 
 #include "dialogs/help/aboutmodel.hpp"
@@ -91,7 +90,6 @@ bool MainUI::setup(QQmlEngine* engine)
     rootCtx->setContextProperty( "topWindow", m_mainInterface->windowHandle());
     rootCtx->setContextProperty( "dialogProvider", DialogsProvider::getInstance());
     rootCtx->setContextProperty( "recentsMedias",  new VLCRecentMediaModel( m_intf, this ));
-    rootCtx->setContextProperty( "settings",  new Settings( m_intf, this ));
     rootCtx->setContextProperty( "systemPalette", new SystemPalette(this));
 
     if (m_mainInterface->hasMediaLibrary())
diff --git a/modules/gui/qt/util/settings.cpp b/modules/gui/qt/util/settings.cpp
deleted file mode 100644
index d4d6ab2d54..0000000000
--- a/modules/gui/qt/util/settings.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * ( at your option ) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include "settings.hpp"
-
-#define QML_AVAILABLE_PROPERTY_IMPL(PropertyName, key, defaultValue) \
-    QVariant Settings::get##PropertyName() const { \
-        return getSettings()->value(key, defaultValue); \
-    } \
-    void Settings::set##PropertyName(QVariant value) { \
-        getSettings()->setValue(key, value); \
-        emit PropertyName##Changed(); \
-    }
-
-Settings::Settings(intf_thread_t *_p_intf, QObject *parent)
-    : QObject(parent),p_intf( _p_intf )
-{
-}
-
-
-QML_AVAILABLE_PROPERTY_IMPL(VLCStyle_colors_state,"VLCStyle-colors-state","system")
-QML_AVAILABLE_PROPERTY_IMPL(medialib_gridView,"medialib-gridView",true)
diff --git a/modules/gui/qt/util/settings.hpp b/modules/gui/qt/util/settings.hpp
deleted file mode 100644
index 6ab7726e0f..0000000000
--- a/modules/gui/qt/util/settings.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * ( at your option ) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef VLC_SETTINGS_HPP
-#define VLC_SETTINGS_HPP
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "qt.hpp"
-#include <QObject>
-#include <QSettings>
-
-#define QML_AVAILABLE_PROPERTY(PropertyName) \
-    Q_PROPERTY(QVariant PropertyName READ get##PropertyName WRITE set##PropertyName NOTIFY PropertyName##Changed) \
-    public: \
-        QVariant get##PropertyName() const; \
-        void set##PropertyName(QVariant); \
-        Q_SIGNAL void PropertyName##Changed();
-
-class Settings : public QObject
-{
-    Q_OBJECT
-
-    QML_AVAILABLE_PROPERTY(VLCStyle_colors_state)
-    QML_AVAILABLE_PROPERTY(medialib_gridView)
-
-public:
-    Settings(intf_thread_t *_p_intf,QObject * parent = nullptr);
-
-private:
-    intf_thread_t *p_intf;
-
-};
-#undef QML_AVAILABLE_PROPERTY
-#endif
-- 
2.25.1



More information about the vlc-devel mailing list