mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
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>
This commit is contained in:
parent
74faca5d43
commit
9bff4eda35
1 changed files with 10 additions and 9 deletions
|
@ -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() ||
|
||||
|
|
Loading…
Reference in a new issue