Improve chances to find cover image.
[dorian] / model / settings.cpp
1 #include <QSettings>
2
3 #include "settings.h"
4
5 static Settings *inst;
6
7 Settings::Settings(QObject *parent) :
8     QObject(parent)
9 {
10 }
11
12 Settings *Settings::instance()
13 {
14     if (!inst) {
15         inst = new Settings();
16     }
17     return inst;
18 }
19
20 void Settings::setValue(const QString &key, const QVariant &value)
21 {
22     QSettings s;
23     s.setValue(QString("settings/") + key, value);
24     emit valueChanged(key);
25 }
26
27 QVariant Settings::value(const QString &key, const QVariant &defaultValue) const
28 {
29     QSettings s;
30     return s.value(QString("settings/") + key, defaultValue);
31 }