summaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputerdialog.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-10 18:25:25 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:11 -0700
commit20eb62a98a70c1773ff99ece05f1c69e6ca8ce15 (patch)
tree0d7e18fd5405b0b259c9ae35b8315887dd4658b6 /qt-ui/configuredivecomputerdialog.cpp
parent4fc16b16749a73b8c06d41cb7cb22b78c77ab29e (diff)
downloadsubsurface-20eb62a98a70c1773ff99ece05f1c69e6ca8ce15.tar.gz
Polish up on classes
This patch polishes up on all classes added for dive computer configuration to give a clean workflow. The classes can now write and read data from the OSTC 3. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui/configuredivecomputerdialog.cpp')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 8ae250468..ea5e764dc 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -8,6 +8,7 @@
#include "../divelist.h"
#include "configuredivecomputer.h"
#include <QInputDialog>
+#include <QDebug>
struct product {
const char *product;
@@ -43,6 +44,8 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
connect (config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
connect (config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
connect (config, SIGNAL(readFinished()), this, SLOT(deviceReadFinished()));
+ connect (config, SIGNAL(deviceDetailsChanged(DeviceDetails*)),
+ this, SLOT(deviceDetailsReceived(DeviceDetails*)));
fill_computer_list();
@@ -159,7 +162,7 @@ void ConfigureDiveComputerDialog::readSettings()
ui->errorLabel->clear();
getDeviceData();
- config->readSettings(deviceDetails, &device_data);
+ config->readSettings(&device_data);
}
void ConfigureDiveComputerDialog::configMessage(QString msg)
@@ -183,8 +186,6 @@ void ConfigureDiveComputerDialog::getDeviceData()
set_default_dive_computer(device_data.vendor, device_data.product);
set_default_dive_computer_device(device_data.devname);
-
- //deviceDetails->setData(&device_data);
}
void ConfigureDiveComputerDialog::on_cancel_clicked()
@@ -194,11 +195,32 @@ void ConfigureDiveComputerDialog::on_cancel_clicked()
void ConfigureDiveComputerDialog::deviceReadFinished()
{
- ui->brightnessComboBox->setCurrentIndex(config->m_deviceDetails->brightness());
+
}
void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
{
- config->saveDeviceDetails();
+ deviceDetails->setBrightness(ui->brightnessComboBox->currentIndex());
+ deviceDetails->setLanguage(ui->languageComboBox->currentIndex());
+ deviceDetails->setDateFormat(ui->dateFormatComboBox->currentIndex());
+ deviceDetails->setCustomText(ui->customTextLlineEdit->text());
+ getDeviceData();
+ config->saveDeviceDetails(deviceDetails, &device_data);
+}
+
+void ConfigureDiveComputerDialog::deviceDetailsReceived(DeviceDetails *newDeviceDetails)
+{
+ deviceDetails = newDeviceDetails;
+ reloadValues();
+}
+
+void ConfigureDiveComputerDialog::reloadValues()
+{
+ ui->serialNoLineEdit->setText(deviceDetails->serialNo());
+ ui->firmwareVersionLineEdit->setText(deviceDetails->firmwareVersion());
+ ui->customTextLlineEdit->setText(deviceDetails->customText());
+ ui->brightnessComboBox->setCurrentIndex(deviceDetails->brightness());
+ ui->languageComboBox->setCurrentIndex(deviceDetails->language());
+ ui->dateFormatComboBox->setCurrentIndex(deviceDetails->dateFormat());
}