cabana: use applicationPath for settings (#29875)
old-commit-hash: 5e1b5b36e48f3b7c776b843993071e24a9d1466e
This commit is contained in:
@@ -18,6 +18,8 @@ int main(int argc, char *argv[]) {
|
||||
app.setWindowIcon(QIcon(":cabana-icon.png"));
|
||||
|
||||
UnixSignalHandler signalHandler;
|
||||
|
||||
settings.load();
|
||||
utils::setTheme(settings.theme);
|
||||
|
||||
QCommandLineParser cmd_parser;
|
||||
|
||||
@@ -13,12 +13,8 @@
|
||||
|
||||
Settings settings;
|
||||
|
||||
Settings::Settings() {
|
||||
load();
|
||||
}
|
||||
|
||||
void Settings::save() {
|
||||
QSettings s("settings", QSettings::IniFormat);
|
||||
QSettings s(filePath(), QSettings::IniFormat);
|
||||
s.setValue("fps", fps);
|
||||
s.setValue("max_cached_minutes", max_cached_minutes);
|
||||
s.setValue("chart_height", chart_height);
|
||||
@@ -42,7 +38,7 @@ void Settings::save() {
|
||||
}
|
||||
|
||||
void Settings::load() {
|
||||
QSettings s("settings", QSettings::IniFormat);
|
||||
QSettings s(filePath(), QSettings::IniFormat);
|
||||
fps = s.value("fps", 10).toInt();
|
||||
max_cached_minutes = s.value("max_cached_minutes", 30).toInt();
|
||||
chart_height = s.value("chart_height", 200).toInt();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QByteArray>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
@@ -22,9 +23,10 @@ public:
|
||||
AlwaysBE,
|
||||
};
|
||||
|
||||
Settings();
|
||||
Settings() {}
|
||||
void save();
|
||||
void load();
|
||||
inline static QString filePath() { return QApplication::applicationDirPath() + "/settings"; }
|
||||
|
||||
int fps = 10;
|
||||
int max_cached_minutes = 30;
|
||||
|
||||
Reference in New Issue
Block a user