summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-03 21:05:08 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-03 21:05:08 -0700
commitda911993f12b2ea3f519294c1c4d160c97cda54f (patch)
treed862ca323823156044e59fcf829c80b7bab36d2b /qt-ui/maintab.cpp
parent5fb947681e234a52ac6457a80a12e0362433cd5c (diff)
downloadsubsurface-da911993f12b2ea3f519294c1c4d160c97cda54f.tar.gz
Small cleanups
Add commented out options to subsurface.pro that enable debuging the planner. Remove obsolete comment. Clean up the selection tracking. Force the re-sort of the divelist inside the reload instead of explicitly calling it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 68918e7ed..e553712e1 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -774,32 +774,11 @@ void MainTab::acceptChanges()
resetPallete();
if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE) {
// now let's resort the dive list and make sure the newly added dive is still selected
- sort_table(&dive_table);
- MainWindow::instance()->dive_list()->unselectDives();
+ selected_dive = -1;
+ amount_selected = 0;
+ MainWindow::instance()->dive_list()->reload(DiveTripModel::CURRENT, true);
int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId));
MainWindow::instance()->dive_list()->selectDive(newDiveNr, true);
-#if 0
- // it's tricky to keep the right dive selected;
- // first remember which one is selected in the current sort order
- // and unselect all dives
- int rememberSelected = selected_dive;
- MainWindow::instance()->dive_list()->unselectDives();
- struct dive *d = get_dive(rememberSelected);
- // mark the previously selected dive as remembered (abusing the selected flag)
- // and then clear that flag out on the other side of the sort_table()
- d->selected = true;
- sort_table(&dive_table);
- for_each_dive (rememberSelected, d) {
- if (d->selected) {
- d->selected = false;
- break;
- }
- }
- // refreshDisplay() will select the top dive if no dive was
- // selected - but that may not be the right one, so select the one
- // we remembered instead
- MainWindow::instance()->dive_list()->selectDive(rememberSelected, true);
-#endif
editMode = NONE;
MainWindow::instance()->refreshDisplay();
MainWindow::instance()->graphics()->replot();