summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-07-09 11:06:11 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-09 06:29:59 -0700
commite16b1162977ac1bf293f0c39a7a8e679935a5ce9 (patch)
treea7b425fe6920c58324796faf64bd6b8d7dc31f4e /qt-ui
parent5cbbff008411c322ce8184e121e93e40424a400d (diff)
downloadsubsurface-e16b1162977ac1bf293f0c39a7a8e679935a5ce9.tar.gz
Teach divemode editing about multiple dc's
This teaches the edit divemode about the fact that we can have multiple dc's with different divemodes. The previous code always just edited the first dc. This was reported by Ian Pitt in: https://groups.google.com/forum/#!category-topic/subsurface-divelog/4Zf47KS4Ifk Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 0ff44ae0c..043fe0a6a 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -495,7 +495,7 @@ void MainTab::updateDiveInfo(bool clear)
UPDATE_TEXT(displayed_dive, buddy);
UPDATE_TEMP(displayed_dive, airtemp);
UPDATE_TEMP(displayed_dive, watertemp);
- ui.DiveType->setCurrentIndex(displayed_dive.dc.divemode);
+ ui.DiveType->setCurrentIndex(get_dive_dc(&displayed_dive, dc_number)->divemode);
if (!clear) {
struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
@@ -861,6 +861,7 @@ void MainTab::acceptChanges()
addedId = displayed_dive.id;
}
struct dive *cd = current_dive;
+ struct divecomputer *displayed_dc = get_dive_dc(&displayed_dive, dc_number);
// now check if something has changed and if yes, edit the selected dives that
// were identical with the master dive shown (and mark the divelist as changed)
if (!same_string(displayed_dive.suit, cd->suit))
@@ -873,9 +874,13 @@ void MainTab::acceptChanges()
MODIFY_SELECTED_DIVES(EDIT_VALUE(visibility));
if (displayed_dive.airtemp.mkelvin != cd->airtemp.mkelvin)
MODIFY_SELECTED_DIVES(EDIT_VALUE(airtemp.mkelvin));
- if (displayed_dive.dc.divemode != cd->dc.divemode) {
- MODIFY_SELECTED_DIVES(EDIT_VALUE(dc.divemode));
- MODIFY_SELECTED_DIVES(update_setpoint_events(&mydive->dc));
+ if (displayed_dc->divemode != current_dc->divemode) {
+ MODIFY_SELECTED_DIVES(
+ if (get_dive_dc(mydive, dc_number)->divemode == current_dc->divemode || copyPaste) {
+ get_dive_dc(mydive, dc_number)->divemode = displayed_dc->divemode;
+ }
+ );
+ MODIFY_SELECTED_DIVES(update_setpoint_events(get_dive_dc(mydive, dc_number)));
do_replot = true;
}
if (displayed_dive.watertemp.mkelvin != cd->watertemp.mkelvin)
@@ -1133,8 +1138,9 @@ void MainTab::divetype_Changed(int index)
{
if (editMode == IGNORE)
return;
- displayed_dive.dc.divemode = (enum dive_comp_type) index;
- update_setpoint_events(&displayed_dive.dc);
+ struct divecomputer *displayed_dc = get_dive_dc(&displayed_dive, dc_number);
+ displayed_dc->divemode = (enum dive_comp_type) index;
+ update_setpoint_events(displayed_dc);
markChangedWidget(ui.DiveType);
MainWindow::instance()->graphics()->recalcCeiling();
}