summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/divecomputer.cpp8
-rw-r--r--core/downloadfromdcthread.cpp30
-rw-r--r--core/qt-init.cpp2
3 files changed, 17 insertions, 23 deletions
diff --git a/core/divecomputer.cpp b/core/divecomputer.cpp
index 978074e62..5e177e541 100644
--- a/core/divecomputer.cpp
+++ b/core/divecomputer.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "divecomputer.h"
#include "dive.h"
-#include "subsurface-qt/SettingsObjectWrapper.h"
+#include "core/settings/qPrefDiveComputer.h"
#include "subsurface-string.h"
DiveComputerList dcList;
@@ -123,14 +123,12 @@ extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *
extern "C" int is_default_dive_computer(const char *vendor, const char *product)
{
- auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
- return dc->vendor() == vendor && dc->product() == product;
+ return qPrefDiveComputer::vendor() == vendor && qPrefDiveComputer::product() == product;
}
extern "C" int is_default_dive_computer_device(const char *name)
{
- auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
- return dc->device() == name;
+ return qPrefDiveComputer::device() == name;
}
extern "C" void set_dc_nickname(struct dive *dive)
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 &currentVendorText)
{
- 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;
}
}
diff --git a/core/qt-init.cpp b/core/qt-init.cpp
index 3543fb9bd..b2d178e8e 100644
--- a/core/qt-init.cpp
+++ b/core/qt-init.cpp
@@ -5,7 +5,7 @@
#include <QLibraryInfo>
#include <QTextCodec>
#include "qthelper.h"
-#include "core/subsurface-qt/SettingsObjectWrapper.h"
+#include "core/settings/qPref.h"
char *settings_suffix = NULL;
static QTranslator *qtTranslator, *ssrfTranslator;