diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-09-17 14:04:27 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-30 10:36:49 -0700 |
commit | b35ccc3a3533a3fcf9c7434584470537b6d0001e (patch) | |
tree | 8b8b4ebbb7c9e705c430fb5c9d38c40fa6cf386a /desktop-widgets | |
parent | 225ac07005e72d52b1f70ae88e7033528789fc21 (diff) | |
download | subsurface-b35ccc3a3533a3fcf9c7434584470537b6d0001e.tar.gz |
Preferences: start to port preferences to a more sane design
Our preferences dialog right now is a rather huge dialog
with more than 9 subpages, and all of those pages are programmed
inside of the same class, same methods and all that - which means
that if I change something on the dialog I can break any
other thing quite easily.
The idea of this patch series is to make it harder to break
user settings and the settings dialog.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/CMakeLists.txt | 2 | ||||
-rw-r--r-- | desktop-widgets/preferences/CMakeLists.txt | 9 | ||||
-rw-r--r-- | desktop-widgets/preferences/abstractpreferenceswidget.cpp | 21 | ||||
-rw-r--r-- | desktop-widgets/preferences/abstractpreferenceswidget.h | 27 |
4 files changed, 59 insertions, 0 deletions
diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index 635a8b68e..6d9051b10 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -13,6 +13,8 @@ include_directories(. ${CMAKE_BINARY_DIR} ) +add_subdirectory(preferences) + # the interface, in C++ set(SUBSURFACE_INTERFACE updatemanager.cpp diff --git a/desktop-widgets/preferences/CMakeLists.txt b/desktop-widgets/preferences/CMakeLists.txt new file mode 100644 index 000000000..953c587b1 --- /dev/null +++ b/desktop-widgets/preferences/CMakeLists.txt @@ -0,0 +1,9 @@ +# the profile widget +set(SUBSURFACE_PREFERENCES_LIB_SRCS + abstractpreferenceswidget.cpp +) + +source_group("Subsurface Preferences" FILES ${SUBSURFACE_PREFERENCES_LIB_SRCS}) + +add_library(subsurface_desktop_preferences STATIC ${SUBSURFACE_PREFERENCES_LIB_SRCS}) +target_link_libraries(subsurface_desktop_preferences ${QT_LIBRARIES})
\ No newline at end of file diff --git a/desktop-widgets/preferences/abstractpreferenceswidget.cpp b/desktop-widgets/preferences/abstractpreferenceswidget.cpp new file mode 100644 index 000000000..9334c74ed --- /dev/null +++ b/desktop-widgets/preferences/abstractpreferenceswidget.cpp @@ -0,0 +1,21 @@ +#include "abstractpreferenceswidget.h" + +AbstractPreferencesWidget::AbstractPreferencesWidget(const QString& name, const QIcon& icon, float positionHeight) +: QWidget(), _name(name), _icon(icon), _positionHeight(positionHeight) +{ +} + +QIcon AbstractPreferencesWidget::icon() const +{ + return _icon; +} + +QString AbstractPreferencesWidget::name() const +{ + return _name; +} + +float AbstractPreferencesWidget::positionHeight() const +{ + return _positionHeight; +} diff --git a/desktop-widgets/preferences/abstractpreferenceswidget.h b/desktop-widgets/preferences/abstractpreferenceswidget.h new file mode 100644 index 000000000..2f607c4c9 --- /dev/null +++ b/desktop-widgets/preferences/abstractpreferenceswidget.h @@ -0,0 +1,27 @@ +#ifndef ABSTRACTPREFERENCESWIDGET_H +#define ABSTRACTPREFERENCESWIDGET_H + +#include <QIcon> +#include <QWidget> + +class AbstractPreferencesWidget : public QWidget { + Q_OBJECT +public: + AbstractPreferencesWidget(const QString& name, const QIcon& icon, float positionHeight); + QIcon icon() const; + QString name() const; + float positionHeight() const; + + /* gets the values from the preferences and should set the correct values in + * the interface */ + virtual void refreshSettings() = 0; + + /* gets the values from the interface and set in the preferences object. */ + virtual void syncSettings() = 0; + +private: + QIcon _icon; + QString _name; + float _positionHeight; +}; +#endif
\ No newline at end of file |