|
@@ -16,13 +16,12 @@
|
|
*along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
*/
|
|
#include "asettings.h"
|
|
#include "asettings.h"
|
|
-#include "src/astandardpaths.h"
|
|
|
|
|
|
+#include "astandardpaths.h"
|
|
#include <QSettings>
|
|
#include <QSettings>
|
|
|
|
|
|
|
|
|
|
QMap<ASettings::Main, QString> ASettings::mainMap = {
|
|
QMap<ASettings::Main, QString> ASettings::mainMap = {
|
|
{Main::Theme, QStringLiteral("theme")},
|
|
{Main::Theme, QStringLiteral("theme")},
|
|
- {Main::ThemeID, QStringLiteral("theme_id")}, // inconsistent naming
|
|
|
|
};
|
|
};
|
|
|
|
|
|
QMap<ASettings::LogBook, QString> ASettings::logBookMap = {
|
|
QMap<ASettings::LogBook, QString> ASettings::logBookMap = {
|
|
@@ -77,60 +76,60 @@ void ASettings::setup()
|
|
//
|
|
//
|
|
|
|
|
|
QVariant ASettings::read(const FlightLogging key)
|
|
QVariant ASettings::read(const FlightLogging key)
|
|
-{ return QSettings().value(pathOfKey(key)); }
|
|
|
|
|
|
+{ return QSettings().value(groupOfKey(key)); }
|
|
|
|
|
|
void ASettings::write(const FlightLogging key, const QVariant &val)
|
|
void ASettings::write(const FlightLogging key, const QVariant &val)
|
|
-{ QSettings().setValue(pathOfKey(key), val); }
|
|
|
|
|
|
+{ QSettings().setValue(groupOfKey(key), val); }
|
|
|
|
|
|
QVariant ASettings::read(const LogBook key)
|
|
QVariant ASettings::read(const LogBook key)
|
|
-{ return QSettings().value(pathOfKey(key)); }
|
|
|
|
|
|
+{ return QSettings().value(groupOfKey(key)); }
|
|
|
|
|
|
void ASettings::write(const LogBook key, const QVariant &val)
|
|
void ASettings::write(const LogBook key, const QVariant &val)
|
|
-{ QSettings().setValue(pathOfKey(key), val); }
|
|
|
|
|
|
+{ QSettings().setValue(groupOfKey(key), val); }
|
|
|
|
|
|
QVariant ASettings::read(const Main key)
|
|
QVariant ASettings::read(const Main key)
|
|
-{ return QSettings().value(pathOfKey(key)); }
|
|
|
|
|
|
+{ return QSettings().value(groupOfKey(key)); }
|
|
|
|
|
|
void ASettings::write(const Main key, const QVariant &val)
|
|
void ASettings::write(const Main key, const QVariant &val)
|
|
-{ QSettings().setValue(pathOfKey(key), val); }
|
|
|
|
|
|
+{ QSettings().setValue(groupOfKey(key), val); }
|
|
|
|
|
|
QVariant ASettings::read(const Setup key)
|
|
QVariant ASettings::read(const Setup key)
|
|
-{ return QSettings().value(pathOfKey(key)); }
|
|
|
|
|
|
+{ return QSettings().value(groupOfKey(key)); }
|
|
|
|
|
|
void ASettings::write(const Setup key, const QVariant &val)
|
|
void ASettings::write(const Setup key, const QVariant &val)
|
|
-{ QSettings().setValue(pathOfKey(key), val); }
|
|
|
|
|
|
+{ QSettings().setValue(groupOfKey(key), val); }
|
|
|
|
|
|
QVariant ASettings::read(const NewFlight key)
|
|
QVariant ASettings::read(const NewFlight key)
|
|
-{ return QSettings().value(pathOfKey(key)); }
|
|
|
|
|
|
+{ return QSettings().value(groupOfKey(key)); }
|
|
|
|
|
|
void ASettings::write(const NewFlight key, const QVariant &val)
|
|
void ASettings::write(const NewFlight key, const QVariant &val)
|
|
-{ QSettings().setValue(pathOfKey(key), val); }
|
|
|
|
|
|
+{ QSettings().setValue(groupOfKey(key), val); }
|
|
|
|
|
|
QVariant ASettings::read(const UserData key)
|
|
QVariant ASettings::read(const UserData key)
|
|
-{ return QSettings().value(pathOfKey(key)); }
|
|
|
|
|
|
+{ return QSettings().value(groupOfKey(key)); }
|
|
|
|
|
|
void ASettings::write(const UserData key, const QVariant &val)
|
|
void ASettings::write(const UserData key, const QVariant &val)
|
|
-{ QSettings().setValue(pathOfKey(key), val); }
|
|
|
|
|
|
+{ QSettings().setValue(groupOfKey(key), val); }
|
|
|
|
|
|
//
|
|
//
|
|
// QString conversion PATH
|
|
// QString conversion PATH
|
|
//
|
|
//
|
|
-QString ASettings::pathOfKey (const ASettings::FlightLogging key)
|
|
|
|
|
|
+QString ASettings::groupOfKey (const ASettings::FlightLogging key)
|
|
{ return QStringLiteral("flightlogging/") + flightLoggingMap[key]; }
|
|
{ return QStringLiteral("flightlogging/") + flightLoggingMap[key]; }
|
|
|
|
|
|
-QString ASettings::pathOfKey (const ASettings::LogBook key)
|
|
|
|
|
|
+QString ASettings::groupOfKey (const ASettings::LogBook key)
|
|
{ return QStringLiteral("logbook/") + logBookMap[key]; }
|
|
{ return QStringLiteral("logbook/") + logBookMap[key]; }
|
|
|
|
|
|
-QString ASettings::pathOfKey (const ASettings::Main key)
|
|
|
|
|
|
+QString ASettings::groupOfKey (const ASettings::Main key)
|
|
{ return QStringLiteral("main/") + mainMap[key]; }
|
|
{ return QStringLiteral("main/") + mainMap[key]; }
|
|
|
|
|
|
-QString ASettings::pathOfKey (const ASettings::NewFlight key)
|
|
|
|
|
|
+QString ASettings::groupOfKey (const ASettings::NewFlight key)
|
|
{ return QStringLiteral("NewFlight/") + newFlightMap[key]; }
|
|
{ return QStringLiteral("NewFlight/") + newFlightMap[key]; }
|
|
|
|
|
|
-QString ASettings::pathOfKey (const ASettings::Setup key)
|
|
|
|
|
|
+QString ASettings::groupOfKey (const ASettings::Setup key)
|
|
{ return QStringLiteral("setup/") + setupMap[key]; }
|
|
{ return QStringLiteral("setup/") + setupMap[key]; }
|
|
|
|
|
|
-QString ASettings::pathOfKey (const ASettings::UserData key)
|
|
|
|
|
|
+QString ASettings::groupOfKey (const ASettings::UserData key)
|
|
{ return QStringLiteral("userdata/") + userDataMap[key]; }
|
|
{ return QStringLiteral("userdata/") + userDataMap[key]; }
|
|
|
|
|
|
//
|
|
//
|