Polishing
[situare] / src / ui / listviewscreen.cpp
index 9ae3618..7a31e57 100644 (file)
 #include "listviewscreen.h"
 #include "situareuser.h"
 #include <QDebug>
-#include <QGraphicsRotation>
+#include <QtGui/QGraphicsTransform>
+#include <QtGui/QGraphicsRotation>
+
+const int INFOTAB_Y_LOC_STATE1 = 71;
+const int INFOTAB_X_LOC_STATE2 = 59;
+const int INFOTAB_Y_LOC_STATE2 = 71;
+const int LEFTBAR_X_LOC = 0;
+const int LEFTBAR_Y_LOC = 0;
+const int SLIDING_BAR_X_LOC_STATE1 = 0;
+const int SLIDING_BAR_Y_LOC_STATE1 = 0;
+const int BACKGROUND_X_LOC_STATE1 = 400;
+const int BACKGROUND_Y_LOC_STATE1 = 0;
+const int RIGHTARROW_X_LOC_STATE1 = 9;
+const int RIGHTARROW_Y_LOC_STATE1 = 205;
+const int LEFTARROW_X_LOC_STATE1 = 9;
+const int LEFTARROW_Y_LOC_STATE1 = 205;
+const int PROXYWIDGET_X_LOC_STATE1 = 59;
+const int PROXYWIDGET_Y_LOC_STATE1 = 71;
+const int SLIDING_BAR_X_LOC_STATE2 = 376;
+const int SLIDING_BAR_Y_LOC_STATE2 = 0;
+const int BACKGROUND_X_LOC_STATE2 = 0;
+const int BACKGROUND_Y_LOC_STATE2 = 0;
+const int RIGHTARROW_X_LOC_STATE2 = 385;
+const int RIGHTARROW_Y_LOC_STATE2 = 205;
+const int LEFTARROW_X_LOC_STATE2 = 385;
+const int LEFTARROW_Y_LOC_STATE2 = 205;
+const int PROXYWIDGET_X_LOC_STATE2 = 59;
+const int PROXYWIDGET_Y_LOC_STATE2 = 71;
+
 
 ListViewScreen::ListViewScreen(QWidget *parent)
     : QWidget(parent)
@@ -61,12 +89,9 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     scene->addItem(m_leftSideBar);
     scene->addItem(m_slidingLeftSideBar);
     scene->addItem(m_arrowRight);
+    scene->addItem(m_arrowLeft);
     m_leftSideBar->setPos(0,0);
 
-    QGraphicsRotation rotation(m_arrowRight);
-    rotation.setAxis(Qt::YAxis);
-    rotation.setOrigin(QVector3D(size().width()/2, size().height()/2, 0));
-
     QGraphicsView *view = new QGraphicsView(scene);
     view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
     view->setSceneRect(0,0,7000,3000);
@@ -84,39 +109,63 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     machine->setInitialState(state1);
 
     // State 1
-    state1->assignProperty(m_widgetProxy,"pos",QPointF(-m_personalInfo->width(),71));
-    state1->assignProperty(m_slidingLeftSideBar,"pos",QPointF(0,0));
-    state1->assignProperty(m_personalInfoBackGround,"pos",QPointF(-400,0));
-    state1->assignProperty(m_arrowRight,"pos", QPointF(9,205));
+    state1->assignProperty(m_widgetProxy,"pos",QPointF(-m_personalInfo->width(),
+                                                       INFOTAB_Y_LOC_STATE1));
+    state1->assignProperty(m_slidingLeftSideBar,"pos",
+                           QPointF(SLIDING_BAR_X_LOC_STATE1,SLIDING_BAR_Y_LOC_STATE1));
+    state1->assignProperty(m_personalInfoBackGround,"pos",
+                           QPointF(-BACKGROUND_X_LOC_STATE1,BACKGROUND_Y_LOC_STATE1));
+    state1->assignProperty(m_arrowRight,"pos", QPointF(RIGHTARROW_X_LOC_STATE1,
+                                                       RIGHTARROW_Y_LOC_STATE1));
+    state1->assignProperty(m_arrowLeft,"pos", QPointF(LEFTARROW_X_LOC_STATE2,
+                                                      LEFTARROW_Y_LOC_STATE2));
+    state1->assignProperty(m_arrowRight,"visible", true);
+    state1->assignProperty(m_arrowLeft,"visible", false);
 
     // State 2
