From 816f6db35644d419ac09e359ec61afc36592686c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 15 Jan 2014 12:43:44 -0200 Subject: [PATCH] Added all the state transitions for each state. This code adds all state transitions for the items on screen; they do not animate yet, but already move to the correct location (the location seems wrong on the screen, because I'v not correctly zoomed out the canvas yet). Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index c25e3925b..5bd738da3 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -126,6 +126,56 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : const QLineF profileYAxisExpanded = QLineF(0,0,0,timeAxisOnCanvas); const QLineF timeAxisLine = QLineF(0, 0, 96, 0); + // State Defaults: + // Empty State, everything but the background is hidden. + emptyState->assignProperty(this, "backgroundBrush", QBrush(Qt::white)); + emptyState->assignProperty(background, "y", backgroundOnCanvas); + emptyState->assignProperty(profileYAxis, "x", profileYAxisOffCanvas); + emptyState->assignProperty(gasYAxis, "x", gasYAxisOffCanvas); + emptyState->assignProperty(timeAxis, "y", timeAxisOffCanvas); + emptyState->assignProperty(depthController, "y", depthControllerOffCanvas); + emptyState->assignProperty(timeController, "y", timeControllerOffCanvas); + + // Profile, everything but the background, depthController and timeController are shown. + profileState->assignProperty(this, "backgroundBrush", getColor(::BACKGROUND)); + profileState->assignProperty(background, "y", backgroundOffCanvas); + profileState->assignProperty(profileYAxis, "x", profileYAxisOnCanvas); + profileState->assignProperty(profileYAxis, "line", profileYAxisExpanded); + profileState->assignProperty(gasYAxis, "x", 0); + profileState->assignProperty(timeAxis, "y", timeAxisOnCanvas); + profileState->assignProperty(depthController, "y", depthControllerOffCanvas); + profileState->assignProperty(timeController, "y", timeControllerOffCanvas); + + // Edit, everything but the background and gasYAxis are shown. + editState->assignProperty(this, "backgroundBrush", QBrush(Qt::darkGray)); + editState->assignProperty(background, "y", backgroundOffCanvas); + editState->assignProperty(profileYAxis, "x", profileYAxisOnCanvas); + editState->assignProperty(profileYAxis, "line", profileYAxisExpanded); + editState->assignProperty(gasYAxis, "x", gasYAxisOffCanvas); + editState->assignProperty(timeAxis, "y", timeAxisEditMode); + editState->assignProperty(depthController, "y", depthControllerOnCanvas); + editState->assignProperty(timeController, "y", timeControllerOnCanvas); + + // Add, everything but the background and gasYAxis are shown. + addState->assignProperty(this, "backgroundBrush", QBrush(Qt::darkGray)); + addState->assignProperty(background, "y", backgroundOffCanvas); + addState->assignProperty(profileYAxis, "x", profileYAxisOnCanvas); + addState->assignProperty(profileYAxis, "rect", profileYAxisExpanded); + addState->assignProperty(gasYAxis, "x", gasYAxisOffCanvas); + addState->assignProperty(timeAxis, "y", timeAxisEditMode); + addState->assignProperty(depthController, "y", depthControllerOnCanvas); + addState->assignProperty(timeController, "y", timeControllerOnCanvas); + + // Plan, everything but the background and gasYAxis are shown. + planState->assignProperty(this, "backgroundBrush", QBrush(Qt::darkGray)); + planState->assignProperty(background, "y", backgroundOffCanvas); + planState->assignProperty(profileYAxis, "x", profileYAxisOnCanvas); + planState->assignProperty(profileYAxis, "line", profileYAxisExpanded); + planState->assignProperty(gasYAxis, "x", gasYAxisOffCanvas); + planState->assignProperty(timeAxis, "y", timeAxisEditMode); + planState->assignProperty(depthController, "y", depthControllerOnCanvas); + planState->assignProperty(timeController, "y", timeControllerOnCanvas); + } // Currently just one dive, but the plan is to enable All of the selected dives.