Setup Thread and timer for settings

This commit is contained in:
Atlante45 2015-01-20 17:11:46 -08:00
parent 2b3f12a7c4
commit 77bab2a8c2
2 changed files with 12 additions and 1 deletions

View file

@ -451,7 +451,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
}
loadSettings();
int SAVE_SETTINGS_INTERVAL = 10 * MSECS_PER_SECOND; // Let's save every seconds for now
connect(&_settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
connect(&_settingsThread, SIGNAL(started), &_settingsTimer, SLOT(start));
connect(&_settingsThread, &QThread::finished, &_settingsTimer, &QTimer::deleteLater);
_settingsTimer.moveToThread(&_settingsThread);
_settingsTimer.setSingleShot(false);
_settingsTimer.setInterval(SAVE_SETTINGS_INTERVAL);
_settingsThread.start();
_trayIcon->show();
// set the local loopback interface for local sounds from audio scripts

View file

@ -586,6 +586,9 @@ private:
bool _aboutToQuit;
Bookmarks* _bookmarks;
QThread _settingsThread;
QTimer _settingsTimer;
};
#endif // hifi_Application_h