profile: add plan-mode flag to ProfileWidget::plotDive()
The flag is passed down to the ProfileView to give a different background. Amazingly, this seems to survive light testing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
86309374cb
commit
4293f39535
@ -670,7 +670,7 @@ void MainWindow::on_actionReplanDive_triggered()
|
||||
|
||||
disableShortcuts(true);
|
||||
plannerWidgets->prepareReplanDive(current_dive);
|
||||
profile->setPlanState(plannerWidgets->getDive(), profile->dc);
|
||||
profile->plotDive(plannerWidgets->getDive(), profile->dc, true);
|
||||
plannerWidgets->replanDive(profile->dc);
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||
|
||||
disableShortcuts(true);
|
||||
plannerWidgets->preparePlanDive(current_dive);
|
||||
profile->setPlanState(plannerWidgets->getDive(), 0);
|
||||
profile->plotDive(plannerWidgets->getDive(), 0, true);
|
||||
plannerWidgets->planDive();
|
||||
}
|
||||
|
||||
|
||||
@ -272,7 +272,7 @@ void ProfileWidget::plotCurrentDive()
|
||||
plotDive(d, dc);
|
||||
}
|
||||
|
||||
void ProfileWidget::plotDive(dive *dIn, int dcIn)
|
||||
void ProfileWidget::plotDive(dive *dIn, int dcIn, bool planMode)
|
||||
{
|
||||
d = dIn;
|
||||
|
||||
@ -302,9 +302,10 @@ void ProfileWidget::plotDive(dive *dIn, int dcIn)
|
||||
view->plotDive(editedDive.get(), editedDc, ProfileView::RenderFlags::EditMode);
|
||||
setDive(editedDive.get());
|
||||
} else if (d) {
|
||||
//view->setProfileState(d, dc);
|
||||
int flags = planMode ? ProfileView::RenderFlags::PlanMode
|
||||
: ProfileView::RenderFlags::None;
|
||||
view->resetZoom(); // when switching dive, reset the zoomLevel
|
||||
view->plotDive(d, dc);
|
||||
view->plotDive(d, dc, flags);
|
||||
setDive(d);
|
||||
} else {
|
||||
view->clear();
|
||||
@ -357,13 +358,6 @@ void ProfileWidget::divesChanged(const QVector<dive *> &dives, DiveField field)
|
||||
plotCurrentDive();
|
||||
}
|
||||
|
||||
void ProfileWidget::setPlanState(const struct dive *d, int dc)
|
||||
{
|
||||
exitEditMode();
|
||||
//view->setPlanState(d, dc);
|
||||
setDive(d);
|
||||
}
|
||||
|
||||
void ProfileWidget::unsetProfHR()
|
||||
{
|
||||
ui.profHR->setChecked(false);
|
||||
@ -389,7 +383,6 @@ void ProfileWidget::editDive()
|
||||
QSignalBlocker blocker(DivePlannerPointsModel::instance());
|
||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
|
||||
DivePlannerPointsModel::instance()->loadFromDive(editedDive.get(), editedDc);
|
||||
//view->setEditState(editedDive.get(), editedDc);
|
||||
}
|
||||
|
||||
void ProfileWidget::exitEditMode()
|
||||
|
||||
@ -23,9 +23,8 @@ class ProfileWidget : public QWidget {
|
||||
public:
|
||||
ProfileWidget();
|
||||
~ProfileWidget();
|
||||
void plotDive(struct dive *d, int dc); // Attempt to keep DC number id dc < 0
|
||||
void plotDive(struct dive *d, int dc, bool planMode = false); // Attempt to keep DC number id dc < 0
|
||||
void plotCurrentDive();
|
||||
void setPlanState(const struct dive *d, int dc);
|
||||
void setEnabledToolbar(bool enabled);
|
||||
void nextDC();
|
||||
void prevDC();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user