2016-01-11 21:40:07 +00:00
|
|
|
#include "SettingsObjectWrapper.h"
|
|
|
|
#include <QSettings>
|
2016-01-13 19:09:46 +00:00
|
|
|
#include "../dive.h" // TODO: remove copy_string from dive.h
|
|
|
|
|
2016-01-11 21:40:07 +00:00
|
|
|
|
|
|
|
static QString tecDetails = QStringLiteral("TecDetails");
|
|
|
|
|
|
|
|
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 19:13:10 +00:00
|
|
|
void PartialPressureGasSettings::setShowPo2(short value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("po2graph", value);
|
|
|
|
prefs.pp_graphs.po2 = value;
|
|
|
|
emit showPo2Changed(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setShowPn2(short value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("pn2graph", value);
|
|
|
|
prefs.pp_graphs.pn2 = value;
|
|
|
|
emit showPn2Changed(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setShowPhe(short value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("phegraph", value);
|
|
|
|
prefs.pp_graphs.phe = value;
|
|
|
|
emit showPheChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setPo2Threshold(double value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("po2threshold", value);
|
|
|
|
prefs.pp_graphs.po2_threshold = value;
|
|
|
|
emit po2ThresholdChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setPn2Threshold(double value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("pn2threshold", value);
|
|
|
|
prefs.pp_graphs.pn2_threshold = value;
|
|
|
|
emit pn2ThresholdChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PartialPressureGasSettings::setPheThreshold(double value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("phethreshold", value);
|
|
|
|
prefs.pp_graphs.phe_threshold = value;
|
|
|
|
emit pheThresholdChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double TechnicalDetailsSettings:: modp02() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.modpO2;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::ead() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.ead;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::dcceiling() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.dcceiling;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::redceiling() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.redceiling;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::calcceiling() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.calcceiling;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::calcceiling3m() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.calcceiling3m;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::calcalltissues() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.calcalltissues;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::calcndltts() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.calcndltts;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::gflow() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.gflow;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::gfhigh() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.gfhigh;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::hrgraph() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.hrgraph;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::tankBar() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.tankbar;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::percentageGraph() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.percentagegraph;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::rulerGraph() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.rulergraph;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
bool TechnicalDetailsSettings::showCCRSetpoint() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.show_ccr_setpoint;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
bool TechnicalDetailsSettings::showCCRSensors() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.show_ccr_sensors;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::zoomedPlot() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.zoomed_plot;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::showSac() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.show_sac;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
bool TechnicalDetailsSettings::gfLowAtMaxDepth() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.gf_low_at_maxdepth;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::displayUnusedTanks() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.display_unused_tanks;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short TechnicalDetailsSettings::showAverageDepth() const
|
2016-01-11 21:58:33 +00:00
|
|
|
{
|
|
|
|
return prefs.show_average_depth;
|
|
|
|
}
|
|
|
|
|
2016-01-13 19:13:10 +00:00
|
|
|
short int TechnicalDetailsSettings::mod() const
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
return prefs.mod;
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setModpO2(double value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("modpO2", value);
|
|
|
|
prefs.modpO2 = value;
|
|
|
|
emit modpO2Changed(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setEad(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("ead", value);
|
|
|
|
prefs.ead = value;
|
|
|
|
emit eadChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setMod(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("mod", value);
|
|
|
|
prefs.mod = value;
|
|
|
|
emit modChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setDcceiling(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("dcceiling", value);
|
|
|
|
prefs.dcceiling = value;
|
|
|
|
emit dcceilingChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setRedceiling(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("redceiling", value);
|
|
|
|
prefs.redceiling = value;
|
|
|
|
emit redceilingChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setCalcceiling(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("calcceiling", value);
|
|
|
|
prefs.calcceiling = value;
|
|
|
|
emit calcceilingChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setCalcceiling3m(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("calcceiling3m", value);
|
|
|
|
prefs.calcceiling3m = value;
|
|
|
|
emit calcceiling3mChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setCalcalltissues(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("calcalltissues", value);
|
|
|
|
prefs.calcalltissues = value;
|
|
|
|
emit calcalltissuesChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setCalcndltts(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("calcndltts", value);
|
|
|
|
prefs.calcndltts = value;
|
|
|
|
emit calcndlttsChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setGflow(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("gflow", value);
|
|
|
|
prefs.gflow = value;
|
|
|
|
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
|
|
|
|
emit gflowChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setGfhigh(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("gfhigh", value);
|
|
|
|
prefs.gfhigh = value;
|
|
|
|
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
|
|
|
|
emit gfhighChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setHRgraph(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("hrgraph", value);
|
|
|
|
prefs.hrgraph = value;
|
|
|
|
emit hrgraphChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setTankBar(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("tankbar", value);
|
|
|
|
prefs.tankbar = value;
|
|
|
|
emit tankBarChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setPercentageGraph(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("percentagegraph", value);
|
|
|
|
prefs.percentagegraph = value;
|
|
|
|
emit percentageGraphChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setRulerGraph(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
/* TODO: search for the QSettings of the RulerBar */
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
2016-01-13 19:53:22 +00:00
|
|
|
s.setValue("RulerBar", value);
|
2016-01-11 22:33:50 +00:00
|
|
|
prefs.pp_graphs.phe_threshold = value;
|
2016-01-13 19:53:22 +00:00
|
|
|
emit rulerGraphChanged(value);
|
2016-01-11 22:33:50 +00:00
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setShowCCRSetpoint(bool value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("show_ccr_setpoint", value);
|
|
|
|
prefs.show_ccr_setpoint = value;
|
|
|
|
emit showCCRSetpointChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setShowCCRSensors(bool value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("show_ccr_sensors", value);
|
|
|
|
prefs.show_ccr_sensors = value;
|
|
|
|
emit showCCRSensorsChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setZoomedPlot(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("zoomed_plot", value);
|
|
|
|
prefs.zoomed_plot = value;
|
|
|
|
emit zoomedPlotChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setShowSac(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("show_sac", value);
|
|
|
|
prefs.show_sac = value;
|
|
|
|
emit showSacChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setGfLowAtMaxDepth(bool value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
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-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setDisplayUnusedTanks(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("display_unused_tanks", value);
|
|
|
|
prefs.display_unused_tanks = value;
|
|
|
|
emit displayUnusedTanksChanged(value);
|
|
|
|
}
|
|
|
|
|
2016-01-11 22:37:54 +00:00
|
|
|
void TechnicalDetailsSettings::setShowAverageDepth(short value)
|
2016-01-11 22:33:50 +00:00
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(tecDetails);
|
|
|
|
s.setValue("show_average_depth", value);
|
|
|
|
prefs.show_average_depth = value;
|
|
|
|
emit showAverageDepthChanged(value);
|
|
|
|
}
|
2016-01-13 19:09:46 +00:00
|
|
|
|
|
|
|
FacebookSettings::FacebookSettings(QObject *parent) :
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
#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)
|
|
|
|
{
|
|
|
|
#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 19:36:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GeocodingPreferences::GeocodingPreferences(QObject *parent) :
|
|
|
|
group(QStringLiteral("geocoding"))
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("enable_geocoding", value);
|
|
|
|
prefs.geocoding.enable_geocoding = value;
|
|
|
|
emit enableGeocodingChanged(value);
|
|
|
|
}
|
2016-01-13 19:53:22 +00:00
|
|
|
|
2016-01-13 19:36:11 +00:00
|
|
|
void GeocodingPreferences::setParseDiveWithoutGps(bool value)
|
|
|
|
{
|
|
|
|
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 19:53:22 +00:00
|
|
|
|
2016-01-13 19:36:11 +00:00
|
|
|
void GeocodingPreferences::setTagExistingDives(bool value)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("cat0", value);
|
|
|
|
prefs.show_average_depth = value;
|
|
|
|
emit firstTaxonomyCategoryChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeocodingPreferences::setSecondTaxonomyCategory(taxonomy_category value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("cat1", value);
|
|
|
|
prefs.show_average_depth = value;
|
|
|
|
emit secondTaxonomyCategoryChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("cat2", value);
|
|
|
|
prefs.show_average_depth = value;
|
|
|
|
emit thirdTaxonomyCategoryChanged(value);
|
2016-01-14 13:55:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ProxySettings::ProxySettings(QObject *parent) :
|
|
|
|
group(QStringLiteral("Network"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProxySettings::type() const
|
|
|
|
{
|
|
|
|
return prefs.proxy_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ProxySettings::host() const
|
|
|
|
{
|
|
|
|
return prefs.proxy_host;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProxySettings::port() const
|
|
|
|
{
|
|
|
|
return prefs.proxy_port;
|
|
|
|
}
|
|
|
|
|
|
|
|
short ProxySettings::auth() const
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("proxy_type", value);
|
|
|
|
prefs.proxy_type = value;
|
|
|
|
emit typeChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxySettings::setHost(const QString& value)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("proxy_port", value);
|
|
|
|
prefs.proxy_port = value;
|
|
|
|
emit portChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxySettings::setAuth(short value)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("proxy_auth", value);
|
|
|
|
prefs.proxy_auth = value;
|
|
|
|
emit authChanged(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxySettings::setUser(const QString& value)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(group);
|
|
|
|
s.setValue("proxy_pass", value);
|
|
|
|
free(prefs.proxy_pass);
|
|
|
|
prefs.proxy_pass = copy_string(qPrintable(value));
|
|
|
|
emit passChanged(value);
|
|
|
|
}
|