This calls either start() or stop() depending on the boolean argument.
@@ -58,6 +58,14 @@ void Timer::stop()
m_active = false;
}
+void Timer::set_active(bool active)
+{
+ if (active)
+ start();
+ else
+ stop();
+}
+
void Timer::timer_event(TimerEvent&)
{
if (m_single_shot)
@@ -37,6 +37,8 @@ public:
void restart(int interval_ms);
void stop();
+ void set_active(bool);
bool is_active() const { return m_active; }
int interval() const { return m_interval_ms; }
void set_interval(int interval_ms)