1
/***************************************************************************
3
copyright : (C) 2002 - 2004 by Scott Wheeler
4
email : wheeler@kde.org
5
***************************************************************************/
7
/***************************************************************************
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
14
***************************************************************************/
16
#include <kapplication.h>
17
#include <kiconloader.h>
23
#include "splashscreen.h"
25
SplashScreen *SplashScreen::splash = 0;
26
bool SplashScreen::done = false;
27
int SplashScreen::count = 0;
29
////////////////////////////////////////////////////////////////////////////////
31
////////////////////////////////////////////////////////////////////////////////
33
SplashScreen *SplashScreen::instance()
36
splash = new SplashScreen();
40
void SplashScreen::finishedLoading()
47
void SplashScreen::increment()
51
if(( count & 63 ) == 0)
52
splash->processEvents();
56
void SplashScreen::update()
59
splash->processEvents();
62
////////////////////////////////////////////////////////////////////////////////
64
////////////////////////////////////////////////////////////////////////////////
66
SplashScreen::SplashScreen() : QHBox(0 , "splashScreen", Qt::WStyle_Splash)
73
setFrameShadow(Plain);
75
QFont font = QWidget::font();
77
if(font.pixelSize() > 0)
78
font.setPixelSize(font.pixelSize() * 2);
80
font.setPointSize(font.pointSize() * 2);
82
QLabel *iconLabel = new QLabel(this);
83
iconLabel->setPixmap(DesktopIcon("juk"));
85
QLabel *textLabel = new QLabel(i18n("Items loaded:"), this);
86
textLabel->setFont(font);
88
m_countLabel = new QLabel(this);
89
m_countLabel->setText(QString::number(count));
90
m_countLabel->setFont(font);
91
m_countLabel->setMinimumWidth(m_countLabel->fontMetrics().width("00000"));
93
setMaximumWidth(iconLabel->width() + textLabel->width() + m_countLabel->width() + 10);
94
setMaximumHeight(QMAX(iconLabel->height(), textLabel->height()));
96
QDesktopWidget *desktop = KApplication::desktop();
97
QRect r = desktop->screenGeometry(desktop->primaryScreen());
98
setGeometry((r.width() / 2) - (width() / 2), (r.height() / 2) - (height() / 2), width(), height());
101
SplashScreen::~SplashScreen()
106
////////////////////////////////////////////////////////////////////////////////
108
////////////////////////////////////////////////////////////////////////////////
110
void SplashScreen::processEvents()
112
m_countLabel->setText(QString::number(count));
113
kapp->processEvents();