summaryrefslogtreecommitdiffstats
path: root/bibletime/frontend/kstartuplogo.cpp
blob: 5bc7089c87833a3c6d178202c7d5bb0204881d9c (plain)
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
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2006 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/



//Own includes
#include "kstartuplogo.h"

//Qt includes
#include <tqapplication.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqpixmap.h>

//KDE includes
#include <kapplication.h>
#include <kstandarddirs.h>
//#include <kimageio.h>

//static objects
KStartupLogo* KStartupLogo::startupLogo = 0;

void KStartupLogo::createSplash() {
	deleteSplash();
	startupLogo = new KStartupLogo();
}

void KStartupLogo::showSplash() {
	if (KStartupLogo::startupLogo) {
		KStartupLogo::startupLogo->show();
	}
}

void KStartupLogo::hideSplash() {
	if (startupLogo) {
		startupLogo->hide();
	}
}

void KStartupLogo::deleteSplash() {
	delete startupLogo;
	startupLogo = 0;
}


void KStartupLogo::setStatusMessage(const TQString& message) {
	if (startupLogo) {
		startupLogo->setText(message);
	}
}

KStartupLogo::KStartupLogo()
: TQWidget(0, "startuplogo", /*WStyle_Customize | WStyle_NoBorder*/ WStyle_NoBorder|WStyle_StaysOnTop|WX11BypassWM ) {

	TQPixmap pm;
	if ( !pm.load(locate("BT_pic","startuplogo.png")) ) {
		qWarning("Can't load startuplogo! Check your installation.");
	}

	setBackgroundPixmap(pm);

	//Please not change the margin
	textLabel = new TQLabel(this);
	textLabel->setGeometry(0,pm.height(),pm.width(),textLabel->sizeHint().height()+10);
	textLabel->setBackgroundColor( TQColor("#0d6de9") );
	textLabel->setFrameStyle(TQFrame::Panel | TQFrame::Plain);
	textLabel->setLineWidth(1);
	textLabel->setScaledContents( true );

	TQFont f;
	f.setBold( true );
	textLabel->setFont( f );

	TQPalette p = palette();
	p.setColor( TQPalette::Inactive, TQColorGroup::Text, Qt::white );
	p.setColor( TQPalette::Inactive, TQColorGroup::Foreground, Qt::white );
	p.setColor( TQPalette::Normal, TQColorGroup::Text, Qt::white );
	p.setColor( TQPalette::Normal, TQColorGroup::Foreground, Qt::white );
	setPalette( p );

	setGeometry (
		(KApplication::desktop()->width()-pm.width())/2,
		(KApplication::desktop()->height()-pm.height()-textLabel->height())/2,
		pm.width(),
		pm.height()+textLabel->height()
	);
}

void KStartupLogo::setText(const TQString text) {
	//Please not make the text bold & let the first character be blank
	textLabel->setText( TQString::fromLatin1(" %1").arg(text) );
	KApplication::kApplication()->processEvents();
}

/** Makes the splashscreen the toplevel window. */
void KStartupLogo::raiseSplash() {
	if (startupLogo) {
		startupLogo->raise();
		startupLogo->setActiveWindow();
		startupLogo->textLabel->show();
	}
}

/** Lowers the splash screen one window down, so it's possible to make it not to hide tip windows or other startup stuff. */
void KStartupLogo::lowerSplash() {
	if (startupLogo) {
		startupLogo->lower();
	}
}