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
|
/***************************************************************************
* Copyright Brian Ledbetter 2001-2003 <[email protected]> *
* Copyright Ravikiran Rajagopal 2003 *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License (version 2) as *
* published by the Free Software Foundation. (The original KSplash/ML *
* codebase (upto version 0.95.3) is BSD-licensed.) *
* *
***************************************************************************/
#include <kapplication.h>
#include <kcursor.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
#include <kprogress.h>
#include <kwin.h>
#include <tqdesktopwidget.h>
#include <tqhbox.h>
#include <tqlabel.h>
#include <tqpoint.h>
#include <tqrect.h>
#include "wndstatus.h"
#include "wndstatus.moc"
// WndtqStatus::WndtqStatus(): Display a nifty status bar at
// the bottom of the screen, so the user always knows what's
// happening to his system.
WndtqStatus::WndtqStatus( TQPalette /*pal*/,
int xineramaScreen,
bool atTop, bool pbVisible,
const TQFont& font,
const TQColor& fgc, const TQColor & bgc,
const TQString& icon
)
:TQHBox( 0, "wndtqStatus", WStyle_Customize|WX11BypassWM )
{
setFrameStyle( TQFrame::NoFrame );
//setPalette( pal );
setPaletteBackgroundColor( bgc );
setPaletteForegroundColor( fgc );
setCursor( KCursor::blankCursor() );
setSpacing( 5 );
const TQRect rect = kapp->desktop()->screenGeometry( xineramaScreen );
// KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.
TQLabel *pix = new TQLabel( this );
TQPixmap _icon( SmallIcon(icon.isNull()||icon.isEmpty()?TQString("run"):icon) );
pix->setPixmap( _icon );
setStretchFactor(pix,0);
pix->setFixedWidth(16);
m_label = new TQLabel( this );
m_label->setFont( font );
m_label->setPaletteBackgroundColor( bgc );
m_label->setPaletteForegroundColor( fgc );
//TQFontMetrics metrics( font );
//m_label->setFixedHeight( metrics.height() );
m_label->setText(TQString(""));
m_label->setFixedWidth(rect.width()-105-16-10); // What's this magic number?
m_label->show();
m_progress = new KProgress( this );
setStretchFactor(m_progress,0);
m_progress->setFixedWidth(100);
TQWidget *widg = new TQWidget( this );
setStretchFactor(widg,50);
setFixedSize( rect.width(), QMAX(m_progress->height(),m_label->height()) );
if ( atTop )
move( rect.topLeft() );
else
move( rect.bottomLeft().x(), rect.bottomLeft().y()-height()+1 ); // The +1 is to work around a bug in screenGeometry().
if (!pbVisible)
m_progress->hide();
}
void WndtqStatus::slotSetMessage( const TQString& msg )
{
raise();
m_label->setText( msg );
}
void WndtqStatus::slotUpdateProgress( int i )
{
raise();
m_progress->setProgress( i );
}
void WndtqStatus::slotUpdateSteps( int i )
{
m_progress->setTotalSteps( i );
}
|