aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-25 13:30:51 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-25 13:30:51 -0300
commit4f0112c4206d98c4810715d8bbee5589cdb4940f (patch)
treec79076bf0725023055b33ed24e639f4b3fe83fac /qt-ui
parent95e094c32531d5f0a78e7f8e419ab1b08b2b4197 (diff)
downloadsubsurface-4f0112c4206d98c4810715d8bbee5589cdb4940f.tar.gz
Created a placeholder for the Equipment Edition.
This creates a placeholder for the equipment edition, it will ease the 'revert' and 'apply' when editing multi dives. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp6
-rw-r--r--qt-ui/maintab.h8
2 files changed, 12 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index d9249046f..a52409c87 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -329,8 +329,10 @@ void MainTab::updateDiveInfo(int dive)
ui->timeLimits->setAverage(get_time_string(seconds, 0));
ui->timeLimits->setMaximum(get_time_string(stats_selection.longest_time.seconds, 0));
ui->timeLimits->setMinimum(get_time_string(stats_selection.shortest_time.seconds, 0));
- cylindersModel->setDive(d);
- weightModel->setDive(d);
+
+ multiEditEquipmentPlaceholder = *d;
+ cylindersModel->setDive(&multiEditEquipmentPlaceholder);
+ weightModel->setDive(&multiEditEquipmentPlaceholder);
} else {
/* clear the fields */
ui->rating->setCurrentStars(0);
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 1970bad1f..023a4de0c 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -81,6 +81,14 @@ private:
WeightModel *weightModel;
CylindersModel *cylindersModel;
QMap<dive*, NotesBackup> notesBackup;
+
+ /* since the multi-edition of the equipment is fairly more
+ * complex than a single item, because it involves a Qt
+ * Model to edit things, we are copying the first selected
+ * dive to this structure, making all editions there,
+ * then applying the changes on the other dives.*/
+ struct dive multiEditEquipmentPlaceholder;
+
enum { NONE, DIVE, TRIP, ADD } editMode;
Completers completers;
void enableEdition();