diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-08-29 14:57:32 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-08-29 16:32:28 +0200 |
commit | 47c7c4c777d848a96c799374dedf999ca3d320d9 (patch) | |
tree | 7c20928ce8907a6aedef2fb1a6e40a32fdb60dd8 /src/MainWindow.cpp | |
parent | Support animated images (diff) | |
download | nheko-47c7c4c777d848a96c799374dedf999ca3d320d9.tar.xz |
cleanup QSettings usage a bit
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r-- | src/MainWindow.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 396e1ab1..7eadc6df 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -7,7 +7,6 @@ #include <QLayout> #include <QMessageBox> #include <QPluginLoader> -#include <QSettings> #include <QShortcut> #include <mtx/requests.hpp> @@ -188,9 +187,10 @@ MainWindow::event(QEvent *event) void MainWindow::restoreWindowSize() { - QSettings settings; - int savedWidth = settings.value("window/width").toInt(); - int savedheight = settings.value("window/height").toInt(); + int savedWidth = userSettings_->qsettings()->value("window/width").toInt(); + int savedheight = userSettings_->qsettings()->value("window/height").toInt(); + + nhlog::ui()->info("Restoring window size {}x{}", savedWidth, savedheight); if (savedWidth == 0 || savedheight == 0) resize(conf::window::width, conf::window::height); @@ -201,11 +201,11 @@ MainWindow::restoreWindowSize() void MainWindow::saveCurrentWindowSize() { - QSettings settings; + auto settings = userSettings_->qsettings(); QSize current = size(); - settings.setValue("window/width", current.width()); - settings.setValue("window/height", current.height()); + settings->setValue("window/width", current.width()); + settings->setValue("window/height", current.height()); } void @@ -301,14 +301,14 @@ MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) bool MainWindow::hasActiveUser() { - QSettings settings; + auto settings = userSettings_->qsettings(); QString prefix; if (userSettings_->profile() != "") prefix = "profile/" + userSettings_->profile() + "/"; - return settings.contains(prefix + "auth/access_token") && - settings.contains(prefix + "auth/home_server") && - settings.contains(prefix + "auth/user_id"); + return settings->contains(prefix + "auth/access_token") && + settings->contains(prefix + "auth/home_server") && + settings->contains(prefix + "auth/user_id"); } void |