mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 13:16:16 +00:00
Planner: fold MainWindow::setupForAddAndPlan into createSimpleDive()
There was only one caller of MainWindow::setupForAddAndPlan() left and that caller immediately called DivePlannerPointsModel::createSimpleDive(). Thus, we might just as fold the former in the latter and thus concentrate all the prepare-dive-for-plan business in one place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
62cbf26cc8
commit
4f5621c4c6
3 changed files with 11 additions and 16 deletions
|
@ -852,19 +852,6 @@ void MainWindow::printPlan()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupForAddAndPlan(const char *model)
|
|
||||||
{
|
|
||||||
// clean out the dive and give it an id and the correct dc model
|
|
||||||
clear_dive(&displayed_dive);
|
|
||||||
displayed_dive.id = dive_getUniqID();
|
|
||||||
displayed_dive.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600;
|
|
||||||
displayed_dive.dc.model = strdup(model); // don't translate! this is stored in the XML file
|
|
||||||
dc_number = 1;
|
|
||||||
// setup the dive cylinders
|
|
||||||
DivePlannerPointsModel::instance()->clear();
|
|
||||||
DivePlannerPointsModel::instance()->setupCylinders();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionReplanDive_triggered()
|
void MainWindow::on_actionReplanDive_triggered()
|
||||||
{
|
{
|
||||||
if (!plannerStateClean() || !current_dive)
|
if (!plannerStateClean() || !current_dive)
|
||||||
|
@ -902,10 +889,9 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||||
setApplicationState(ApplicationState::PlanDive);
|
setApplicationState(ApplicationState::PlanDive);
|
||||||
|
|
||||||
graphics->setPlanState();
|
graphics->setPlanState();
|
||||||
|
dc_number = 1;
|
||||||
|
|
||||||
// create a simple starting dive, using the first gas from the just copied cylinders
|
// create a simple starting dive, using the first gas from the just copied cylinders
|
||||||
setupForAddAndPlan("planned dive"); // don't translate, stored in XML file
|
|
||||||
DivePlannerPointsModel::instance()->setupStartTime();
|
|
||||||
DivePlannerPointsModel::instance()->createSimpleDive();
|
DivePlannerPointsModel::instance()->createSimpleDive();
|
||||||
// plan the dive in the same mode as the currently selected one
|
// plan the dive in the same mode as the currently selected one
|
||||||
if (current_dive) {
|
if (current_dive) {
|
||||||
|
|
|
@ -211,7 +211,6 @@ private:
|
||||||
LocationInformationWidget *diveSiteEdit;
|
LocationInformationWidget *diveSiteEdit;
|
||||||
|
|
||||||
bool plannerStateClean();
|
bool plannerStateClean();
|
||||||
void setupForAddAndPlan(const char *model);
|
|
||||||
void configureToolbar();
|
void configureToolbar();
|
||||||
void setupSocialNetworkMenu();
|
void setupSocialNetworkMenu();
|
||||||
QDialog *findMovedImagesDialog;
|
QDialog *findMovedImagesDialog;
|
||||||
|
|
|
@ -46,6 +46,16 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows)
|
||||||
|
|
||||||
void DivePlannerPointsModel::createSimpleDive()
|
void DivePlannerPointsModel::createSimpleDive()
|
||||||
{
|
{
|
||||||
|
// clean out the dive and give it an id and the correct dc model
|
||||||
|
clear_dive(&displayed_dive);
|
||||||
|
displayed_dive.id = dive_getUniqID();
|
||||||
|
displayed_dive.when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600;
|
||||||
|
displayed_dive.dc.model = strdup("planned dive"); // don't translate! this is stored in the XML file
|
||||||
|
|
||||||
|
clear();
|
||||||
|
setupCylinders();
|
||||||
|
setupStartTime();
|
||||||
|
|
||||||
// initialize the start time in the plan
|
// initialize the start time in the plan
|
||||||
diveplan.when = displayed_dive.when;
|
diveplan.when = displayed_dive.when;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue