diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-12-27 17:26:22 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-12-27 17:31:23 -0800 |
commit | 9bff4eda35d18ca7b1c06d1e85a8994f47e1baea (patch) | |
tree | c59272e26c5b959399acf35ef70295e81f5a7d8e | |
parent | 74faca5d43f856b9f72a9023ef0b5b1ace238285 (diff) | |
download | subsurface-9bff4eda35d18ca7b1c06d1e85a8994f47e1baea.tar.gz |
Clear equipment tab for trips display
And prevent the user from editing equipment in trip edit mode (those edits
are both meaningless and of course will be ignored once we save the
changes to the trip).
Also moved some code for setting up tanks, weights, tags, etc, into the
"this is not a trip-edit" part of the updateDiveInfo() function.
Fixes #392
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/maintab.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 40dcf9b48..4fc543fc0 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -377,6 +377,7 @@ void MainTab::updateDiveInfo(int dive) temperature_t temp; struct dive *prevd; struct dive *d = get_dive(dive); + char buf[1024]; process_selected_dives(); process_all_dives(d, &prevd); @@ -418,6 +419,8 @@ void MainTab::updateDiveInfo(int dive) ui.location->setText(currentTrip->location); ui.NotesLabel->setText(tr("Trip Notes")); ui.notes->setText(currentTrip->notes); + clearEquipment(); + ui.equipmentTab->setEnabled(false); } else { setTabText(0, tr("Dive Notes")); // make all the fields visible writeable @@ -445,6 +448,12 @@ void MainTab::updateDiveInfo(int dive) // reset labels in case we last displayed trip notes ui.LocationLabel->setText(tr("Location")); ui.NotesLabel->setText(tr("Notes")); + ui.equipmentTab->setEnabled(true); + multiEditEquipmentPlaceholder = *d; + cylindersModel->setDive(&multiEditEquipmentPlaceholder); + weightModel->setDive(&multiEditEquipmentPlaceholder); + taglist_get_tagstring(d->tag_list, buf, 1024); + ui.tagWidget->setText(QString(buf)); } ui.maximumDepthText->setText(get_depth_string(d->maxdepth, TRUE)); ui.averageDepthText->setText(get_depth_string(d->meandepth, TRUE)); @@ -517,15 +526,6 @@ 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)); - - - char buf[1024]; - taglist_get_tagstring(d->tag_list, buf, 1024); - ui.tagWidget->setText(QString(buf)); - - multiEditEquipmentPlaceholder = *d; - cylindersModel->setDive(&multiEditEquipmentPlaceholder); - weightModel->setDive(&multiEditEquipmentPlaceholder); } else { /* clear the fields */ clearInfo(); @@ -569,6 +569,7 @@ void MainTab::acceptChanges() tabBar()->setTabIcon(0, QIcon()); // Notes tabBar()->setTabIcon(1, QIcon()); // Equipment hideMessage(); + ui.equipmentTab->setEnabled(true); /* now figure out if things have changed */ if (mainWindow() && mainWindow()->dive_list()->selectedTrips().count() == 1) { if (notesBackup[NULL].notes != ui.notes->toPlainText() || |