Qt: Delay settings save by one second

This commit is contained in:
Connor McLaughlin
2020-07-21 19:58:50 +10:00
parent 68d98af497
commit 2fb00faa67
2 changed files with 39 additions and 2 deletions

View File

@@ -145,6 +145,7 @@ private Q_SLOTS:
void doStopThread();
void onHostDisplayWindowResized(int width, int height);
void doBackgroundControllerPoll();
void doSaveSettings();
protected:
bool AcquireHostDisplay() override;
@@ -171,7 +172,9 @@ private:
enum : u32
{
BACKGROUND_CONTROLLER_POLLING_INTERVAL =
100 /// Interval at which the controllers are polled when the system is not active.
100, /// Interval at which the controllers are polled when the system is not active.
SETTINGS_SAVE_DELAY = 1000
};
using InputButtonHandler = std::function<void(bool)>;
@@ -211,6 +214,7 @@ private:
void renderDisplay();
void connectDisplaySignals(QtDisplayWidget* widget);
void updateDisplayState();
void queueSettingsSave();
void wakeThread();
std::unique_ptr<INISettingsInterface> m_settings_interface;
@@ -224,6 +228,7 @@ private:
std::atomic_bool m_shutdown_flag{false};
QTimer* m_background_controller_polling_timer = nullptr;
std::unique_ptr<QTimer> m_settings_save_timer;
bool m_is_rendering_to_main = false;
bool m_is_fullscreen = false;