more fixes.
On Wed, Jul 16, 2014 at 7:15 PM, Tomaz Canabrava <[email protected]> wrote: > 5 bugs in 4 patches. \o/
From 050bfb593eb6ac08c937280973f9ab3aacc16352 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 16 Jul 2014 19:23:02 -0300 Subject: [PATCH 5/7] Use 'this' instead of ::instance() when iside of same class. Do not use MainWindow::instance() inside of a non-static mainWindow method, that's just bogus. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 5f1e0c4..1016aac 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -85,8 +85,8 @@ MainWindow::MainWindow() : QMainWindow(), connect(ui.actionRecent3, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool))); connect(ui.actionRecent4, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool))); connect(information(), SIGNAL(addDiveFinished()), ui.newProfile, SLOT(setProfileState())); - connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), MainWindow::instance(), SLOT(planCreated())); - connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), MainWindow::instance(), SLOT(planCanceled())); + connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated())); + connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled())); connect(ui.printPlan, SIGNAL(pressed()), ui.divePlannerWidget, SLOT(printDecoPlan())); #ifdef NO_PRINTING ui.printPlan->hide(); @@ -695,7 +695,7 @@ QString MainWindow::filter() bool MainWindow::askSaveChanges() { QString message; - QMessageBox response(MainWindow::instance()); + QMessageBox response(this); if (existing_filename) message = tr("Do you want to save the changes that you made in the file %1?").arg(existing_filename); -- 2.0.1
From 4a710e56019fb914926e35dd6fcce4347fcf9d8f Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 16 Jul 2014 19:29:01 -0300 Subject: [PATCH 6/7] Force replot of selected_dive when canceling plan The profile was still the planner one, so we need to force a replot. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 1016aac..6e6859e 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -397,6 +397,7 @@ void MainWindow::planCanceled() { showProfile(); refreshDisplay(false); + ui.newProfile->plotDive(get_dive(selected_dive)); } void MainWindow::planCreated() -- 2.0.1
From fa1ccc4a0bc5a01a9ffa6073c7382e00cde9e016 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Wed, 16 Jul 2014 19:44:06 -0300 Subject: [PATCH 7/7] Desselects the trip before dive add / plan, and reselects it on cancel When we had a trip selected, we ignored that and simply called the DiveAdd functions, but the mainTab code that deal with selections to show one or more dives or trips asked how many trips were selected to the DiveList, and since a trip was selected things go kabum. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 2 ++ qt-ui/mainwindow.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 0fa81a4..d790f6e 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -807,6 +807,8 @@ void MainTab::rejectChanges() resetPallete(); // no harm done to call cancelPlan even if we were not in ADD or PLAN mode... DivePlannerPointsModel::instance()->cancelPlan(); + if(lastMode == ADD) + MainWindow::instance()->dive_list()->restoreSelection(); // now make sure that the correct dive is displayed if (selected_dive >= 0) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 6e6859e..c847660 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -470,6 +470,11 @@ void MainWindow::on_actionAddDive_triggered() if(!plannerStateClean()) return; + if (dive_list()->selectedTrips().count() >= 1){ + dive_list()->rememberSelection(); + dive_list()->clearSelection(); + } + ui.ListWidget->endSearch(); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD); -- 2.0.1
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
