6 #include "ui_settingsvatsimreaderscomponent.h"
9 using namespace swift::misc::physical_quantities;
11 using namespace swift::core::vatsim;
15 CSettingsVatsimReadersComponent::CSettingsVatsimReadersComponent(QWidget *parent)
19 connect(ui->pb_Save, &QPushButton::clicked,
this, &CSettingsVatsimReadersComponent::save);
20 connect(ui->pb_Reload, &QPushButton::clicked,
this, &CSettingsVatsimReadersComponent::reload);
26 void CSettingsVatsimReadersComponent::onSettingsChanged() { this->initValues(); }
28 void CSettingsVatsimReadersComponent::save()
30 const int metarSec = m_settingsMetars.
get().getPeriodicTime().toMs() / 1000;
31 const int dataFileSec = m_settingsDataFile.
get().getPeriodicTime().toMs() / 1000;
33 const int newMetarSec = ui->sb_Metar->value();
34 if (newMetarSec != metarSec)
37 CReaderSettings::IndexPeriodicTime,
38 CVariant::fromValue(
CTime {
static_cast<double>(newMetarSec), CTimeUnit::s() }));
40 const int newDataFileSec = ui->sb_DataFile->value();
41 if (newDataFileSec != dataFileSec)
44 CReaderSettings::IndexPeriodicTime,
45 CVariant::fromValue(
CTime {
static_cast<double>(newDataFileSec), CTimeUnit::s() }));
49 void CSettingsVatsimReadersComponent::reload() { this->initValues(); }
51 void CSettingsVatsimReadersComponent::initValues()
53 const int metarSec = m_settingsMetars.
get().getPeriodicTime().toMs() / 1000;
54 const int dataFileSec = m_settingsDataFile.
get().getPeriodicTime().toMs() / 1000;
56 ui->sb_Metar->setValue(metarSec);
57 ui->sb_DataFile->setValue(dataFileSec);
virtual ~CSettingsVatsimReadersComponent()
Destructor.
T get() const
Get a copy of the current value.
CStatusMessage setAndSaveProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp=0)
Write a property and save in the same step. Must be called from the thread in which the owner lives.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Free functions in swift::misc.