summaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputerdialog.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-10 15:03:26 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-09 12:06:42 -0300
commit4fc16b16749a73b8c06d41cb7cb22b78c77ab29e (patch)
tree6a434679d4f6d0677f920f910a2ddca39296cf87 /qt-ui/configuredivecomputerdialog.cpp
parent2432350064c6a9109501b3df21f56a9fe41aa686 (diff)
downloadsubsurface-4fc16b16749a73b8c06d41cb7cb22b78c77ab29e.tar.gz
Move divecomputer configuration code to different files
This splits the code in configuredivecomputer.cpp into multiple files. The read and write threads are moved to configuredivecomputerthreads.h/cpp, and the device details class is moved to devicedetails.h/.cpp 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.cpp36
1 files changed, 11 insertions, 25 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 1d5b1d7f8..8ae250468 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -33,14 +33,16 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
ui(new Ui::ConfigureDiveComputerDialog),
config(0),
vendorModel(0),
- productModel(0)
+ productModel(0),
+ deviceDetails(0)
{
ui->setupUi(this);
+ deviceDetails = new DeviceDetails(this);
config = new ConfigureDiveComputer(this);
connect (config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
connect (config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
- connect (config, SIGNAL(deviceSettings(QString)), ui->availableDetails, SLOT(setText(QString)));
+ connect (config, SIGNAL(readFinished()), this, SLOT(deviceReadFinished()));
fill_computer_list();
@@ -157,7 +159,7 @@ void ConfigureDiveComputerDialog::readSettings()
ui->errorLabel->clear();
getDeviceData();
- config->readSettings(&device_data);
+ config->readSettings(deviceDetails, &device_data);
}
void ConfigureDiveComputerDialog::configMessage(QString msg)
@@ -181,6 +183,8 @@ 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()
@@ -188,31 +192,13 @@ void ConfigureDiveComputerDialog::on_cancel_clicked()
this->close();
}
-void ConfigureDiveComputerDialog::on_setDeviceName_clicked()
+void ConfigureDiveComputerDialog::deviceReadFinished()
{
- ui->statusLabel->clear();
- ui->errorLabel->clear();
- ui->availableDetails->clear();
-
- QString newDeviceName = QInputDialog::getText(this, tr("Set device name"), tr("Enter the new name for this device:"));
- if (newDeviceName.length() > 0) {
- getDeviceData();
- config->setDeviceName(&device_data, newDeviceName);
- }
+ ui->brightnessComboBox->setCurrentIndex(config->m_deviceDetails->brightness());
}
-void ConfigureDiveComputerDialog::on_setDateAndTime_clicked()
+void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
{
- ui->statusLabel->clear();
- ui->errorLabel->clear();
- ui->availableDetails->clear();
-
- getDeviceData();
- config->setDeviceDateAndTime(&device_data, QDateTime::currentDateTime());
+ config->saveDeviceDetails();
}
-void ConfigureDiveComputerDialog::on_setBrightnessButton_clicked()
-{
- getDeviceData();
- config->setDeviceBrightness(&device_data, ui->brightnessComboBox->currentIndex());
-}