summaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-18 10:00:39 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-18 10:03:55 -0800
commit7d0cc6b337f242be2d15744465cc6adec5937193 (patch)
tree41ffa2383570a8745912b723f9cbbe10c9c0ef99 /qt-ui/simplewidgets.cpp
parent4966336e1d6c729e5763aa3ac607c77f8794e5da (diff)
downloadsubsurface-7d0cc6b337f242be2d15744465cc6adec5937193.tar.gz
Improve shift time functionality
In commit 85fab31c71fc ("Shift times of selected dives") we added a dialog that didn't align its content very well. This change improves the layout (I hope) and makes the labels in the layout clearer (earlier and later seem easier to correlate with the direction of the shift). The original commit also forgets to deal with the consequences of shifting the dives. The dive list needs to be re-sorted (as the relative order of dives could have changed) and be marked as changed. And we should try to maintain the selection across these operations. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index bbe7b1b37..692cda1a1 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -134,9 +134,15 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton* button)
amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60;
if (ui.backwards->isChecked())
amount *= -1;
-
- shift_times(amount);
- mainWindow()->refreshDisplay();
+ if (amount != 0) {
+ // DANGER, DANGER - this could get our dive_table unsorted...
+ shift_times(amount);
+ sort_table(&dive_table);
+ mark_divelist_changed(TRUE);
+ mainWindow()->dive_list()->rememberSelection();
+ mainWindow()->refreshDisplay();
+ mainWindow()->dive_list()->restoreSelection();
+ }
}
}