Break everything to make it correct next time.

This commit breaks the whole new profile. <3
The problem with the old code is that I was using the QStateMachine
and I just got tired of it. I will implement a much-simpler state
machine to do what I want instead of hitting my head on the wall
to understand how that was supposed to work.

This commit also adds a few helper methods to simplify the understanding
of the constructor and tries to make the logic a bit better. No graphics
are being show right now. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-02-07 14:59:58 -02:00 committed by Dirk Hohndel
parent 6de9b329d1
commit 9cf6b2be6b
4 changed files with 103 additions and 178 deletions

View file

@ -46,6 +46,10 @@ class ProfileWidget2 : public QGraphicsView {
Q_OBJECT
void fixBackgroundPos();
void scrollViewTo(const QPoint& pos);
void setupSceneAndFlags();
void setupItemSizes();
void addItemsToScene();
void setupItemOnScene();
public:
enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
enum Items{BACKGROUND, PROFILE_Y_AXIS, GAS_Y_AXIS, TIME_AXIS, DEPTH_CONTROLLER, TIME_CONTROLLER, COLUMNS};
@ -58,7 +62,6 @@ public:
public slots: // Necessary to call from QAction's signals.
void settingsChanged();
protected:
virtual void contextMenuEvent(QContextMenuEvent* event);
virtual void resizeEvent(QResizeEvent* event);
virtual void wheelEvent(QWheelEvent* event);
virtual void mouseMoveEvent(QMouseEvent* event);
@ -69,7 +72,6 @@ signals:
private:
DivePlotDataModel *dataModel;
State currentState;
QStateMachine *stateMachine;
int zoomLevel;
DivePixmapItem *background ;
ToolTipItem *toolTipItem;