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
|
#include "splashscreen.h"
#include "splashscreen.moc"
#include <config.h>
#include <tqtimer.h>
#include <tqfont.h>
#include <klocale.h>
#include <kglobalsettings.h>
KDevSplashScreen::KDevSplashScreen(const TQPixmap& pixmap, WFlags f) : TQSplashScreen(pixmap, f)
{
TQTimer *timer = new TQTimer( this );
TQObject::connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(animate()));
timer->start(150);
state = 0;
progress_bar_size = 3;
}
KDevSplashScreen::~KDevSplashScreen()
{
}
void KDevSplashScreen::animate()
{
state = ((state + 1) % (2*progress_bar_size-1));
repaint();
}
void KDevSplashScreen::message( const TQString &str, int flags, const TQColor &color)
{
TQSplashScreen::message(str,flags,color);
animate();
m_string = str;
}
void KDevSplashScreen::drawContents (TQPainter* painter)
{
int position;
TQColor base_color (201,229,165); // Base green color
// Draw background circles
painter->setPen(NoPen);
painter->setBrush(TQColor(215,234,181));
painter->drawEllipse(51,7,9,9);
painter->drawEllipse(62,7,9,9);
painter->drawEllipse(73,7,9,9);
// Draw animated circles, increments are chosen
// to get close to background's color
// (didn't work well with TQColor::light function)
for (int i=0; i < progress_bar_size; i++)
{
position = (state+i)%(2*progress_bar_size-1);
painter->setBrush(TQColor(base_color.red()-18*i,
base_color.green()-10*i,
base_color.blue()-28*i));
if (position < 3) painter->drawEllipse(51+position*11,7,9,9);
}
painter->setPen(TQColor(74,112,18));
TQFont fnt(KGlobalSettings::generalFont());
fnt.setPointSize(8);
painter->setFont(fnt);
// Draw version number
TQRect r = rect();
r.setRect(r.x() + 5, r.y() + 5, r.width() - 10, r.height() - 10);
painter->drawText(r, Qt::AlignRight, i18n("Version %1").arg( VERSION ));
// Draw message at given position, limited to 43 chars
// If message is too long, string is truncated
if (m_string.length() > 40) {m_string.truncate(39); m_string += "...";}
painter->drawText (90, 16, m_string, 42);
}
|