diff options
author | jan Iversen <jani@apache.org> | 2018-08-15 11:54:37 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-15 16:11:39 -0700 |
commit | 4b2071728dd450e8fa9b81d4ccd3a1d80d78a305 (patch) | |
tree | 0c127d89f59a52a42171f043dc091e2a434f1601 /core/downloadfromdcthread.cpp | |
parent | 94fd7586072e019a89b648cf885e0dcb266ba076 (diff) | |
download | subsurface-4b2071728dd450e8fa9b81d4ccd3a1d80d78a305.tar.gz |
core: 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 'core/downloadfromdcthread.cpp')
-rw-r--r-- | core/downloadfromdcthread.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index a05dffb8d..da8c09f54 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -1,7 +1,7 @@ #include "downloadfromdcthread.h" #include "core/libdivecomputer.h" #include "core/qthelper.h" -#include "core/subsurface-qt/SettingsObjectWrapper.h" +#include "core/settings/qPrefDiveComputer.h" #include <QDebug> #include <QRegularExpression> #if defined(Q_OS_ANDROID) @@ -57,11 +57,10 @@ void DownloadThread::run() } else { qDebug() << "Finishing download thread:" << downloadTable.nr << "dives downloaded"; } - auto dcs = SettingsObjectWrapper::instance()->dive_computer_settings; - dcs->set_vendor(internalData->vendor); - dcs->set_product(internalData->product); - dcs->set_device(internalData->devname); - dcs->set_device_name(m_data->devBluetoothName()); + qPrefDiveComputer::set_vendor(internalData->vendor); + qPrefDiveComputer::set_product(internalData->product); + qPrefDiveComputer::set_device(internalData->devname); + qPrefDiveComputer::set_device_name(m_data->devBluetoothName()); } static void fill_supported_mobile_list() @@ -252,13 +251,12 @@ QStringList DCDeviceData::getProductListFromVendor(const QString &vendor) int DCDeviceData::getMatchingAddress(const QString &vendor, const QString &product) { - auto dcs = SettingsObjectWrapper::instance()->dive_computer_settings; - if (dcs->vendor() == vendor && - dcs->product() == product) { + if (qPrefDiveComputer::vendor() == vendor && + qPrefDiveComputer::product() == product) { // we are trying to show the last dive computer selected for (int i = 0; i < connectionListModel.rowCount(); i++) { QString address = connectionListModel.address(i); - if (address.contains(dcs->device())) + if (address.contains(qPrefDiveComputer::device())) return i; } } @@ -415,11 +413,10 @@ device_data_t *DCDeviceData::internalData() int DCDeviceData::getDetectedVendorIndex() { - auto dcs = SettingsObjectWrapper::instance()->dive_computer_settings; - if (!dcs->vendor().isEmpty()) { + if (!qPrefDiveComputer::vendor().isEmpty()) { // use the last one for (int i = 0; i < vendorList.length(); i++) { - if (vendorList[i] == dcs->vendor()) + if (vendorList[i] == qPrefDiveComputer::vendor()) return i; } } @@ -436,12 +433,11 @@ int DCDeviceData::getDetectedVendorIndex() int DCDeviceData::getDetectedProductIndex(const QString ¤tVendorText) { - auto dcs = SettingsObjectWrapper::instance()->dive_computer_settings; - if (!dcs->vendor().isEmpty()) { - if (dcs->vendor() == currentVendorText) { + if (!qPrefDiveComputer::vendor().isEmpty()) { + if (qPrefDiveComputer::vendor() == currentVendorText) { // we are trying to show the last dive computer selected for (int i = 0; i < productList[currentVendorText].length(); i++) { - if (productList[currentVendorText][i] == dcs->product()) + if (productList[currentVendorText][i] == qPrefDiveComputer::product()) return i; } } |