summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/command.cpp20
-rw-r--r--commands/command.h4
-rw-r--r--commands/command_edit.cpp104
-rw-r--r--commands/command_edit.h41
4 files changed, 169 insertions, 0 deletions
diff --git a/commands/command.cpp b/commands/command.cpp
index 4257324ec..d04128b8a 100644
--- a/commands/command.cpp
+++ b/commands/command.cpp
@@ -183,6 +183,26 @@ int editVisibility(int newValue, bool currentDiveOnly)
return execute_edit(new EditVisibility(newValue, currentDiveOnly));
}
+int editWaveSize(int newValue, bool currentDiveOnly)
+{
+ return execute_edit(new EditWaveSize(newValue, currentDiveOnly));
+}
+
+int editCurrent(int newValue, bool currentDiveOnly)
+{
+ return execute_edit(new EditCurrent(newValue, currentDiveOnly));
+}
+
+int editSurge(int newValue, bool currentDiveOnly)
+{
+ return execute_edit(new EditSurge(newValue, currentDiveOnly));
+}
+
+int editChill(int newValue, bool currentDiveOnly)
+{
+ return execute_edit(new EditChill(newValue, currentDiveOnly));
+}
+
int editAirTemp(int newValue, bool currentDiveOnly)
{
return execute_edit(new EditAirTemp(newValue, currentDiveOnly));
diff --git a/commands/command.h b/commands/command.h
index 8fbed5069..1b7e65394 100644
--- a/commands/command.h
+++ b/commands/command.h
@@ -64,6 +64,10 @@ int editMode(int index, int newValue, bool currentDiveOnly);
int editNumber(int newValue, bool currentDiveOnly);
int editRating(int newValue, bool currentDiveOnly);
int editVisibility(int newValue, bool currentDiveOnly);
+int editWaveSize(int newValue, bool currentDiveOnly);
+int editCurrent(int newValue, bool currentDiveOnly);
+int editSurge(int newValue, bool currentDiveOnly);
+int editChill(int newValue, bool currentDiveOnly);
int editAirTemp(int newValue, bool currentDiveOnly);
int editWaterTemp(int newValue, bool currentDiveOnly);
int editAtmPress(int newValue, bool currentDiveOnly);
diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp
index 638bfb792..215f57899 100644
--- a/commands/command_edit.cpp
+++ b/commands/command_edit.cpp
@@ -224,6 +224,90 @@ DiveField EditVisibility::fieldId() const
return DiveField::VISIBILITY;
}
+// ***** WaveSize *****
+void EditWaveSize::set(struct dive *d, int value) const
+{
+ d->wavesize = value;
+}
+
+int EditWaveSize::data(struct dive *d) const
+{
+ return d->wavesize;
+}
+
+QString EditWaveSize::fieldName() const
+{
+ return tr("wavesize");
+}
+
+DiveField EditWaveSize::fieldId() const
+{
+ return DiveField::WAVESIZE;
+}
+
+// ***** Current *****
+void EditCurrent::set(struct dive *d, int value) const
+{
+ d->current = value;
+}
+
+int EditCurrent::data(struct dive *d) const
+{
+ return d->current;
+}
+
+QString EditCurrent::fieldName() const
+{
+ return tr("current");
+}
+
+DiveField EditCurrent::fieldId() const
+{
+ return DiveField::CURRENT;
+}
+
+// ***** Surge *****
+void EditSurge::set(struct dive *d, int value) const
+{
+ d->surge = value;
+}
+
+int EditSurge::data(struct dive *d) const
+{
+ return d->surge;
+}
+
+QString EditSurge::fieldName() const
+{
+ return tr("surge");
+}
+
+DiveField EditSurge::fieldId() const
+{
+ return DiveField::SURGE;
+}
+
+// ***** Chill *****
+void EditChill::set(struct dive *d, int value) const
+{
+ d->chill = value;
+}
+
+int EditChill::data(struct dive *d) const
+{
+ return d->chill;
+}
+
+QString EditChill::fieldName() const
+{
+ return tr("chill");
+}
+
+DiveField EditChill::fieldId() const
+{
+ return DiveField::CHILL;
+}
+
// ***** Air Temperature *****
void EditAirTemp::set(struct dive *d, int value) const
{
@@ -690,6 +774,14 @@ PasteState::PasteState(dive *dIn, const dive *data, dive_components what) : d(dI
rating = data->rating;
if (what.visibility)
visibility = data->visibility;
+ if (what.wavesize)
+ wavesize = data->wavesize;
+ if (what.current)
+ current = data->current;
+ if (what.surge)
+ surge = data->surge;
+ if (what.chill)
+ chill = data->chill;
if (what.divesite)
divesite = data->dive_site;
if (what.tags)
@@ -722,6 +814,14 @@ void PasteState::swap(dive_components what)
std::swap(rating, d->rating);
if (what.visibility)
std::swap(visibility, d->visibility);
+ if (what.wavesize)
+ std::swap(wavesize, d->wavesize);
+ if (what.current)
+ std::swap(current, d->current);
+ if (what.surge)
+ std::swap(surge, d->surge);
+ if (what.chill)
+ std::swap(chill, d->chill);
if (what.divesite)
std::swap(divesite, d->dive_site);
if (what.tags)
@@ -767,6 +867,10 @@ void PasteDives::undo()
fields.suit = what.suit;
fields.rating = what.rating;
fields.visibility = what.visibility;
+ fields.wavesize = what.wavesize;
+ fields.current = what.current;
+ fields.surge = what.surge;
+ fields.chill = what.chill;
fields.divesite = what.divesite;
fields.tags = what.tags;
emit diveListNotifier.divesChanged(divesToNotify, fields);
diff --git a/commands/command_edit.h b/commands/command_edit.h
index 8532523e2..cd12eaa04 100644
--- a/commands/command_edit.h
+++ b/commands/command_edit.h
@@ -97,6 +97,43 @@ public:
DiveField fieldId() const override;
};
+
+class EditWaveSize : public EditBase<int> {
+public:
+ using EditBase<int>::EditBase; // Use constructor of base class.
+ void set(struct dive *d, int value) const override;
+ int data(struct dive *d) const override;
+ QString fieldName() const override;
+ DiveField fieldId() const override;
+};
+
+class EditCurrent : public EditBase<int> {
+public:
+ using EditBase<int>::EditBase; // Use constructor of base class.
+ void set(struct dive *d, int value) const override;
+ int data(struct dive *d) const override;
+ QString fieldName() const override;
+ DiveField fieldId() const override;
+};
+
+class EditSurge : public EditBase<int> {
+public:
+ using EditBase<int>::EditBase; // Use constructor of base class.
+ void set(struct dive *d, int value) const override;
+ int data(struct dive *d) const override;
+ QString fieldName() const override;
+ DiveField fieldId() const override;
+};
+
+class EditChill : public EditBase<int> {
+public:
+ using EditBase<int>::EditBase; // Use constructor of base class.
+ void set(struct dive *d, int value) const override;
+ int data(struct dive *d) const override;
+ QString fieldName() const override;
+ DiveField fieldId() const override;
+};
+
class EditAirTemp : public EditBase<int> {
public:
using EditBase<int>::EditBase; // Use constructor of base class.
@@ -244,7 +281,11 @@ struct PasteState {
QString buddy;
QString suit;
int rating;
+ int wavesize;
int visibility;
+ int current;
+ int surge;
+ int chill;
tag_entry *tags;
struct cylinder_table cylinders;
struct weightsystem_table weightsystems;