From 7ea3b0a82cc84e0e6b03441a823cd4977ae6b0a9 Mon Sep 17 00:00:00 2001 From: Ckat Date: Sat, 6 Oct 2018 21:06:15 +0200 Subject: [PATCH] periodically save tab/window layout --- src/singletons/WindowManager.cpp | 7 +++++++ src/singletons/WindowManager.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index 853baa8e8..3989a8eca 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -352,11 +352,18 @@ void WindowManager::initialize(Settings &settings, Paths &paths) settings.collpseMessagesMinLines.connect( [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; } void WindowManager::save() { + log("[WindowManager] Saving"); + assertInGuiThread(); auto app = getApp(); diff --git a/src/singletons/WindowManager.hpp b/src/singletons/WindowManager.hpp index 74149876e..9f3fb9361 100644 --- a/src/singletons/WindowManager.hpp +++ b/src/singletons/WindowManager.hpp @@ -75,6 +75,8 @@ private: MessageElementFlags wordFlags_{}; pajlada::Settings::SettingListener wordFlagsListener_; + + QTimer saveTimer_; }; } // namespace chatterino