periodically save tab/window layout

This commit is contained in:
Ckat 2018-10-06 21:06:15 +02:00
parent ced5508286
commit 7ea3b0a82c
2 changed files with 9 additions and 0 deletions

View file

@ -352,11 +352,18 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
settings.collpseMessagesMinLines.connect( settings.collpseMessagesMinLines.connect(
[this](auto, auto) { this->forceLayoutChannelViews(); }); [this](auto, auto) { this->forceLayoutChannelViews(); });
// timer for periodically saving tabs
QObject::connect(&this->saveTimer_, &QTimer::timeout,
[=] { this->save(); });
this->saveTimer_.start(60 * 1000);
this->initialized_ = true; this->initialized_ = true;
} }
void WindowManager::save() void WindowManager::save()
{ {
log("[WindowManager] Saving");
assertInGuiThread(); assertInGuiThread();
auto app = getApp(); auto app = getApp();

View file

@ -75,6 +75,8 @@ private:
MessageElementFlags wordFlags_{}; MessageElementFlags wordFlags_{};
pajlada::Settings::SettingListener wordFlagsListener_; pajlada::Settings::SettingListener wordFlagsListener_;
QTimer saveTimer_;
}; };
} // namespace chatterino } // namespace chatterino