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>
This commit is contained in:
jan Iversen 2018-08-15 11:56:17 +02:00 committed by Dirk Hohndel
parent c6998ee926
commit 0f68e0cc2e
6 changed files with 80 additions and 91 deletions

View file

@ -3,7 +3,7 @@
#include "core/display.h"
#include "core/qthelper.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include "core/settings/qPrefDiveComputer.h"
#include "desktop-widgets/mainwindow.h"
// For fill_computer_list, descriptorLookup
#include "core/downloadfromdcthread.h"
@ -132,9 +132,8 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
memset(&device_data, 0, sizeof(device_data));
fill_computer_list();
auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
if (!dc->device().isEmpty())
ui.device->setEditText(dc->device());
if (!qPrefDiveComputer::device().isEmpty())
ui.device->setEditText(qPrefDiveComputer::device());
ui.DiveComputerList->setCurrentRow(0);
on_DiveComputerList_currentRowChanged(0);
@ -912,11 +911,10 @@ void ConfigureDiveComputerDialog::getDeviceData()
device_data.descriptor = descriptorLookup.value(selected_vendor + selected_product);
device_data.deviceid = device_data.diveid = 0;
auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
dc->set_device(device_data.devname);
qPrefDiveComputer::set_device(device_data.devname);
#ifdef BT_SUPPORT
if (ui.bluetoothMode && btDeviceSelectionDialog)
dc->set_device_name(btDeviceSelectionDialog->getSelectedDeviceName());
qPrefDiveComputer::set_device_name(btDeviceSelectionDialog->getSelectedDeviceName());
#endif
}