| 
									
										
										
										
											2016-01-11 19:40:07 -02:00
										 |  |  | #include "SettingsObjectWrapper.h"
 | 
					
						
							|  |  |  | #include <QSettings>
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | #include <QApplication>
 | 
					
						
							|  |  |  | #include <QFont>
 | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | #include <QDate>
 | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | #include <QNetworkProxy>
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | #include "core/dive.h" // TODO: remove copy_string from dive.h
 | 
					
						
							|  |  |  | #include "core/helpers.h"
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:09:46 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:10:15 -03:00
										 |  |  | DiveComputerSettings::DiveComputerSettings(QObject *parent): | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-08-10 18:10:15 -03:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString DiveComputerSettings::dc_vendor() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.dive_computer.vendor; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString DiveComputerSettings::dc_product() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.dive_computer.product; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString DiveComputerSettings::dc_device() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.dive_computer.device; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DiveComputerSettings::downloadMode() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.dive_computer.download_mode; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DiveComputerSettings::setVendor(const QString& vendor) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (vendor == prefs.dive_computer.vendor) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:10:15 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("dive_computer_vendor", vendor); | 
					
						
							|  |  |  | 	free(prefs.dive_computer.vendor); | 
					
						
							|  |  |  | 	prefs.dive_computer.vendor = copy_string(qPrintable(vendor)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DiveComputerSettings::setProduct(const QString& product) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (product == prefs.dive_computer.product) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:10:15 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("dive_computer_product", product); | 
					
						
							|  |  |  | 	free(prefs.dive_computer.product); | 
					
						
							|  |  |  | 	prefs.dive_computer.product = copy_string(qPrintable(product)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DiveComputerSettings::setDevice(const QString& device) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (device == prefs.dive_computer.device) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:10:15 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("dive_computer_device", device); | 
					
						
							|  |  |  | 	free(prefs.dive_computer.device); | 
					
						
							|  |  |  | 	prefs.dive_computer.device = copy_string(qPrintable(device)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DiveComputerSettings::setDownloadMode(int mode) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (mode == prefs.dive_computer.download_mode) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:10:15 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("dive_computer_download_mode", mode); | 
					
						
							|  |  |  | 	prefs.dive_computer.download_mode = mode; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-11 19:40:07 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | UpdateManagerSettings::UpdateManagerSettings(QObject *parent) : QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool UpdateManagerSettings::dontCheckForUpdates() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.update_manager.dont_check_for_updates; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-27 12:26:13 -07:00
										 |  |  | bool UpdateManagerSettings::dontCheckExists() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.update_manager.dont_check_exists; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | QString UpdateManagerSettings::lastVersionUsed() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.update_manager.last_version_used; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QDate UpdateManagerSettings::nextCheck() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-11-01 11:57:28 +01:00
										 |  |  | 	return QDate::fromString(QString(prefs.update_manager.next_check), "dd/MM/yyyy"); | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void UpdateManagerSettings::setDontCheckForUpdates(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.update_manager.dont_check_for_updates) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("DontCheckForUpdates", value); | 
					
						
							|  |  |  | 	prefs.update_manager.dont_check_for_updates = value; | 
					
						
							| 
									
										
										
										
											2016-08-27 12:26:13 -07:00
										 |  |  | 	prefs.update_manager.dont_check_exists = true; | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | 	emit dontCheckForUpdatesChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | void UpdateManagerSettings::setLastVersionUsed(const QString& value) | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.update_manager.last_version_used) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("LastVersionUsed", value); | 
					
						
							|  |  |  | 	free (prefs.update_manager.last_version_used); | 
					
						
							|  |  |  | 	prefs.update_manager.last_version_used = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit lastVersionUsedChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void UpdateManagerSettings::setNextCheck(const QDate& date) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (date.toString() == prefs.update_manager.next_check) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("NextCheck", date); | 
					
						
							|  |  |  | 	free (prefs.update_manager.next_check); | 
					
						
							| 
									
										
										
										
											2016-11-01 11:57:28 +01:00
										 |  |  | 	prefs.update_manager.next_check = copy_string(qPrintable(date.toString("dd/MM/yyyy"))); | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | 	emit nextCheckChanged(date); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 19:40:07 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | PartialPressureGasSettings::PartialPressureGasSettings(QObject* parent): | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 19:40:07 -02:00
										 |  |  | short PartialPressureGasSettings::showPo2() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.pp_graphs.po2; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | short PartialPressureGasSettings::showPn2() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.pp_graphs.pn2; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | short PartialPressureGasSettings::showPhe() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.pp_graphs.phe; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | double PartialPressureGasSettings::po2Threshold() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.pp_graphs.po2_threshold; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | double PartialPressureGasSettings::pn2Threshold() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.pp_graphs.pn2_threshold; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | double PartialPressureGasSettings::pheThreshold() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.pp_graphs.phe_threshold; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | void PartialPressureGasSettings::setShowPo2(short value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.pp_graphs.po2) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	s.setValue("po2graph", value); | 
					
						
							|  |  |  | 	prefs.pp_graphs.po2 = value; | 
					
						
							|  |  |  | 	emit showPo2Changed(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void PartialPressureGasSettings::setShowPn2(short value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.pp_graphs.pn2) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	s.setValue("pn2graph", value); | 
					
						
							|  |  |  | 	prefs.pp_graphs.pn2 = value; | 
					
						
							|  |  |  | 	emit showPn2Changed(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void PartialPressureGasSettings::setShowPhe(short value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.pp_graphs.phe) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	s.setValue("phegraph", value); | 
					
						
							|  |  |  | 	prefs.pp_graphs.phe = value; | 
					
						
							|  |  |  | 	emit showPheChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void PartialPressureGasSettings::setPo2Threshold(double value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.pp_graphs.po2_threshold) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	s.setValue("po2threshold", value); | 
					
						
							|  |  |  | 	prefs.pp_graphs.po2_threshold = value; | 
					
						
							|  |  |  | 	emit po2ThresholdChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void PartialPressureGasSettings::setPn2Threshold(double value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.pp_graphs.pn2_threshold) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	s.setValue("pn2threshold", value); | 
					
						
							|  |  |  | 	prefs.pp_graphs.pn2_threshold = value; | 
					
						
							|  |  |  | 	emit pn2ThresholdChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void PartialPressureGasSettings::setPheThreshold(double value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.pp_graphs.phe_threshold) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | 	s.setValue("phethreshold", value); | 
					
						
							|  |  |  | 	prefs.pp_graphs.phe_threshold = value; | 
					
						
							|  |  |  | 	emit pheThresholdChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | TechnicalDetailsSettings::TechnicalDetailsSettings(QObject* parent): QObject(parent) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-01 17:00:06 +01:00
										 |  |  | deco_mode TechnicalDetailsSettings::deco() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return prefs.display_deco_mode; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void TechnicalDetailsSettings::setDecoMode(deco_mode d) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (prefs.display_deco_mode == d) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	prefs.display_deco_mode = d; | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("display_deco_mode", d); | 
					
						
							|  |  |  | 	emit decoModeChanged(d); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | double TechnicalDetailsSettings:: modp02() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.modpO2; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::ead() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.ead; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::dcceiling() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.dcceiling; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::redceiling() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.redceiling; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::calcceiling() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.calcceiling; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::calcceiling3m() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.calcceiling3m; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::calcalltissues() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.calcalltissues; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::calcndltts() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.calcndltts; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-03 16:25:48 +02:00
										 |  |  | bool TechnicalDetailsSettings::buehlmann() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return (prefs.deco_mode == BUEHLMANN); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-02 07:52:17 +10:00
										 |  |  | int TechnicalDetailsSettings::gflow() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.gflow; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-02 07:52:17 +10:00
										 |  |  | int TechnicalDetailsSettings::gfhigh() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.gfhigh; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-24 18:02:08 +10:00
										 |  |  | short TechnicalDetailsSettings::vpmbConservatism() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.vpmb_conservatism; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::hrgraph() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.hrgraph; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::tankBar() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.tankbar; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::percentageGraph() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.percentagegraph; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::rulerGraph() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.rulergraph; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | bool TechnicalDetailsSettings::showCCRSetpoint() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.show_ccr_setpoint; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | bool TechnicalDetailsSettings::showCCRSensors() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.show_ccr_sensors; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::zoomedPlot() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.zoomed_plot; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::showSac() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.show_sac; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:13:10 -02:00
										 |  |  | bool TechnicalDetailsSettings::gfLowAtMaxDepth() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.gf_low_at_maxdepth; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::displayUnusedTanks() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.display_unused_tanks; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::showAverageDepth() const | 
					
						
							| 
									
										
										
										
											2016-01-11 19:58:33 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.show_average_depth; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | bool TechnicalDetailsSettings::mod() const | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.mod; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | bool TechnicalDetailsSettings::showPicturesInProfile() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.show_pictures_in_profile; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void TechnicalDetailsSettings::setModp02(double value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.modpO2) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("modpO2", value); | 
					
						
							|  |  |  | 	prefs.modpO2 = value; | 
					
						
							|  |  |  | 	emit modpO2Changed(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | void TechnicalDetailsSettings::setShowPicturesInProfile(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.show_pictures_in_profile) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | 	s.setValue("show_pictures_in_profile", value); | 
					
						
							|  |  |  | 	prefs.show_pictures_in_profile = value; | 
					
						
							|  |  |  | 	emit showPicturesInProfileChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setEad(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.ead) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("ead", value); | 
					
						
							|  |  |  | 	prefs.ead = value; | 
					
						
							|  |  |  | 	emit eadChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setMod(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.mod) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("mod", value); | 
					
						
							|  |  |  | 	prefs.mod = value; | 
					
						
							|  |  |  | 	emit modChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setDCceiling(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.dcceiling) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("dcceiling", value); | 
					
						
							|  |  |  | 	prefs.dcceiling = value; | 
					
						
							|  |  |  | 	emit dcceilingChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setRedceiling(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.redceiling) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("redceiling", value); | 
					
						
							|  |  |  | 	prefs.redceiling = value; | 
					
						
							|  |  |  | 	emit redceilingChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setCalcceiling(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.calcceiling) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("calcceiling", value); | 
					
						
							|  |  |  | 	prefs.calcceiling = value; | 
					
						
							|  |  |  | 	emit calcceilingChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setCalcceiling3m(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.calcceiling3m) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("calcceiling3m", value); | 
					
						
							|  |  |  | 	prefs.calcceiling3m = value; | 
					
						
							|  |  |  | 	emit calcceiling3mChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setCalcalltissues(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.calcalltissues) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("calcalltissues", value); | 
					
						
							|  |  |  | 	prefs.calcalltissues = value; | 
					
						
							|  |  |  | 	emit calcalltissuesChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setCalcndltts(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.calcndltts) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("calcndltts", value); | 
					
						
							|  |  |  | 	prefs.calcndltts = value; | 
					
						
							|  |  |  | 	emit calcndlttsChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-03 16:25:48 +02:00
										 |  |  | void TechnicalDetailsSettings::setBuehlmann(bool value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (value == (prefs.deco_mode == BUEHLMANN)) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("buehlmann", value); | 
					
						
							|  |  |  | 	prefs.deco_mode = value ? BUEHLMANN : VPMB; | 
					
						
							|  |  |  | 	emit buehlmannChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-02 07:52:17 +10:00
										 |  |  | void TechnicalDetailsSettings::setGflow(int value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.gflow) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("gflow", value); | 
					
						
							|  |  |  | 	prefs.gflow = value; | 
					
						
							|  |  |  | 	set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); | 
					
						
							|  |  |  | 	emit gflowChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-02 07:52:17 +10:00
										 |  |  | void TechnicalDetailsSettings::setGfhigh(int value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.gfhigh) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("gfhigh", value); | 
					
						
							|  |  |  | 	prefs.gfhigh = value; | 
					
						
							|  |  |  | 	set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); | 
					
						
							|  |  |  | 	emit gfhighChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-24 18:02:08 +10:00
										 |  |  | void TechnicalDetailsSettings::setVpmbConservatism(short value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (value == prefs.vpmb_conservatism) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-09-24 18:02:08 +10:00
										 |  |  | 	s.setValue("vpmb_conservatism", value); | 
					
						
							|  |  |  | 	prefs.vpmb_conservatism = value; | 
					
						
							|  |  |  | 	set_vpmb_conservatism(value); | 
					
						
							|  |  |  | 	emit vpmbConservatismChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setHRgraph(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.hrgraph) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("hrgraph", value); | 
					
						
							|  |  |  | 	prefs.hrgraph = value; | 
					
						
							|  |  |  | 	emit hrgraphChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setTankBar(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.tankbar) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("tankbar", value); | 
					
						
							|  |  |  | 	prefs.tankbar = value; | 
					
						
							|  |  |  | 	emit tankBarChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setPercentageGraph(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.percentagegraph) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("percentagegraph", value); | 
					
						
							|  |  |  | 	prefs.percentagegraph = value; | 
					
						
							|  |  |  | 	emit percentageGraphChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setRulerGraph(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.rulergraph) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	/* TODO: search for the QSettings of the RulerBar */ | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:53:22 -02:00
										 |  |  | 	s.setValue("RulerBar", value); | 
					
						
							| 
									
										
										
										
											2016-01-25 18:15:06 -02:00
										 |  |  | 	prefs.rulergraph = value; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:53:22 -02:00
										 |  |  | 	emit rulerGraphChanged(value); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:37:54 -02:00
										 |  |  | void TechnicalDetailsSettings::setShowCCRSetpoint(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.show_ccr_setpoint) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("show_ccr_setpoint", value); | 
					
						
							|  |  |  | 	prefs.show_ccr_setpoint = value; | 
					
						
							|  |  |  | 	emit showCCRSetpointChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:37:54 -02:00
										 |  |  | void TechnicalDetailsSettings::setShowCCRSensors(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.show_ccr_sensors) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("show_ccr_sensors", value); | 
					
						
							|  |  |  | 	prefs.show_ccr_sensors = value; | 
					
						
							|  |  |  | 	emit showCCRSensorsChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setZoomedPlot(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.zoomed_plot) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("zoomed_plot", value); | 
					
						
							|  |  |  | 	prefs.zoomed_plot = value; | 
					
						
							|  |  |  | 	emit zoomedPlotChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setShowSac(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.show_sac) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("show_sac", value); | 
					
						
							|  |  |  | 	prefs.show_sac = value; | 
					
						
							|  |  |  | 	emit showSacChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:37:54 -02:00
										 |  |  | void TechnicalDetailsSettings::setGfLowAtMaxDepth(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.gf_low_at_maxdepth) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("gf_low_at_maxdepth", value); | 
					
						
							|  |  |  | 	prefs.gf_low_at_maxdepth = value; | 
					
						
							|  |  |  | 	set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); | 
					
						
							|  |  |  | 	emit gfLowAtMaxDepthChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setDisplayUnusedTanks(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.display_unused_tanks) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("display_unused_tanks", value); | 
					
						
							|  |  |  | 	prefs.display_unused_tanks = value; | 
					
						
							|  |  |  | 	emit displayUnusedTanksChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 16:49:51 -02:00
										 |  |  | void TechnicalDetailsSettings::setShowAverageDepth(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.show_average_depth) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-11 20:33:50 -02:00
										 |  |  | 	s.setValue("show_average_depth", value); | 
					
						
							|  |  |  | 	prefs.show_average_depth = value; | 
					
						
							|  |  |  | 	emit showAverageDepthChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-13 17:09:46 -02:00
										 |  |  | 
 | 
					
						
							|  |  |  | FacebookSettings::FacebookSettings(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-03-07 16:55:29 -03:00
										 |  |  | 	QObject(parent), | 
					
						
							| 
									
										
										
										
											2016-01-13 17:09:46 -02:00
										 |  |  | 	group(QStringLiteral("WebApps")), | 
					
						
							|  |  |  | 	subgroup(QStringLiteral("Facebook")) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString FacebookSettings::accessToken() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.facebook.access_token); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString FacebookSettings::userId() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.facebook.user_id); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString FacebookSettings::albumId() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.facebook.album_id); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void FacebookSettings::setAccessToken (const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if SAVE_FB_CREDENTIALS
 | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.beginGroup(subgroup); | 
					
						
							|  |  |  | 	s.setValue("ConnectToken", value); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	prefs.facebook.access_token = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit accessTokenChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void FacebookSettings::setUserId(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.facebook.user_id) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:09:46 -02:00
										 |  |  | #if SAVE_FB_CREDENTIALS
 | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.beginGroup(subgroup); | 
					
						
							|  |  |  | 	s.setValue("UserId", value); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	prefs.facebook.user_id = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit userIdChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void FacebookSettings::setAlbumId(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.facebook.album_id) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:09:46 -02:00
										 |  |  | #if SAVE_FB_CREDENTIALS
 | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.beginGroup(subgroup); | 
					
						
							|  |  |  | 	s.setValue("AlbumId", value); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	prefs.facebook.album_id = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit albumIdChanged(value); | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GeocodingPreferences::GeocodingPreferences(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool GeocodingPreferences::enableGeocoding() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.geocoding.enable_geocoding; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool GeocodingPreferences::parseDiveWithoutGps() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.geocoding.parse_dive_without_gps; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool GeocodingPreferences::tagExistingDives() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.geocoding.tag_existing_dives; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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::setEnableGeocoding(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.geocoding.enable_geocoding) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("enable_geocoding", value); | 
					
						
							|  |  |  | 	prefs.geocoding.enable_geocoding = value; | 
					
						
							|  |  |  | 	emit enableGeocodingChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-13 17:53:22 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | void GeocodingPreferences::setParseDiveWithoutGps(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.geocoding.parse_dive_without_gps) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("parse_dives_without_gps", value); | 
					
						
							|  |  |  | 	prefs.geocoding.parse_dive_without_gps = value; | 
					
						
							|  |  |  | 	emit parseDiveWithoutGpsChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-13 17:53:22 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | void GeocodingPreferences::setTagExistingDives(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.geocoding.tag_existing_dives) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("tag_existing_dives", value); | 
					
						
							|  |  |  | 	prefs.geocoding.tag_existing_dives = value; | 
					
						
							|  |  |  | 	emit tagExistingDivesChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeocodingPreferences::setFirstTaxonomyCategory(taxonomy_category value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.geocoding.category[0]) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("cat0", value); | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	prefs.geocoding.category[0] = value; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	emit firstTaxonomyCategoryChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeocodingPreferences::setSecondTaxonomyCategory(taxonomy_category value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.geocoding.category[1]) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("cat1", value); | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	prefs.geocoding.category[1]= value; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	emit secondTaxonomyCategoryChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.geocoding.category[2]) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("cat2", value); | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	prefs.geocoding.category[2] = value; | 
					
						
							| 
									
										
										
										
											2016-01-13 17:36:11 -02:00
										 |  |  | 	emit thirdTaxonomyCategoryChanged(value); | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ProxySettings::ProxySettings(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int ProxySettings::type() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.proxy_type; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString ProxySettings::host() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.proxy_host; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int ProxySettings::port() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.proxy_port; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-15 20:26:34 +02:00
										 |  |  | bool ProxySettings::auth() const | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.proxy_auth; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString ProxySettings::user() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.proxy_user; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString ProxySettings::pass() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.proxy_pass; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProxySettings::setType(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.proxy_type) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("proxy_type", value); | 
					
						
							|  |  |  | 	prefs.proxy_type = value; | 
					
						
							|  |  |  | 	emit typeChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProxySettings::setHost(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.proxy_host) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("proxy_host", value); | 
					
						
							|  |  |  | 	free(prefs.proxy_host); | 
					
						
							|  |  |  | 	prefs.proxy_host = copy_string(qPrintable(value));; | 
					
						
							|  |  |  | 	emit hostChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProxySettings::setPort(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.proxy_port) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("proxy_port", value); | 
					
						
							|  |  |  | 	prefs.proxy_port = value; | 
					
						
							|  |  |  | 	emit portChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-15 20:26:34 +02:00
										 |  |  | void ProxySettings::setAuth(bool value) | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.proxy_auth) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("proxy_auth", value); | 
					
						
							|  |  |  | 	prefs.proxy_auth = value; | 
					
						
							|  |  |  | 	emit authChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProxySettings::setUser(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.proxy_user) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("proxy_user", value); | 
					
						
							|  |  |  | 	free(prefs.proxy_user); | 
					
						
							|  |  |  | 	prefs.proxy_user = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit userChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ProxySettings::setPass(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.proxy_pass) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 11:55:31 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("proxy_pass", value); | 
					
						
							|  |  |  | 	free(prefs.proxy_pass); | 
					
						
							|  |  |  | 	prefs.proxy_pass = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit passChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 
 | 
					
						
							|  |  |  | CloudStorageSettings::CloudStorageSettings(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | bool CloudStorageSettings::gitLocalOnly() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.git_local_only; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | QString CloudStorageSettings::password() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.cloud_storage_password); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString CloudStorageSettings::newPassword() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.cloud_storage_newpassword); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString CloudStorageSettings::email() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.cloud_storage_email); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString CloudStorageSettings::emailEncoded() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.cloud_storage_email_encoded); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool CloudStorageSettings::savePasswordLocal() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.save_password_local; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | short CloudStorageSettings::verificationStatus() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.cloud_verification_status; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool CloudStorageSettings::backgroundSync() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.cloud_background_sync; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString CloudStorageSettings::userId() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.userid); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString CloudStorageSettings::baseUrl() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.cloud_base_url); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString CloudStorageSettings::gitUrl() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return QString(prefs.cloud_git_url); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setPassword(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.cloud_storage_password) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("password", value); | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	free(prefs.cloud_storage_password); | 
					
						
							|  |  |  | 	prefs.cloud_storage_password = copy_string(qPrintable(value)); | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	emit passwordChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setNewPassword(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.cloud_storage_newpassword) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	/*TODO: This looks like wrong, but 'new password' is not saved on disk, why it's on prefs? */ | 
					
						
							|  |  |  | 	free(prefs.cloud_storage_newpassword); | 
					
						
							|  |  |  | 	prefs.cloud_storage_newpassword = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit newPasswordChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setEmail(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.cloud_storage_email) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("email", value); | 
					
						
							|  |  |  | 	free(prefs.cloud_storage_email); | 
					
						
							|  |  |  | 	prefs.cloud_storage_email = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit emailChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setUserId(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.userid) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	//WARNING: UserId is stored outside of any group, but it belongs to Cloud Storage.
 | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.setValue("subsurface_webservice_uid", value); | 
					
						
							|  |  |  | 	free(prefs.userid); | 
					
						
							|  |  |  | 	prefs.userid = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit userIdChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setEmailEncoded(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.cloud_storage_email_encoded) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	/*TODO: This looks like wrong, but 'email encoded' is not saved on disk, why it's on prefs? */ | 
					
						
							|  |  |  | 	free(prefs.cloud_storage_email_encoded); | 
					
						
							|  |  |  | 	prefs.cloud_storage_email_encoded = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit emailEncodedChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setSavePasswordLocal(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.save_password_local) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("save_password_local", value); | 
					
						
							|  |  |  | 	prefs.save_password_local = value; | 
					
						
							|  |  |  | 	emit savePasswordLocalChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setVerificationStatus(short value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.cloud_verification_status) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("cloud_verification_status", value); | 
					
						
							|  |  |  | 	prefs.cloud_verification_status = value; | 
					
						
							|  |  |  | 	emit verificationStatusChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setBackgroundSync(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.cloud_background_sync) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("cloud_background_sync", value); | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	prefs.cloud_background_sync = value; | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	emit backgroundSyncChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 13:27:03 -03:00
										 |  |  | void CloudStorageSettings::setSaveUserIdLocal(short int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	//TODO: this is not saved on disk?
 | 
					
						
							|  |  |  | 	if (value == prefs.save_userid_local) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-08-10 13:27:03 -03:00
										 |  |  | 	prefs.save_userid_local = value; | 
					
						
							|  |  |  | 	emit saveUserIdLocalChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | short int CloudStorageSettings::saveUserIdLocal() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.save_userid_local; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | void CloudStorageSettings::setBaseUrl(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.cloud_base_url) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-08-28 20:10:17 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// dont free data segment.
 | 
					
						
							|  |  |  | 	if (prefs.cloud_base_url != default_prefs.cloud_base_url) { | 
					
						
							|  |  |  | 		free((void*)prefs.cloud_base_url); | 
					
						
							|  |  |  | 		free((void*)prefs.cloud_git_url); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("cloud_base_url", value); | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | 	prefs.cloud_base_url = copy_string(qPrintable(value)); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.cloud_git_url = copy_string(qPrintable(QString(prefs.cloud_base_url) + "/git")); | 
					
						
							| 
									
										
										
										
											2016-01-14 13:38:35 -02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | void CloudStorageSettings::setGitUrl(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Q_UNUSED(value); /* no op */ | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CloudStorageSettings::setGitLocalOnly(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.git_local_only) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-08-28 20:20:53 -03:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup("CloudStorage"); | 
					
						
							|  |  |  | 	s.setValue("git_local_only", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | 	prefs.git_local_only = value; | 
					
						
							| 
									
										
										
										
											2016-07-30 13:05:28 -07:00
										 |  |  | 	emit gitLocalOnlyChanged(value); | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | DivePlannerSettings::DivePlannerSettings(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::lastStop() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.last_stop; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::verbatimPlan() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.verbatim_plan; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::displayRuntime() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.display_runtime; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::displayDuration() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.display_duration; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::displayTransitions() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.display_transitions; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::doo2breaks() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.doo2breaks; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::dropStoneMode() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.drop_stone_mode; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::safetyStop() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.safetystop; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivePlannerSettings::switchAtRequiredStop() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.switch_at_req_stop; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::ascrate75() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.ascrate75; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::ascrate50() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.ascrate50; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::ascratestops() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.ascratestops; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::ascratelast6m() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.ascratelast6m; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::descrate() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.descrate; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::bottompo2() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.bottompo2; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::decopo2() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.decopo2; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-21 20:14:23 +10:00
										 |  |  | int DivePlannerSettings::bestmixend() const | 
					
						
							| 
									
										
										
										
											2016-05-21 19:32:09 +10:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-07-06 22:40:31 +10:00
										 |  |  | 	return prefs.bestmixend.mm; | 
					
						
							| 
									
										
										
										
											2016-05-21 19:32:09 +10:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | int DivePlannerSettings::reserveGas() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.reserve_gas; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::minSwitchDuration() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.min_switch_duration; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::bottomSac() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.bottomsac; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivePlannerSettings::decoSac() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.decosac; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | deco_mode DivePlannerSettings::decoMode() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.deco_mode; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setLastStop(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.last_stop) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("last_stop", value); | 
					
						
							|  |  |  | 	prefs.last_stop = value; | 
					
						
							|  |  |  | 	emit lastStopChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setVerbatimPlan(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.verbatim_plan) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("verbatim_plan", value); | 
					
						
							|  |  |  | 	prefs.verbatim_plan = value; | 
					
						
							|  |  |  | 	emit verbatimPlanChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDisplayRuntime(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.display_runtime) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("display_runtime", value); | 
					
						
							|  |  |  | 	prefs.display_runtime = value; | 
					
						
							|  |  |  | 	emit displayRuntimeChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDisplayDuration(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.display_duration) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("display_duration", value); | 
					
						
							|  |  |  | 	prefs.display_duration = value; | 
					
						
							|  |  |  | 	emit displayDurationChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDisplayTransitions(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.display_transitions) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("display_transitions", value); | 
					
						
							|  |  |  | 	prefs.display_transitions = value; | 
					
						
							|  |  |  | 	emit displayTransitionsChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDoo2breaks(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.doo2breaks) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("doo2breaks", value); | 
					
						
							|  |  |  | 	prefs.doo2breaks = value; | 
					
						
							|  |  |  | 	emit doo2breaksChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDropStoneMode(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.drop_stone_mode) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("drop_stone_mode", value); | 
					
						
							|  |  |  | 	prefs.drop_stone_mode = value; | 
					
						
							|  |  |  | 	emit dropStoneModeChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setSafetyStop(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.safetystop) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("safetystop", value); | 
					
						
							|  |  |  | 	prefs.safetystop = value; | 
					
						
							|  |  |  | 	emit safetyStopChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setSwitchAtRequiredStop(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.switch_at_req_stop) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("switch_at_req_stop", value); | 
					
						
							|  |  |  | 	prefs.switch_at_req_stop = value; | 
					
						
							|  |  |  | 	emit switchAtRequiredStopChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setAscrate75(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.ascrate75) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("ascrate75", value); | 
					
						
							|  |  |  | 	prefs.ascrate75 = value; | 
					
						
							|  |  |  | 	emit ascrate75Changed(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setAscrate50(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.ascrate50) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("ascrate50", value); | 
					
						
							|  |  |  | 	prefs.ascrate50 = value; | 
					
						
							|  |  |  | 	emit ascrate50Changed(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setAscratestops(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.ascratestops) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("ascratestops", value); | 
					
						
							|  |  |  | 	prefs.ascratestops = value; | 
					
						
							|  |  |  | 	emit ascratestopsChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setAscratelast6m(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.ascratelast6m) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("ascratelast6m", value); | 
					
						
							|  |  |  | 	prefs.ascratelast6m = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	emit ascratelast6mChanged(value); | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDescrate(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.descrate) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("descrate", value); | 
					
						
							|  |  |  | 	prefs.descrate = value; | 
					
						
							|  |  |  | 	emit descrateChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setBottompo2(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.bottompo2) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("bottompo2", value); | 
					
						
							|  |  |  | 	prefs.bottompo2 = value; | 
					
						
							|  |  |  | 	emit bottompo2Changed(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDecopo2(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.decopo2) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("decopo2", value); | 
					
						
							|  |  |  | 	prefs.decopo2 = value; | 
					
						
							|  |  |  | 	emit decopo2Changed(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-21 20:14:23 +10:00
										 |  |  | void DivePlannerSettings::setBestmixend(int value) | 
					
						
							| 
									
										
										
										
											2016-05-21 19:32:09 +10:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.bestmixend.mm) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-21 19:32:09 +10:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-05-21 20:14:23 +10:00
										 |  |  | 	s.setValue("bestmixend", value); | 
					
						
							| 
									
										
										
										
											2016-07-06 22:40:31 +10:00
										 |  |  | 	prefs.bestmixend.mm = value; | 
					
						
							| 
									
										
										
										
											2016-05-21 20:14:23 +10:00
										 |  |  | 	emit bestmixendChanged(value); | 
					
						
							| 
									
										
										
										
											2016-05-21 19:32:09 +10:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | void DivePlannerSettings::setReserveGas(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.reserve_gas) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("reserve_gas", value); | 
					
						
							|  |  |  | 	prefs.reserve_gas = value; | 
					
						
							|  |  |  | 	emit reserveGasChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setMinSwitchDuration(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.min_switch_duration) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("min_switch_duration", value); | 
					
						
							|  |  |  | 	prefs.min_switch_duration = value; | 
					
						
							|  |  |  | 	emit minSwitchDurationChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setBottomSac(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.bottomsac) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("bottomsac", value); | 
					
						
							|  |  |  | 	prefs.bottomsac = value; | 
					
						
							|  |  |  | 	emit bottomSacChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-15 19:52:17 +02:00
										 |  |  | void DivePlannerSettings::setDecoSac(int value) | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.decosac) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("decosac", value); | 
					
						
							|  |  |  | 	prefs.decosac = value; | 
					
						
							|  |  |  | 	emit decoSacChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivePlannerSettings::setDecoMode(deco_mode value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.deco_mode) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("deco_mode", value); | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	prefs.deco_mode = value; | 
					
						
							| 
									
										
										
										
											2016-01-14 16:08:34 -02:00
										 |  |  | 	emit decoModeChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | UnitsSettings::UnitsSettings(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | int UnitsSettings::length() const | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.units.length; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | int UnitsSettings::pressure() const | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.units.pressure; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | int UnitsSettings::volume() const | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.units.volume; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | int UnitsSettings::temperature() const | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.units.temperature; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | int UnitsSettings::weight() const | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.units.weight; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | int UnitsSettings::verticalSpeedTime() const | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							|  |  |  | 	return prefs.units.vertical_speed_time; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString UnitsSettings::unitSystem() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-10-17 17:50:55 +02:00
										 |  |  | 	return prefs.unit_system == METRIC ? QStringLiteral("metric") | 
					
						
							|  |  |  | 			: prefs.unit_system == IMPERIAL ? QStringLiteral("imperial") | 
					
						
							|  |  |  | 			: QStringLiteral("personalized"); | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool UnitsSettings::coordinatesTraditional() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.coordinates_traditional; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | void UnitsSettings::setLength(int value) | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.units.length) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("length", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.units.length = (units::LENGHT) value; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	emit lengthChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | void UnitsSettings::setPressure(int value) | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.units.pressure) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("pressure", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.units.pressure = (units::PRESSURE) value; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	emit pressureChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | void UnitsSettings::setVolume(int value) | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.units.volume) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("volume", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.units.volume = (units::VOLUME) value; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	emit volumeChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | void UnitsSettings::setTemperature(int value) | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.units.temperature) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("temperature", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.units.temperature = (units::TEMPERATURE) value; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	emit temperatureChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | void UnitsSettings::setWeight(int value) | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.units.weight) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("weight", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.units.weight = (units::WEIGHT) value; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	emit weightChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | void UnitsSettings::setVerticalSpeedTime(int value) | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.units.vertical_speed_time) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("vertical_speed_time", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.units.vertical_speed_time = (units::TIME) value; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	emit verticalSpeedTimeChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void UnitsSettings::setCoordinatesTraditional(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.coordinates_traditional) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	s.setValue("coordinates", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.coordinates_traditional = value; | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	emit coordinatesTraditionalChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void UnitsSettings::setUnitSystem(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	short int v = value == QStringLiteral("metric") ? METRIC | 
					
						
							| 
									
										
										
										
											2016-09-20 12:35:49 -07:00
										 |  |  | 		      : value == QStringLiteral("imperial")? IMPERIAL | 
					
						
							|  |  |  | 		      : PERSONALIZE; | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (v == prefs.unit_system) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-10-28 11:43:26 +02:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-14 17:06:55 -02:00
										 |  |  | 	s.setValue("unit_system", value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (value == QStringLiteral("metric")) { | 
					
						
							|  |  |  | 		prefs.unit_system = METRIC; | 
					
						
							|  |  |  | 		prefs.units = SI_units; | 
					
						
							|  |  |  | 	} else if (value == QStringLiteral("imperial")) { | 
					
						
							|  |  |  | 		prefs.unit_system = IMPERIAL; | 
					
						
							|  |  |  | 		prefs.units = IMPERIAL_units; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		prefs.unit_system = PERSONALIZE; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	emit unitSystemChanged(value); | 
					
						
							|  |  |  | 	// TODO: emit the other values here?
 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 
 | 
					
						
							|  |  |  | GeneralSettingsObjectWrapper::GeneralSettingsObjectWrapper(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02: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; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralSettingsObjectWrapper::setDefaultFilename(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.default_filename) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-04-22 06:51:47 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	s.setValue("default_filename", value); | 
					
						
							|  |  |  | 	prefs.default_filename = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit defaultFilenameChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralSettingsObjectWrapper::setDefaultCylinder(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.default_cylinder) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-04-22 06:51:47 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	s.setValue("default_cylinder", value); | 
					
						
							|  |  |  | 	prefs.default_cylinder = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit defaultCylinderChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralSettingsObjectWrapper::setDefaultFileBehavior(short value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.default_file_behavior && prefs.default_file_behavior != UNDEFINED_DEFAULT_FILE) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-04-22 06:51:47 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	s.setValue("default_file_behavior", value); | 
					
						
							| 
									
										
										
										
											2016-10-28 11:51:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.default_file_behavior = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02: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-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.use_default_file) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-04-22 06:51:47 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	s.setValue("use_default_file", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.use_default_file = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	emit useDefaultFileChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralSettingsObjectWrapper::setDefaultSetPoint(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.defaultsetpoint) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-04-22 06:51:47 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	s.setValue("defaultsetpoint", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.defaultsetpoint = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	emit defaultSetPointChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralSettingsObjectWrapper::setO2Consumption(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.o2consumption) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-04-22 06:51:47 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	s.setValue("o2consumption", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.o2consumption = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	emit o2ConsumptionChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GeneralSettingsObjectWrapper::setPscrRatio(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.pscr_ratio) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-04-22 06:51:47 -07:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	s.setValue("pscr_ratio", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.pscr_ratio = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 15:39:40 -02:00
										 |  |  | 	emit pscrRatioChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 
 | 
					
						
							|  |  |  | DisplaySettingsObjectWrapper::DisplaySettingsObjectWrapper(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString DisplaySettingsObjectWrapper::divelistFont() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.divelist_font; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | double DisplaySettingsObjectWrapper::fontSize() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.font_size; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | short DisplaySettingsObjectWrapper::displayInvalidDives() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.display_invalid_dives; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DisplaySettingsObjectWrapper::setDivelistFont(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	QString newValue = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 	if (value.contains(",")) | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 		newValue = value.left(value.indexOf(",")); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (newValue == prefs.divelist_font) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-11-01 14:08:59 +01:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	s.setValue("divelist_font", value); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	if (!subsurface_ignore_font(newValue.toUtf8().constData())) { | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 		free((void *)prefs.divelist_font); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 		prefs.divelist_font = strdup(newValue.toUtf8().constData()); | 
					
						
							|  |  |  | 		qApp->setFont(QFont(newValue)); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	emit divelistFontChanged(newValue); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DisplaySettingsObjectWrapper::setFontSize(double value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.font_size) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.setValue("font_size", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.font_size = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 	QFont defaultFont = qApp->font(); | 
					
						
							|  |  |  | 	defaultFont.setPointSizeF(prefs.font_size); | 
					
						
							|  |  |  | 	qApp->setFont(defaultFont); | 
					
						
							|  |  |  | 	emit fontSizeChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DisplaySettingsObjectWrapper::setDisplayInvalidDives(short value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.display_invalid_dives) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-10-28 11:57:41 +02:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 	s.setValue("displayinvalid", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.display_invalid_dives = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:00:44 -02:00
										 |  |  | 	emit displayInvalidDivesChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 
 | 
					
						
							|  |  |  | LanguageSettingsObjectWrapper::LanguageSettingsObjectWrapper(QObject *parent) : | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString LanguageSettingsObjectWrapper::language() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.locale.language; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString LanguageSettingsObjectWrapper::timeFormat() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.time_format; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString LanguageSettingsObjectWrapper::dateFormat() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.date_format; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString LanguageSettingsObjectWrapper::dateFormatShort() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.date_format_short; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool LanguageSettingsObjectWrapper::timeFormatOverride() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.time_format_override; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool LanguageSettingsObjectWrapper::dateFormatOverride() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.date_format_override; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool LanguageSettingsObjectWrapper::useSystemLanguage() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.locale.use_system_language; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-17 18:23:45 +02:00
										 |  |  | QString LanguageSettingsObjectWrapper::langLocale() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.locale.lang_locale; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | void LanguageSettingsObjectWrapper::setUseSystemLanguage(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.locale.use_system_language) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	s.setValue("UseSystemLanguage", value); | 
					
						
							|  |  |  | 	prefs.locale.use_system_language = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit useSystemLanguageChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-20 12:35:49 -07:00
										 |  |  | void  LanguageSettingsObjectWrapper::setLangLocale(const QString &value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (value == prefs.locale.lang_locale) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup(group); | 
					
						
							|  |  |  | 	s.setValue("UiLangLocale", value); | 
					
						
							|  |  |  | 	prefs.locale.lang_locale = copy_string(qPrintable(value)); | 
					
						
							| 
									
										
										
										
											2016-10-17 18:23:45 +02:00
										 |  |  | 	emit langLocaleChanged(value); | 
					
						
							| 
									
										
										
										
											2016-09-20 12:35:49 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | void  LanguageSettingsObjectWrapper::setLanguage(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.locale.language) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	s.setValue("UiLanguage", value); | 
					
						
							|  |  |  | 	prefs.locale.language = copy_string(qPrintable(value)); | 
					
						
							|  |  |  | 	emit languageChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void  LanguageSettingsObjectWrapper::setTimeFormat(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.time_format) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	s.setValue("time_format", value); | 
					
						
							|  |  |  | 	prefs.time_format = copy_string(qPrintable(value));; | 
					
						
							|  |  |  | 	emit timeFormatChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void  LanguageSettingsObjectWrapper::setDateFormat(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.date_format) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	s.setValue("date_format", value); | 
					
						
							|  |  |  | 	prefs.date_format = copy_string(qPrintable(value));; | 
					
						
							|  |  |  | 	emit dateFormatChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void  LanguageSettingsObjectWrapper::setDateFormatShort(const QString& value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.date_format_short) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	s.setValue("date_format_short", value); | 
					
						
							|  |  |  | 	prefs.date_format_short = copy_string(qPrintable(value));; | 
					
						
							|  |  |  | 	emit dateFormatShortChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void  LanguageSettingsObjectWrapper::setTimeFormatOverride(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.time_format_override) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	s.setValue("time_format_override", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.time_format_override = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	emit timeFormatOverrideChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void  LanguageSettingsObjectWrapper::setDateFormatOverride(bool value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.date_format_override) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	s.setValue("date_format_override", value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	prefs.date_format_override = value; | 
					
						
							| 
									
										
										
										
											2016-01-22 16:55:03 -02:00
										 |  |  | 	emit dateFormatOverrideChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | AnimationsSettingsObjectWrapper::AnimationsSettingsObjectWrapper(QObject* parent): | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int AnimationsSettingsObjectWrapper::animationSpeed() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.animation_speed; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void AnimationsSettingsObjectWrapper::setAnimationSpeed(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.animation_speed) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	s.setValue("animation_speed", value); | 
					
						
							|  |  |  | 	prefs.animation_speed = value; | 
					
						
							|  |  |  | 	emit animationSpeedChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | LocationServiceSettingsObjectWrapper::LocationServiceSettingsObjectWrapper(QObject* parent): | 
					
						
							| 
									
										
										
										
											2016-09-25 11:01:03 -07:00
										 |  |  | 	QObject(parent) | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int LocationServiceSettingsObjectWrapper::distanceThreshold() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.distance_threshold; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int LocationServiceSettingsObjectWrapper::timeThreshold() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return prefs.time_threshold; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LocationServiceSettingsObjectWrapper::setDistanceThreshold(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.distance_threshold) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	s.setValue("distance_threshold", value); | 
					
						
							|  |  |  | 	prefs.distance_threshold = value; | 
					
						
							|  |  |  | 	emit distanceThresholdChanged(value); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void LocationServiceSettingsObjectWrapper::setTimeThreshold(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2016-08-27 21:33:27 -03:00
										 |  |  | 	if (value == prefs.time_threshold) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	s.beginGroup(group); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	s.setValue("time_threshold", value); | 
					
						
							|  |  |  | 	prefs.time_threshold = value; | 
					
						
							| 
									
										
										
										
											2016-08-27 22:13:33 -03:00
										 |  |  | 	emit timeThresholdChanged(value); | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-22 17:46:15 -02:00
										 |  |  | SettingsObjectWrapper::SettingsObjectWrapper(QObject* parent): | 
					
						
							|  |  |  | QObject(parent), | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | 	techDetails(new TechnicalDetailsSettings(this)), | 
					
						
							|  |  |  | 	pp_gas(new PartialPressureGasSettings(this)), | 
					
						
							|  |  |  | 	facebook(new FacebookSettings(this)), | 
					
						
							|  |  |  | 	geocoding(new GeocodingPreferences(this)), | 
					
						
							|  |  |  | 	proxy(new ProxySettings(this)), | 
					
						
							|  |  |  | 	cloud_storage(new CloudStorageSettings(this)), | 
					
						
							|  |  |  | 	planner_settings(new DivePlannerSettings(this)), | 
					
						
							|  |  |  | 	unit_settings(new UnitsSettings(this)), | 
					
						
							|  |  |  | 	general_settings(new GeneralSettingsObjectWrapper(this)), | 
					
						
							|  |  |  | 	display_settings(new DisplaySettingsObjectWrapper(this)), | 
					
						
							|  |  |  | 	language_settings(new LanguageSettingsObjectWrapper(this)), | 
					
						
							|  |  |  | 	animation_settings(new AnimationsSettingsObjectWrapper(this)), | 
					
						
							| 
									
										
										
										
											2016-08-10 15:50:00 -03:00
										 |  |  | 	location_settings(new LocationServiceSettingsObjectWrapper(this)), | 
					
						
							| 
									
										
										
										
											2016-08-10 18:10:15 -03:00
										 |  |  | 	update_manager_settings(new UpdateManagerSettings(this)), | 
					
						
							|  |  |  | 	dive_computer_settings(new DiveComputerSettings(this)) | 
					
						
							| 
									
										
										
										
											2016-01-22 18:37:18 -02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 16:01:31 -03:00
										 |  |  | void SettingsObjectWrapper::load() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | 	QVariant v; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	uiLanguage(NULL); | 
					
						
							|  |  |  | 	s.beginGroup("Units"); | 
					
						
							|  |  |  | 	if (s.value("unit_system").toString() == "metric") { | 
					
						
							|  |  |  | 		prefs.unit_system = METRIC; | 
					
						
							|  |  |  | 		prefs.units = SI_units; | 
					
						
							|  |  |  | 	} else if (s.value("unit_system").toString() == "imperial") { | 
					
						
							|  |  |  | 		prefs.unit_system = IMPERIAL; | 
					
						
							|  |  |  | 		prefs.units = IMPERIAL_units; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		prefs.unit_system = PERSONALIZE; | 
					
						
							|  |  |  | 		GET_UNIT("length", length, units::FEET, units::METERS); | 
					
						
							|  |  |  | 		GET_UNIT("pressure", pressure, units::PSI, units::BAR); | 
					
						
							|  |  |  | 		GET_UNIT("volume", volume, units::CUFT, units::LITER); | 
					
						
							|  |  |  | 		GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS); | 
					
						
							|  |  |  | 		GET_UNIT("weight", weight, units::LBS, units::KG); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS); | 
					
						
							|  |  |  | 	GET_BOOL("coordinates", coordinates_traditional); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 	s.beginGroup("TecDetails"); | 
					
						
							|  |  |  | 	GET_BOOL("po2graph", pp_graphs.po2); | 
					
						
							|  |  |  | 	GET_BOOL("pn2graph", pp_graphs.pn2); | 
					
						
							|  |  |  | 	GET_BOOL("phegraph", pp_graphs.phe); | 
					
						
							|  |  |  | 	GET_DOUBLE("po2threshold", pp_graphs.po2_threshold); | 
					
						
							|  |  |  | 	GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold); | 
					
						
							|  |  |  | 	GET_DOUBLE("phethreshold", pp_graphs.phe_threshold); | 
					
						
							|  |  |  | 	GET_BOOL("mod", mod); | 
					
						
							|  |  |  | 	GET_DOUBLE("modpO2", modpO2); | 
					
						
							|  |  |  | 	GET_BOOL("ead", ead); | 
					
						
							|  |  |  | 	GET_BOOL("redceiling", redceiling); | 
					
						
							|  |  |  | 	GET_BOOL("dcceiling", dcceiling); | 
					
						
							|  |  |  | 	GET_BOOL("calcceiling", calcceiling); | 
					
						
							|  |  |  | 	GET_BOOL("calcceiling3m", calcceiling3m); | 
					
						
							|  |  |  | 	GET_BOOL("calcndltts", calcndltts); | 
					
						
							|  |  |  | 	GET_BOOL("calcalltissues", calcalltissues); | 
					
						
							|  |  |  | 	GET_BOOL("hrgraph", hrgraph); | 
					
						
							|  |  |  | 	GET_BOOL("tankbar", tankbar); | 
					
						
							|  |  |  | 	GET_BOOL("RulerBar", rulergraph); | 
					
						
							|  |  |  | 	GET_BOOL("percentagegraph", percentagegraph); | 
					
						
							|  |  |  | 	GET_INT("gflow", gflow); | 
					
						
							|  |  |  | 	GET_INT("gfhigh", gfhigh); | 
					
						
							| 
									
										
										
										
											2016-09-24 18:02:08 +10:00
										 |  |  | 	GET_INT("vpmb_conservatism", vpmb_conservatism); | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | 	GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth); | 
					
						
							|  |  |  | 	GET_BOOL("show_ccr_setpoint",show_ccr_setpoint); | 
					
						
							|  |  |  | 	GET_BOOL("show_ccr_sensors",show_ccr_sensors); | 
					
						
							|  |  |  | 	GET_BOOL("zoomed_plot", zoomed_plot); | 
					
						
							|  |  |  | 	set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); | 
					
						
							| 
									
										
										
										
											2016-09-24 18:02:08 +10:00
										 |  |  | 	set_vpmb_conservatism(prefs.vpmb_conservatism); | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | 	GET_BOOL("show_sac", show_sac); | 
					
						
							|  |  |  | 	GET_BOOL("display_unused_tanks", display_unused_tanks); | 
					
						
							|  |  |  | 	GET_BOOL("show_average_depth", show_average_depth); | 
					
						
							| 
									
										
										
										
											2016-08-28 19:24:44 -03:00
										 |  |  | 	GET_BOOL("show_pictures_in_profile", show_pictures_in_profile); | 
					
						
							| 
									
										
										
										
											2016-11-01 17:00:06 +01:00
										 |  |  | 	prefs.display_deco_mode =  (deco_mode) s.value("display_deco_mode").toInt(); | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	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); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	s.beginGroup("Display"); | 
					
						
							|  |  |  | 	// get the font from the settings or our defaults
 | 
					
						
							|  |  |  | 	// respect the system default font size if none is explicitly set
 | 
					
						
							|  |  |  | 	QFont defaultFont = s.value("divelist_font", prefs.divelist_font).value<QFont>(); | 
					
						
							|  |  |  | 	if (IS_FP_SAME(system_divelist_default_font_size, -1.0)) { | 
					
						
							|  |  |  | 		prefs.font_size = qApp->font().pointSizeF(); | 
					
						
							|  |  |  | 		system_divelist_default_font_size = prefs.font_size; // this way we don't save it on exit
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	prefs.font_size = s.value("font_size", prefs.font_size).toFloat(); | 
					
						
							|  |  |  | 	// painful effort to ignore previous default fonts on Windows - ridiculous
 | 
					
						
							|  |  |  | 	QString fontName = defaultFont.toString(); | 
					
						
							|  |  |  | 	if (fontName.contains(",")) | 
					
						
							|  |  |  | 		fontName = fontName.left(fontName.indexOf(",")); | 
					
						
							|  |  |  | 	if (subsurface_ignore_font(fontName.toUtf8().constData())) { | 
					
						
							|  |  |  | 		defaultFont = QFont(prefs.divelist_font); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		free((void *)prefs.divelist_font); | 
					
						
							|  |  |  | 		prefs.divelist_font = strdup(fontName.toUtf8().constData()); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	defaultFont.setPointSizeF(prefs.font_size); | 
					
						
							|  |  |  | 	qApp->setFont(defaultFont); | 
					
						
							|  |  |  | 	GET_INT("displayinvalid", display_invalid_dives); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	s.beginGroup("Animations"); | 
					
						
							|  |  |  | 	GET_INT("animation_speed", animation_speed); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	s.beginGroup("Network"); | 
					
						
							|  |  |  | 	GET_INT_DEF("proxy_type", proxy_type, QNetworkProxy::DefaultProxy); | 
					
						
							|  |  |  | 	GET_TXT("proxy_host", proxy_host); | 
					
						
							|  |  |  | 	GET_INT("proxy_port", proxy_port); | 
					
						
							|  |  |  | 	GET_BOOL("proxy_auth", proxy_auth); | 
					
						
							|  |  |  | 	GET_TXT("proxy_user", proxy_user); | 
					
						
							|  |  |  | 	GET_TXT("proxy_pass", proxy_pass); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	s.beginGroup("CloudStorage"); | 
					
						
							|  |  |  | 	GET_TXT("email", cloud_storage_email); | 
					
						
							|  |  |  | #ifndef SUBSURFACE_MOBILE
 | 
					
						
							|  |  |  | 	GET_BOOL("save_password_local", save_password_local); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 	// always save the password in Subsurface-mobile
 | 
					
						
							|  |  |  | 	prefs.save_password_local = true; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	if (prefs.save_password_local) { // GET_TEXT macro is not a single statement
 | 
					
						
							|  |  |  | 		GET_TXT("password", cloud_storage_password); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	GET_INT("cloud_verification_status", cloud_verification_status); | 
					
						
							|  |  |  | 	GET_BOOL("cloud_background_sync", cloud_background_sync); | 
					
						
							|  |  |  | 	GET_BOOL("git_local_only", git_local_only); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// creating the git url here is simply a convenience when C code wants
 | 
					
						
							|  |  |  | 	// to compare against that git URL - it's always derived from the base URL
 | 
					
						
							|  |  |  | 	GET_TXT("cloud_base_url", cloud_base_url); | 
					
						
							|  |  |  | 	prefs.cloud_git_url = strdup(qPrintable(QString(prefs.cloud_base_url) + "/git")); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Subsurface webservice id is stored outside of the groups
 | 
					
						
							|  |  |  | 	GET_TXT("subsurface_webservice_uid", userid); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// GeoManagement
 | 
					
						
							|  |  |  | 	s.beginGroup("geocoding"); | 
					
						
							| 
									
										
										
										
											2016-10-15 20:18:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | 	GET_BOOL("enable_geocoding", geocoding.enable_geocoding); | 
					
						
							| 
									
										
										
										
											2016-10-15 20:18:56 +02:00
										 |  |  | 	GET_BOOL("parse_dives_without_gps", geocoding.parse_dive_without_gps); | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03:00
										 |  |  | 	GET_BOOL("tag_existing_dives", geocoding.tag_existing_dives); | 
					
						
							| 
									
										
										
										
											2016-10-15 20:18:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 16:52:51 -03: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
 | 
					
						
							|  |  |  | 	s.beginGroup("LocationService"); | 
					
						
							|  |  |  | 	GET_INT("time_threshold", time_threshold); | 
					
						
							|  |  |  | 	GET_INT("distance_threshold", distance_threshold); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 16:01:31 -03:00
										 |  |  | 	s.beginGroup("Planner"); | 
					
						
							| 
									
										
										
										
											2016-11-01 14:35:56 +01:00
										 |  |  | 	GET_BOOL("last_stop", last_stop); | 
					
						
							|  |  |  | 	GET_BOOL("verbatim_plan", verbatim_plan); | 
					
						
							|  |  |  | 	GET_BOOL("display_duration", display_duration); | 
					
						
							|  |  |  | 	GET_BOOL("display_runtime", display_runtime); | 
					
						
							|  |  |  | 	GET_BOOL("display_transitions", display_transitions); | 
					
						
							|  |  |  | 	GET_BOOL("safetystop", safetystop); | 
					
						
							|  |  |  | 	GET_BOOL("doo2breaks", doo2breaks); | 
					
						
							|  |  |  | 	GET_BOOL("switch_at_req_stop",switch_at_req_stop); | 
					
						
							|  |  |  | 	GET_BOOL("drop_stone_mode", drop_stone_mode); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	GET_INT("reserve_gas", reserve_gas); | 
					
						
							|  |  |  | 	GET_INT("ascrate75", ascrate75); | 
					
						
							|  |  |  | 	GET_INT("ascrate50", ascrate50); | 
					
						
							|  |  |  | 	GET_INT("ascratestops", ascratestops); | 
					
						
							|  |  |  | 	GET_INT("ascratelast6m", ascratelast6m); | 
					
						
							|  |  |  | 	GET_INT("descrate", descrate); | 
					
						
							|  |  |  | 	GET_INT("bottompo2", bottompo2); | 
					
						
							|  |  |  | 	GET_INT("decopo2", decopo2); | 
					
						
							|  |  |  | 	GET_INT("bestmixend", bestmixend.mm); | 
					
						
							|  |  |  | 	GET_INT("min_switch_duration", min_switch_duration); | 
					
						
							|  |  |  | 	GET_INT("bottomsac", bottomsac); | 
					
						
							|  |  |  | 	GET_INT("decosac", decosac); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	prefs.deco_mode = deco_mode(s.value("deco_mode", default_prefs.deco_mode).toInt()); | 
					
						
							| 
									
										
										
										
											2016-08-26 16:01:31 -03:00
										 |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-25 10:34:30 -07:00
										 |  |  | 	s.beginGroup("DiveComputer"); | 
					
						
							|  |  |  | 	GET_TXT("dive_computer_vendor",dive_computer.vendor); | 
					
						
							|  |  |  | 	GET_TXT("dive_computer_product", dive_computer.product); | 
					
						
							|  |  |  | 	GET_TXT("dive_computer_device", dive_computer.device); | 
					
						
							|  |  |  | 	GET_INT("dive_computer_download_mode", dive_computer.download_mode); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 17:11:12 -03:00
										 |  |  | 	s.beginGroup("UpdateManager"); | 
					
						
							| 
									
										
										
										
											2016-08-27 12:26:13 -07:00
										 |  |  | 	prefs.update_manager.dont_check_exists = s.contains("DontCheckForUpdates"); | 
					
						
							| 
									
										
										
										
											2016-11-01 14:42:26 +01:00
										 |  |  | 	GET_BOOL("DontCheckForUpdates", update_manager.dont_check_for_updates); | 
					
						
							|  |  |  | 	GET_TXT("LastVersionUsed", update_manager.last_version_used); | 
					
						
							| 
									
										
										
										
											2016-11-01 11:57:28 +01:00
										 |  |  | 	prefs.update_manager.next_check = copy_string(qPrintable(s.value("NextCheck").toDate().toString("dd/MM/yyyy"))); | 
					
						
							| 
									
										
										
										
											2016-08-26 17:11:12 -03:00
										 |  |  | 	s.endGroup(); | 
					
						
							| 
									
										
										
										
											2016-10-28 11:57:41 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	s.beginGroup("Language"); | 
					
						
							| 
									
										
										
										
											2016-11-01 14:42:26 +01:00
										 |  |  | 	GET_BOOL("UseSystemLanguage", locale.use_system_language); | 
					
						
							|  |  |  | 	GET_TXT("UiLanguage", locale.language); | 
					
						
							|  |  |  | 	GET_TXT("UiLangLocale", locale.lang_locale); | 
					
						
							|  |  |  | 	GET_TXT("time_format", time_format); | 
					
						
							|  |  |  | 	GET_TXT("date_format", date_format); | 
					
						
							|  |  |  | 	GET_TXT("date_format_short", date_format_short); | 
					
						
							| 
									
										
										
										
											2016-11-01 15:44:30 +01:00
										 |  |  | 	GET_BOOL("time_format_override", time_format_override); | 
					
						
							|  |  |  | 	GET_BOOL("date_format_override", date_format_override); | 
					
						
							| 
									
										
										
										
											2016-10-28 11:57:41 +02:00
										 |  |  | 	s.endGroup(); | 
					
						
							| 
									
										
										
										
											2016-08-26 16:01:31 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void SettingsObjectWrapper::sync() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	QSettings s; | 
					
						
							|  |  |  | 	s.beginGroup("Planner"); | 
					
						
							|  |  |  | 	s.setValue("last_stop", prefs.last_stop); | 
					
						
							|  |  |  | 	s.setValue("verbatim_plan", prefs.verbatim_plan); | 
					
						
							|  |  |  | 	s.setValue("display_duration", prefs.display_duration); | 
					
						
							|  |  |  | 	s.setValue("display_runtime", prefs.display_runtime); | 
					
						
							|  |  |  | 	s.setValue("display_transitions", prefs.display_transitions); | 
					
						
							|  |  |  | 	s.setValue("safetystop", prefs.safetystop); | 
					
						
							|  |  |  | 	s.setValue("reserve_gas", prefs.reserve_gas); | 
					
						
							|  |  |  | 	s.setValue("ascrate75", prefs.ascrate75); | 
					
						
							|  |  |  | 	s.setValue("ascrate50", prefs.ascrate50); | 
					
						
							|  |  |  | 	s.setValue("ascratestops", prefs.ascratestops); | 
					
						
							|  |  |  | 	s.setValue("ascratelast6m", prefs.ascratelast6m); | 
					
						
							|  |  |  | 	s.setValue("descrate", prefs.descrate); | 
					
						
							|  |  |  | 	s.setValue("bottompo2", prefs.bottompo2); | 
					
						
							|  |  |  | 	s.setValue("decopo2", prefs.decopo2); | 
					
						
							|  |  |  | 	s.setValue("bestmixend", prefs.bestmixend.mm); | 
					
						
							|  |  |  | 	s.setValue("doo2breaks", prefs.doo2breaks); | 
					
						
							|  |  |  | 	s.setValue("drop_stone_mode", prefs.drop_stone_mode); | 
					
						
							|  |  |  | 	s.setValue("switch_at_req_stop", prefs.switch_at_req_stop); | 
					
						
							|  |  |  | 	s.setValue("min_switch_duration", prefs.min_switch_duration); | 
					
						
							|  |  |  | 	s.setValue("bottomsac", prefs.bottomsac); | 
					
						
							|  |  |  | 	s.setValue("decosac", prefs.decosac); | 
					
						
							|  |  |  | 	s.setValue("deco_mode", int(prefs.deco_mode)); | 
					
						
							|  |  |  | 	s.endGroup(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 15:54:23 -02:00
										 |  |  | SettingsObjectWrapper* SettingsObjectWrapper::instance() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	static SettingsObjectWrapper settings; | 
					
						
							|  |  |  | 	return &settings; | 
					
						
							|  |  |  | } |