With a few more additions. :) There's a new class, that's not being used yet (because it's not finished) that will control the Widget / QML preferences part in a more dynamic way.
Tomaz
From f5de39be2a960ac6a1480aa26719689754dc4346 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 20:37:54 -0200 Subject: [PATCH 24/24] Splitted PartialPressureGasSettings with TechnicalDetailsSettings It was becomming too big, a smaller class is nicer to work wirh Signed-off-by: Tomaz Canabrava <[email protected]> --- .../subsurface-qt/SettingsObjectWrapper.cpp | 44 +++++++++---------- .../subsurface-qt/SettingsObjectWrapper.h | 50 ++++++++++++++-------- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index 8bb5877..ccb38b6 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -197,7 +197,7 @@ void PartialPressureGasSettings::setPheThreshold(double value) emit pheThresholdChanged(value); } -void PartialPressureGasSettings::setModpO2(double value) +void TechnicalDetailsSettings::setModpO2(double value) { QSettings s; s.beginGroup(tecDetails); @@ -206,7 +206,7 @@ void PartialPressureGasSettings::setModpO2(double value) emit modpO2Changed(value); } -void PartialPressureGasSettings::setEad(short value) +void TechnicalDetailsSettings::setEad(short value) { QSettings s; s.beginGroup(tecDetails); @@ -215,7 +215,7 @@ void PartialPressureGasSettings::setEad(short value) emit eadChanged(value); } -void PartialPressureGasSettings::setMod(short value) +void TechnicalDetailsSettings::setMod(short value) { QSettings s; s.beginGroup(tecDetails); @@ -224,7 +224,7 @@ void PartialPressureGasSettings::setMod(short value) emit modChanged(value); } -void PartialPressureGasSettings::setDcceiling(short value) +void TechnicalDetailsSettings::setDcceiling(short value) { QSettings s; s.beginGroup(tecDetails); @@ -233,7 +233,7 @@ void PartialPressureGasSettings::setDcceiling(short value) emit dcceilingChanged(value); } -void PartialPressureGasSettings::setRedceiling(short value) +void TechnicalDetailsSettings::setRedceiling(short value) { QSettings s; s.beginGroup(tecDetails); @@ -242,7 +242,7 @@ void PartialPressureGasSettings::setRedceiling(short value) emit redceilingChanged(value); } -void PartialPressureGasSettings::setCalcceiling(short value) +void TechnicalDetailsSettings::setCalcceiling(short value) { QSettings s; s.beginGroup(tecDetails); @@ -251,7 +251,7 @@ void PartialPressureGasSettings::setCalcceiling(short value) emit calcceilingChanged(value); } -void PartialPressureGasSettings::setCalcceiling3m(short value) +void TechnicalDetailsSettings::setCalcceiling3m(short value) { QSettings s; s.beginGroup(tecDetails); @@ -260,7 +260,7 @@ void PartialPressureGasSettings::setCalcceiling3m(short value) emit calcceiling3mChanged(value); } -void PartialPressureGasSettings::setCalcalltissues(short value) +void TechnicalDetailsSettings::setCalcalltissues(short value) { QSettings s; s.beginGroup(tecDetails); @@ -269,7 +269,7 @@ void PartialPressureGasSettings::setCalcalltissues(short value) emit calcalltissuesChanged(value); } -void PartialPressureGasSettings::setCalcndltts(short value) +void TechnicalDetailsSettings::setCalcndltts(short value) { QSettings s; s.beginGroup(tecDetails); @@ -278,7 +278,7 @@ void PartialPressureGasSettings::setCalcndltts(short value) emit calcndlttsChanged(value); } -void PartialPressureGasSettings::setGflow(short value) +void TechnicalDetailsSettings::setGflow(short value) { QSettings s; s.beginGroup(tecDetails); @@ -288,7 +288,7 @@ void PartialPressureGasSettings::setGflow(short value) emit gflowChanged(value); } -void PartialPressureGasSettings::setGfhigh(short value) +void TechnicalDetailsSettings::setGfhigh(short value) { QSettings s; s.beginGroup(tecDetails); @@ -298,7 +298,7 @@ void PartialPressureGasSettings::setGfhigh(short value) emit gfhighChanged(value); } -void PartialPressureGasSettings::setHRgraph(short value) +void TechnicalDetailsSettings::setHRgraph(short value) { QSettings s; s.beginGroup(tecDetails); @@ -307,7 +307,7 @@ void PartialPressureGasSettings::setHRgraph(short value) emit hrgraphChanged(value); } -void PartialPressureGasSettings::setTankBar(short value) +void TechnicalDetailsSettings::setTankBar(short value) { QSettings s; s.beginGroup(tecDetails); @@ -316,7 +316,7 @@ void PartialPressureGasSettings::setTankBar(short value) emit tankBarChanged(value); } -void PartialPressureGasSettings::setPercentageGraph(short value) +void TechnicalDetailsSettings::setPercentageGraph(short value) { QSettings s; s.beginGroup(tecDetails); @@ -325,7 +325,7 @@ void PartialPressureGasSettings::setPercentageGraph(short value) emit percentageGraphChanged(value); } -void PartialPressureGasSettings::setRulerGraph(short value) +void TechnicalDetailsSettings::setRulerGraph(short value) { /* TODO: search for the QSettings of the RulerBar */ QSettings s; @@ -335,7 +335,7 @@ void PartialPressureGasSettings::setRulerGraph(short value) emit pheThresholdChanged(value); } -void PartialPressureGasSettings::setShowCCRSetpoint(bool value) +void TechnicalDetailsSettings::setShowCCRSetpoint(bool value) { QSettings s; s.beginGroup(tecDetails); @@ -344,7 +344,7 @@ void PartialPressureGasSettings::setShowCCRSetpoint(bool value) emit showCCRSetpointChanged(value); } -void PartialPressureGasSettings::setShowCCRSensors(bool value) +void TechnicalDetailsSettings::setShowCCRSensors(bool value) { QSettings s; s.beginGroup(tecDetails); @@ -353,7 +353,7 @@ void PartialPressureGasSettings::setShowCCRSensors(bool value) emit showCCRSensorsChanged(value); } -void PartialPressureGasSettings::setZoomedPlot(short value) +void TechnicalDetailsSettings::setZoomedPlot(short value) { QSettings s; s.beginGroup(tecDetails); @@ -362,7 +362,7 @@ void PartialPressureGasSettings::setZoomedPlot(short value) emit zoomedPlotChanged(value); } -void PartialPressureGasSettings::setShowSac(short value) +void TechnicalDetailsSettings::setShowSac(short value) { QSettings s; s.beginGroup(tecDetails); @@ -371,7 +371,7 @@ void PartialPressureGasSettings::setShowSac(short value) emit showSacChanged(value); } -void PartialPressureGasSettings::setGfLowAtMaxDepth(bool value) +void TechnicalDetailsSettings::setGfLowAtMaxDepth(bool value) { QSettings s; s.beginGroup(tecDetails); @@ -381,7 +381,7 @@ void PartialPressureGasSettings::setGfLowAtMaxDepth(bool value) emit gfLowAtMaxDepthChanged(value); } -void PartialPressureGasSettings::setDisplayUnusedTanks(short value) +void TechnicalDetailsSettings::setDisplayUnusedTanks(short value) { QSettings s; s.beginGroup(tecDetails); @@ -390,7 +390,7 @@ void PartialPressureGasSettings::setDisplayUnusedTanks(short value) emit displayUnusedTanksChanged(value); } -void PartialPressureGasSettings::setShowAverageDepth(short value) +void TechnicalDetailsSettings::setShowAverageDepth(short value) { QSettings s; s.beginGroup(tecDetails); diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h index 411a456..a42b00c 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -20,6 +20,34 @@ class PartialPressureGasSettings : public QObject { Q_PROPERTY(double po2_threshold READ po2Threshold WRITE setPo2Threshold NOTIFY po2ThresholdChanged) Q_PROPERTY(double pn2_threshold READ pn2Threshold WRITE setPn2Threshold NOTIFY pn2ThresholdChanged) Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged) + +public: + PartialPressureGasSettings(QObject *parent); + short showPo2() const; + short showPn2() const; + short showPhe() const; + double po2Threshold() const; + double pn2Threshold() const; + double pheThreshold() const; + +public slots: + void setShowPo2(short value); + void setShowPn2(short value); + void setShowPhe(short value); + void setPo2Threshold(double value); + void setPn2Threshold(double value); + void setPheThreshold(double value); + +signals: + void showPo2Changed(short value); + void showPn2Changed(short value); + void showPheChanged(short value); + void po2ThresholdChanged(double value); + void pn2ThresholdChanged(double value); + void pheThresholdChanged(double value); +}; + +class TechnicalDetailsSettings : public QObject { Q_PROPERTY(double modpO2 READ modp02 WRITE setModp02 NOTIFY modpO2Changed) Q_PROPERTY(short ead READ ead WRITE setEad NOTIFY eadChanged) Q_PROPERTY(short mod READ mod WRITE setMod NOTIFY modChanged); @@ -44,13 +72,8 @@ class PartialPressureGasSettings : public QObject { Q_PROPERTY(short show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged) public: - PartialPressureGasSettings(QObject *parent); - short showPo2() const; - short showPn2() const; - short showPhe() const; - double po2Threshold() const; - double pn2Threshold() const; - double pheThreshold() const; + TechnicalDetailsSettings(QObject *parent); + double modp02() const; short ead() const; short mod() const; @@ -75,12 +98,6 @@ public: short showAverageDepth() const; public slots: - void setShowPo2(short value); - void setShowPn2(short value); - void setShowPhe(short value); - void setPo2Threshold(double value); - void setPn2Threshold(double value); - void setPheThreshold(double value); void setMod(short value); void setModp02(double value); void setEad(short value); @@ -105,12 +122,6 @@ public slots: void setShowAverageDepth(short value); signals: - void showPo2Changed(short value); - void showPn2Changed(short value); - void showPheChanged(short value); - void po2ThresholdChanged(double value); - void pn2ThresholdChanged(double value); - void pheThresholdChanged(double value); void modpO2Changed(double value); void eadChanged(short value); void modChanged(short value); @@ -236,6 +247,7 @@ class SettingsObjectWrapper : public QObject { Q_PROPERTY(int distance_threshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged) Q_PROPERTY(bool git_local_only READ gitLocalOnly WRITE setGitLocalOnly NOTIFY gitLocalOnlyChanged) + TechnicalDetailsSettings *techDetails; PartialPressureGasSettings *pp_gas; FacebookSettings *facebook; GeocodingPreferences *geocoding; -- 2.7.0
From 1f319fb35c853f51d6f07d4d18288ebfeb657627 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 20:33:50 -0200 Subject: [PATCH 23/24] Finish PartialPressureGasSettings Signed-off-by: Tomaz Canabrava <[email protected]> --- .../subsurface-qt/SettingsObjectWrapper.cpp | 209 ++++++++++++++++++++- .../subsurface-qt/SettingsObjectWrapper.h | 34 +++- 2 files changed, 237 insertions(+), 6 deletions(-) diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index c0706a2..8bb5877 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -138,6 +138,11 @@ short PartialPressureGasSettings::showAverageDepth() const return prefs.show_average_depth; } +short int PartialPressureGasSettings::mod() const +{ + return prefs.mod; +} + void PartialPressureGasSettings::setShowPo2(short value) { QSettings s; @@ -168,7 +173,7 @@ void PartialPressureGasSettings::setShowPhe(short value) void PartialPressureGasSettings::setPo2Threshold(double value) { QSettings s; - s.beginGroup(tecDetails); + s.beginGroup(tecDetails); s.setValue("po2threshold", value); prefs.pp_graphs.po2_threshold = value; emit po2ThresholdChanged(value); @@ -191,3 +196,205 @@ void PartialPressureGasSettings::setPheThreshold(double value) prefs.pp_graphs.phe_threshold = value; emit pheThresholdChanged(value); } + +void PartialPressureGasSettings::setModpO2(double value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("modpO2", value); + prefs.modpO2 = value; + emit modpO2Changed(value); +} + +void PartialPressureGasSettings::setEad(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("ead", value); + prefs.ead = value; + emit eadChanged(value); +} + +void PartialPressureGasSettings::setMod(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("mod", value); + prefs.mod = value; + emit modChanged(value); +} + +void PartialPressureGasSettings::setDcceiling(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("dcceiling", value); + prefs.dcceiling = value; + emit dcceilingChanged(value); +} + +void PartialPressureGasSettings::setRedceiling(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("redceiling", value); + prefs.redceiling = value; + emit redceilingChanged(value); +} + +void PartialPressureGasSettings::setCalcceiling(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("calcceiling", value); + prefs.calcceiling = value; + emit calcceilingChanged(value); +} + +void PartialPressureGasSettings::setCalcceiling3m(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("calcceiling3m", value); + prefs.calcceiling3m = value; + emit calcceiling3mChanged(value); +} + +void PartialPressureGasSettings::setCalcalltissues(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("calcalltissues", value); + prefs.calcalltissues = value; + emit calcalltissuesChanged(value); +} + +void PartialPressureGasSettings::setCalcndltts(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("calcndltts", value); + prefs.calcndltts = value; + emit calcndlttsChanged(value); +} + +void PartialPressureGasSettings::setGflow(short value) +{ + 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); +} + +void PartialPressureGasSettings::setGfhigh(short value) +{ + 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); +} + +void PartialPressureGasSettings::setHRgraph(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("hrgraph", value); + prefs.hrgraph = value; + emit hrgraphChanged(value); +} + +void PartialPressureGasSettings::setTankBar(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("tankbar", value); + prefs.tankbar = value; + emit tankBarChanged(value); +} + +void PartialPressureGasSettings::setPercentageGraph(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("percentagegraph", value); + prefs.percentagegraph = value; + emit percentageGraphChanged(value); +} + +void PartialPressureGasSettings::setRulerGraph(short value) +{ + /* TODO: search for the QSettings of the RulerBar */ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("phethreshold", value); + prefs.pp_graphs.phe_threshold = value; + emit pheThresholdChanged(value); +} + +void PartialPressureGasSettings::setShowCCRSetpoint(bool value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("show_ccr_setpoint", value); + prefs.show_ccr_setpoint = value; + emit showCCRSetpointChanged(value); +} + +void PartialPressureGasSettings::setShowCCRSensors(bool value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("show_ccr_sensors", value); + prefs.show_ccr_sensors = value; + emit showCCRSensorsChanged(value); +} + +void PartialPressureGasSettings::setZoomedPlot(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("zoomed_plot", value); + prefs.zoomed_plot = value; + emit zoomedPlotChanged(value); +} + +void PartialPressureGasSettings::setShowSac(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("show_sac", value); + prefs.show_sac = value; + emit showSacChanged(value); +} + +void PartialPressureGasSettings::setGfLowAtMaxDepth(bool value) +{ + 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); +} + +void PartialPressureGasSettings::setDisplayUnusedTanks(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("display_unused_tanks", value); + prefs.display_unused_tanks = value; + emit displayUnusedTanksChanged(value); +} + +void PartialPressureGasSettings::setShowAverageDepth(short value) +{ + QSettings s; + s.beginGroup(tecDetails); + s.setValue("show_average_depth", value); + prefs.show_average_depth = value; + emit showAverageDepthChanged(value); +} diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h index 3670205..411a456 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -22,6 +22,7 @@ class PartialPressureGasSettings : public QObject { Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged) Q_PROPERTY(double modpO2 READ modp02 WRITE setModp02 NOTIFY modpO2Changed) Q_PROPERTY(short ead READ ead WRITE setEad NOTIFY eadChanged) + Q_PROPERTY(short mod READ mod WRITE setMod NOTIFY modChanged); Q_PROPERTY(short dcceiling READ dcceiling WRITE setDCceiling NOTIFY dcceilingChanged) Q_PROPERTY(short redceiling READ redceiling WRITE setRedceiling NOTIFY redceilingChanged) Q_PROPERTY(short calcceiling READ calcceiling WRITE setCalcceiling NOTIFY calcceilingChanged) @@ -52,6 +53,7 @@ public: double pheThreshold() const; double modp02() const; short ead() const; + short mod() const; short dcceiling() const; short redceiling() const; short calcceiling() const; @@ -79,6 +81,28 @@ public slots: void setPo2Threshold(double value); void setPn2Threshold(double value); void setPheThreshold(double value); + void setMod(short value); + void setModp02(double value); + void setEad(short value); + void setDCceiling(short value); + void setRedceiling(short value); + void setCalcceiling(short value); + void setCalcceiling3m(short value); + void setCalcalltissues(short value); + void setCalcndltts(short value); + void setGflow(short value); + void setGfhigh(short value); + void setHRgraph(short value); + void setTankBar(short value); + void setPercentageGraph(short value); + void setRulerGraph(short value); + void setShowCCRSetpoint(bool value); + void setShowCCRSensors(bool value); + void setZoomedPlot(short value); + void setShowSac(short value); + void setGfLowAtMaxDepth(bool value); + void setDisplayUnusedTanks(short value); + void setShowAverageDepth(short value); signals: void showPo2Changed(short value); @@ -89,6 +113,7 @@ signals: void pheThresholdChanged(double value); void modpO2Changed(double value); void eadChanged(short value); + void modChanged(short value); void dcceilingChanged(short value); void redceilingChanged(short value); void calcceilingChanged(short value); @@ -170,11 +195,10 @@ class SettingsObjectWrapper : public QObject { Q_PROPERTY(QString cloud_git_url READ cloudGitUrl WRITE setCloudGitUrl NOTIFY cloudGitUrlChanged) Q_PROPERTY(QString time_format READ timeFormat WRITE setTimeFormat NOTIFY timeFormatChanged) Q_PROPERTY(QString date_format READ dateFormat WRITE setDateFormat NOTIFY dateFormatChanged) - Q_PROPERTY(QString date_format_short READ dateFormatShort WRITE setDateFormatShort NOTIFY dateFormatShortChanged) + Q_PROPERTY(QString date_format_short READ dateFormatShort WRITE setDateFormatShort NOTIFY dateFormatShortChanged) Q_PROPERTY(bool time_format_override READ timeFormatOverride WRITE setTimeFormatOverride NOTIFY timeFormatOverrideChanged) Q_PROPERTY(bool date_format_override READ dateFormatOverride WRITE setDateFormatOverride NOTIFY dateFormatOverrideChanged) Q_PROPERTY(double font_size READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) - Q_PROPERTY(short mod READ mod WRITE setMod NOTIFY modChanged); Q_PROPERTY(int animation_speed READ animationSpeed WRITE setAnimationSpeed NOTIFY animationSpeedChanged) Q_PROPERTY(short display_invalid_dives READ displayInvalidDives WRITE setDisplayInvalidDives NOTIFY displayInvalidDivesChanged) Q_PROPERTY(short unit_system READ unitSystem WRITE setUnitSystem NOTIFY uintSystemChanged) @@ -211,18 +235,18 @@ class SettingsObjectWrapper : public QObject { Q_PROPERTY(int time_threshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged) Q_PROPERTY(int distance_threshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged) Q_PROPERTY(bool git_local_only READ gitLocalOnly WRITE setGitLocalOnly NOTIFY gitLocalOnlyChanged) - + PartialPressureGasSettings *pp_gas; FacebookSettings *facebook; GeocodingPreferences *geocoding; ProxySettings *proxy; // Units struct units units; - + // Decompression Mode enum deco_mode deco_mode; }; - + public: SettingsObjectWrapper(QObject *parent = NULL); }; -- 2.7.0
From b1aa4d585b0366603cc2844e159d7068232c19d2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 20:06:01 -0200 Subject: [PATCH 22/24] Implemented missing signals for PartialPressureGasSettings Signed-off-by: Tomaz Canabrava <[email protected]> --- .../subsurface-qt/SettingsObjectWrapper.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h index b429085..3670205 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -79,6 +79,7 @@ public slots: void setPo2Threshold(double value); void setPn2Threshold(double value); void setPheThreshold(double value); + signals: void showPo2Changed(short value); void showPn2Changed(short value); @@ -86,6 +87,27 @@ signals: void po2ThresholdChanged(double value); void pn2ThresholdChanged(double value); void pheThresholdChanged(double value); + void modpO2Changed(double value); + void eadChanged(short value); + void dcceilingChanged(short value); + void redceilingChanged(short value); + void calcceilingChanged(short value); + void calcceiling3mChanged(short value); + void calcalltissuesChanged(short value); + void calcndlttsChanged(short value); + void gflowChanged(short value); + void gfhighChanged(short value); + void hrgraphChanged(short value); + void tankBarChanged(short value); + void percentageGraphChanged(short value); + void rulerGraphChanged(short value); + void showCCRSetpointChanged(bool value); + void showCCRSensorsChanged(bool value); + void zoomedPlotChanged(short value); + void showSacChanged(short value); + void gfLowAtMaxDepthChanged(bool value); + void displayUnusedTanksChanged(short value); + void showAverageDepthChanged(short value); }; /* Control the state of the Facebook preferences */ -- 2.7.0
From b278652b9fe90009dd7b676cade87b51b83101e7 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 19:58:33 -0200 Subject: [PATCH 21/24] Implement more reader accessors for PartialPressureGasSettings Also, the QtHelper.cpp file told me that some propertiies where also TecDetails, graph related, so I moved them to the correct preferences. Signed-off-by: Tomaz Canabrava <[email protected]> --- .../subsurface-qt/SettingsObjectWrapper.cpp | 105 +++++++++++++++++++++ .../subsurface-qt/SettingsObjectWrapper.h | 69 +++++++++----- 2 files changed, 149 insertions(+), 25 deletions(-) diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index d9b307a..c0706a2 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -33,6 +33,111 @@ double PartialPressureGasSettings::pheThreshold() const return prefs.pp_graphs.phe_threshold; } +double PartialPressureGasSettings:: modp02() const +{ + return prefs.modpO2; +} + +short PartialPressureGasSettings::ead() const +{ + return prefs.ead; +} + +short PartialPressureGasSettings::dcceiling() const +{ + return prefs.dcceiling; +} + +short PartialPressureGasSettings::redceiling() const +{ + return prefs.redceiling; +} + +short PartialPressureGasSettings::calcceiling() const +{ + return prefs.calcceiling; +} + +short PartialPressureGasSettings::calcceiling3m() const +{ + return prefs.calcceiling3m; +} + +short PartialPressureGasSettings::calcalltissues() const +{ + return prefs.calcalltissues; +} + +short PartialPressureGasSettings::calcndltts() const +{ + return prefs.calcndltts; +} + +short PartialPressureGasSettings::gflow() const +{ + return prefs.gflow; +} + +short PartialPressureGasSettings::gfhigh() const +{ + return prefs.gfhigh; +} + +short PartialPressureGasSettings::hrgraph() const +{ + return prefs.hrgraph; +} + +short PartialPressureGasSettings::tankBar() const +{ + return prefs.tankbar; +} + +short PartialPressureGasSettings::percentageGraph() const +{ + return prefs.percentagegraph; +} + +short PartialPressureGasSettings::rulerGraph() const +{ + return prefs.rulergraph; +} + +bool PartialPressureGasSettings::showCCRSetpoint() const +{ + return prefs.show_ccr_setpoint; +} + +bool PartialPressureGasSettings::showCCRSensors() const +{ + return prefs.show_ccr_sensors; +} + +short PartialPressureGasSettings::zoomedPlot() const +{ + return prefs.zoomed_plot; +} + +short PartialPressureGasSettings::showSac() const +{ + return prefs.show_sac; +} + +bool PartialPressureGasSettings::gfLowAtMaxDepth() const +{ + return prefs.gf_low_at_maxdepth; +} + +short PartialPressureGasSettings::displayUnusedTanks() const +{ + return prefs.display_unused_tanks; +} + +short PartialPressureGasSettings::showAverageDepth() const +{ + return prefs.show_average_depth; +} + void PartialPressureGasSettings::setShowPo2(short value) { QSettings s; diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h index 612570b..b429085 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -20,6 +20,28 @@ class PartialPressureGasSettings : public QObject { Q_PROPERTY(double po2_threshold READ po2Threshold WRITE setPo2Threshold NOTIFY po2ThresholdChanged) Q_PROPERTY(double pn2_threshold READ pn2Threshold WRITE setPn2Threshold NOTIFY pn2ThresholdChanged) Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged) + Q_PROPERTY(double modpO2 READ modp02 WRITE setModp02 NOTIFY modpO2Changed) + Q_PROPERTY(short ead READ ead WRITE setEad NOTIFY eadChanged) + Q_PROPERTY(short dcceiling READ dcceiling WRITE setDCceiling NOTIFY dcceilingChanged) + Q_PROPERTY(short redceiling READ redceiling WRITE setRedceiling NOTIFY redceilingChanged) + Q_PROPERTY(short calcceiling READ calcceiling WRITE setCalcceiling NOTIFY calcceilingChanged) + Q_PROPERTY(short calcceiling3m READ calcceiling3m WRITE setCalcceiling3m NOTIFY calcceiling3mChanged) + Q_PROPERTY(short calcalltissues READ calcalltissues WRITE setCalcalltissues NOTIFY calcalltissuesChanged) + Q_PROPERTY(short calcndltts READ calcndltts WRITE setCalcndltts NOTIFY calcndlttsChanged) + Q_PROPERTY(short gflow READ gflow WRITE setGflow NOTIFY gflowChanged) + Q_PROPERTY(short gfhigh READ gfhigh WRITE setGfhigh NOTIFY gfhighChanged) + Q_PROPERTY(short hrgraph READ hrgraph WRITE setHRgraph NOTIFY hrgraphChanged) + Q_PROPERTY(short tankbar READ tankBar WRITE setTankBar NOTIFY tankBarChanged) + Q_PROPERTY(short percentagegraph READ percentageGraph WRITE setPercentageGraph NOTIFY percentageGraphChanged) + Q_PROPERTY(short rulergraph READ rulerGraph WRITE setRulerGraph NOTIFY rulerGraphChanged) + Q_PROPERTY(bool show_ccr_setpoint READ showCCRSetpoint WRITE setShowCCRSetpoint NOTIFY showCCRSetpointChanged) + Q_PROPERTY(bool show_ccr_sensors READ showCCRSensors WRITE setShowCCRSensors NOTIFY showCCRSensorsChanged) + Q_PROPERTY(short zoomed_plot READ zoomedPlot WRITE setZoomedPlot NOTIFY zoomedPlotChanged) + Q_PROPERTY(short show_sac READ showSac WRITE setShowSac NOTIFY showSacChanged) + Q_PROPERTY(bool gf_low_at_maxdepth READ gfLowAtMaxDepth WRITE setGfLowAtMaxDepth NOTIFY gfLowAtMaxDepthChanged) + Q_PROPERTY(short display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged) + Q_PROPERTY(short show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged) + public: PartialPressureGasSettings(QObject *parent); short showPo2() const; @@ -28,6 +50,28 @@ public: double po2Threshold() const; double pn2Threshold() const; double pheThreshold() const; + double modp02() const; + short ead() const; + short dcceiling() const; + short redceiling() const; + short calcceiling() const; + short calcceiling3m() const; + short calcalltissues() const; + short calcndltts() const; + short gflow() const; + short gfhigh() const; + short hrgraph() const; + short tankBar() const; + short percentageGraph() const; + short rulerGraph() const; + bool showCCRSetpoint() const; + bool showCCRSensors() const; + short zoomedPlot() const; + short showSac() const; + bool gfLowAtMaxDepth() const; + short displayUnusedTanks() const; + short showAverageDepth() const; + public slots: void setShowPo2(short value); void setShowPn2(short value); @@ -109,34 +153,10 @@ class SettingsObjectWrapper : public QObject { Q_PROPERTY(bool date_format_override READ dateFormatOverride WRITE setDateFormatOverride NOTIFY dateFormatOverrideChanged) Q_PROPERTY(double font_size READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) Q_PROPERTY(short mod READ mod WRITE setMod NOTIFY modChanged); - - Q_PROPERTY(double modpO2 READ modp02 WRITE setModp02 NOTIFY modpO2Changed) - Q_PROPERTY(short ead READ ead WRITE setEad NOTIFY eadChanged) - Q_PROPERTY(short dcceiling READ dcceiling WRITE setDCceiling NOTIFY dcceilingChanged) - Q_PROPERTY(short redceiling READ redceiling WRITE setRedceiling NOTIFY redceilingChanged) - Q_PROPERTY(short calcceiling READ calcceiling WRITE setCalcceiling NOTIFY calcceilingChanged) - Q_PROPERTY(short calcceiling3m READ calcceiling3m WRITE setCalcceiling3m NOTIFY calcceiling3mChanged) - Q_PROPERTY(short calcalltissues READ calcalltissues WRITE setCalcalltissues NOTIFY calcalltissuesChanged) - Q_PROPERTY(short calcndltts READ calcndltts WRITE setCalcndltts NOTIFY calcndlttsChanged) - Q_PROPERTY(short gflow READ gflow WRITE setGflow NOTIFY gflowChanged) - Q_PROPERTY(short gfhigh READ gfhigh WRITE setGfhigh NOTIFY gfhighChanged) Q_PROPERTY(int animation_speed READ animationSpeed WRITE setAnimationSpeed NOTIFY animationSpeedChanged) - - Q_PROPERTY(bool gf_low_at_maxdepth READ gfLowAtMaxDepth WRITE setGfLowAtMaxDepth NOTIFY gfLowAtMaxDepthChanged) - Q_PROPERTY(bool show_ccr_setpoint READ showCCRSetpoint WRITE setShowCCRSetpoint NOTIFY showCCRSetpointChanged) - Q_PROPERTY(bool show_ccr_sensors READ showCCRSensors WRITE setShowCCRSensors NOTIFY showCCRSensorsChanged) Q_PROPERTY(short display_invalid_dives READ displayInvalidDives WRITE setDisplayInvalidDives NOTIFY displayInvalidDivesChanged) Q_PROPERTY(short unit_system READ unitSystem WRITE setUnitSystem NOTIFY uintSystemChanged) Q_PROPERTY(bool coordinates_traditional READ coordinatesTraditional WRITE setCoordinatesTraditional NOTIFY coordinatesTraditionalChanged) - Q_PROPERTY(short show_sac READ showSac WRITE setShowSac NOTIFY showSacChanged) - Q_PROPERTY(short display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged) - Q_PROPERTY(short show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged) - - Q_PROPERTY(short zoomed_plot READ zoomedPlot WRITE setZoomedPlot NOTIFY zoomedPlotChanged) - Q_PROPERTY(short hrgraph READ hrgraph WRITE setHRgraph NOTIFY hrgraphChanged) - Q_PROPERTY(short percentagegraph READ percentageGraph WRITE setPercentageGraph NOTIFY percentageGraphChanged) - Q_PROPERTY(short rulergraph READ rulerGraph WRITE setRulerGraph NOTIFY rulerGraphChanged) - Q_PROPERTY(short tankbar READ tankBar WRITE setTankBar NOTIFY tankBarChanged) Q_PROPERTY(short save_userid_local READ saveUserIdLocal WRITE setSaveUserIdLocal NOTIFY saveUserIdLocalChanged) Q_PROPERTY(QString userid READ userId WRITE setUserId NOTIFY userIdChanged) Q_PROPERTY(int ascrate75 READ ascrate75 WRITE setAscrate75 NOTIFY ascrate75Changed) @@ -150,7 +170,6 @@ class SettingsObjectWrapper : public QObject { Q_PROPERTY(bool drop_stone_mode READ dropStoneMode WRITE setDropStoneMode NOTIFY dropStoneModeChanged) Q_PROPERTY(bool last_stop READ lastStop WRITE setLastStop NOTIFY lastStopChanged) Q_PROPERTY(bool verbatim_plan READ verbatimPlan WRITE setVerbatimPlan NOTIFY verbatimPlanChanged) - Q_PROPERTY(bool display_runtime READ displayRuntime WRITE setDisplayRuntime NOTIFY displayRuntimeChanged) Q_PROPERTY(bool display_duration READ displayDuration WRITE setDisplayDuration NOTIFY displayDurationChanged) Q_PROPERTY(bool display_transitions READ displayTransitions WRITE setDisplayTransitions NOTIFY displayTransitionsChanged) -- 2.7.0
From 410607f0945aed3d8116ffa03b2295a65d643582 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 19:40:07 -0200 Subject: [PATCH 20/24] Implement the methods for PartialPressureGasSettings I didn't allowed the build on CMake for those files yet because there will be tons of breackage, so when I finish, I'll allow. Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/CMakeLists.txt | 1 + .../subsurface-qt/SettingsObjectWrapper.cpp | 88 ++++++++++++++++++++++ .../subsurface-qt/SettingsObjectWrapper.h | 20 +++++ 3 files changed, 109 insertions(+) create mode 100644 subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp diff --git a/subsurface-core/CMakeLists.txt b/subsurface-core/CMakeLists.txt index decc94d..0e060b0 100644 --- a/subsurface-core/CMakeLists.txt +++ b/subsurface-core/CMakeLists.txt @@ -84,6 +84,7 @@ set(SUBSURFACE_CORE_LIB_SRCS #Subsurface Qt have the Subsurface structs QObjectified for easy access via QML. subsurface-qt/DiveObjectHelper.cpp + #subsurface-qt/SettingsObjectWrapper.cpp ${SERIAL_FTDI} ${PLATFORM_SRC} ${BT_CORE_SRC_FILES} diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp new file mode 100644 index 0000000..d9b307a --- /dev/null +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -0,0 +1,88 @@ +#include "SettingsObjectWrapper.h" +#include <QSettings> + +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; +} + +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); +} diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h index db25005..612570b 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -22,6 +22,26 @@ class PartialPressureGasSettings : public QObject { Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged) public: PartialPressureGasSettings(QObject *parent); + short showPo2() const; + short showPn2() const; + short showPhe() const; + double po2Threshold() const; + double pn2Threshold() const; + double pheThreshold() const; +public slots: + void setShowPo2(short value); + void setShowPn2(short value); + void setShowPhe(short value); + void setPo2Threshold(double value); + void setPn2Threshold(double value); + void setPheThreshold(double value); +signals: + void showPo2Changed(short value); + void showPn2Changed(short value); + void showPheChanged(short value); + void po2ThresholdChanged(double value); + void pn2ThresholdChanged(double value); + void pheThresholdChanged(double value); }; /* Control the state of the Facebook preferences */ -- 2.7.0
From 4b8246d1a3d19886decb14fb36ce2f2eca275b8d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 19:10:00 -0200 Subject: [PATCH 19/24] Start the SettingsObjectWrapper - a QSettings helper for QML This class needs to have all settings in Q_PROPERTIES so it can be used in QML. I know we will not use all of the settings in a visible way for the user on the QML app, but we might increase things in the future and on different form factors so it's good to be prepared. Currently I implemented all of the possible properties, but I still need to hoock up everything. Signed-off-by: Tomaz Canabrava <[email protected]> --- .../subsurface-qt/SettingsObjectWrapper.h | 169 +++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 subsurface-core/subsurface-qt/SettingsObjectWrapper.h diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h new file mode 100644 index 0000000..db25005 --- /dev/null +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -0,0 +1,169 @@ +#ifndef SETTINGSOBJECTWRAPPER_H +#define SETTINGSOBJECTWRAPPER_H + +#include <QObject> + +#include "../pref.h" +#include "../prefs-macros.h" + +/* Wrapper class for the Settings. This will allow + * seamlessy integration of the settings with the QML + * and QWidget frontends. This class will be huge, since + * I need tons of properties, one for each option. */ + +/* Control the state of the Partial Pressure Graphs preferences */ +class PartialPressureGasSettings : public QObject { + Q_OBJECT + Q_PROPERTY(short show_po2 READ showPo2 WRITE setShowPo2 NOTIFY showPo2Changed) + Q_PROPERTY(short show_pn2 READ showPn2 WRITE setShowPn2 NOTIFY showPn2Changed) + Q_PROPERTY(short show_phe READ showPhe WRITE setShowPhe NOTIFY showPheChanged) + Q_PROPERTY(double po2_threshold READ po2Threshold WRITE setPo2Threshold NOTIFY po2ThresholdChanged) + Q_PROPERTY(double pn2_threshold READ pn2Threshold WRITE setPn2Threshold NOTIFY pn2ThresholdChanged) + Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged) +public: + PartialPressureGasSettings(QObject *parent); +}; + +/* Control the state of the Facebook preferences */ +class FacebookSettings : public QObject { + Q_OBJECT + Q_PROPERTY(access_token READ WRITE setAccessToken NOTIFY accessTokenChanged); + Q_PROPERTY(user_id READ WRITE setUserId NOTIFY userIdChanged) + Q_PROPERTY(album_id READ WRITE setAlbumId NOTIFY albumIdChanged) +public: + FacebookSettings(QObject *parent); +}; + +/* Control the state of the Geocoding preferences */ +class GeocodingPreferences : public QObject { + Q_OBJECT + Q_PROPERTY(bool enable_geocoding READ enableGeocoding WRITE setEnableGeocoding NOTIFY enableGeocodingChanged) + Q_PROPERTY(bool parse_dive_without_gps READ parseDiveWithoutGps WRITE setParseDiveWithoutGps NOTIFY parseDiveWithoutGpsChanged) + Q_PROPERTY(bool tag_existing_dives READ tagExistingDives WRITE setTagExistingDives NOTIFY tagExistingDivesChanged) + Q_PROPERTY(taxonomy_category first READ firstTaxonomyCategory WRITE setFirstTaxonomyCategory NOTIFY firstTaxonomyCategoryChanged) + Q_PROPERTY(taxonomy_category second READ secondTaxonomyCategory WRITE setSecondTaxonomyCategory NOTIFY secondTaxonomyCategoryChanged) + Q_PROPERTY(taxonomy_category third READ thirdTaxonomyCategory WRITE setThirdTaxonomyCategory NOTIFY thirdTaxonomyCategoryChanged) +public: + GeocodingPreferences(QObject *parent); +}; + +class ProxySettings : public QObject { + Q_OBJECT + Q_PROPERTY(int type READ type WRITE setType NOTIFY typeChanged) + Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged) + Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged) + Q_PROPERTY(short auth READ auth WRITE setAuth NOTIFY authChanged) + Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged) + Q_PROPERTY(QString pass READ pass WRITE setPass NOTIFY passChanged) +public: + ProxySettings(QObject *parent); +}; + +class CloudStorageSettings : public QObject { + Q_OBJECT + Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) + Q_PROPERTY(QString newpassword READ newPassword WRITE setNewPassword NOTIFY newPasswordChanged) + Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged) + Q_PROPERTY(QString email_encoded READ emailEncoded WRITE setEmailEncoded NOTIFY emailEncodedChanged) + Q_PROPERTY(bool save_password_local READ savePasswordLocal WRITE setSavePasswordLocal NOTIFY savePasswordLocalChanged) + Q_PROPERTY(short verification_status READ verificationStatus WRITE setVerificationStatus NOTIFY verificationStatusChanged) + Q_PROPERTY(bool background_sync READ backgroundSync WRITE setBackgroundSync NOTIFY backgroundSyncChanged) +public: + CloudStorageSettings(QObject *parent); +}; + +/* Monster class, should be breaken into a few more understandable classes later, wich will be easy to do: +* grab the Q_PROPERTYES and create a wrapper class like the ones above. +*/ +class SettingsObjectWrapper : public QObject { + Q_OBJECT + Q_PROPERTY(QString divelist_font READ divelistFont WRITE setDivelistFont NOTIFY divelistFontChanged) + Q_PROPERTY(QString default_filename READ defaultFilename WRITE setDefaultFilename NOTIFY defaultFilenameChanged) + Q_PROPERTY(QString default_cylinder READ defaultCylinder WRITE setDefaultCylinder NOTIFY defaultCylinderChanged) + Q_PROPERTY(QString cloud_base_url READ cloudBaseUrl WRITE setCloudBaseURL NOTIFY cloudBaseUrlChanged) + Q_PROPERTY(QString cloud_git_url READ cloudGitUrl WRITE setCloudGitUrl NOTIFY cloudGitUrlChanged) + Q_PROPERTY(QString time_format READ timeFormat WRITE setTimeFormat NOTIFY timeFormatChanged) + Q_PROPERTY(QString date_format READ dateFormat WRITE setDateFormat NOTIFY dateFormatChanged) + Q_PROPERTY(QString date_format_short READ dateFormatShort WRITE setDateFormatShort NOTIFY dateFormatShortChanged) + Q_PROPERTY(bool time_format_override READ timeFormatOverride WRITE setTimeFormatOverride NOTIFY timeFormatOverrideChanged) + Q_PROPERTY(bool date_format_override READ dateFormatOverride WRITE setDateFormatOverride NOTIFY dateFormatOverrideChanged) + Q_PROPERTY(double font_size READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) + Q_PROPERTY(short mod READ mod WRITE setMod NOTIFY modChanged); + + Q_PROPERTY(double modpO2 READ modp02 WRITE setModp02 NOTIFY modpO2Changed) + Q_PROPERTY(short ead READ ead WRITE setEad NOTIFY eadChanged) + Q_PROPERTY(short dcceiling READ dcceiling WRITE setDCceiling NOTIFY dcceilingChanged) + Q_PROPERTY(short redceiling READ redceiling WRITE setRedceiling NOTIFY redceilingChanged) + Q_PROPERTY(short calcceiling READ calcceiling WRITE setCalcceiling NOTIFY calcceilingChanged) + Q_PROPERTY(short calcceiling3m READ calcceiling3m WRITE setCalcceiling3m NOTIFY calcceiling3mChanged) + Q_PROPERTY(short calcalltissues READ calcalltissues WRITE setCalcalltissues NOTIFY calcalltissuesChanged) + Q_PROPERTY(short calcndltts READ calcndltts WRITE setCalcndltts NOTIFY calcndlttsChanged) + Q_PROPERTY(short gflow READ gflow WRITE setGflow NOTIFY gflowChanged) + Q_PROPERTY(short gfhigh READ gfhigh WRITE setGfhigh NOTIFY gfhighChanged) + Q_PROPERTY(int animation_speed READ animationSpeed WRITE setAnimationSpeed NOTIFY animationSpeedChanged) + + Q_PROPERTY(bool gf_low_at_maxdepth READ gfLowAtMaxDepth WRITE setGfLowAtMaxDepth NOTIFY gfLowAtMaxDepthChanged) + Q_PROPERTY(bool show_ccr_setpoint READ showCCRSetpoint WRITE setShowCCRSetpoint NOTIFY showCCRSetpointChanged) + Q_PROPERTY(bool show_ccr_sensors READ showCCRSensors WRITE setShowCCRSensors NOTIFY showCCRSensorsChanged) + Q_PROPERTY(short display_invalid_dives READ displayInvalidDives WRITE setDisplayInvalidDives NOTIFY displayInvalidDivesChanged) + Q_PROPERTY(short unit_system READ unitSystem WRITE setUnitSystem NOTIFY uintSystemChanged) + Q_PROPERTY(bool coordinates_traditional READ coordinatesTraditional WRITE setCoordinatesTraditional NOTIFY coordinatesTraditionalChanged) + Q_PROPERTY(short show_sac READ showSac WRITE setShowSac NOTIFY showSacChanged) + Q_PROPERTY(short display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged) + Q_PROPERTY(short show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged) + + Q_PROPERTY(short zoomed_plot READ zoomedPlot WRITE setZoomedPlot NOTIFY zoomedPlotChanged) + Q_PROPERTY(short hrgraph READ hrgraph WRITE setHRgraph NOTIFY hrgraphChanged) + Q_PROPERTY(short percentagegraph READ percentageGraph WRITE setPercentageGraph NOTIFY percentageGraphChanged) + Q_PROPERTY(short rulergraph READ rulerGraph WRITE setRulerGraph NOTIFY rulerGraphChanged) + Q_PROPERTY(short tankbar READ tankBar WRITE setTankBar NOTIFY tankBarChanged) + Q_PROPERTY(short save_userid_local READ saveUserIdLocal WRITE setSaveUserIdLocal NOTIFY saveUserIdLocalChanged) + Q_PROPERTY(QString userid READ userId WRITE setUserId NOTIFY userIdChanged) + Q_PROPERTY(int ascrate75 READ ascrate75 WRITE setAscrate75 NOTIFY ascrate75Changed) + Q_PROPERTY(int ascrate50 READ ascrate50 WRITE setAscrate50 NOTIFY ascrate50Changed) + Q_PROPERTY(int ascratestops READ ascratestops WRITE setAscratestops NOTIFY ascratestopsChanged) + Q_PROPERTY(int ascratelast6m READ ascratelast6m WRITE setAscratelast6m NOTIFY ascratelast6mChanged) + Q_PROPERTY(int descrate READ descrate WRITE setDescrate NOTIFY descrateChanged) + Q_PROPERTY(int bottompo2 READ bottompo2 WRITE setBottompo2 NOTIFY bottompo2Changed) + Q_PROPERTY(int decopo2 READ decopo2 WRITE setDecopo2 NOTIFY decopo2Changed) + Q_PROPERTY(bool doo2breaks READ doo2breaks WRITE setDoo2breaks NOTIFY doo2breaksChanged) + Q_PROPERTY(bool drop_stone_mode READ dropStoneMode WRITE setDropStoneMode NOTIFY dropStoneModeChanged) + Q_PROPERTY(bool last_stop READ lastStop WRITE setLastStop NOTIFY lastStopChanged) + Q_PROPERTY(bool verbatim_plan READ verbatimPlan WRITE setVerbatimPlan NOTIFY verbatimPlanChanged) + + Q_PROPERTY(bool display_runtime READ displayRuntime WRITE setDisplayRuntime NOTIFY displayRuntimeChanged) + Q_PROPERTY(bool display_duration READ displayDuration WRITE setDisplayDuration NOTIFY displayDurationChanged) + Q_PROPERTY(bool display_transitions READ displayTransitions WRITE setDisplayTransitions NOTIFY displayTransitionsChanged) + Q_PROPERTY(bool safetystop READ safetyStop WRITE setSafetyStop NOTIFY safetyStopChanged) + Q_PROPERTY(bool switch_at_req_stop READ switchAtRequiredStop WRITE setSwitchAtRequiredStop NOTIFY switchAtRequiredStopChanged) + Q_PROPERTY(int reserve_gas READ reserveGas WRITE setReserveGas NOTIFY reserveGasChanged) + Q_PROPERTY(int min_switch_duration READ minSwitchDuration WRITE setMinSwitchDuration NOTIFY minSwitchDurationChanged) + Q_PROPERTY(int bottomsac READ bottomSac WRITE setBottomSac NOTIFY bottomSacChanged) + Q_PROPERTY(int decosac READ decoSac WRITE setSecoSac NOTIFY decoSacChanged) + Q_PROPERTY(int o2consumption READ o2Consumption WRITE setO2Consumption NOTIFY o2ConsumptionChanged) + Q_PROPERTY(int pscr_ratio READ pscrRatio WRITE setPscrRatio NOTIFY pscrRatioChanged) + Q_PROPERTY(int defaultsetpoint READ defaultSetPoint WRITE setDefaultSetPoint NOTIFY defaultSetPointChanged) + Q_PROPERTY(bool show_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged) + Q_PROPERTY(bool use_default_file READ useDefaultFile WRITE setUseDefaultFile NOTIFY useDefaultFileChanged) + Q_PROPERTY(short default_file_behavior READ defaultFileBehavior WRITE setDefaultFileBehavior NOTIFY defaultFileBehaviorChanged) + Q_PROPERTY(short conservatism_level READ conservatism_level WRITE setConservatismLevel NOTIFY conservatismLevelChanged) + Q_PROPERTY(int time_threshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged) + Q_PROPERTY(int distance_threshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged) + Q_PROPERTY(bool git_local_only READ gitLocalOnly WRITE setGitLocalOnly NOTIFY gitLocalOnlyChanged) + + PartialPressureGasSettings *pp_gas; + FacebookSettings *facebook; + GeocodingPreferences *geocoding; + ProxySettings *proxy; + // Units + struct units units; + + // Decompression Mode + enum deco_mode deco_mode; +}; + +public: + SettingsObjectWrapper(QObject *parent = NULL); +}; + +#endif \ No newline at end of file -- 2.7.0
From 7e9be7aef1ebe6fb2e26122462843847bb64f13d Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 16:48:46 -0200 Subject: [PATCH 18/24] Simplify: remove weigths and cylinders. This finishes the first round of Simplication patches for the QML basecode. The second one will be about the preferences. Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 23 +++++++++++----------- subsurface-core/subsurface-qt/DiveObjectHelper.h | 2 -- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index a03bd31..51831ef 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -36,11 +36,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_dive(d) { - for (int i = 0; i < MAX_CYLINDERS; i++) - m_cylinders << getFormattedCylinder(d, i); - - for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) - m_weights << getFormattedWeight(d, i); } DiveObjectHelper::~DiveObjectHelper() @@ -186,14 +181,17 @@ QString DiveObjectHelper::sac() const QStringList DiveObjectHelper::weights() const { - return m_weights; + QStringList weights; + for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) + weights << getFormattedWeight(m_dive, i); + return weights; } QString DiveObjectHelper::weight(int idx) const { - if (idx < 0 || idx > m_weights.size() - 1) + if ( (idx < 0) || idx > MAX_WEIGHTSYSTEMS ) return QString(EMPTY_DIVE_STRING); - return m_weights.at(idx); + return getFormattedWeight(m_dive, idx); } QString DiveObjectHelper::suit() const @@ -203,14 +201,17 @@ QString DiveObjectHelper::suit() const QStringList DiveObjectHelper::cylinders() const { - return m_cylinders; + QStringList cylinders; + for (int i = 0; i < MAX_CYLINDERS; i++) + cylinders << getFormattedCylinder(m_dive, i); + return cylinders; } QString DiveObjectHelper::cylinder(int idx) const { - if (idx < 0 || idx > m_cylinders.size() - 1) + if ( (idx < 0) || idx > MAX_CYLINDERS) return QString(EMPTY_DIVE_STRING); - return m_cylinders.at(idx); + return getFormattedCylinder(m_dive, idx); } QString DiveObjectHelper::trip() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 5702535..4d1e1ac 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -62,8 +62,6 @@ public: QString otu() const; private: - QStringList m_weights; - QStringList m_cylinders; struct dive *m_dive; }; Q_DECLARE_METATYPE(DiveObjectHelper *) -- 2.7.0
From 988d98c1b3ad1840a1a1e806aa95fb0ab28f67a0 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 16:40:10 -0200 Subject: [PATCH 17/24] Simplify: return date and time directly Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 13 ++++++------- subsurface-core/subsurface-qt/DiveObjectHelper.h | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index a3ecdf1..a03bd31 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -41,11 +41,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) : for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) m_weights << getFormattedWeight(d, i); - - QDateTime localTime = QDateTime::fromTime_t(d->when - gettimezoneoffset(d->when)); - localTime.setTimeSpec(Qt::UTC); - m_date = localTime.date().toString(prefs.date_format); - m_time = localTime.time().toString(prefs.time_format); } DiveObjectHelper::~DiveObjectHelper() @@ -64,7 +59,9 @@ int DiveObjectHelper::id() const QString DiveObjectHelper::date() const { - return m_date; + QDateTime localTime = QDateTime::fromTime_t(m_dive->when - gettimezoneoffset(m_dive->when)); + localTime.setTimeSpec(Qt::UTC); + return localTime.date().toString(prefs.date_format); } timestamp_t DiveObjectHelper::timestamp() const @@ -74,7 +71,9 @@ timestamp_t DiveObjectHelper::timestamp() const QString DiveObjectHelper::time() const { - return m_time; + QDateTime localTime = QDateTime::fromTime_t(m_dive->when - gettimezoneoffset(m_dive->when)); + localTime.setTimeSpec(Qt::UTC); + return localTime.time().toString(prefs.time_format); } QString DiveObjectHelper::location() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 160bbfb..5702535 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -62,8 +62,6 @@ public: QString otu() const; private: - QString m_date; - QString m_time; QStringList m_weights; QStringList m_cylinders; struct dive *m_dive; -- 2.7.0
From 6918c8238b7cfc5c43248326151a96710e17dda9 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 16:37:10 -0200 Subject: [PATCH 16/24] Simplify: remove the gas variable Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 37 +++++++++++----------- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index a947ea4..a3ecdf1 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -36,23 +36,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_dive(d) { - int added = 0; - QString gas, gases; - for (int i = 0; i < MAX_CYLINDERS; i++) { - if (!is_cylinder_used(d, i)) - continue; - gas = d->cylinder[i].type.description; - gas += QString(!gas.isEmpty() ? " " : "") + gasname(&d->cylinder[i].gasmix); - // if has a description and if such gas is not already present - if (!gas.isEmpty() && gases.indexOf(gas) == -1) { - if (added > 0) - gases += QString(" / "); - gases += gas; - added++; - } - } - m_gas = gases; - for (int i = 0; i < MAX_CYLINDERS; i++) m_cylinders << getFormattedCylinder(d, i); @@ -171,7 +154,25 @@ QString DiveObjectHelper::tags() const QString DiveObjectHelper::gas() const { - return m_gas; + /*WARNING: here should be the gastlist, returned + * from the get_gas_string function or this is correct? + */ + QString gas, gases; + for (int i = 0; i < MAX_CYLINDERS; i++) { + if (!is_cylinder_used(m_dive, i)) + continue; + gas = m_dive->cylinder[i].type.description; + if (!gas.isEmpty()) + gas += QChar(' '); + gas += gasname(&m_dive->cylinder[i].gasmix); + // if has a description and if such gas is not already present + if (!gas.isEmpty() && gases.indexOf(gas) == -1) { + if (!gases.isEmpty()) + gases += QString(" / "); + gases += gas; + } + } + return gases; } QString DiveObjectHelper::sac() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index ba1a022..160bbfb 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -64,7 +64,6 @@ public: private: QString m_date; QString m_time; - QString m_gas; QStringList m_weights; QStringList m_cylinders; struct dive *m_dive; -- 2.7.0
From 4ae80ba260aff82e244796837597769eababaa6c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 16:29:49 -0200 Subject: [PATCH 15/24] Simplify: remove variable tags Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 9 +++------ subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index e39ba2f..a947ea4 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -36,11 +36,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_dive(d) { - char buffer[256]; - taglist_get_tagstring(d->tag_list, buffer, 256); - m_tags = QString(buffer); - - int added = 0; QString gas, gases; for (int i = 0; i < MAX_CYLINDERS; i++) { @@ -169,7 +164,9 @@ QString DiveObjectHelper::notes() const QString DiveObjectHelper::tags() const { - return m_tags; + static char buffer[256]; + taglist_get_tagstring(m_dive->tag_list, buffer, 256); + return QString(buffer); } QString DiveObjectHelper::gas() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index c5fddbb..ba1a022 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -64,7 +64,6 @@ public: private: QString m_date; QString m_time; - QString m_tags; QString m_gas; QStringList m_weights; QStringList m_cylinders; -- 2.7.0
From 821ce3700d8977ec2a82423043a2ca120e9f11b7 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 16:16:48 -0200 Subject: [PATCH 14/24] Simplify: remove SAC variable Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 14 ++++++-------- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index a06e5bb..e39ba2f 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -58,13 +58,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) : } m_gas = gases; - if (d->sac) { - const char *unit; - int decimal; - double value = get_volume_units(d->sac, &decimal, &unit); - m_sac = QString::number(value, 'f', decimal).append(unit); - } - for (int i = 0; i < MAX_CYLINDERS; i++) m_cylinders << getFormattedCylinder(d, i); @@ -186,7 +179,12 @@ QString DiveObjectHelper::gas() const QString DiveObjectHelper::sac() const { - return m_sac; + if (!m_dive->sac) + return QString(); + const char *unit; + int decimal; + double value = get_volume_units(m_dive->sac, &decimal, &unit); + QString::number(value, 'f', decimal).append(unit); } QStringList DiveObjectHelper::weights() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 587b3f6..c5fddbb 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -66,7 +66,6 @@ private: QString m_time; QString m_tags; QString m_gas; - QString m_sac; QStringList m_weights; QStringList m_cylinders; struct dive *m_dive; -- 2.7.0
From eaf78d7ff8c061c0d7a39250a421bc2ab3f4fd0c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 16:13:23 -0200 Subject: [PATCH 13/24] Simplify: remove gps variable And also use existing helper function to get the GPS string Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 7 ++----- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index 3d9c9cb..a06e5bb 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -36,10 +36,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_dive(d) { - struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid); - if (ds) - m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0); - char buffer[256]; taglist_get_tagstring(d->tag_list, buffer, 256); m_tags = QString(buffer); @@ -117,7 +113,8 @@ QString DiveObjectHelper::location() const QString DiveObjectHelper::gps() const { - return m_gps; + struct dive_site *ds = get_dive_site_by_uuid(m_dive->dive_site_uuid); + return ds ? QString(printGPSCoords(ds->latitude.udeg, ds->longitude.udeg)) : QString(); } QString DiveObjectHelper::duration() const { diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 4ef5114..587b3f6 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -64,7 +64,6 @@ public: private: QString m_date; QString m_time; - QString m_gps; QString m_tags; QString m_gas; QString m_sac; -- 2.7.0
From 948b34bf66acfe891057a951a4acffc2db1d09f8 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 16:04:46 -0200 Subject: [PATCH 12/24] Simplify: remove m_notes variable I didn't understood the logic of the define & replace, so maybe we want a few comments there. Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 37 ++++++++++------------ subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index cd9d018..3d9c9cb 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -40,26 +40,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) : if (ds) m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0); - m_notes = QString::fromUtf8(d->notes); - if (m_notes.isEmpty()) - m_notes = EMPTY_DIVE_STRING; - if (same_string(d->dc.model, "planned dive")) { - QTextDocument notes; - QString notesFormatted = m_notes; -#define _NOTES_BR "\n" - notesFormatted = notesFormatted.replace("<thead>", "<thead>" _NOTES_BR); - notesFormatted = notesFormatted.replace("<br>", "<br>" _NOTES_BR); - notesFormatted = notesFormatted.replace("<tr>", "<tr>" _NOTES_BR); - notesFormatted = notesFormatted.replace("</tr>", "</tr>" _NOTES_BR); - notes.setHtml(notesFormatted); - m_notes = notes.toPlainText(); - m_notes.replace(_NOTES_BR, "<br>"); -#undef _NOTES_BR - } else { - m_notes.replace("\n", "<br>"); - } - - char buffer[256]; taglist_get_tagstring(d->tag_list, buffer, 256); m_tags = QString(buffer); @@ -179,7 +159,22 @@ QString DiveObjectHelper::waterTemp() const QString DiveObjectHelper::notes() const { - return m_notes; + QString tmp = m_dive->notes ? QString::fromUtf8(m_dive->notes) : EMPTY_DIVE_STRING; + if (same_string(m_dive->dc.model, "planned dive")) { + QTextDocument notes; + #define _NOTES_BR "\n" + tmp.replace("<thead>", "<thead>" _NOTES_BR) + .replace("<br>", "<br>" _NOTES_BR) + .replace("<tr>", "<tr>" _NOTES_BR) + .replace("</tr>", "</tr>" _NOTES_BR); + notes.setHtml(tmp); + tmp = notes.toPlainText(); + tmp.replace(_NOTES_BR, "<br>"); + #undef _NOTES_BR + } else { + tmp.replace("\n", "<br>"); + } + return tmp; } QString DiveObjectHelper::tags() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index c3c8def..4ef5114 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -65,7 +65,6 @@ private: QString m_date; QString m_time; QString m_gps; - QString m_notes; QString m_tags; QString m_gas; QString m_sac; -- 2.7.0
From c9ffa88cd4155045778a67baaeb0d6d86cb8343c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:56:50 -0200 Subject: [PATCH 11/24] Simplidy: remove Maxcns and OTU variables Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 6 ++---- subsurface-core/subsurface-qt/DiveObjectHelper.h | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index 181f89b..cd9d018 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,8 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_maxcns(d->maxcns), - m_otu(d->otu), m_dive(d) { struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid); @@ -235,12 +233,12 @@ QString DiveObjectHelper::trip() const QString DiveObjectHelper::maxcns() const { - return m_maxcns; + return QString(m_dive->maxcns); } QString DiveObjectHelper::otu() const { - return m_otu; + return QString(m_dive->otu); } int DiveObjectHelper::rating() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index b96eb61..c3c8def 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -71,8 +71,6 @@ private: QString m_sac; QStringList m_weights; QStringList m_cylinders; - QString m_maxcns; - QString m_otu; struct dive *m_dive; }; Q_DECLARE_METATYPE(DiveObjectHelper *) -- 2.7.0
From 7406cdc316c8cd4ac1fd28aacf6d4a1951d87640 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:49:06 -0200 Subject: [PATCH 10/24] Simplify: removed suit and trip Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 6 ++---- subsurface-core/subsurface-qt/DiveObjectHelper.h | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index b1501b3..181f89b 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,8 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_suit(d->suit ? d->suit : EMPTY_DIVE_STRING), - m_trip(d->divetrip ? d->divetrip->location : EMPTY_DIVE_STRING), m_maxcns(d->maxcns), m_otu(d->otu), m_dive(d) @@ -215,7 +213,7 @@ QString DiveObjectHelper::weight(int idx) const QString DiveObjectHelper::suit() const { - return m_suit; + return m_dive->suit ? m_dive->suit : EMPTY_DIVE_STRING; } QStringList DiveObjectHelper::cylinders() const @@ -232,7 +230,7 @@ QString DiveObjectHelper::cylinder(int idx) const QString DiveObjectHelper::trip() const { - return m_trip; + return m_dive->divetrip ? m_dive->divetrip->location : EMPTY_DIVE_STRING; } QString DiveObjectHelper::maxcns() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index a47bff5..b96eb61 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -70,9 +70,7 @@ private: QString m_gas; QString m_sac; QStringList m_weights; - QString m_suit; QStringList m_cylinders; - QString m_trip; QString m_maxcns; QString m_otu; struct dive *m_dive; -- 2.7.0
From 97a077343868ccae3cf6a46908bad44256631720 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:46:30 -0200 Subject: [PATCH 09/24] removed waterTemp variable Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 11 +++++------ subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index 35dc537..b1501b3 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,7 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_waterTemp(get_temperature_string(d->watertemp, true)), m_suit(d->suit ? d->suit : EMPTY_DIVE_STRING), m_trip(d->divetrip ? d->divetrip->location : EMPTY_DIVE_STRING), m_maxcns(d->maxcns), @@ -45,10 +44,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) : if (ds) m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0); - if (m_waterTemp.isEmpty()) { - m_waterTemp = EMPTY_DIVE_STRING; - } - m_notes = QString::fromUtf8(d->notes); if (m_notes.isEmpty()) m_notes = EMPTY_DIVE_STRING; @@ -179,7 +174,11 @@ QString DiveObjectHelper::airTemp() const QString DiveObjectHelper::waterTemp() const { - return m_waterTemp; + QString temp = get_temperature_string(m_dive->watertemp, true); + if (temp.isEmpty()) { + temp = EMPTY_DIVE_STRING; + } + return temp; } QString DiveObjectHelper::notes() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index b874506..a47bff5 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -65,7 +65,6 @@ private: QString m_date; QString m_time; QString m_gps; - QString m_waterTemp; QString m_notes; QString m_tags; QString m_gas; -- 2.7.0
From 16cc99bf96079005a60bb1ec909207a3b77c5fee Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:40:10 -0200 Subject: [PATCH 08/24] Simplify: removed buddy and airTemp variable also fixed a bug on the depth Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 13 ++++++------- subsurface-core/subsurface-qt/DiveObjectHelper.h | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index c60dc4a..35dc537 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,8 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_buddy(d->buddy ? d->buddy : EMPTY_DIVE_STRING), - m_airTemp(get_temperature_string(d->airtemp, true)), m_waterTemp(get_temperature_string(d->watertemp, true)), m_suit(d->suit ? d->suit : EMPTY_DIVE_STRING), m_trip(d->divetrip ? d->divetrip->location : EMPTY_DIVE_STRING), @@ -47,9 +45,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) : if (ds) m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0); - if (m_airTemp.isEmpty()) { - m_airTemp = EMPTY_DIVE_STRING; - } if (m_waterTemp.isEmpty()) { m_waterTemp = EMPTY_DIVE_STRING; } @@ -170,12 +165,16 @@ QString DiveObjectHelper::divemaster() const QString DiveObjectHelper::buddy() const { - return m_buddy; + return m_dive->buddy ? m_dive->buddy : EMPTY_DIVE_STRING; } QString DiveObjectHelper::airTemp() const { - return m_airTemp; + QString temp = get_temperature_string(m_dive->airtemp, true); + if (temp.isEmpty()) { + temp = EMPTY_DIVE_STRING; + } + return temp; } QString DiveObjectHelper::waterTemp() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 4240b03..b874506 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -65,8 +65,6 @@ private: QString m_date; QString m_time; QString m_gps; - QString m_buddy; - QString m_airTemp; QString m_waterTemp; QString m_notes; QString m_tags; -- 2.7.0
From b71fa5637063a14a2ae4699483d75ec23f4593f0 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:39:04 -0200 Subject: [PATCH 07/24] Simplify: removed divemaster Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 3 +-- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index 5e441d8..c60dc4a 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,7 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_divemaster(d->divemaster ? d->divemaster : EMPTY_DIVE_STRING), m_buddy(d->buddy ? d->buddy : EMPTY_DIVE_STRING), m_airTemp(get_temperature_string(d->airtemp, true)), m_waterTemp(get_temperature_string(d->watertemp, true)), @@ -166,7 +165,7 @@ QString DiveObjectHelper::depth() const QString DiveObjectHelper::divemaster() const { - return m_divemaster; + return m_dive->divemaster ? m_dive->divemaster : EMPTY_DIVE_STRING; } QString DiveObjectHelper::buddy() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 4a78fd7..4240b03 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -65,7 +65,6 @@ private: QString m_date; QString m_time; QString m_gps; - QString m_divemaster; QString m_buddy; QString m_airTemp; QString m_waterTemp; -- 2.7.0
From c53e599802c38829fb258c8a614676c4ef4a6f54 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:36:12 -0200 Subject: [PATCH 06/24] Simplify: removed duration and depth variables Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 6 ++---- subsurface-core/subsurface-qt/DiveObjectHelper.h | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index e50dc91..5e441d8 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,8 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))), - m_depth(get_depth_string(d->dc.maxdepth.mm, true, true)), m_divemaster(d->divemaster ? d->divemaster : EMPTY_DIVE_STRING), m_buddy(d->buddy ? d->buddy : EMPTY_DIVE_STRING), m_airTemp(get_temperature_string(d->airtemp, true)), @@ -158,12 +156,12 @@ QString DiveObjectHelper::gps() const } QString DiveObjectHelper::duration() const { - return m_duration; + return get_dive_duration_string(m_dive->duration.seconds, QObject::tr("h:"), QObject::tr("min")); } QString DiveObjectHelper::depth() const { - return m_depth; + return get_depth_string(m_dive->dc.maxdepth.mm, true, true); } QString DiveObjectHelper::divemaster() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index f135466..4a78fd7 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -65,8 +65,6 @@ private: QString m_date; QString m_time; QString m_gps; - QString m_duration; - QString m_depth; QString m_divemaster; QString m_buddy; QString m_airTemp; -- 2.7.0
From c3b851d03ba0f4f23eac3115accbeb7b2ccee758 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:35:21 -0200 Subject: [PATCH 05/24] Simplify: removed location variable Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 5 ++--- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index ee1beb2..e50dc91 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,8 +34,7 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_location(get_dive_location(d) ? QString::fromUtf8(get_dive_location(d)) : EMPTY_DIVE_STRING), - m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))), + m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))), m_depth(get_depth_string(d->dc.maxdepth.mm, true, true)), m_divemaster(d->divemaster ? d->divemaster : EMPTY_DIVE_STRING), m_buddy(d->buddy ? d->buddy : EMPTY_DIVE_STRING), @@ -150,7 +149,7 @@ QString DiveObjectHelper::time() const QString DiveObjectHelper::location() const { - return m_location; + return get_dive_location(m_dive) ? QString::fromUtf8(get_dive_location(m_dive)) : EMPTY_DIVE_STRING; } QString DiveObjectHelper::gps() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index b79ce43..f135466 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -64,7 +64,6 @@ public: private: QString m_date; QString m_time; - QString m_location; QString m_gps; QString m_duration; QString m_depth; -- 2.7.0
From 0ca3d21f2807354fdd927f4dc7c6b4102a007995 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:34:53 -0200 Subject: [PATCH 04/24] Simplify: removed timestamp variable Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 3 +-- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index 621918e..ee1beb2 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,7 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_timestamp(d->when), m_location(get_dive_location(d) ? QString::fromUtf8(get_dive_location(d)) : EMPTY_DIVE_STRING), m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))), m_depth(get_depth_string(d->dc.maxdepth.mm, true, true)), @@ -141,7 +140,7 @@ QString DiveObjectHelper::date() const timestamp_t DiveObjectHelper::timestamp() const { - return m_timestamp; + return m_dive->when; } QString DiveObjectHelper::time() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 19d88e0..b79ce43 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -63,7 +63,6 @@ public: private: QString m_date; - timestamp_t m_timestamp; QString m_time; QString m_location; QString m_gps; -- 2.7.0
From 6322bd44d823c1e273f3c9ae3653e1c25d34fa30 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:05:07 -0200 Subject: [PATCH 03/24] Simplify: remove uneeded variable, rating. Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 3 +-- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index c7e111d..621918e 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,7 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_rating(d->rating), m_timestamp(d->when), m_location(get_dive_location(d) ? QString::fromUtf8(get_dive_location(d)) : EMPTY_DIVE_STRING), m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))), @@ -255,5 +254,5 @@ QString DiveObjectHelper::otu() const int DiveObjectHelper::rating() const { - return m_rating; + return m_dive->rating; } diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index f1c1a19..19d88e0 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -62,7 +62,6 @@ public: QString otu() const; private: - int m_rating; QString m_date; timestamp_t m_timestamp; QString m_time; -- 2.7.0
From b82fc6a79ae0b16b587d3fb73acb27d95a2eb00e Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:04:21 -0200 Subject: [PATCH 02/24] Remove uneeded variable: id Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 3 +-- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index 94ba937..c7e111d 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -34,7 +34,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) } DiveObjectHelper::DiveObjectHelper(struct dive *d) : - m_id(d->id), m_rating(d->rating), m_timestamp(d->when), m_location(get_dive_location(d) ? QString::fromUtf8(get_dive_location(d)) : EMPTY_DIVE_STRING), @@ -133,7 +132,7 @@ int DiveObjectHelper::number() const int DiveObjectHelper::id() const { - return m_id; + return m_dive->id; } QString DiveObjectHelper::date() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index ee51b0e..f1c1a19 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -62,7 +62,6 @@ public: QString otu() const; private: - int m_id; int m_rating; QString m_date; timestamp_t m_timestamp; -- 2.7.0
From ce2ea45b476dffb255710f387daa46999f443ca9 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 11 Jan 2016 15:02:13 -0200 Subject: [PATCH 01/24] Simplify QML Code Handling Series We are starting to do a not-the-best-work on our current QML code, the following series will do small but important updates on the code regarding QML and QtWidget coexistence and behavior. 1 - Simplify Wrapper class, removing uneeded variable. Signed-off-by: Tomaz Canabrava <[email protected]> --- subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 4 ++-- subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index 7db882d..94ba937 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -33,7 +33,7 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) return fmt; } -DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_number(d->number), +DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_id(d->id), m_rating(d->rating), m_timestamp(d->when), @@ -128,7 +128,7 @@ DiveObjectHelper::~DiveObjectHelper() int DiveObjectHelper::number() const { - return m_number; + return m_dive->number; } int DiveObjectHelper::id() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 5f6cdf6..ee51b0e 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -62,7 +62,6 @@ public: QString otu() const; private: - int m_number; int m_id; int m_rating; QString m_date; -- 2.7.0
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
