mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Always make sure that settings are saved.
This commit is contained in:
parent
baccec623d
commit
70570e0987
2 changed files with 9 additions and 3 deletions
|
@ -152,6 +152,10 @@ Application::Application(not_null<Launcher*> launcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
if (_saveSettingsTimer && _saveSettingsTimer->isActive()) {
|
||||||
|
Local::writeSettings();
|
||||||
|
}
|
||||||
|
|
||||||
// Depend on activeWindow() for now :(
|
// Depend on activeWindow() for now :(
|
||||||
Shortcuts::Finish();
|
Shortcuts::Finish();
|
||||||
|
|
||||||
|
@ -465,7 +469,9 @@ bool Application::eventFilter(QObject *object, QEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSettingsDelayed(crl::time delay) {
|
void Application::saveSettingsDelayed(crl::time delay) {
|
||||||
_saveSettingsTimer.callOnce(delay);
|
if (_saveSettingsTimer) {
|
||||||
|
_saveSettingsTimer->callOnce(delay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSettings() {
|
void Application::saveSettings() {
|
||||||
|
@ -533,7 +539,7 @@ void Application::badMtprotoConfigurationError() {
|
||||||
|
|
||||||
void Application::startLocalStorage() {
|
void Application::startLocalStorage() {
|
||||||
Local::start();
|
Local::start();
|
||||||
_saveSettingsTimer.setCallback([=] { saveSettings(); });
|
_saveSettingsTimer.emplace([=] { saveSettings(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::startEmojiImageLoader() {
|
void Application::startEmojiImageLoader() {
|
||||||
|
|
|
@ -368,7 +368,7 @@ private:
|
||||||
crl::time _shouldLockAt = 0;
|
crl::time _shouldLockAt = 0;
|
||||||
base::Timer _autoLockTimer;
|
base::Timer _autoLockTimer;
|
||||||
|
|
||||||
base::Timer _saveSettingsTimer;
|
std::optional<base::Timer> _saveSettingsTimer;
|
||||||
|
|
||||||
struct LeaveSubscription {
|
struct LeaveSubscription {
|
||||||
LeaveSubscription(
|
LeaveSubscription(
|
||||||
|
|
Loading…
Add table
Reference in a new issue