Files
z-bar-qt/Plugins/ZShell/Services/tickingservice.cpp
T
zach 2a50732bc2
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 10s
Python / lint-format (pull_request) Successful in 23s
Python / test (pull_request) Successful in 31s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m12s
resources popout refresh + new components & reskinned old components
2026-06-14 23:09:10 +02:00

43 lines
759 B
C++

#include "tickingservice.hpp"
namespace ZShell::services {
TickingService::TickingService(QObject* parent)
: Service(parent)
, m_timer(new QTimer(this)) {
m_timer->setSingleShot(false);
QObject::connect(m_timer, &QTimer::timeout, this, [this] {
tick();
});
}
int TickingService::updateInterval() const {
return m_interval;
}
void TickingService::start() {
m_running = true;
if (m_interval > 0) {
m_timer->start(m_interval);
}
tick();
}
void TickingService::stop() {
m_running = false;
m_timer->stop();
}
void TickingService::applyInterval(int ms) {
if (ms <= 0 || ms == m_interval) {
return;
}
m_interval = ms;
if (m_running) {
m_timer->start(m_interval);
}
Q_EMIT updateIntervalChanged();
}
} // namespace ZShell::services