diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-06-30 07:49:56 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-07-03 14:30:46 -0700 |
commit | 4a7cf0e97020ff26d0f93c664183f8af262bf7d5 (patch) | |
tree | 1afd9451e41a4ccc78b91d2bb698242ba96c7c30 | |
parent | 9424760effd7ad4746fbb13ccc725054f336cfab (diff) | |
download | subsurface-4a7cf0e97020ff26d0f93c664183f8af262bf7d5.tar.gz |
profile: rename ADD state to EDIT state
The ADD state is not used for adding dives since adding dives
was made undoable. Therefore, rename it to EDIT state, since
that is what it is used for.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 2 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 34 | ||||
-rw-r--r-- | profile-widget/profilewidget2.h | 4 |
3 files changed, 20 insertions, 20 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 5c036915d..fd4fe8f82 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1523,7 +1523,7 @@ void MainWindow::editCurrentDive() copy_dive(current_dive, &displayed_dive); // Work on a copy of the dive DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD); DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive); - graphics->setAddState(&displayed_dive, 0); + graphics->setEditState(&displayed_dive, 0); setApplicationState(ApplicationState::EditDive); mainTab->enableEdition(); } diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 90058ebb6..e64f07b22 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -512,7 +512,7 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict #ifdef SUBSURFACE_MOBILE Q_UNUSED(doClearPictures); #endif - if ((currentState != ADD && currentState != PLAN) || !plannerModel) { + if ((currentState != EDIT && currentState != PLAN) || !plannerModel) { if (decoMode(false) == VPMB) decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.vpmb_conservatism)); else @@ -540,7 +540,7 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict #ifndef SUBSURFACE_MOBILE // reset some item visibility on printMode changes toolTipItem->setVisible(!printMode); - rulerItem->setVisible(prefs.rulergraph && !printMode && currentState != PLAN && currentState != ADD); + rulerItem->setVisible(prefs.rulergraph && !printMode && currentState != PLAN && currentState != EDIT); #endif if (currentState == EMPTY) setProfileState(); @@ -750,7 +750,7 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict diveComputerText->setText(dcText); #ifndef SUBSURFACE_MOBILE - if ((currentState == ADD || currentState == PLAN) && plannerModel) { + if ((currentState == EDIT || currentState == PLAN) && plannerModel) { repositionDiveHandlers(); plannerModel->deleteTemporaryPlan(); } @@ -866,7 +866,7 @@ void ProfileWidget2::mousePressEvent(QMouseEvent *event) if (zoomLevel) return; QGraphicsView::mousePressEvent(event); - if (currentState == PLAN || currentState == ADD) + if (currentState == PLAN || currentState == EDIT) shouldCalculateMaxDepth = shouldCalculateMaxTime = false; } @@ -890,7 +890,7 @@ void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event) if (zoomLevel) return; QGraphicsView::mouseReleaseEvent(event); - if (currentState == PLAN || currentState == ADD) { + if (currentState == PLAN || currentState == EDIT) { shouldCalculateMaxTime = shouldCalculateMaxDepth = true; replot(); } @@ -961,7 +961,7 @@ void ProfileWidget2::wheelEvent(QWheelEvent *event) void ProfileWidget2::mouseDoubleClickEvent(QMouseEvent *event) { - if ((currentState == PLAN || currentState == ADD) && plannerModel) { + if ((currentState == PLAN || currentState == EDIT) && plannerModel) { QPointF mappedPos = mapToScene(event->pos()); if (isPointOutOfBoundaries(mappedPos)) return; @@ -1187,9 +1187,9 @@ void ProfileWidget2::connectPlannerModel() connect(plannerModel, &DivePlannerPointsModel::rowsMoved, this, &ProfileWidget2::pointsMoved); } -void ProfileWidget2::setAddState(const dive *d, int dc) +void ProfileWidget2::setEditState(const dive *d, int dc) { - if (currentState == ADD) + if (currentState == EDIT) return; setProfileState(d, dc); @@ -1208,7 +1208,7 @@ void ProfileWidget2::setAddState(const dive *d, int dc) connectPlannerModel(); /* show the same stuff that the profile shows. */ - currentState = ADD; /* enable the add state. */ + currentState = EDIT; /* enable the add state. */ diveCeiling->setVisible(true); decoModelParameters->setVisible(true); setBackgroundBrush(QColor("#A7DCFF")); @@ -1292,7 +1292,7 @@ static bool isDiveTextItem(const QGraphicsItem *item, const DiveTextItem *textIt void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event) { - if (currentState == ADD || currentState == PLAN) { + if (currentState == EDIT || currentState == PLAN) { QGraphicsView::contextMenuEvent(event); return; } @@ -1727,7 +1727,7 @@ void ProfileWidget2::divePlannerHandlerMoved() void ProfileWidget2::keyDownAction() { - if ((currentState != ADD && currentState != PLAN) || !plannerModel) + if ((currentState != EDIT && currentState != PLAN) || !plannerModel) return; Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { @@ -1743,7 +1743,7 @@ void ProfileWidget2::keyDownAction() void ProfileWidget2::keyUpAction() { - if ((currentState != ADD && currentState != PLAN) || !plannerModel) + if ((currentState != EDIT && currentState != PLAN) || !plannerModel) return; Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { @@ -1762,7 +1762,7 @@ void ProfileWidget2::keyUpAction() void ProfileWidget2::keyLeftAction() { - if ((currentState != ADD && currentState != PLAN) || !plannerModel) + if ((currentState != EDIT && currentState != PLAN) || !plannerModel) return; Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { @@ -1781,7 +1781,7 @@ void ProfileWidget2::keyLeftAction() void ProfileWidget2::keyRightAction() { - if ((currentState != ADD && currentState != PLAN) || !plannerModel) + if ((currentState != EDIT && currentState != PLAN) || !plannerModel) return; Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { @@ -1797,7 +1797,7 @@ void ProfileWidget2::keyRightAction() void ProfileWidget2::keyDeleteAction() { - if ((currentState != ADD && currentState != PLAN) || !plannerModel) + if ((currentState != EDIT && currentState != PLAN) || !plannerModel) return; QVector<int> selectedIndices; @@ -1813,7 +1813,7 @@ void ProfileWidget2::keyDeleteAction() void ProfileWidget2::keyEscAction() { - if ((currentState != ADD && currentState != PLAN) || !plannerModel) + if ((currentState != EDIT && currentState != PLAN) || !plannerModel) return; if (scene()->selectedItems().count()) { @@ -1967,7 +1967,7 @@ void ProfileWidget2::plotPictures() void ProfileWidget2::plotPicturesInternal(const struct dive *d, bool synchronous) { pictures.clear(); - if (currentState == ADD || currentState == PLAN) + if (currentState == EDIT || currentState == PLAN) return; // Fetch all pictures of the dive, but consider only those that are within the dive time. diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index f4058a4f9..568141134 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -60,7 +60,7 @@ public: enum State { EMPTY, PROFILE, - ADD, + EDIT, PLAN, INVALID }; @@ -82,7 +82,7 @@ public: void plotDive(const struct dive *d, int dc, bool clearPictures = false, bool instant = false); void setProfileState(const struct dive *d, int dc); void setPlanState(const struct dive *d, int dc); - void setAddState(const struct dive *d, int dc); + void setEditState(const struct dive *d, int dc); void setPrintMode(bool mode, bool grayscale = false); bool isPointOutOfBoundaries(const QPointF &point) const; bool isPlanner() const; |