Selaa lähdekoodia

Refactored use of QSettings

George 4 vuotta sitten
vanhempi
commit
c5bc3b6546
3 muutettua tiedostoa jossa 13 lisäystä ja 10 poistoa
  1. 3 3
      main.cpp
  2. 1 3
      src/classes/asettings.cpp
  3. 9 4
      src/classes/asettings.h

+ 3 - 3
main.cpp

@@ -29,9 +29,9 @@
 #include <QStandardPaths>
 #include <QDebug>
 
-#define APPNAME "openPilotLog"
-#define ORGNAME APPNAME
-#define ORGDOMAIN "https://github.com/fiffty-50/openpilotlog"
+#define APPNAME QStringLiteral("openPilotLog")
+#define ORGNAME QStringLiteral("opl")
+#define ORGDOMAIN QStringLiteral("https://github.com/fiffty-50/openpilotlog")
 
 int main(int argc, char *argv[])
 {

+ 1 - 3
src/classes/asettings.cpp

@@ -22,9 +22,7 @@
 void ASettings::setup()
 {
     QSettings::setDefaultFormat(QSettings::IniFormat);
-    QSettings::setPath(QSettings::IniFormat,
-                       QSettings::UserScope,
-                       AStandardPaths::getPaths()[QStandardPaths::AppConfigLocation]);
+    QSettings();
 }
 
 QVariant ASettings::read(const QString &key)

+ 9 - 4
src/classes/asettings.h

@@ -26,13 +26,18 @@
  */
 namespace ASettings
 {
-    void setup();
 
-    QVariant read(const QString &key);
+/*!
+ * \brief Should be called after QCoreApplication::set...Name have been called.
+ */
+void setup();
+
+QVariant read(const QString &key);
+
+void write(const QString &key, const QVariant &val);
 
-    void write(const QString &key, const QVariant &val);
+QSettings settings();
 
-    QSettings settings();
 }
 
 #endif // ASETTINGS_H