From: Max Lapan Date: Sun, 7 Mar 2010 18:00:55 +0000 (+0300) Subject: Application settings class with reasonable defaults. X-Git-Tag: v0.1~68 X-Git-Url: http://vcs.maemo.org/git/?p=yandex-traffic;a=commitdiff_plain;h=2b4db483cbe235a540fe8807ec88b85d73804887 Application settings class with reasonable defaults. Class is mostly a stub so far. --- diff --git a/settings.cpp b/settings.cpp new file mode 100644 index 0000000..f3fdcb4 --- /dev/null +++ b/settings.cpp @@ -0,0 +1,28 @@ +#include +#include + + +Settings::Settings () +{ + if (!load ()) + makeDefault (); +} + + +bool Settings::load () +{ + return false; +} + + +bool Settings::save () +{ + return false; +} + + +void Settings::makeDefault () +{ + _regions.clear (); + _regions.append ("1"); // Moscow +} diff --git a/settings.hpp b/settings.hpp new file mode 100644 index 0000000..2cfa2f6 --- /dev/null +++ b/settings.hpp @@ -0,0 +1,24 @@ +#ifndef __SETTINGS_H__ +#define __SETTINGS_H__ + + + +class Settings +{ +private: + QStringList _regions; // List of regions IDs to display + + void makeDefault (); + +public: + Settings (); + + bool load (); + bool save (); + + QStringList regions () const + { return _regions; }; +}; + + +#endif // __SETTINGS_H__ diff --git a/yandex-traffic-core.pri b/yandex-traffic-core.pri index d7d6021..0ff6630 100644 --- a/yandex-traffic-core.pri +++ b/yandex-traffic-core.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/regions.hpp -SOURCES += $$PWD/regions.cpp +HEADERS += $$PWD/regions.hpp $$PWD/settings.hpp +SOURCES += $$PWD/regions.cpp $$PWD/settings.cpp INCLUDEPATH += $$PWD \ No newline at end of file