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
147
148
149
150
151
152
153
154
155
|
// -*- c-basic-offset: 4 -*-
/*
Rosegarden
A sequencer and musical notation editor.
This program is Copyright 2000-2008
Guillaume Laurent <glaurent@telegraph-road.org>,
Chris Cannam <cannam@all-day-breakfast.com>,
Richard Bown <bownie@bownie.com>
This file contains code borrowed from KDevelop 2.0
Copyright (c) The KDevelop Development Team.
The moral right of the authors to claim authorship of this work
has been asserted.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#include <unistd.h>
#include <kapplication.h>
#include <tqpainter.h>
#include <tqfontmetrics.h>
#include <kapp.h>
#include <kstddirs.h>
#include <tdeconfig.h>
#include <ktip.h>
#include "TDEStartupLogo.h"
#include "misc/Debug.h"
TDEStartupLogo::TDEStartupLogo(TQWidget * parent, const char *name)
: TQWidget(parent, name,
WStyle_Customize |
WStyle_Splash
),
m_readyToHide(false),
m_showTip(true)
{
TQString pixmapFile = locate("appdata", "pixmaps/splash.png");
if (!pixmapFile)
return ;
m_pixmap.load(pixmapFile);
setBackgroundPixmap(m_pixmap);
setGeometry(TQApplication::desktop()->width() / 2 - m_pixmap.width() / 2,
TQApplication::desktop()->height() / 2 - m_pixmap.height() / 2,
m_pixmap.width(), m_pixmap.height());
}
TDEStartupLogo::~TDEStartupLogo()
{
m_wasClosed = true;
m_instance = 0;
}
void TDEStartupLogo::paintEvent(TQPaintEvent*)
{
// Print version number
TQPainter paint(this);
TQFont defaultFont;
defaultFont.setPixelSize(12);
paint.setFont(defaultFont);
TQFontMetrics metrics(defaultFont);
int width = metrics.width(m_statusMessage) + 6;
if (width > 200)
width = 200;
int y = m_pixmap.height() - 12;
// grep me: splash color
// TQColor bg(49, 94, 19); // color for 2006 splash
TQColor bg(19, 19, 19); // color for the 2008 splash
paint.setPen(bg);
paint.setBrush(bg);
paint.drawRect(TQRect(m_pixmap.width() - 220, m_pixmap.height() - 43,
220, (y + 8) - (m_pixmap.height() - 43)));
// paint.setPen(TQt::black);
// paint.setBrush(TQt::black);
paint.setPen(TQt::white);
paint.setBrush(TQt::white);
//TQString version(VERSION);
//int sepIdx = version.find("-");
TQString versionLabel(VERSION);
//TQString("R%1 v%2").arg(version.left(sepIdx)).arg(version.mid(sepIdx + 1));
int versionWidth = metrics.width(versionLabel);
paint.drawText(m_pixmap.width() - versionWidth - 18,
m_pixmap.height() - 28,
versionLabel);
paint.drawText(m_pixmap.width() - (width + 10), y, m_statusMessage);
}
void TDEStartupLogo::slotShowStatusMessage(TQString message)
{
m_statusMessage = message;
paintEvent(0);
TQApplication::flushX();
}
void TDEStartupLogo::close()
{
if (!m_wasClosed && isVisible()) {
if (m_showTip) {
RG_DEBUG << "TDEStartupLogo::close: Showing Tips\n";
KTipDialog::showTip(locate("data", "rosegarden/tips"));
}
}
TQWidget::close();
}
void TDEStartupLogo::mousePressEvent(TQMouseEvent*)
{
// for the haters of raising startlogos
if (m_readyToHide)
hide(); // don't close, main() sets up a TQTimer for that
}
TDEStartupLogo* TDEStartupLogo::getInstance()
{
if (m_wasClosed)
return 0;
if (!m_instance)
m_instance = new TDEStartupLogo;
return m_instance;
}
void TDEStartupLogo::hideIfStillThere()
{
if (m_instance)
m_instance->hide();
// don't close, main() sets up a TQTimer for that
}
TDEStartupLogo* TDEStartupLogo::m_instance = 0;
bool TDEStartupLogo::m_wasClosed = false;
#include "TDEStartupLogo.moc"
|