summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-03 21:25:20 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-03 18:48:17 -0800
commit9190c97a3c2c9c73f0a351e7478077b057993955 (patch)
tree44af7c497c39e09f6402ebdc4926b1698a07fd22 /qt-ui/maintab.cpp
parentd128b74a8a05fda4cd43583ecc2323fd2d38f032 (diff)
downloadsubsurface-9190c97a3c2c9c73f0a351e7478077b057993955.tar.gz
Attempt to fix the 'click goes to 0,0' thing on the globe.
This patch attempts to fix the 'click goes to 0,0' bug on the globe. it moves a bit of code around and I particulary don't like the way that we are dealing with 'EditMode', I think I'll refactor that for 4.1. We are alredy dealing with a bunch of states, maybe a State Machine will help on removing code-complexity. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c91870f46..6fc72957b 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -602,11 +602,6 @@ void MainTab::acceptChanges()
else if (selected_dive == dive_table.nr - 1 && get_dive(dive_table.nr - 2)->number)
current_dive->number = get_dive(dive_table.nr - 2)->number + 1;
DivePlannerPointsModel::instance()->cancelPlan();
- // now make sure the selection logic is in a sane state
- // it's ok to hold on to the dive pointer for this short stretch of code
- // unselectDives() doesn't mess with the dive_table at all
- mainWindow()->dive_list()->unselectDives();
- mainWindow()->dive_list()->selectDive(selected_dive, true, true);
mainWindow()->showProfile();
mark_divelist_changed(TRUE);
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
@@ -619,7 +614,7 @@ void MainTab::acceptChanges()
}
resetPallete();
- if(editMode == ADD){
+ if(editMode == ADD || editMode == MANUALLY_ADDED_DIVE){
mainWindow()->dive_list()->unselectDives();
struct dive *d = get_dive(dive_table.nr -1 );
// HACK. this shouldn't be here. but apparently it's
@@ -630,14 +625,16 @@ void MainTab::acceptChanges()
for_each_dive(i,d){
if (d->selected) break;
}
+ editMode = NONE;
+ mainWindow()->refreshDisplay();
mainWindow()->dive_list()->selectDive( i, true );
}else{
+ editMode = NONE;
mainWindow()->dive_list()->rememberSelection();
sort_table(&dive_table);
mainWindow()->refreshDisplay();
mainWindow()->dive_list()->restoreSelection();
}
- editMode = NONE;
}
void MainTab::resetPallete()