summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/tab-widgets/TabDiveEquipment.cpp2
-rw-r--r--desktop-widgets/tab-widgets/TabDiveEquipment.h2
-rw-r--r--qt-models/cylindermodel.cpp11
-rw-r--r--qt-models/cylindermodel.h3
-rw-r--r--qt-models/weightmodel.cpp9
-rw-r--r--qt-models/weightmodel.h3
6 files changed, 22 insertions, 8 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
index 13cfe77c4..78973b6c1 100644
--- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
@@ -35,6 +35,8 @@ TabDiveEquipment::TabDiveEquipment(QWidget *parent) : TabBase(parent),
connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &TabDiveEquipment::divesChanged);
connect(ui.cylinders, &TableView::itemClicked, this, &TabDiveEquipment::editCylinderWidget);
connect(ui.weights, &TableView::itemClicked, this, &TabDiveEquipment::editWeightWidget);
+ connect(cylindersModel->model(), &CylindersModel::divesEdited, this, &TabDiveEquipment::divesEdited);
+ connect(weightModel, &WeightModel::divesEdited, this, &TabDiveEquipment::divesEdited);
// Current display of things on Gnome3 looks like shit, so
// let's fix that.
diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.h b/desktop-widgets/tab-widgets/TabDiveEquipment.h
index 3576b449e..55eb21d1e 100644
--- a/desktop-widgets/tab-widgets/TabDiveEquipment.h
+++ b/desktop-widgets/tab-widgets/TabDiveEquipment.h
@@ -21,7 +21,6 @@ public:
~TabDiveEquipment();
void updateData() override;
void clear() override;
- void divesEdited(int i);
void closeWarning();
private slots:
@@ -32,6 +31,7 @@ private slots:
void editCylinderWidget(const QModelIndex &index);
void editWeightWidget(const QModelIndex &index);
void on_suit_editingFinished();
+ void divesEdited(int count);
private:
Ui::TabDiveEquipment ui;
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index c7e1b186d..e519d347b 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -473,7 +473,8 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
} else {
#ifndef SUBSURFACE_MOBILE
// On the EquipmentTab - place an editCylinder command.
- Command::editCylinder(index.row(), cyl, type, false);
+ int count = Command::editCylinder(index.row(), cyl, type, false);
+ emit divesEdited(count);
#endif
}
return true;
@@ -718,10 +719,12 @@ void CylindersModel::commitTempCyl(int row)
return;
// Only submit a command if the type changed
if (!same_string(cyl->type.description, tempCyl.type.description) || gettextFromC::tr(cyl->type.description) != QString(tempCyl.type.description)) {
- if (inPlanner)
+ if (inPlanner) {
std::swap(*cyl, tempCyl);
- else
- Command::editCylinder(tempRow, tempCyl, Command::EditCylinderType::TYPE, false);
+ } else {
+ int count = Command::editCylinder(tempRow, tempCyl, Command::EditCylinderType::TYPE, false);
+ emit divesEdited(count);
+ }
}
free_cylinder(tempCyl);
tempRow = -1;
diff --git a/qt-models/cylindermodel.h b/qt-models/cylindermodel.h
index 7b868b5b2..099a3beb2 100644
--- a/qt-models/cylindermodel.h
+++ b/qt-models/cylindermodel.h
@@ -51,6 +51,9 @@ public:
bool updateBestMixes();
bool cylinderUsed(int i) const;
+signals:
+ void divesEdited(int num);
+
public
slots:
void remove(QModelIndex index);
diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp
index 6e56071e2..6b5f9e70d 100644
--- a/qt-models/weightmodel.cpp
+++ b/qt-models/weightmodel.cpp
@@ -112,8 +112,10 @@ void WeightModel::commitTempWS()
return;
// Only submit a command if the type changed
weightsystem_t ws = d->weightsystems.weightsystems[tempRow];
- if (!same_string(ws.description, tempWS.description) || gettextFromC::tr(ws.description) != QString(tempWS.description))
- Command::editWeight(tempRow, tempWS, false);
+ if (!same_string(ws.description, tempWS.description) || gettextFromC::tr(ws.description) != QString(tempWS.description)) {
+ int count = Command::editWeight(tempRow, tempWS, false);
+ emit divesEdited(count);
+ }
tempRow = -1;
#endif
}
@@ -126,7 +128,8 @@ bool WeightModel::setData(const QModelIndex &index, const QVariant &value, int r
switch (index.column()) {
case WEIGHT:
ws.weight = string_to_weight(qPrintable(vString));
- Command::editWeight(index.row(), ws, false);
+ int count = Command::editWeight(index.row(), ws, false);
+ emit divesEdited(count);
return true;
}
return false;
diff --git a/qt-models/weightmodel.h b/qt-models/weightmodel.h
index 950e96d2b..b1df4fc8e 100644
--- a/qt-models/weightmodel.h
+++ b/qt-models/weightmodel.h
@@ -29,6 +29,9 @@ public:
void updateDive(dive *d);
weightsystem_t weightSystemAt(const QModelIndex &index) const;
+signals:
+ void divesEdited(int num);
+
public
slots:
void weightsystemsReset(const QVector<dive *> &dives);