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()));
34 &CSettingsModelComponent::consolidationEntered);
36 &CSettingsModelComponent::allowExcludedModelsChanged);
41 if (!myself) {
return; }
42 this->consolidationEntered();
50 const QString v = ui->le_ConsolidateSecs->text().trimmed();
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;
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.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QString arg(Args &&... args) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
int toInt(bool *ok, int base) const const