8 #include "ui_settingsmodelcomponent.h"
15 using namespace swift::misc::simulation::settings;
16 using namespace swift::gui::settings;
21 CSettingsModelComponent::CSettingsModelComponent(QWidget *parent)
25 ui->le_ConsolidateSecs->setValidator(
26 new QIntValidator(0, TBackgroundConsolidation::maxSecs(), ui->le_ConsolidateSecs));
29 const QString lbl(
"Consolidate (%1-%2s):");
30 ui->lbl_Consolidate->setText(
31 lbl.arg(TBackgroundConsolidation::minSecs()).arg(TBackgroundConsolidation::maxSecs()));
33 connect(ui->le_ConsolidateSecs, &QLineEdit::returnPressed,
this,
34 &CSettingsModelComponent::consolidationEntered);
35 connect(ui->cb_AllowExcludeModels, &QCheckBox::toggled,
this,
36 &CSettingsModelComponent::allowExcludedModelsChanged);
39 QPointer<CSettingsModelComponent> myself(
this);
41 if (!myself) {
return; }
42 this->consolidationEntered();
50 const QString v = ui->le_ConsolidateSecs->text().trimmed();
51 if (v.isEmpty()) {
return -1; }
53 const int secs = v.toInt(&ok);
54 return ok ? secs : -1;
59 void CSettingsModelComponent::consolidationEntered()
62 if (v < TBackgroundConsolidation::minSecs()) { v = -1; }
65 CLogMessage::preformatted(m);
69 void CSettingsModelComponent::allowExcludedModelsChanged(
bool allow)
75 CLogMessage::preformatted(msg);
78 void CSettingsModelComponent::cacheChanged()
80 const int v = m_consolidationSetting.get();
81 const bool on = v > 0;
82 const QString s = on ? QString::number(v) :
"";
83 ui->le_ConsolidateSecs->setText(s);
86 ui->comp_Led->setOn(updater);
SWIFT_CORE_EXPORT swift::core::CApplication * sApp
Single instance of application object.
bool isShuttingDown() const
Is application shutting down?
Update and consolidation of DB data.
Settings UI for model matching/mapping.
virtual ~CSettingsModelComponent()
Destructor.
void setBackgroundUpdater(const swift::core::db::CBackgroundDataUpdater *updater)
Updater (the updater this setting is for)
int getBackgroundUpdaterIntervallSecs() const
Interval, -1 for disabled.
CStatusMessage setAndSave(const T &value, qint64 timestamp=0)
Write and save in the same step. Must be called from the thread in which the owner lives.
T get() const
Get a copy of the current value.
bool isEnabled() const
Enabled (running)?
Streamable status message, e.g.
void setAllowExcludedModels(bool allow)
Allow excluded models?
bool getAllowExcludedModels() const
Allow excluded models?
Classes interacting with the swift database (aka "datastore").
High level reusable GUI components.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...