diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/vehiclefunctions/climate_qml/main.qml | 7 | ||||
-rw-r--r-- | examples/vehiclefunctions/climate_widget/mainwindow.cpp | 27 | ||||
-rw-r--r-- | examples/vehiclefunctions/climate_widget/mainwindow.h | 4 |
3 files changed, 28 insertions, 10 deletions
diff --git a/examples/vehiclefunctions/climate_qml/main.qml b/examples/vehiclefunctions/climate_qml/main.qml index 7776b01..68c11ae 100644 --- a/examples/vehiclefunctions/climate_qml/main.qml +++ b/examples/vehiclefunctions/climate_qml/main.qml @@ -139,10 +139,13 @@ ApplicationWindow { CheckBox { text: "Air Recirculation" - checked: climateControl.airRecirculation.value + checked: climateControl.recirculationMode.value === ClimateControl.RecirculationOn enabled: climateControl.airRecirculation.available onClicked: { - climateControl.airRecirculation.value = checked + if (checked) + climateControl.recirculationMode.value = ClimateControl.RecirculationOn + else + climateControl.recirculationMode.value = ClimateControl.RecirculationOff } } diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.cpp b/examples/vehiclefunctions/climate_widget/mainwindow.cpp index 66ac611..343a83e 100644 --- a/examples/vehiclefunctions/climate_widget/mainwindow.cpp +++ b/examples/vehiclefunctions/climate_widget/mainwindow.cpp @@ -101,14 +101,14 @@ MainWindow::MainWindow(QWidget *parent) : m_climateControl, &QtIVIClimateControl::setAirConditioningEnabled); //Air Recirculation - ui->cb_airRecirculation->setChecked(m_climateControl->isAirRecirculationEnabled()); - ui->cb_airRecirculation->setEnabled(m_climateControl->airRecirculationAttribute().isAvailable()); - connect(m_climateControl, &QtIVIClimateControl::airRecirculationEnabledChanged, - ui->cb_airRecirculation, &QCheckBox::setChecked); - connect(m_climateControl, &QtIVIClimateControl::airRecirculationAttributeChanged, + ui->cb_airRecirculation->setChecked(m_climateControl->recirculationMode() == QtIVIClimateControl::RecirculationOn); + ui->cb_airRecirculation->setEnabled(m_climateControl->recirculationModeAttribute().isAvailable()); + connect(m_climateControl, &QtIVIClimateControl::recirculationModeChanged, + this, &MainWindow::onAirRecirculationModeChanged); + connect(m_climateControl, &QtIVIClimateControl::recirculationModeAttributeChanged, this, &MainWindow::onAirRecirculationAttributeChanged); connect(ui->cb_airRecirculation, &QCheckBox::clicked, - m_climateControl, &QtIVIClimateControl::setAirRecirculationEnabled); + this, &MainWindow::setAirRecirculationEnabled); //Heater ui->cb_heater->setChecked(m_climateControl->isHeaterEnabled()); @@ -127,7 +127,20 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute<bool> & attribute) +void MainWindow::setAirRecirculationEnabled(bool enabled) +{ + if (enabled) + m_climateControl->setRecirculationMode(QtIVIClimateControl::RecirculationOn); + else + m_climateControl->setRecirculationMode(QtIVIClimateControl::RecirculationOff); +} + +void MainWindow::onAirRecirculationModeChanged(QtIVIClimateControl::RecirculationMode mode) +{ + ui->cb_airRecirculation->setChecked(mode == QtIVIClimateControl::RecirculationOn); +} + +void MainWindow::onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute<QtIVIClimateControl::RecirculationMode> & attribute) { ui->cb_airRecirculation->setEnabled(attribute.isAvailable()); } diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.h b/examples/vehiclefunctions/climate_widget/mainwindow.h index 65d936a..81564bd 100644 --- a/examples/vehiclefunctions/climate_widget/mainwindow.h +++ b/examples/vehiclefunctions/climate_widget/mainwindow.h @@ -74,7 +74,9 @@ public: ~MainWindow(); private slots: - void onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute<bool> &attribute); + void setAirRecirculationEnabled(bool enabled); + void onAirRecirculationModeChanged(QtIVIClimateControl::RecirculationMode mode); + void onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute<QtIVIClimateControl::RecirculationMode> &attribute); void onHeaterAttributeChanged(const QtIVIPropertyAttribute<bool> &attribute); void onAirConditioningAttributeChanged(const QtIVIPropertyAttribute<bool> &attribute); void setupFlowDirectionRadioButtons(QtIVIClimateControl::AirflowDirections direction); |