mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
412317c91f
commit
86d7f6ace0
3 changed files with 11 additions and 7 deletions
|
@ -274,9 +274,6 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
|
||||||
// Creating (and canceling) the plan
|
// Creating (and canceling) the plan
|
||||||
connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));
|
connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));
|
||||||
connect(ui.buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan()));
|
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. */
|
/* set defaults. */
|
||||||
ui.startTime->setTime(QTime(1, 0));
|
ui.startTime->setTime(QTime(1, 0));
|
||||||
|
@ -879,10 +876,8 @@ void DivePlannerPointsModel::createPlan()
|
||||||
// Remove and clean the diveplan, so we don't delete
|
// Remove and clean the diveplan, so we don't delete
|
||||||
// the dive by mistake.
|
// the dive by mistake.
|
||||||
diveplan.dp = NULL;
|
diveplan.dp = NULL;
|
||||||
planCreated();
|
|
||||||
setPlanMode(NOTHING);
|
setPlanMode(NOTHING);
|
||||||
free(stagingDive);
|
free(stagingDive);
|
||||||
stagingDive = NULL;
|
stagingDive = NULL;
|
||||||
// we unselected all dives earlier, so as a side effect recreating the dive list will select the new dive
|
planCreated();
|
||||||
MainWindow::instance()->refreshDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,8 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(ui.actionRecent3, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
|
connect(ui.actionRecent3, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
|
||||||
connect(ui.actionRecent4, 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(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();
|
ui.mainErrorMessage->hide();
|
||||||
initialUiSetup();
|
initialUiSetup();
|
||||||
readSettings();
|
readSettings();
|
||||||
|
@ -406,6 +407,13 @@ void MainWindow::planCanceled()
|
||||||
refreshDisplay();
|
refreshDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::planCreated()
|
||||||
|
{
|
||||||
|
removeFakeDiveForAddAndPlan();
|
||||||
|
showProfile();
|
||||||
|
refreshDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionDivePlanner_triggered()
|
void MainWindow::on_actionDivePlanner_triggered()
|
||||||
{
|
{
|
||||||
if(!plannerStateClean())
|
if(!plannerStateClean())
|
||||||
|
|
|
@ -153,6 +153,7 @@ slots:
|
||||||
void editCurrentDive();
|
void editCurrentDive();
|
||||||
void removeFakeDiveForAddAndPlan();
|
void removeFakeDiveForAddAndPlan();
|
||||||
void planCanceled();
|
void planCanceled();
|
||||||
|
void planCreated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
|
|
Loading…
Reference in a new issue