12 const int FIELD_WIDTH=45; //GUI size
13 const int FIELD_HEIGHT=45;
19 QPropertyAnimation *a;
23 Animation(QRect _src, QString _name):src(_src),name(_name)
26 QPropertyAnimation* getAnimation(QWidget *i)
28 a->setTargetObject(i);
33 class Move : public Animation
36 Move(QRect _src, QRect _dst):Animation(_src,"Move")
38 a=new QPropertyAnimation();
39 a->setPropertyName("geometry");
41 a->setStartValue(_src);
45 class Hide : public Animation
48 Hide(QRect _src): Animation (_src,"Hide")
50 a=new QPropertyAnimation();
54 a->setPropertyName("geometry");
56 a->setStartValue(src);
60 class FieldView : public QWidget
64 explicit FieldView(QWidget *parent = 0);
65 PlayField* setPlayField(PlayField *pf);
75 QList<Animation*> *moves;
76 QTimer *solutionTimer;
79 void move(int x, int y, int dest_x);
84 void solved(int moves);
85 void updateMoves(int moves);
89 void cellMoved(int w, int h, int wnew, int hnew);
90 void cellGone(int w, int h);
93 void playSolutionMove();
99 void mousePressEvent(QMouseEvent *event);
100 void mouseReleaseEvent(QMouseEvent *event);
101 virtual void updateWidgets();
103 //void paintCell(int x, int y, int cell, QPainter &painter);
104 QWidget *cellWidget(int w, int h);
105 QRect coo(int x, int y, int off=1)
107 return QRect(x*FV::FIELD_WIDTH+off,y*FV::FIELD_HEIGHT+off,FV::FIELD_WIDTH-off,FV::FIELD_HEIGHT-off);
109 QPoint cell(int worldX, int worldY)
111 return QPoint(width()/worldX, height()/worldY);
113 QPoint cell(const QPoint &pos)
115 return QPoint(pos.x()/FV::FIELD_WIDTH, pos.y()/FV::FIELD_HEIGHT);
120 #endif // FIELDVIEW_H