mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T28, allow to set updater to really show if it is "on"
This commit is contained in:
committed by
Mathew Sutcliffe
parent
e7e984227b
commit
0fd3857b87
@@ -11,6 +11,7 @@
|
||||
#include "ui_datasettingscomponent.h"
|
||||
|
||||
using namespace BlackGui;
|
||||
using namespace BlackCore::Db;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -27,5 +28,9 @@ namespace BlackGui
|
||||
CDataSettingsComponent::~CDataSettingsComponent()
|
||||
{ }
|
||||
|
||||
void CDataSettingsComponent::setBackgroundUpdater(CBackgroundDataUpdater *updater)
|
||||
{
|
||||
ui->comp_ModelSettings->setBackgroundUpdater(updater);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -14,14 +14,13 @@
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Ui { class CDataSettingsComponent; }
|
||||
|
||||
namespace BlackCore { namespace Db { class CBackgroundDataUpdater; }}
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
@@ -38,7 +37,10 @@ namespace BlackGui
|
||||
explicit CDataSettingsComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CDataSettingsComponent();
|
||||
virtual ~CDataSettingsComponent();
|
||||
|
||||
//! Background updater
|
||||
void setBackgroundUpdater(BlackCore::Db::CBackgroundDataUpdater *updater);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDataSettingsComponent> ui;
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
#include "settingsmodelcomponent.h"
|
||||
#include "ui_settingsmodelcomponent.h"
|
||||
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackcore/db/backgrounddataupdater.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include <QValidator>
|
||||
|
||||
@@ -45,6 +46,11 @@ namespace BlackGui
|
||||
return ok ? secs : -1;
|
||||
}
|
||||
|
||||
void CSettingsModelComponent::setBackgroundUpdater(BlackCore::Db::CBackgroundDataUpdater *updater)
|
||||
{
|
||||
m_updater = updater;
|
||||
}
|
||||
|
||||
void CSettingsModelComponent::consolidationEntered()
|
||||
{
|
||||
int v = this->getBackgroundUpdaterIntervallSecs();
|
||||
@@ -61,7 +67,12 @@ namespace BlackGui
|
||||
const bool on = v > 0;
|
||||
const QString s = on ? QString::number(v) : "";
|
||||
ui->le_ConsolidateSecs->setText(s);
|
||||
ui->comp_Led->setOn(on);
|
||||
|
||||
const bool updater =
|
||||
on &&
|
||||
sApp && !sApp->isShuttingDown() &&
|
||||
this->m_updater && this->m_updater->isEnabled();
|
||||
ui->comp_Led->setOn(updater);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CSettingsModelComponent; }
|
||||
namespace BlackCore { namespace Db { class CBackgroundDataUpdater; }}
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
@@ -37,9 +38,13 @@ namespace BlackGui
|
||||
//! Interval, -1 for disabled
|
||||
int getBackgroundUpdaterIntervallSecs() const;
|
||||
|
||||
//! Updater (the updater this setting is for)
|
||||
void setBackgroundUpdater(BlackCore::Db::CBackgroundDataUpdater *updater);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CSettingsModelComponent> ui;
|
||||
BlackMisc::CSetting<BlackGui::Settings::TBackgroundConsolidation> m_consolidationSetting { this, &CSettingsModelComponent::cacheChanged }; //!< consolidation time
|
||||
BlackCore::Db::CBackgroundDataUpdater *m_updater = nullptr;
|
||||
|
||||
//! Consolidation time entered
|
||||
void consolidationEntered();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "blackgui/components/datamaininfoareacomponent.h"
|
||||
#include "blackgui/components/dbmappingcomponent.h"
|
||||
#include "blackgui/components/logcomponent.h"
|
||||
#include "blackgui/components/datasettingscomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
@@ -160,6 +161,7 @@ void CSwiftData::consolidationSettingChanged()
|
||||
{
|
||||
if (m_updater)
|
||||
{
|
||||
ui->comp_MainInfoArea->getDataSettingsComponent()->setBackgroundUpdater(nullptr);
|
||||
m_updater->gracefulShutdown();
|
||||
m_updater.reset(nullptr);
|
||||
}
|
||||
@@ -170,6 +172,7 @@ void CSwiftData::consolidationSettingChanged()
|
||||
{
|
||||
m_updater.reset(new CBackgroundDataUpdater(this));
|
||||
m_updater->start(QThread::LowestPriority);
|
||||
ui->comp_MainInfoArea->getDataSettingsComponent()->setBackgroundUpdater(m_updater.data());
|
||||
}
|
||||
m_updater->startUpdating(consolidationSecs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user