-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathabout.cpp
More file actions
146 lines (126 loc) · 5.6 KB
/
Copy pathabout.cpp
File metadata and controls
146 lines (126 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include "about.h"
#include <QtGui/QPixmap>
#include <QtGui/QFont>
#include <QtCore/QPointF>
About::About(QWidget *parent) : QGraphicsView(parent) {
desktopWidget = new QDesktopWidget;
scene = new QGraphicsScene;
scene->setSceneRect(0,0,500,300);
bgPixmap = new Pixmap(QPixmap(":/images/AboutWindow/background.png"));
bgPixmap->setPos(0,0);
icon = new Pixmap(QPixmap(":/icons/webrender.png"));
closeButton = new Pixmap(QPixmap(":/images/AboutWindow/close.png"));
headerTextItem = new QGraphicsTextItem(tr("WebRender"));
headerTextItem->setFont(QFont("sans",25));
versionTextItem = new QGraphicsTextItem(tr("Release Candidate 4"));
versionTextItem->setFont(QFont("sans",10));
subHeaderTextItem = new QGraphicsTextItem(tr("Brought to you by,"));
subHeaderTextItem->setFont(QFont("sans",10, 75));
textItem1 = new QGraphicsTextItem(tr("Anand Bose (Software Developer)"));
textItem1->setFont(QFont("sans",10));
textItem2 = new QGraphicsTextItem(tr("Jaideep Sasi (Mac OS X deployment)"));
textItem2->setFont(QFont("sans",10));
timer = new QTimer;
timer->setSingleShot(true);
stateMachine = new QStateMachine;
initialState = new QState;
finalState = new QState;
initialState->assignProperty(icon, "pos", QPointF(122,5));
initialState->assignProperty(closeButton, "pos", QPointF(375,270));
initialState->assignProperty(headerTextItem, "pos", QPointF(255,0));
initialState->assignProperty(versionTextItem, "pos", QPointF(255,0));
initialState->assignProperty(subHeaderTextItem, "pos", QPointF(255,0));
initialState->assignProperty(textItem1, "pos", QPointF(255,0));
initialState->assignProperty(textItem2, "pos", QPointF(255,0));
initialState->assignProperty(icon, "opacity", 0.0);
initialState->assignProperty(closeButton, "opacity", 0.0);
initialState->assignProperty(headerTextItem, "opacity", 0.0);
initialState->assignProperty(versionTextItem, "opacity", 0.0);
initialState->assignProperty(subHeaderTextItem, "opacity", 0.0);
initialState->assignProperty(textItem1, "opacity", 0.0);
initialState->assignProperty(textItem2, "opacity", 0.0);
finalState->assignProperty(icon, "pos", QPointF(0,5));
finalState->assignProperty(closeButton, "pos", QPointF(425,270));
finalState->assignProperty(headerTextItem, "pos", QPointF(255,45));
finalState->assignProperty(versionTextItem, "pos", QPointF(255,80));
finalState->assignProperty(subHeaderTextItem, "pos", QPointF(255,125));
finalState->assignProperty(textItem1, "pos", QPointF(255,141));
finalState->assignProperty(textItem2, "pos", QPointF(255,157));
finalState->assignProperty(icon, "opacity", 1.0);
finalState->assignProperty(closeButton, "opacity", 1.0);
finalState->assignProperty(headerTextItem, "opacity", 1.0);
finalState->assignProperty(versionTextItem, "opacity", 0.6);
finalState->assignProperty(subHeaderTextItem, "opacity", 1.0);
finalState->assignProperty(textItem1, "opacity", 1.0);
finalState->assignProperty(textItem2, "opacity", 1.0);
transition = initialState->addTransition(timer, SIGNAL(timeout()), finalState);
animation = new QPropertyAnimation(icon, "pos");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(closeButton, "pos");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(headerTextItem, "pos");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(versionTextItem, "pos");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(subHeaderTextItem, "pos");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(textItem1, "pos");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(textItem2, "pos");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(icon, "opacity");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(closeButton, "opacity");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(headerTextItem, "opacity");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(versionTextItem, "opacity");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(subHeaderTextItem, "opacity");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(textItem1, "opacity");
animation->setDuration(800);
transition->addAnimation(animation);
animation = new QPropertyAnimation(textItem2, "opacity");
animation->setDuration(800);
transition->addAnimation(animation);
stateMachine->addState(initialState);
stateMachine->addState(finalState);
stateMachine->setInitialState(initialState);
scene->addItem(bgPixmap);
scene->addItem(icon);
scene->addItem(closeButton);
scene->addItem(headerTextItem);
scene->addItem(versionTextItem);
scene->addItem(subHeaderTextItem);
scene->addItem(textItem1);
scene->addItem(textItem2);
setScene(scene);
setFixedSize(505,305);
setWindowTitle(tr("About WebRender"));
connect(closeButton,SIGNAL(clicked()),this,SLOT(close()));
connect(closeButton, SIGNAL(clicked()), stateMachine, SLOT(stop()));
}
void About::showAnimated() {
stateMachine->start();
timer->start(100);
show();
move((desktopWidget->availableGeometry(this).width()/2)- width()/2,(desktopWidget->availableGeometry(this).height()/2)- height()/2);
}
void About::closeEvent(QCloseEvent *event)
{
stateMachine->stop();
event->accept();
}