2017-04-27 18:24:53 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2016-01-11 21:40:07 +00:00
|
|
|
#include "SettingsObjectWrapper.h"
|
|
|
|
#include <QSettings>
|
2016-01-22 18:00:44 +00:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QFont>
|
2016-08-10 18:50:00 +00:00
|
|
|
#include <QDate>
|
2016-01-22 18:00:44 +00:00
|
|
|
|
2018-06-03 20:15:19 +00:00
|
|
|
#include "core/qthelper.h"
|
2018-06-29 06:57:27 +00:00
|
|
|
#include "core/prefs-macros.h"
|
2016-01-13 19:09:46 +00:00
|
|
|
|
2016-01-22 19:46:15 +00:00
|
|
|
PartialPressureGasSettings::PartialPressureGasSettings(QObject* parent):
|
2016-09-25 18:01:03 +00:00
|
|
|
QObject(parent)
|
2016-01-22 19:46:15 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-11-18 15:06:41 +00:00
|
|
|
bool PartialPressureGasSettings::showPo2() const
|
2016-01-11 21:40:07 +00:00
|
|
|
{
|
|
|
|
return prefs.pp_graphs.po2;
|
|
|
|
}
|
|
|
|
|
2017-11-18 15:06:41 +00:00
|
|
|
bool PartialPressureGasSettings::showPn2() const
|
2016-01-11 21:40:07 +00:00
|
|
|
{
|
|
|
|
return prefs.pp_graphs.pn2;
|
|
|
|
}
|
|
|
|
|
2017-11-18 15:06:41 +00:00
|
|
|
bool PartialPressureGasSettings::showPhe() const
|
2016-01-11 21:40:07 +00:00
|
|
|
{
|
|
|
|
return prefs.pp_graphs.phe;
|
|
|
|
}
|
|
|
|
|
2017-03-24 18:11:31 +00:00
|
|
|
double PartialPressureGasSettings::po2ThresholdMin() const
|
2016-01-11 21:40:07 +00:00
|
|
|
{
|
2017-03-24 18:11:31 +00:00
|
|
|
return prefs.pp_graphs.po2_threshold_min;
|
2016-01-11 21:40:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 18:11:31 +00:00
|
|
|
double PartialPressureGasSettings::po2ThresholdMax() const
|
|
|
|
{
|
|
|
|
return prefs.pp_graphs.po2_threshold_max;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-11 21:40:07 +00:00
|
|
|
double PartialPressureGasSettings::pn2Threshold() const
|
|
|
|
{
|
|
|
|
return prefs.pp_graphs.pn2_threshold;
|
|
|
|
}
|
|
|
|
|
|
|
|
double PartialPressureGasSettings::pheThreshold() const
|
|
|
|
{
|
|
|
|
return prefs.pp_graphs.phe_threshold;
|
|
|
|
}
|
|
|
|
|
2017-11-18 15:06:41 +00:00
|
|
|
void PartialPressureGasSettings::setShowPo2(bool value)
|
2016-01-13 19:13:10 +00:00
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.pp_graphs.po2)
|
|
|
|
return;
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
QSettings s;
|
2016-09-25 18:01:03 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-13 19:13:10 +00:00
|
|
|
s.setValue("po2graph", value);
|
|
|
|
prefs.pp_graphs.po2 = value;
|
|
|
|
emit showPo2Changed(value);
|
|
|
|
}
|
|
|
|
|
2017-11-18 15:06:41 +00:00
|
|
|
void PartialPressureGasSettings::setShowPn2(bool value)
|
2016-01-13 19:13:10 +00:00
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.pp_graphs.pn2)
|
|
|
|
return;
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
QSettings s;
|
2016-09-25 18:01:03 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-13 19:13:10 +00:00
|
|
|
s.setValue("pn2graph", value);
|
|
|
|
prefs.pp_graphs.pn2 = value;
|
|
|
|
emit showPn2Changed(value);
|
|
|
|
}
|
|
|
|
|
2017-11-18 15:06:41 +00:00
|
|
|
void PartialPressureGasSettings::setShowPhe(bool value)
|
2016-01-13 19:13:10 +00:00
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.pp_graphs.phe)
|
|
|
|
return;
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
QSettings s;
|
2016-09-25 18:01:03 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-13 19:13:10 +00:00
|
|
|
s.setValue("phegraph", value);
|
|
|
|
prefs.pp_graphs.phe = value;
|
|
|
|
emit showPheChanged(value);
|
|
|
|
}
|
|
|
|
|
2017-03-24 18:11:31 +00:00
|
|
|
void PartialPressureGasSettings::setPo2ThresholdMin(double value)
|
|
|
|
{
|
|
|
|
if (value == prefs.pp_graphs.po2_threshold_min)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("po2thresholdmin", value);
|
|
|
|
prefs.pp_graphs.po2_threshold_min = value;
|
|
|
|
emit po2ThresholdMinChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setPo2ThresholdMax(double value)
|
2016-01-13 19:13:10 +00:00
|
|
|
{
|
2017-03-24 18:11:31 +00:00
|
|
|
if (value == prefs.pp_graphs.po2_threshold_max)
|
2016-08-28 00:33:27 +00:00
|
|
|
return;
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
QSettings s;
|
2016-09-25 18:01:03 +00:00
|
|
|
s.beginGroup(group);
|
2017-03-24 18:11:31 +00:00
|
|
|
s.setValue("po2thresholdmax", value);
|
|
|
|
prefs.pp_graphs.po2_threshold_max = value;
|
|
|
|
emit po2ThresholdMaxChanged(value);
|
2016-01-13 19:13:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setPn2Threshold(double value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.pp_graphs.pn2_threshold)
|
|
|
|
return;
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
QSettings s;
|
2016-09-25 18:01:03 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-13 19:13:10 +00:00
|
|
|
s.setValue("pn2threshold", value);
|
|
|
|
prefs.pp_graphs.pn2_threshold = value;
|
|
|
|
emit pn2ThresholdChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setPheThreshold(double value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.pp_graphs.phe_threshold)
|
|
|
|
return;
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
QSettings s;
|
2016-09-25 18:01:03 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-13 19:13:10 +00:00
|
|
|
s.setValue("phethreshold", value);
|
|
|
|
prefs.pp_graphs.phe_threshold = value;
|
|
|
|
emit pheThresholdChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:36:11 +00:00
|
|
|
GeocodingPreferences::GeocodingPreferences(QObject *parent) :
|
2016-09-25 18:01:03 +00:00
|
|
|
QObject(parent)
|
2016-01-13 19:36:11 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
taxonomy_category GeocodingPreferences::firstTaxonomyCategory() const
|
|
|
|
{
|
|
|
|
return prefs.geocoding.category[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
taxonomy_category GeocodingPreferences::secondTaxonomyCategory() const
|
|
|
|
{
|
|
|
|
return prefs.geocoding.category[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
taxonomy_category GeocodingPreferences::thirdTaxonomyCategory() const
|
|
|
|
{
|
|
|
|
return prefs.geocoding.category[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeocodingPreferences::setFirstTaxonomyCategory(taxonomy_category value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.geocoding.category[0])
|
|
|
|
return;
|
2016-01-13 19:36:11 +00:00
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("cat0", value);
|
2016-08-28 00:33:27 +00:00
|
|
|
prefs.geocoding.category[0] = value;
|
2016-01-13 19:36:11 +00:00
|
|
|
emit firstTaxonomyCategoryChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeocodingPreferences::setSecondTaxonomyCategory(taxonomy_category value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.geocoding.category[1])
|
|
|
|
return;
|
2016-01-13 19:36:11 +00:00
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("cat1", value);
|
2016-08-28 00:33:27 +00:00
|
|
|
prefs.geocoding.category[1]= value;
|
2016-01-13 19:36:11 +00:00
|
|
|
emit secondTaxonomyCategoryChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.geocoding.category[2])
|
|
|
|
return;
|
2016-01-13 19:36:11 +00:00
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("cat2", value);
|
2016-08-28 00:33:27 +00:00
|
|
|
prefs.geocoding.category[2] = value;
|
2016-01-13 19:36:11 +00:00
|
|
|
emit thirdTaxonomyCategoryChanged(value);
|
2016-01-14 13:55:31 +00:00
|
|
|
}
|
|
|
|
|
2016-01-22 17:39:40 +00:00
|
|
|
GeneralSettingsObjectWrapper::GeneralSettingsObjectWrapper(QObject *parent) :
|
2016-09-25 18:01:03 +00:00
|
|
|
QObject(parent)
|
2016-01-22 17:39:40 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QString GeneralSettingsObjectWrapper::defaultFilename() const
|
|
|
|
{
|
|
|
|
return prefs.default_filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString GeneralSettingsObjectWrapper::defaultCylinder() const
|
|
|
|
{
|
|
|
|
return prefs.default_cylinder;
|
|
|
|
}
|
|
|
|
|
|
|
|
short GeneralSettingsObjectWrapper::defaultFileBehavior() const
|
|
|
|
{
|
|
|
|
return prefs.default_file_behavior;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GeneralSettingsObjectWrapper::useDefaultFile() const
|
|
|
|
{
|
|
|
|
return prefs.use_default_file;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GeneralSettingsObjectWrapper::defaultSetPoint() const
|
|
|
|
{
|
|
|
|
return prefs.defaultsetpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GeneralSettingsObjectWrapper::o2Consumption() const
|
|
|
|
{
|
|
|
|
return prefs.o2consumption;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GeneralSettingsObjectWrapper::pscrRatio() const
|
|
|
|
{
|
|
|
|
return prefs.pscr_ratio;
|
|
|
|
}
|
|
|
|
|
2018-05-27 13:42:22 +00:00
|
|
|
bool GeneralSettingsObjectWrapper::autoRecalculateThumbnails() const
|
|
|
|
{
|
|
|
|
return prefs.auto_recalculate_thumbnails;
|
|
|
|
}
|
|
|
|
|
2018-07-10 13:04:35 +00:00
|
|
|
bool GeneralSettingsObjectWrapper::extractVideoThumbnails() const
|
|
|
|
{
|
|
|
|
return prefs.extract_video_thumbnails;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GeneralSettingsObjectWrapper::extractVideoThumbnailsPosition() const
|
|
|
|
{
|
|
|
|
return prefs.extract_video_thumbnails_position;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString GeneralSettingsObjectWrapper::ffmpegExecutable() const
|
|
|
|
{
|
|
|
|
return prefs.ffmpeg_executable;
|
|
|
|
}
|
|
|
|
|
2016-01-22 17:39:40 +00:00
|
|
|
void GeneralSettingsObjectWrapper::setDefaultFilename(const QString& value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.default_filename)
|
|
|
|
return;
|
|
|
|
|
2016-01-22 17:39:40 +00:00
|
|
|
QSettings s;
|
2016-04-22 13:51:47 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-22 17:39:40 +00:00
|
|
|
s.setValue("default_filename", value);
|
2017-11-18 18:57:50 +00:00
|
|
|
free((void *)prefs.default_filename);
|
2018-02-28 22:37:09 +00:00
|
|
|
prefs.default_filename = copy_qstring(value);
|
2016-01-22 17:39:40 +00:00
|
|
|
emit defaultFilenameChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setDefaultCylinder(const QString& value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.default_cylinder)
|
|
|
|
return;
|
|
|
|
|
2016-01-22 17:39:40 +00:00
|
|
|
QSettings s;
|
2016-04-22 13:51:47 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-22 17:39:40 +00:00
|
|
|
s.setValue("default_cylinder", value);
|
2017-11-18 18:57:50 +00:00
|
|
|
free((void *)prefs.default_cylinder);
|
2018-02-28 22:37:09 +00:00
|
|
|
prefs.default_cylinder = copy_qstring(value);
|
2016-01-22 17:39:40 +00:00
|
|
|
emit defaultCylinderChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setDefaultFileBehavior(short value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.default_file_behavior && prefs.default_file_behavior != UNDEFINED_DEFAULT_FILE)
|
|
|
|
return;
|
|
|
|
|
2016-01-22 17:39:40 +00:00
|
|
|
QSettings s;
|
2016-04-22 13:51:47 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-22 17:39:40 +00:00
|
|
|
s.setValue("default_file_behavior", value);
|
2016-10-28 09:51:13 +00:00
|
|
|
|
2016-01-22 20:37:18 +00:00
|
|
|
prefs.default_file_behavior = value;
|
2016-01-22 17:39:40 +00:00
|
|
|
if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE) {
|
|
|
|
// undefined, so check if there's a filename set and
|
|
|
|
// use that, otherwise go with no default file
|
|
|
|
if (QString(prefs.default_filename).isEmpty())
|
|
|
|
prefs.default_file_behavior = NO_DEFAULT_FILE;
|
|
|
|
else
|
|
|
|
prefs.default_file_behavior = LOCAL_DEFAULT_FILE;
|
|
|
|
}
|
|
|
|
emit defaultFileBehaviorChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setUseDefaultFile(bool value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.use_default_file)
|
|
|
|
return;
|
|
|
|
|
2016-01-22 17:39:40 +00:00
|
|
|
QSettings s;
|
2016-04-22 13:51:47 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-22 17:39:40 +00:00
|
|
|
s.setValue("use_default_file", value);
|
2016-01-22 20:37:18 +00:00
|
|
|
prefs.use_default_file = value;
|
2016-01-22 17:39:40 +00:00
|
|
|
emit useDefaultFileChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setDefaultSetPoint(int value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.defaultsetpoint)
|
|
|
|
return;
|
|
|
|
|
2016-01-22 17:39:40 +00:00
|
|
|
QSettings s;
|
2016-04-22 13:51:47 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-22 17:39:40 +00:00
|
|
|
s.setValue("defaultsetpoint", value);
|
2016-01-22 20:37:18 +00:00
|
|
|
prefs.defaultsetpoint = value;
|
2016-01-22 17:39:40 +00:00
|
|
|
emit defaultSetPointChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setO2Consumption(int value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.o2consumption)
|
|
|
|
return;
|
2016-01-22 17:39:40 +00:00
|
|
|
QSettings s;
|
2016-04-22 13:51:47 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-22 17:39:40 +00:00
|
|
|
s.setValue("o2consumption", value);
|
2016-01-22 20:37:18 +00:00
|
|
|
prefs.o2consumption = value;
|
2016-01-22 17:39:40 +00:00
|
|
|
emit o2ConsumptionChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setPscrRatio(int value)
|
|
|
|
{
|
2016-08-28 00:33:27 +00:00
|
|
|
if (value == prefs.pscr_ratio)
|
|
|
|
return;
|
2016-01-22 17:39:40 +00:00
|
|
|
QSettings s;
|
2016-04-22 13:51:47 +00:00
|
|
|
s.beginGroup(group);
|
2016-01-22 17:39:40 +00:00
|
|
|
s.setValue("pscr_ratio", value);
|
2016-01-22 20:37:18 +00:00
|
|
|
prefs.pscr_ratio = value;
|
2016-01-22 17:39:40 +00:00
|
|
|
emit pscrRatioChanged(value);
|
|
|
|
}
|
2016-01-22 18:00:44 +00:00
|
|
|
|
2018-05-27 13:42:22 +00:00
|
|
|
void GeneralSettingsObjectWrapper::setAutoRecalculateThumbnails(bool value)
|
|
|
|
{
|
|
|
|
if (value == prefs.auto_recalculate_thumbnails)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("auto_recalculate_thumbnails", value);
|
|
|
|
prefs.auto_recalculate_thumbnails = value;
|
|
|
|
emit autoRecalculateThumbnailsChanged(value);
|
|
|
|
}
|
|
|
|
|
2018-07-10 13:04:35 +00:00
|
|
|
void GeneralSettingsObjectWrapper::setExtractVideoThumbnails(bool value)
|
|
|
|
{
|
|
|
|
if (value == prefs.extract_video_thumbnails)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("extract_video_thumbnails", value);
|
|
|
|
prefs.extract_video_thumbnails = value;
|
|
|
|
emit extractVideoThumbnailsChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setExtractVideoThumbnailsPosition(int value)
|
|
|
|
{
|
|
|
|
if (value == prefs.extract_video_thumbnails_position)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("extract_video_thumbnails_position", value);
|
|
|
|
prefs.extract_video_thumbnails_position = value;
|
|
|
|
emit extractVideoThumbnailsPositionChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralSettingsObjectWrapper::setFfmpegExecutable(const QString &value)
|
|
|
|
{
|
|
|
|
if (value == prefs.ffmpeg_executable)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("ffmpeg_executable", value);
|
|
|
|
free((void *)prefs.ffmpeg_executable);
|
|
|
|
prefs.ffmpeg_executable = copy_qstring(value);
|
|
|
|
emit ffmpegExecutableChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-22 19:46:15 +00:00
|
|
|
SettingsObjectWrapper::SettingsObjectWrapper(QObject* parent):
|
|
|
|
QObject(parent),
|
2018-08-05 08:57:24 +00:00
|
|
|
techDetails(new qPrefTechnicalDetails(this)),
|
2016-01-22 20:37:18 +00:00
|
|
|
pp_gas(new PartialPressureGasSettings(this)),
|
2018-07-23 15:49:12 +00:00
|
|
|
facebook(new qPrefFacebook(this)),
|
2016-01-22 20:37:18 +00:00
|
|
|
geocoding(new GeocodingPreferences(this)),
|
2018-07-27 19:55:49 +00:00
|
|
|
proxy(new qPrefProxy(this)),
|
2018-07-14 14:52:25 +00:00
|
|
|
cloud_storage(new qPrefCloudStorage(this)),
|
2018-08-01 19:41:42 +00:00
|
|
|
planner_settings(new qPrefDivePlanner(this)),
|
2018-07-31 16:40:59 +00:00
|
|
|
unit_settings(new qPrefUnits(this)),
|
2016-01-22 20:37:18 +00:00
|
|
|
general_settings(new GeneralSettingsObjectWrapper(this)),
|
2018-07-04 19:45:48 +00:00
|
|
|
display_settings(new qPrefDisplay(this)),
|
2018-08-08 14:34:17 +00:00
|
|
|
language_settings(new qPrefLanguage(this)),
|
2018-07-12 08:25:28 +00:00
|
|
|
animation_settings(new qPrefAnimations(this)),
|
2018-08-06 15:36:29 +00:00
|
|
|
location_settings(new qPrefLocationService(this)),
|
2018-08-03 18:25:02 +00:00
|
|
|
update_manager_settings(new qPrefUpdateManager(this)),
|
2018-07-22 14:19:22 +00:00
|
|
|
dive_computer_settings(new qPrefDiveComputer(this))
|
2016-01-22 20:37:18 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-08-26 19:01:31 +00:00
|
|
|
void SettingsObjectWrapper::load()
|
|
|
|
{
|
|
|
|
QSettings s;
|
2016-08-26 19:52:51 +00:00
|
|
|
QVariant v;
|
|
|
|
|
|
|
|
uiLanguage(NULL);
|
2018-07-31 16:40:59 +00:00
|
|
|
|
|
|
|
qPrefUnits::instance()->load();
|
2018-08-05 08:57:24 +00:00
|
|
|
qPrefTechnicalDetails::instance()->load();
|
2016-08-26 19:52:51 +00:00
|
|
|
|
|
|
|
s.beginGroup("GeneralSettings");
|
|
|
|
GET_TXT("default_filename", default_filename);
|
|
|
|
GET_INT("default_file_behavior", default_file_behavior);
|
|
|
|
if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE) {
|
|
|
|
// undefined, so check if there's a filename set and
|
|
|
|
// use that, otherwise go with no default file
|
|
|
|
if (QString(prefs.default_filename).isEmpty())
|
|
|
|
prefs.default_file_behavior = NO_DEFAULT_FILE;
|
|
|
|
else
|
|
|
|
prefs.default_file_behavior = LOCAL_DEFAULT_FILE;
|
|
|
|
}
|
|
|
|
GET_TXT("default_cylinder", default_cylinder);
|
|
|
|
GET_BOOL("use_default_file", use_default_file);
|
|
|
|
GET_INT("defaultsetpoint", defaultsetpoint);
|
|
|
|
GET_INT("o2consumption", o2consumption);
|
|
|
|
GET_INT("pscr_ratio", pscr_ratio);
|
2018-05-27 13:42:22 +00:00
|
|
|
GET_BOOL("auto_recalculate_thumbnails", auto_recalculate_thumbnails);
|
2016-08-26 19:52:51 +00:00
|
|
|
s.endGroup();
|
|
|
|
|
2018-07-22 14:14:16 +00:00
|
|
|
qPrefAnimations::instance()->load();
|
2018-07-14 14:52:25 +00:00
|
|
|
qPrefCloudStorage::instance()->load();
|
2018-07-27 19:55:49 +00:00
|
|
|
qPrefDisplay::instance()->load();
|
|
|
|
qPrefProxy::instance()->load();
|
2016-08-26 19:52:51 +00:00
|
|
|
|
|
|
|
// GeoManagement
|
|
|
|
s.beginGroup("geocoding");
|
2016-10-15 18:18:56 +00:00
|
|
|
|
2016-08-26 19:52:51 +00:00
|
|
|
GET_ENUM("cat0", taxonomy_category, geocoding.category[0]);
|
|
|
|
GET_ENUM("cat1", taxonomy_category, geocoding.category[1]);
|
|
|
|
GET_ENUM("cat2", taxonomy_category, geocoding.category[2]);
|
|
|
|
s.endGroup();
|
|
|
|
|
|
|
|
// GPS service time and distance thresholds
|
2018-08-06 15:36:29 +00:00
|
|
|
qPrefLocationService::instance()->load();
|
2016-08-26 19:52:51 +00:00
|
|
|
|
2018-08-01 19:41:42 +00:00
|
|
|
qPrefDivePlanner::instance()->load();
|
2018-07-22 14:19:22 +00:00
|
|
|
qPrefDiveComputer::instance()->load();
|
2018-08-03 18:25:02 +00:00
|
|
|
qPrefUpdateManager::instance()->load();
|
2016-10-28 09:57:41 +00:00
|
|
|
|
2018-08-08 14:34:17 +00:00
|
|
|
qPrefLanguage::instance()->load();
|
2016-08-26 19:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsObjectWrapper::sync()
|
|
|
|
{
|
2018-07-04 20:39:53 +00:00
|
|
|
qPrefDisplay::instance()->sync();
|
2016-08-26 19:01:31 +00:00
|
|
|
}
|
|
|
|
|
2016-01-25 17:54:23 +00:00
|
|
|
SettingsObjectWrapper* SettingsObjectWrapper::instance()
|
|
|
|
{
|
|
|
|
static SettingsObjectWrapper settings;
|
|
|
|
return &settings;
|
|
|
|
}
|