History

Setup Thread and timer for settings

Atlante45 committed 11 years ago

Commit 77bab2a1 parent 2b3f12a2 files · +12 −1Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+9−1
@@ -451,7 +451,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 450 unmodified lines
451451 }
452452
453453 loadSettings();
454−
454+ int SAVE_SETTINGS_INTERVAL = 10 * MSECS_PER_SECOND; // Let's save every seconds for now
455+ connect(&_settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
456+ connect(&_settingsThread, SIGNAL(started), &_settingsTimer, SLOT(start));
457+ connect(&_settingsThread, &QThread::finished, &_settingsTimer, &QTimer::deleteLater);
458+ _settingsTimer.moveToThread(&_settingsThread);
459+ _settingsTimer.setSingleShot(false);
460+ _settingsTimer.setInterval(SAVE_SETTINGS_INTERVAL);
461+ _settingsThread.start();
462+
455463 _trayIcon->show();
456464
457465 // set the local loopback interface for local sounds from audio scripts

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t