aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/downloadfromdivecomputer.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-15 11:56:17 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-15 16:11:39 -0700
commit0f68e0cc2e6e9c4d4e07b065888b9982086748e7 (patch)
treef1fc7bb8778bbac553f79a142099cace64f72aef /desktop-widgets/downloadfromdivecomputer.cpp
parentc6998ee92680f2724c2a6adbb4c7a06c9bae0633 (diff)
downloadsubsurface-0f68e0cc2e6e9c4d4e07b065888b9982086748e7.tar.gz
desktop-widget: remove SettingsObjectWrapper and update qPref calls
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r--desktop-widgets/downloadfromdivecomputer.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp
index 4b5a0c917..4d86958af 100644
--- a/desktop-widgets/downloadfromdivecomputer.cpp
+++ b/desktop-widgets/downloadfromdivecomputer.cpp
@@ -2,7 +2,7 @@
#include "desktop-widgets/downloadfromdivecomputer.h"
#include "core/display.h"
#include "core/qthelper.h"
-#include "core/subsurface-qt/SettingsObjectWrapper.h"
+#include "core/settings/qPrefDiveComputer.h"
#include "core/subsurface-string.h"
#include "core/uemis.h"
#include "desktop-widgets/divelistview.h"
@@ -71,12 +71,11 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) :
MainWindow *w = MainWindow::instance();
connect(&thread, SIGNAL(finished()), w, SLOT(refreshDisplay()));
- auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
- if (!dc->vendor().isEmpty()) {
- ui.vendor->setCurrentIndex(ui.vendor->findText(dc->vendor()));
- productModel.setStringList(productList[dc->vendor()]);
- if (!dc->product().isEmpty())
- ui.product->setCurrentIndex(ui.product->findText(dc->product()));
+ if (!qPrefDiveComputer::vendor().isEmpty()) {
+ ui.vendor->setCurrentIndex(ui.vendor->findText(qPrefDiveComputer::vendor()));
+ productModel.setStringList(productList[qPrefDiveComputer::vendor()]);
+ if (!qPrefDiveComputer::product().isEmpty())
+ ui.product->setCurrentIndex(ui.product->findText(qPrefDiveComputer::product()));
}
updateState(INITIAL);
@@ -84,16 +83,16 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) :
ui.downloadCancelRetryButton->setEnabled(true);
ui.downloadCancelRetryButton->setText(tr("Download"));
- QString deviceText = dc->device();
+ QString deviceText = qPrefDiveComputer::device();
#if defined(BT_SUPPORT)
ui.bluetoothMode->setText(tr("Choose Bluetooth download mode"));
- ui.bluetoothMode->setChecked(dc->download_mode() == DC_TRANSPORT_BLUETOOTH);
+ ui.bluetoothMode->setChecked(qPrefDiveComputer::download_mode() == DC_TRANSPORT_BLUETOOTH);
btDeviceSelectionDialog = 0;
connect(ui.bluetoothMode, SIGNAL(stateChanged(int)), this, SLOT(enableBluetoothMode(int)));
connect(ui.chooseBluetoothDevice, SIGNAL(clicked()), this, SLOT(selectRemoteBluetoothDevice()));
ui.chooseBluetoothDevice->setEnabled(ui.bluetoothMode->isChecked());
if (ui.bluetoothMode->isChecked())
- deviceText = BtDeviceSelectionDialog::formatDeviceText(dc->device(), dc->device_name());
+ deviceText = BtDeviceSelectionDialog::formatDeviceText(qPrefDiveComputer::device(), qPrefDiveComputer::device_name());
#else
ui.bluetoothMode->hide();
ui.chooseBluetoothDevice->hide();
@@ -288,9 +287,8 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
data->setDevName(btDeviceSelectionDialog->getSelectedDeviceAddress());
data->setDevBluetoothName(btDeviceSelectionDialog->getSelectedDeviceName());
} else {
- auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
- data->setDevName(dc->device());
- data->setDevBluetoothName(dc->device_name());
+ data->setDevName(qPrefDiveComputer::device());
+ data->setDevBluetoothName(qPrefDiveComputer::device_name());
}
} else
// this breaks an "else if" across lines... not happy...
@@ -313,13 +311,12 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
data->setSaveLog(ui.logToFile->isChecked());
data->setSaveDump(ui.dumpToFile->isChecked());
- auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
- dc->set_vendor(data->vendor());
- dc->set_product(data->product());
- dc->set_device(data->devName());
+ qPrefDiveComputer::set_vendor(data->vendor());
+ qPrefDiveComputer::set_product(data->product());
+ qPrefDiveComputer::set_device(data->devName());
#if defined(BT_SUPPORT)
- dc->set_download_mode(ui.bluetoothMode->isChecked() ? DC_TRANSPORT_BLUETOOTH : DC_TRANSPORT_SERIAL);
+ qPrefDiveComputer::set_download_mode(ui.bluetoothMode->isChecked() ? DC_TRANSPORT_BLUETOOTH : DC_TRANSPORT_SERIAL);
#endif
// before we start, remember where the dive_table ended