-    state2->assignProperty(m_widgetProxy,"pos",QPointF(59,71));
-    state2->assignProperty(m_slidingLeftSideBar,"pos",QPointF(376,0));
-    state2->assignProperty(m_personalInfoBackGround,"pos",QPointF(0,0));
-    state2->assignProperty(m_arrowRight,"pos", QPointF(385,205));
-    state2->assignProperty(m_arrowRight,"angle", 180);
+    state2->assignProperty(m_widgetProxy,"pos",QPointF(INFOTAB_X_LOC_STATE2,INFOTAB_Y_LOC_STATE2));
+    state2->assignProperty(m_slidingLeftSideBar,"pos",QPointF(SLIDING_BAR_X_LOC_STATE2,
+                                                              SLIDING_BAR_Y_LOC_STATE2));
+    state2->assignProperty(m_personalInfoBackGround,"pos",QPointF(BACKGROUND_X_LOC_STATE2,
+                                                                  BACKGROUND_Y_LOC_STATE2));
+    state2->assignProperty(m_arrowRight,"pos", QPointF(RIGHTARROW_X_LOC_STATE2,
+                                                       RIGHTARROW_Y_LOC_STATE2));
+    state2->assignProperty(m_arrowLeft,"pos", QPointF(LEFTARROW_X_LOC_STATE2,
+                                                      LEFTARROW_Y_LOC_STATE2));
+    state2->assignProperty(m_arrowRight,"visible", false);
+    state2->assignProperty(m_arrowLeft,"visible", true);
 
     m_trans1 = state1->addTransition(m_slidingLeftSideBar,SIGNAL(clicked()),state2);
     m_anim1 = new QPropertyAnimation(m_widgetProxy,"pos");
     m_anim2 = new QPropertyAnimation(m_slidingLeftSideBar,"pos");
-    m_anim5 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
-    m_anim7 = new QPropertyAnimation(m_arrowRight,"pos");
+    m_anim3 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
+    m_anim4 = new QPropertyAnimation(m_arrowRight,"pos");
+    m_anim5 = new QPropertyAnimation(m_arrowLeft,"pos");
+    m_anim6 = new QPropertyAnimation(m_arrowRight,"visible");
+    m_anim7 = new QPropertyAnimation(m_arrowLeft,"visible");
     m_trans1->addAnimation(m_anim1);
     m_trans1->addAnimation(m_anim2);
+    m_trans1->addAnimation(m_anim3);
+    m_trans1->addAnimation(m_anim4);
     m_trans1->addAnimation(m_anim5);
+    m_trans1->addAnimation(m_anim6);
     m_trans1->addAnimation(m_anim7);
 
     m_trans2 = state2->addTransition(m_slidingLeftSideBar,SIGNAL(clicked()),state1);
-    m_anim3 = new QPropertyAnimation(m_widgetProxy,"pos");
-    m_anim4 = new QPropertyAnimation(m_slidingLeftSideBar,"pos");
-    m_anim6 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
-    m_anim8 = new QPropertyAnimation(m_arrowRight,"pos");
-    m_anim9 = new QPropertyAnimation(&rotation,"angle");
-    m_trans2->addAnimation(m_anim3);
-    m_trans2->addAnimation(m_anim4);
-    m_trans2->addAnimation(m_anim6);
+    m_anim8 = new QPropertyAnimation(m_widgetProxy,"pos");
+    m_anim9 = new QPropertyAnimation(m_slidingLeftSideBar,"pos");
+    m_anim10 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
+    m_anim11 = new QPropertyAnimation(m_arrowRight,"pos");
+    m_anim12 = new QPropertyAnimation(m_arrowLeft,"pos");
+    m_anim13 = new QPropertyAnimation(m_arrowRight,"visible");
+    m_anim14 = new QPropertyAnimation(m_arrowLeft,"visible");
     m_trans2->addAnimation(m_anim8);
     m_trans2->addAnimation(m_anim9);
+    m_trans2->addAnimation(m_anim10);
+    m_trans2->addAnimation(m_anim11);
+    m_trans2->addAnimation(m_anim12);
+    m_trans2->addAnimation(m_anim13);
+    m_trans2->addAnimation(m_anim14);
     machine->start();
 
     m_vbox = new QVBoxLayout(this);
@@ -128,34 +177,29 @@ ListViewScreen::ListViewScreen(QWidget *parent)
 
 ListViewScreen::~ListViewScreen()
 {
-    if (m_personalInfo)
-        delete m_personalInfo;
-    if (m_leftSideBar)
-        delete m_leftSideBar;
-    if (m_slidingLeftSideBar)
-        delete m_slidingLeftSideBar;
-    if (m_trans1)
-        delete m_trans1;
-    if (m_trans2)
-        delete m_trans2;
-    if (m_anim1)
-        delete m_anim1;
-    if (m_anim2)
-        delete m_anim2;
-    if (m_anim3)
-        delete m_anim3;
-    if (m_anim4)
-        delete m_anim4;
-    if (m_anim5)
-        delete m_anim5;
-    if (m_anim6)
-        delete m_anim6;
-    if (m_anim7)
-        delete m_anim7;
-    if (m_anim8)
-        delete m_anim8;
-    if (m_vbox)
-        delete m_vbox;
+    delete m_personalInfo;
+    delete m_leftSideBar;
+    delete m_slidingLeftSideBar;
+    delete m_personalInfoBackGround;
+    delete m_arrowLeft;
+    delete m_arrowRight;
+    delete m_trans1;
+    delete m_trans2;
+    delete m_anim1;
+    delete m_anim2;
+    delete m_anim3;
+    delete m_anim4;
+    delete m_anim5;
+    delete m_anim6;
+    delete m_anim7;
+    delete m_anim8;
+    delete m_anim9;
+    delete m_anim10;
+    delete m_anim11;
+    delete m_anim12;
+    delete m_anim13;
+    delete m_anim14;
+    delete m_vbox;
 }
 
 void ListViewScreen::updateMessage()