1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#pragma once
#include <sigc++/trackable.h>
#include <wx/timer.h>
#include <wx/sharedptr.h>
namespace map
{
/**
* Timer object which repeatedly triggers the automatic map save algorithms
* in the configured intervals.
*/
class AutoSaveTimer final :
public wxEvtHandler,
public sigc::trackable
{
private:
// TRUE, if autosaving is enabled
bool _enabled;
// The autosave interval stored in seconds
unsigned long _interval;
// The timer object that triggers the callback
wxSharedPtr<wxTimer> _timer;
public:
AutoSaveTimer();
~AutoSaveTimer();
void initialise();
// Starts/stops the autosave "countdown"
void startTimer();
void stopTimer();
private:
void registryKeyChanged();
void onIntervalReached(wxTimerEvent& ev);
};
}
|