fix: handle aboutToQuit() (#6159)
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
- Dev: Conan will no longer generate a `CMakeUserPresets.json` file. (#6117)
|
- Dev: Conan will no longer generate a `CMakeUserPresets.json` file. (#6117)
|
||||||
- Dev: Pass `--force-openssl` when installing from CMake in Qt 6.8+. (#6129)
|
- Dev: Pass `--force-openssl` when installing from CMake in Qt 6.8+. (#6129)
|
||||||
- Dev: Fixed `<build-tool> clean` not working correctly with generated sources. (#6154)
|
- Dev: Fixed `<build-tool> clean` not working correctly with generated sources. (#6154)
|
||||||
|
- Dev: Save settings in `aboutToQuit`. (#6159)
|
||||||
|
|
||||||
## 2.5.3
|
## 2.5.3
|
||||||
|
|
||||||
|
|||||||
+11
-3
@@ -280,12 +280,20 @@ void runGui(QApplication &a, const Paths &paths, Settings &settings,
|
|||||||
chatterino::NetworkManager::init();
|
chatterino::NetworkManager::init();
|
||||||
updates.checkForUpdates();
|
updates.checkForUpdates();
|
||||||
|
|
||||||
|
QObject::connect(qApp, &QApplication::aboutToQuit, [] {
|
||||||
|
auto *app = dynamic_cast<Application *>(tryGetApp());
|
||||||
|
if (app)
|
||||||
|
{
|
||||||
|
app->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
getSettings()->requestSave();
|
||||||
|
getSettings()->disableSave();
|
||||||
|
});
|
||||||
|
|
||||||
Application app(settings, paths, args, updates);
|
Application app(settings, paths, args, updates);
|
||||||
app.initialize(settings, paths);
|
app.initialize(settings, paths);
|
||||||
app.run();
|
app.run();
|
||||||
app.save();
|
|
||||||
|
|
||||||
settings.requestSave();
|
|
||||||
|
|
||||||
chatterino::NetworkManager::deinit();
|
chatterino::NetworkManager::deinit();
|
||||||
|
|
||||||
|
|||||||
@@ -278,6 +278,11 @@ void Settings::restoreSnapshot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::disableSave()
|
||||||
|
{
|
||||||
|
this->disableSaving = true;
|
||||||
|
}
|
||||||
|
|
||||||
float Settings::getClampedUiScale() const
|
float Settings::getClampedUiScale() const
|
||||||
{
|
{
|
||||||
return std::clamp(this->uiScale.getValue(), 0.2F, 10.F);
|
return std::clamp(this->uiScale.getValue(), 0.2F, 10.F);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class Settings
|
|||||||
static Settings *instance_;
|
static Settings *instance_;
|
||||||
Settings *prevInstance_ = nullptr;
|
Settings *prevInstance_ = nullptr;
|
||||||
|
|
||||||
const bool disableSaving;
|
bool disableSaving;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Settings(const Args &args, const QString &settingsDirectory);
|
Settings(const Args &args, const QString &settingsDirectory);
|
||||||
@@ -120,6 +120,8 @@ public:
|
|||||||
void saveSnapshot();
|
void saveSnapshot();
|
||||||
void restoreSnapshot();
|
void restoreSnapshot();
|
||||||
|
|
||||||
|
void disableSave();
|
||||||
|
|
||||||
FloatSetting uiScale = {"/appearance/uiScale2", 1};
|
FloatSetting uiScale = {"/appearance/uiScale2", 1};
|
||||||
BoolSetting windowTopMost = {"/appearance/windowAlwaysOnTop", false};
|
BoolSetting windowTopMost = {"/appearance/windowAlwaysOnTop", false};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user