summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-05-28 15:54:04 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 17:02:46 -0700
commit86d7f6ace06adf13fe5045a217c4f264356a01df (patch)
treee45777cafa6ecd5d0edde3e611541323d70f9562
parent412317c91ff5212ea5e53fc4fd12cfdae4c04571 (diff)
downloadsubsurface-86d7f6ace06adf13fe5045a217c4f264356a01df.tar.gz
Move code from the Planner that doesn't belongs there.
Moved the connections between DivePlannerPointsModel and MainWindow from inside the Planner class to the MainWindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/diveplanner.cpp7
-rw-r--r--qt-ui/mainwindow.cpp10
-rw-r--r--qt-ui/mainwindow.h1
3 files changed, 11 insertions, 7 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 131cf300a..215898389 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -274,9 +274,6 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
// Creating (and canceling) the plan
connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));
connect(ui.buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan()));
- connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(removeFakeDiveForAddAndPlan()));
- connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(showProfile()));
- connect(plannerModel, SIGNAL(planCanceled()), MainWindow::instance(), SLOT(planCanceled()));
/* set defaults. */
ui.startTime->setTime(QTime(1, 0));
@@ -879,10 +876,8 @@ void DivePlannerPointsModel::createPlan()
// Remove and clean the diveplan, so we don't delete
// the dive by mistake.
diveplan.dp = NULL;
- planCreated();
setPlanMode(NOTHING);
free(stagingDive);
stagingDive = NULL;
- // we unselected all dives earlier, so as a side effect recreating the dive list will select the new dive
- MainWindow::instance()->refreshDisplay();
+ planCreated();
}
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 52eb3d115..9a325cef4 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -77,7 +77,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()));
ui.mainErrorMessage->hide();
initialUiSetup();
readSettings();
@@ -406,6 +407,13 @@ void MainWindow::planCanceled()
refreshDisplay();
}
+void MainWindow::planCreated()
+{
+ removeFakeDiveForAddAndPlan();
+ showProfile();
+ refreshDisplay();
+}
+
void MainWindow::on_actionDivePlanner_triggered()
{
if(!plannerStateClean())
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index f34c7a58a..9501e97e6 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -153,6 +153,7 @@ slots:
void editCurrentDive();
void removeFakeDiveForAddAndPlan();
void planCanceled();
+ void planCreated();
private:
Ui::MainWindow ui;