mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Automatically start background updater
Ref T28
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c790e344ac
commit
e2c43a688b
@@ -89,6 +89,7 @@ namespace BlackCore
|
||||
{
|
||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||
{
|
||||
// shift in correct thread
|
||||
QTimer::singleShot(0, this, [this, updateTimeSecs] { this->startUpdating(updateTimeSecs); });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,11 @@ namespace BlackGui
|
||||
|
||||
this->cacheChanged();
|
||||
connect(ui->le_ConsolidateSecs, &QLineEdit::returnPressed, this, &CSettingsModelComponent::consolidationEntered);
|
||||
static QString lbl("Consolidate (%1-%2s):");
|
||||
const QString lbl("Consolidate (%1-%2s):");
|
||||
ui->lbl_Consolidate->setText(lbl.arg(TBackgroundConsolidation::minSecs()).arg(TBackgroundConsolidation::maxSecs()));
|
||||
|
||||
// start updater if not yet done
|
||||
QTimer::singleShot(2000, this, &CSettingsModelComponent::consolidationEntered);
|
||||
}
|
||||
|
||||
CSettingsModelComponent::~CSettingsModelComponent()
|
||||
@@ -54,7 +57,7 @@ namespace BlackGui
|
||||
void CSettingsModelComponent::consolidationEntered()
|
||||
{
|
||||
int v = this->getBackgroundUpdaterIntervallSecs();
|
||||
if (v < TBackgroundConsolidation::minSecs()) v = -1;
|
||||
if (v < TBackgroundConsolidation::minSecs()) { v = -1; }
|
||||
|
||||
const CStatusMessage m = m_consolidationSetting.setAndSave(v);
|
||||
CLogMessage::preformatted(m);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace BlackGui
|
||||
private:
|
||||
QScopedPointer<Ui::CSettingsModelComponent> ui;
|
||||
BlackMisc::CSetting<BlackGui::Settings::TBackgroundConsolidation> m_consolidationSetting { this, &CSettingsModelComponent::cacheChanged }; //!< consolidation time
|
||||
BlackCore::Db::CBackgroundDataUpdater *m_updater = nullptr;
|
||||
BlackCore::Db::CBackgroundDataUpdater *m_updater = nullptr; //!< externally (i.e. other component) provided existing updater
|
||||
|
||||
//! Consolidation time entered
|
||||
void consolidationEntered();
|
||||
|
||||
@@ -150,7 +150,10 @@ void CSwiftData::initMenu()
|
||||
|
||||
void CSwiftData::performGracefulShutdown()
|
||||
{
|
||||
// void
|
||||
if (this->m_updater)
|
||||
{
|
||||
this->m_updater->gracefulShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftData::consolidationSettingChanged()
|
||||
|
||||
Reference in New Issue
Block a user