mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
Ref T105, use timer in base class CContinuousWorker
* remove unused cleanup * object name set in base class
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4a7ad09e46
commit
0bfd9a55a2
@@ -37,38 +37,7 @@ namespace BlackCore
|
||||
CContinuousWorker(owner, "Background data updater")
|
||||
{
|
||||
connect(&m_updateTimer, &QTimer::timeout, this, &CBackgroundDataUpdater::doWork);
|
||||
m_updateTimer.setObjectName(getName());
|
||||
}
|
||||
|
||||
void CBackgroundDataUpdater::initialize()
|
||||
{
|
||||
m_updateTimer.start(60 * 1000);
|
||||
}
|
||||
|
||||
void CBackgroundDataUpdater::cleanup()
|
||||
{
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
|
||||
void CBackgroundDataUpdater::startUpdating(int updateTimeSecs)
|
||||
{
|
||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||
{
|
||||
// shift in correct thread
|
||||
QTimer::singleShot(0, this, [this, updateTimeSecs] { this->startUpdating(updateTimeSecs); });
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateTimeSecs < 0)
|
||||
{
|
||||
setEnabled(false);
|
||||
QTimer::singleShot(0, &m_updateTimer, &QTimer::stop);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEnabled(true);
|
||||
m_updateTimer.start(1000 * updateTimeSecs);
|
||||
}
|
||||
m_updateTimer.setInterval(60 * 1000);
|
||||
}
|
||||
|
||||
void CBackgroundDataUpdater::doWork()
|
||||
|
||||
Reference in New Issue
Block a user