1
/***************************************************************************
2
* Copyright Brian Ledbetter 2001-2003 <brian@shadowcom.net> *
3
* Copyright Ravikiran Rajagopal 2003 <ravi@kde.org> *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License (version 2) as *
7
* published by the Free Software Foundation. (The original KSplash/ML *
8
* codebase (upto version 0.95.3) is BSD-licensed.) *
10
***************************************************************************/
12
#include <kapplication.h>
14
#include <kdialogbase.h>
15
#include <kglobalsettings.h>
16
#include <kiconloader.h>
18
#include <kstandarddirs.h>
21
#include <qdesktopwidget.h>
27
#include <objkstheme.h>
28
#include "themestandard.h"
29
#include "themestandard.moc"
31
#include "wndstatus.h"
33
ThemeStandard::ThemeStandard( QWidget *parent, const char *name, const QStringList &args )
34
:ThemeEngine( parent, name, args ), mIcon(0L), mPrevIcon(0L), mIconCount(0), mStdIconWidth(-1),
35
mIconPos(WndIcon::HBottomLeft), mSbAtTop(false), mSbVisible(true), mSbPbVisible(true), mSbFontName("helvetica"),
36
mSbFontSz(16), mSbFontBold(true), mSbFontItalic(false), mSbFont(QFont()), mSbFg(QColor()), mSbBg(QColor()),
37
mSbIcon("run"), mIconsVisible(true), mIconsJumping(true), mSplashScreen("(Default)")
43
void ThemeStandard::_initUi()
45
setFrameStyle( QFrame::NoFrame );
47
QString pixName = mTheme->locateThemeData( mSplashScreen );
49
if( mSplashScreen == "(Default)" || pixName.isEmpty() )
51
QString resource_prefix = "pics/";
52
if ( mTheme->loColor() )
53
resource_prefix += "locolor/";
54
pixName = locate( "appdata", resource_prefix + "splash.png");
57
QPixmap px = QPixmap( pixName );
61
//kdDebug() << "Loaded splash " << mSplashScreen << endl;
65
QLabel *lbl = new QLabel( this );
66
lbl->setBackgroundMode( NoBackground );
67
lbl->setFixedSize( pw, ph );
74
//kdDebug() << "Couldn't load splash " << mSplashScreen << endl;
78
const QRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
79
// KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.
81
move( rect.x() + (rect.width() - size().width())/2,
82
rect.y() + (rect.height() - size().height())/2 );
84
mStatus = new WndStatus( QPalette(), mTheme->xineramaScreen(), mSbAtTop, mSbPbVisible, mSbFont, mSbFg, mSbBg, mSbIcon );
87
void ThemeStandard::showEvent( QShowEvent * )
95
mStatusBarHeight = mStatus->height();
99
mStatusBarHeight = 0L;
103
// Adjust the visible icon.
104
void ThemeStandard::slotSetPixmap( const QString& pxn )
106
QPixmap px = DesktopIcon( pxn );
109
px = DesktopIcon( "go" );
111
if ( !mIconsVisible )
114
/* (We only use prev_i if jumping is enabled...) */
115
if ( mIconsJumping && mPrevIcon )
116
emit mPrevIcon->slotStopJumping();
118
if ( mStdIconWidth < 0 )
119
mStdIconWidth = DesktopIcon( "go" ).width();
121
mIcon = new WndIcon( ++mIconCount, mStdIconWidth, mStatusBarHeight, mTheme->xineramaScreen(),
122
px, QString::null, mIconPos, mSbAtTop, mIconsJumping );
127
emit mIcon->slotJump();
132
void ThemeStandard::_readSettings()
138
KConfig *cfg = mTheme->themeConfig();
142
//if ( !cfg->hasGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) ) )
144
cfg->setGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) );
146
QString sbpos = cfg->readEntry( "Statusbar Position", "Bottom" ).upper();
147
mSbAtTop = ( sbpos == "TOP" );
148
mSbVisible = cfg->readBoolEntry( "Statusbar Visible", true);
149
mSbPbVisible = cfg->readBoolEntry( "Progress Visible", true);
151
mSbFontName = cfg->readEntry( "Statusbar Font", "Sans Serif" );
152
mSbFontSz = cfg->readNumEntry( "Statusbar Font Size", 16 );
153
mSbFontBold = cfg->readBoolEntry( "Statusbar Font Bold", true );
154
mSbFontItalic = cfg->readBoolEntry( "Statusbar Font Italic", false );
155
mSbFont = QFont( mSbFontName, mSbFontSz, ( mSbFontBold? QFont::Bold : QFont::Normal ) );
157
mSbFont.setItalic( true );
159
mSbFg = cfg->readColorEntry( "Statusbar Foreground", &Qt::white );
160
mSbBg = cfg->readColorEntry( "Statusbar Background", &Qt::black );
161
mSbIcon = cfg->readEntry( "Statusbar Icon", "run" );
162
mIconsVisible = cfg->readBoolEntry( "Icons Visible", true);
163
mIconsJumping = cfg->readBoolEntry( "Icons Jumping", true);
164
mIconPos = (WndIcon::Position)cfg->readNumEntry( "Icon Position", 0 );
165
mSplashScreen = cfg->readEntry( "Splash Screen", "(Default)");
166
// cfg->readBoolEntry( "Allow Configuration", true );