diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/configuredivecomputer.cpp | 16 | ||||
-rw-r--r-- | qt-ui/configuredivecomputer.h | 1 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.cpp | 6 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.h | 2 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.ui | 33 |
5 files changed, 58 insertions, 0 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index f591efffa..8cc3a6953 100644 --- a/qt-ui/configuredivecomputer.cpp +++ b/qt-ui/configuredivecomputer.cpp @@ -34,6 +34,11 @@ void ConfigureDiveComputer::setDeviceDateAndTime(device_data_t *data, QDateTime writeSettingToDevice(data, "DateAndTime", dateAndTime); } +void ConfigureDiveComputer::setDeviceBrightness(device_data_t *data, int brighnessLevel) +{ + writeSettingToDevice(data, "Brightness", brighnessLevel); +} + void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState) { currentState = newState; @@ -151,6 +156,17 @@ void WriteSettingsThread::run() break; } } + if (m_settingName == "Brightness") { + switch (dc_device_get_type(data->device)) { + case DC_FAMILY_HW_OSTC3: + qDebug() << "Brightness"; + supported = true; + unsigned char packet[1] = { m_settingValue.toInt() }; + result = hw_ostc3_device_config_write(data->device, 0x2D, packet, sizeof (packet)); + break; + } + } + qDebug() << result; if (result != DC_STATUS_SUCCESS) { qDebug() << result; lastError = tr("An error occurred while sending data to the dive computer."); diff --git a/qt-ui/configuredivecomputer.h b/qt-ui/configuredivecomputer.h index 8b1c4b4c7..08c4e190f 100644 --- a/qt-ui/configuredivecomputer.h +++ b/qt-ui/configuredivecomputer.h @@ -56,6 +56,7 @@ public: void setDeviceName(device_data_t *data, QString newName); void setDeviceDateAndTime(device_data_t *data, QDateTime dateAndTime); + void setDeviceBrightness(device_data_t *data, int brighnessLevel); signals: void deviceSettings(QString settings); void message(QString msg); diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index b88715fc9..1d5b1d7f8 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -210,3 +210,9 @@ void ConfigureDiveComputerDialog::on_setDateAndTime_clicked() getDeviceData(); config->setDeviceDateAndTime(&device_data, QDateTime::currentDateTime()); } + +void ConfigureDiveComputerDialog::on_setBrightnessButton_clicked() +{ + getDeviceData(); + config->setDeviceBrightness(&device_data, ui->brightnessComboBox->currentIndex()); +} diff --git a/qt-ui/configuredivecomputerdialog.h b/qt-ui/configuredivecomputerdialog.h index 4c63c8c8f..7c4243ab8 100644 --- a/qt-ui/configuredivecomputerdialog.h +++ b/qt-ui/configuredivecomputerdialog.h @@ -32,6 +32,8 @@ private slots: void on_setDateAndTime_clicked(); + void on_setBrightnessButton_clicked(); + private: Ui::ConfigureDiveComputerDialog *ui; diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui index 71fa541c3..cb4dacb23 100644 --- a/qt-ui/configuredivecomputerdialog.ui +++ b/qt-ui/configuredivecomputerdialog.ui @@ -110,6 +110,39 @@ </property> </widget> </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Brightness:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="brightnessComboBox"> + <item> + <property name="text"> + <string>Eco</string> + </property> + </item> + <item> + <property name="text"> + <string>Medium</string> + </property> + </item> + <item> + <property name="text"> + <string>High</string> + </property> + </item> + </widget> + </item> + <item row="1" column="2"> + <widget class="QToolButton" name="setBrightnessButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> </layout> </item> <item> |