12 const int FIELD_WIDTH=34; //GUI size
13 const int FIELD_HEIGHT=34;
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);
71 QStateMachine *machine;
75 QList<Animation*> *moves;
79 void solved(int moves);
80 void updateMoves(int moves);
83 void cellMoved(int w, int h, int wnew, int hnew);
84 void cellGone(int w, int h);
92 void mousePressEvent(QMouseEvent *event);
93 void mouseReleaseEvent(QMouseEvent *event);
96 void paintCell(int x, int y, int cell, QPainter &painter);
97 QWidget *cellWidget(int w, int h);
98 QRect coo(int x, int y, int off=1)
100 return QRect(x*FV::FIELD_WIDTH+off,y*FV::FIELD_HEIGHT+off,FV::FIELD_WIDTH-off,FV::FIELD_HEIGHT-off);
102 QPoint cell(int worldX, int worldY)
104 return QPoint(width()/worldX, height()/worldY);
106 QPoint cell(const QPoint &pos)
108 return QPoint(pos.x()/FV::FIELD_WIDTH, pos.y()/FV::FIELD_HEIGHT);
113 #endif // FIELDVIEW_H