summaryrefslogtreecommitdiffstats
path: root/ksplashml/themeengine
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /ksplashml/themeengine
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksplashml/themeengine')
-rw-r--r--ksplashml/themeengine/Makefile.am18
-rw-r--r--ksplashml/themeengine/default/Makefile.am17
-rw-r--r--ksplashml/themeengine/default/ksplashdefault.desktop97
-rw-r--r--ksplashml/themeengine/default/main.cpp17
-rw-r--r--ksplashml/themeengine/default/themelegacy.cpp310
-rw-r--r--ksplashml/themeengine/default/themelegacy.h103
-rw-r--r--ksplashml/themeengine/ksplashplugins.desktop12
-rw-r--r--ksplashml/themeengine/objkstheme.cpp168
-rw-r--r--ksplashml/themeengine/objkstheme.h70
-rw-r--r--ksplashml/themeengine/redmond/Makefile.am18
-rw-r--r--ksplashml/themeengine/redmond/Theme.rc2
-rw-r--r--ksplashml/themeengine/redmond/ksplashredmond.desktop96
-rw-r--r--ksplashml/themeengine/redmond/main.cpp38
-rw-r--r--ksplashml/themeengine/redmond/pics/Background.pngbin0 -> 32680 bytes
-rw-r--r--ksplashml/themeengine/redmond/pics/Makefile.am4
-rw-r--r--ksplashml/themeengine/redmond/pics/Preview.pngbin0 -> 10541 bytes
-rw-r--r--ksplashml/themeengine/redmond/previewredmond.cpp113
-rw-r--r--ksplashml/themeengine/redmond/previewredmond.h104
-rw-r--r--ksplashml/themeengine/redmond/themeredmond.cpp365
-rw-r--r--ksplashml/themeengine/redmond/themeredmond.h103
-rw-r--r--ksplashml/themeengine/simple/Makefile.am7
-rw-r--r--ksplashml/themeengine/simple/configure.in.in27
-rw-r--r--ksplashml/themeengine/simple/main.cpp182
-rw-r--r--ksplashml/themeengine/standard/Makefile.am23
-rw-r--r--ksplashml/themeengine/standard/Preview.pngbin0 -> 290009 bytes
-rw-r--r--ksplashml/themeengine/standard/Theme.rc2
-rw-r--r--ksplashml/themeengine/standard/ksplashstandard.desktop97
-rw-r--r--ksplashml/themeengine/standard/pics/Makefile.am4
-rw-r--r--ksplashml/themeengine/standard/pics/Preview.pngbin0 -> 51462 bytes
-rw-r--r--ksplashml/themeengine/standard/themestandard.cpp167
-rw-r--r--ksplashml/themeengine/standard/themestandard.h93
-rw-r--r--ksplashml/themeengine/standard/themestandardlib.cpp15
-rw-r--r--ksplashml/themeengine/standard/wndicon.cpp310
-rw-r--r--ksplashml/themeengine/standard/wndicon.h70
-rw-r--r--ksplashml/themeengine/standard/wndstatus.cpp101
-rw-r--r--ksplashml/themeengine/standard/wndstatus.h50
-rw-r--r--ksplashml/themeengine/themeengine.cpp136
-rw-r--r--ksplashml/themeengine/themeengine.h82
38 files changed, 3021 insertions, 0 deletions
diff --git a/ksplashml/themeengine/Makefile.am b/ksplashml/themeengine/Makefile.am
new file mode 100644
index 000000000..411825cc9
--- /dev/null
+++ b/ksplashml/themeengine/Makefile.am
@@ -0,0 +1,18 @@
+SUBDIRS = . default standard redmond simple
+
+INCLUDES = -I$(srcdir)/.. $(all_includes)
+
+lib_LTLIBRARIES = libksplashthemes.la
+
+libksplashthemes_la_SOURCES = themeengine.cpp objkstheme.cpp
+libksplashthemes_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined
+libksplashthemes_la_LIBADD = $(LIB_KDEUI) $(LIB_XCURSOR)
+METASOURCES = AUTO
+
+# install this header for theme developers.
+pkgincludedir = $(includedir)/ksplash
+pkginclude_HEADERS=themeengine.h objkstheme.h
+
+servicetypesdir = $(kde_servicetypesdir)
+servicetypes_DATA = ksplashplugins.desktop
+
diff --git a/ksplashml/themeengine/default/Makefile.am b/ksplashml/themeengine/default/Makefile.am
new file mode 100644
index 000000000..e3f522751
--- /dev/null
+++ b/ksplashml/themeengine/default/Makefile.am
@@ -0,0 +1,17 @@
+
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../.. $(all_includes)
+
+noinst_LTLIBRARIES = libthemedefault.la
+libthemedefault_la_SOURCES = themelegacy.cpp
+libthemedefault_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+libthemedefault_la_LIBADD = $(LIB_KDEUI) ../libksplashthemes.la
+
+kde_module_LTLIBRARIES = ksplashdefault.la
+
+ksplashdefault_la_SOURCES = main.cpp
+ksplashdefault_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(KDE_PLUGIN) -module
+ksplashdefault_la_LIBADD = $(LIB_KDEUI) ../libksplashthemes.la libthemedefault.la
+METASOURCES = AUTO
+
+servicesdir = $(kde_servicesdir)
+services_DATA = ksplashdefault.desktop
diff --git a/ksplashml/themeengine/default/ksplashdefault.desktop b/ksplashml/themeengine/default/ksplashdefault.desktop
new file mode 100644
index 000000000..66244d5d4
--- /dev/null
+++ b/ksplashml/themeengine/default/ksplashdefault.desktop
@@ -0,0 +1,97 @@
+[Desktop Entry]
+Type=Service
+Comment=KSplash Plugin
+Comment[af]=KSplash Inprop module
+Comment[ar]=ملحق للشاشة الافتتاحية
+Comment[az]=KSplash Əlavəsi
+Comment[be]=Утулка KSplash
+Comment[bg]=Приставка KSplash
+Comment[bn]=কে-স্প্ল্যাশ প্লাগ-ইন
+Comment[br]=Lugent KSplash
+Comment[bs]=KSplash dodatak
+Comment[ca]=Connector per a KSplash
+Comment[cs]=Modul aplikaci KSplash
+Comment[csb]=Plugins KSplash
+Comment[cy]=Ategyn KCroeso
+Comment[da]=KSplash-plugin
+Comment[de]=KSplash-Plugin
+Comment[el]=Πρόσθετο KSplash
+Comment[eo]=Ksalutŝilda kromaĵo
+Comment[es]=Complemento KSplash
+Comment[et]=KSplashi plugin
+Comment[eu]=KSplash plugina
+Comment[fa]=وصلۀ KSplash
+Comment[fi]=KSplash-liitännäinen
+Comment[fr]=Modules de KSplash
+Comment[fy]=KSplash-plugin
+Comment[ga]=Breiseán KSplash
+Comment[gl]=Plugin de KSplash
+Comment[he]=תוסף KSplash
+Comment[hi]=के-स्प्लैश प्लगइन
+Comment[hr]=KSplash dodatak
+Comment[hu]=KSplash bővítőmodul
+Comment[is]=KSplash íforrit
+Comment[it]=Plugin KSplash
+Comment[ja]=KSplash プラグイン
+Comment[ka]=KSplash პლაგინი
+Comment[kk]=KSplash модулі
+Comment[km]=កម្មវិធី​ជំនួយ​ខាង​ក្នុង​របស់ KSplash
+Comment[lt]=KSplash įskiepis
+Comment[lv]=KSplash spraudnis
+Comment[mk]=Приклучок за KSplash
+Comment[ms]=Plugin KSplash
+Comment[mt]=Plugin ta' KSplash
+Comment[nb]=Programtillegg Ksplash
+Comment[ne]=के स्प्लयास प्लगइन
+Comment[nl]=KSplash-plugin
+Comment[nn]=KSplash-programtillegg
+Comment[pa]=ਕੇ-ਸਪਲੇਸ ਪਲੱਗਇਨ
+Comment[pl]=Wtyczka KSplash
+Comment[pt]='Plugin' do KSplash
+Comment[pt_BR]=Plug-in do KSplash
+Comment[ro]=Modul KSplash
+Comment[ru]=Модуль KSplash
+Comment[rw]=Icomeka rya K-Gukwiza
+Comment[se]=KSplash-lassemoduvla
+Comment[sk]=Modul KSplash
+Comment[sl]=Vstavek KSplash
+Comment[sr]=KSplash прикључак
+Comment[sr@Latn]=KSplash priključak
+Comment[sv]=Insticksprogram för startskärm
+Comment[ta]=Kஸ்ப்ளாஷ் செருகு பொருள்
+Comment[tg]=Мутассалкунандаи KSplash
+Comment[th]=ปลั๊กอิน KSplash
+Comment[tr]=KSplash Eklentisi
+Comment[tt]=KSplash atlı Östämä
+Comment[uk]=Втулок KSplash
+Comment[uz]=KSplash plagini
+Comment[uz@cyrillic]=KSplash плагини
+Comment[vi]=Trình bổ sung Chào mừng KDE
+Comment[wa]=Tchôke-divins KSplash (waitroûle d' enondaedje)
+Comment[zh_CN]=KSplash 插件
+Comment[zh_TW]=KSplash 外掛程式
+Name=KSplashLegacy
+Name[af]=KSplash Verouders
+Name[be]=Старая тэма
+Name[ca]=KSplash heretat
+Name[cs]=Staré
+Name[cy]=KCroesoEtifeddiaeth
+Name[de]=KSplash mit älterem Programm
+Name[eo]=Ksalutŝildotestamento
+Name[et]=KSplahs Legacy
+Name[hi]=के-स्प्लैश-लीजेसी
+Name[it]=KSplashVecchio
+Name[ne]=के स्प्लयास अवस्था
+Name[pa]=ਕੇਸਪਲੇਸਲੀਜੈਂਸੀ
+Name[pt_BR]=Herança do KSplash
+Name[rw]=K-GukwizaUmurage
+Name[sv]=Klassisk startskärm
+Name[ta]=Kஸ்ப்ளாஷ் Legacy
+Name[tg]=МеросиKSplash
+Name[vi]=Chào mừng KDE Gia tài
+Name[wa]=KSplashTayons
+ServiceTypes=KSplash/Plugin
+X-KDE-Library=ksplashdefault
+X-KSplash-Default=true
+X-KSplash-PluginName=Default
+X-KSplash-ObjectName=ThemeLegacy
diff --git a/ksplashml/themeengine/default/main.cpp b/ksplashml/themeengine/default/main.cpp
new file mode 100644
index 000000000..e1382dd37
--- /dev/null
+++ b/ksplashml/themeengine/default/main.cpp
@@ -0,0 +1,17 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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 <kgenericfactory.h>
+
+#include "themelegacy.h"
+
+K_EXPORT_COMPONENT_FACTORY( ksplashdefault, KGenericFactory<ThemeDefault>( "ksplash" ) )
diff --git a/ksplashml/themeengine/default/themelegacy.cpp b/ksplashml/themeengine/default/themelegacy.cpp
new file mode 100644
index 000000000..35d47241b
--- /dev/null
+++ b/ksplashml/themeengine/default/themelegacy.cpp
@@ -0,0 +1,310 @@
+/***************************************************************************
+ * 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 <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kprogress.h>
+
+#include <qcheckbox.h>
+#include <qdesktopwidget.h>
+#include <qlabel.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qwidget.h>
+#include <qtimer.h>
+
+#include "objkstheme.h"
+#include "themeengine.h"
+#include "themelegacy.h"
+#include "themelegacy.moc"
+
+DefaultConfig::DefaultConfig( QWidget *parent, KConfig *config )
+ :ThemeEngineConfig( parent, config )
+{
+ mConfig->setGroup( QString("KSplash Theme: Default") );
+ QVBox *hbox = new QVBox( this );
+ mFlash = new QCheckBox( i18n("Icons flash while they are starting"), hbox );
+ mFlash->setChecked( mConfig->readBoolEntry("Icons Flashing",true) );
+ mAlwaysShow = new QCheckBox( i18n("Always show progress bar"), hbox );
+ mAlwaysShow->setChecked( mConfig->readBoolEntry("Always Show Progress",true) );
+}
+
+void DefaultConfig::save()
+{
+ kdDebug() << "DefaultConfig::save()" << endl;
+ mConfig->setGroup( QString("KSplash Theme: Default") );
+ mConfig->writeEntry( "Icons Flashing", mFlash->isChecked() );
+ mConfig->writeEntry( "Always Show Progress", mAlwaysShow->isChecked() );
+ mConfig->sync();
+}
+
+#define BIDI 0
+
+ThemeDefault::ThemeDefault( QWidget *parent, const char *name, const QStringList &args )
+ :ThemeEngine( parent, name, args )
+{
+
+ mActivePixmap = mInactivePixmap = 0L;
+ mState = 0;
+
+ _readSettings();
+ _initUi();
+
+ if( mIconsFlashing )
+ {
+ mFlashTimer = new QTimer( this );
+ connect( mFlashTimer, SIGNAL(timeout()), this, SLOT(flash()) );
+ mFlashPixmap1 = new QPixmap();
+ mFlashPixmap2 = new QPixmap();
+
+ }
+ else
+ {
+ mFlashTimer = 0L;
+ mFlashPixmap1 = 0L;
+ mFlashPixmap2 = 0L;
+ }
+}
+
+ThemeDefault::~ThemeDefault()
+{
+ delete mFlashPixmap1;
+ delete mFlashPixmap2;
+}
+
+void ThemeDefault::_initUi()
+{
+ QString resource_prefix;
+
+ QVBox *vbox = new QVBox( this );
+ vbox->setBackgroundMode(NoBackground);
+
+
+ QString activePix, inactivePix;
+#if BIDI
+ if ( QApplication::reverseLayout() )
+ {
+ activePix = _findPicture(QString("splash_active_bar_bidi.png"));
+ inactivePix = _findPicture(QString("splash_inactive_bar_bidi.png"));
+ }
+ else
+#endif
+ {
+ activePix = _findPicture(QString("splash_active_bar.png"));
+ inactivePix = _findPicture(QString("splash_inactive_bar.png"));
+ }
+ kdDebug() << "Inactive pixmap: " << inactivePix << endl;
+ kdDebug() << "Active pixmap: " << activePix << endl;
+
+ mActivePixmap = new QPixmap( activePix );
+ mInactivePixmap = new QPixmap( inactivePix );
+
+ if (mActivePixmap->isNull())
+ {
+ mActivePixmap->resize(200,100);
+ mActivePixmap->fill(Qt::blue);
+ }
+ if (mInactivePixmap->isNull())
+ {
+ mInactivePixmap->resize(200,100);
+ mInactivePixmap->fill(Qt::black);
+ }
+
+ QPixmap tlimage( _findPicture(QString("splash_top.png")) );
+ if (tlimage.isNull())
+ {
+ tlimage.resize(200,100);
+ tlimage.fill(Qt::blue);
+ }
+ QLabel *top_label = new QLabel( vbox );
+ top_label->setPixmap( tlimage );
+ top_label->setFixedSize( tlimage.width(), tlimage.height() );
+ top_label->setBackgroundMode(NoBackground);
+
+ mBarLabel = new QLabel( vbox );
+ mBarLabel->setPixmap(*mInactivePixmap);
+ mBarLabel->setBackgroundMode(NoBackground);
+
+ QPixmap blimage( _findPicture(QString("splash_bottom.png")) );
+ if (blimage.isNull())
+ {
+ blimage.resize(200,100);
+ blimage.fill(Qt::black);
+ }
+ QLabel *bottom_label = new QLabel( vbox );
+ bottom_label->setPaletteBackgroundPixmap( blimage );
+
+
+ mLabel = new QLabel( bottom_label );
+ mLabel->setBackgroundOrigin( QWidget::ParentOrigin );
+ mLabel->setPaletteForegroundColor( mLabelForeground );
+ mLabel->setPaletteBackgroundPixmap( blimage );
+ QFont f(mLabel->font());
+ f.setBold(TRUE);
+ mLabel->setFont(f);
+
+ mProgressBar = new KProgress( mLabel );
+ int h, s, v;
+ mLabelForeground.getHsv( &h, &s, &v );
+ mProgressBar->setPalette( QPalette( v > 128 ? black : white ));
+ mProgressBar->setBackgroundOrigin( QWidget::ParentOrigin );
+ mProgressBar->setPaletteBackgroundPixmap( blimage );
+
+ bottom_label->setFixedWidth( QMAX(blimage.width(),tlimage.width()) );
+ bottom_label->setFixedHeight( mLabel->sizeHint().height()+4 );
+
+ // 3 pixels of whitespace between the label and the progressbar.
+ mLabel->resize( bottom_label->width(), bottom_label->height() );
+
+ mProgressBar->setFixedSize( 120, mLabel->height() );
+
+ if (QApplication::reverseLayout()){
+ mProgressBar->move( 2, 0 );
+// mLabel->move( mProgressBar->width() + 4, 0);
+ }
+ else{
+ mProgressBar->move( bottom_label->width() - mProgressBar->width() - 4, 0);
+ mLabel->move( 2, 0 );
+ }
+
+ mProgressBar->hide();
+
+ setFixedWidth( mInactivePixmap->width() );
+ setFixedHeight( mInactivePixmap->height() +
+ top_label->height() + bottom_label->height() );
+
+ const QRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
+ // KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.
+ // kdDebug() << "ThemeDefault::_initUi" << rect << endl;
+
+ move( rect.x() + (rect.width() - size().width())/2,
+ rect.y() + (rect.height() - size().height())/2 );
+}
+
+// Attempt to find overrides elsewhere?
+void ThemeDefault::_readSettings()
+{
+ if( !mTheme )
+ return;
+
+ KConfig *cfg = mTheme->themeConfig();
+ if( !cfg )
+ return;
+
+ cfg->setGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) );
+
+ mIconsFlashing = cfg->readBoolEntry( "Icons Flashing", true );
+ QColor df(Qt::white);
+ mLabelForeground = cfg->readColorEntry( "Label Foreground", &df );
+}
+
+/*
+ * ThemeDefault::slotUpdateState(): IF in Default mode, THEN adjust the bar
+ * pixmap label. Whee, phun!
+ *
+ * A similar method exists in the old KSplash.
+ */
+void ThemeDefault::slotUpdateState()
+{
+ if( mState > 8 )
+ mState = 8;
+
+ if( mIconsFlashing )
+ {
+
+ *mFlashPixmap1 = updateBarPixmap( mState );
+ *mFlashPixmap2 = updateBarPixmap( mState+1 );
+ mBarLabel->setPixmap(*mFlashPixmap2);
+ mFlashTimer->stop();
+
+ if( mState < 8 )
+ mFlashTimer->start(400);
+ }
+ else
+ mBarLabel->setPixmap( updateBarPixmap( mState ) );
+
+ mState++;
+}
+
+/*
+ * ThemeDefault::updateBarPixmap(): IF in Default mode, THEN adjust the
+ * bar pixmap to reflect the current state. WARNING! KSplash Default
+ * does NOT support our "Restoring Session..." state. We will need
+ * to reflect that somehow.
+ */
+QPixmap ThemeDefault::updateBarPixmap( int state )
+{
+ int offs;
+
+ QPixmap x;
+ if( !mActivePixmap ) return( x );
+#if BIDI
+
+
+ if( QApplication::reverseLayout() )
+ {
+ if ( state > 7 )
+ return ( x );
+ }
+#endif
+
+ offs = state * 58;
+ if (state == 3)
+ offs += 8;
+ else if (state == 6)
+ offs -= 8;
+
+ QPixmap tmp(*mActivePixmap);
+ QPainter p(&tmp);
+#if BIDI
+ if ( QApplication::reverseLayout() )
+ p.drawPixmap(0, 0, *mInactivePixmap, 0, 0, tmp.width()-offs );
+ else
+#endif
+ p.drawPixmap(offs, 0, *mInactivePixmap, offs, 0);
+ return tmp ;
+}
+
+void ThemeDefault::flash()
+{
+ if( !mIconsFlashing )
+ return;
+ QPixmap *swap = mFlashPixmap1;
+ mFlashPixmap1 = mFlashPixmap2;
+ mFlashPixmap2 = swap;
+ mBarLabel->setPixmap(*mFlashPixmap2);
+}
+
+QString ThemeDefault::_findPicture( const QString &pic )
+{
+ // Don't use ObjKsTheme::locateThemeData here for compatibility reasons.
+ QString f = pic;
+ if (mTheme->loColor())
+ f = QString("locolor/")+f;
+ //kdDebug() << "Searching for " << f << endl;
+ //kdDebug() << "Theme directory: " << mTheme->themeDir() << endl;
+ //kdDebug() << "Theme name: " << mTheme->theme() << endl;
+ QString p = QString::null;
+ if ((p = locate("appdata",mTheme->themeDir()+f)).isEmpty())
+ if ((p = locate("appdata",mTheme->themeDir()+"pics/"+f)).isEmpty())
+ if ((p = locate("appdata", QString("pics/")+mTheme->theme()+"/"+f)).isEmpty())
+ if ((p = locate("appdata",f)).isEmpty())
+ if ((p = locate("appdata",QString("pics/")+f)).isEmpty())
+ if ((p = locate("data",QString("pics/")+f)).isEmpty()) {
+ ; // No more places to search
+ }
+ return p;
+}
diff --git a/ksplashml/themeengine/default/themelegacy.h b/ksplashml/themeengine/default/themelegacy.h
new file mode 100644
index 000000000..b0a6138a9
--- /dev/null
+++ b/ksplashml/themeengine/default/themelegacy.h
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifndef __THEMELEGACY_H__
+#define __THEMELEGACY_H__
+
+#include <kprogress.h>
+
+#include <qlabel.h>
+#include <qwidget.h>
+
+#include "themeengine.h"
+class QPixmap;
+class QTimer;
+
+class QCheckBox;
+
+class DefaultConfig: public ThemeEngineConfig
+{
+ Q_OBJECT
+public:
+ DefaultConfig( QWidget *, KConfig * );
+ void save();
+protected:
+ QCheckBox *mFlash, *mAlwaysShow;
+};
+
+/**
+ * @short Traditional KDE splash screen.
+ */
+class ObjKsTheme;
+class KDE_EXPORT ThemeDefault : public ThemeEngine
+{
+ Q_OBJECT
+public:
+ ThemeDefault( QWidget *, const char *, const QStringList& );
+ virtual ~ThemeDefault();
+
+ inline const DefaultConfig *config( QWidget *p, KConfig *c )
+ {
+ return new DefaultConfig( p, c );
+ };
+
+ static QStringList names()
+ {
+ QStringList Names;
+ Names << "Default";
+ Names << "Classic";
+ Names << "Klassic";
+ return( Names );
+ }
+
+public slots:
+ inline void slotSetText( const QString& s )
+ {
+ if( mLabel )
+ mLabel->setText( s );
+ slotUpdateState();
+ };
+ inline void slotUpdateSteps( int s )
+ {
+ mProgressBar->show();
+ mProgressBar->setTotalSteps( s );
+ }
+ inline void slotUpdateProgress( int i )
+ {
+ mProgressBar->setProgress( i );
+ }
+
+
+private slots:
+ void slotUpdateState();
+ QPixmap updateBarPixmap( int );
+ void flash();
+
+private:
+ void _initUi();
+ void _readSettings();
+ QString _findPicture( const QString &pic );
+
+ // Configurable Options
+ bool mIconsFlashing;
+ QColor mLabelForeground;
+
+ // Internals.
+ KProgress *mProgressBar;
+ QLabel *mLabel, *mBarLabel;
+ QPixmap *mActivePixmap, *mInactivePixmap;
+ int mState;
+ QTimer *mFlashTimer;
+ QPixmap *mFlashPixmap1, *mFlashPixmap2;
+};
+
+#endif
diff --git a/ksplashml/themeengine/ksplashplugins.desktop b/ksplashml/themeengine/ksplashplugins.desktop
new file mode 100644
index 000000000..3ebbfcdcd
--- /dev/null
+++ b/ksplashml/themeengine/ksplashplugins.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KSplash/Plugin
+
+[PropertyDef::X-KSplash-PluginName]
+Type=QString
+
+[PropertyDef::X-KSplash-ObjectName]
+Type=QString
+
+[PropertyDef::X-KSplash-Default]
+Type=bool
diff --git a/ksplashml/themeengine/objkstheme.cpp b/ksplashml/themeengine/objkstheme.cpp
new file mode 100644
index 000000000..955b5f903
--- /dev/null
+++ b/ksplashml/themeengine/objkstheme.cpp
@@ -0,0 +1,168 @@
+/***************************************************************************
+ * 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 <kcmdlineargs.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+
+#include <qcolor.h>
+#include <qcursor.h>
+#include <qdesktopwidget.h>
+#include <qfont.h>
+#include <qpixmap.h>
+#include <qrect.h>
+#include <qstring.h>
+
+#include "objkstheme.h"
+#include "objkstheme.moc"
+
+ObjKsTheme::ObjKsTheme( const QString& theme )
+ :mActiveTheme (theme), mThemeDir("/"), mThemeConfig (0L), mThemePrefix( "Themes/" ), d(0)
+{
+ // Get Xinerama config.
+ KConfig *config = kapp->config();
+ config->setGroup( "Xinerama" );
+ QDesktopWidget *desktop = kapp->desktop();
+ mXineramaScreen = config->readNumEntry("KSplashScreen", desktop->primaryScreen());
+
+ // For Xinerama, let's put the mouse on the first head. Otherwise it could appear anywhere!
+ if (desktop->isVirtualDesktop() && mXineramaScreen != -2)
+ {
+ QRect rect = desktop->screenGeometry( mXineramaScreen );
+ if (!rect.contains(QCursor::pos()))
+ QCursor::setPos(rect.center());
+ }
+
+ // Does the active theme exist?
+ if( !loadThemeRc( mActiveTheme, false ) )
+ if( !loadLocalConfig( mActiveTheme, false ) )
+ if( !loadThemeRc( "Default", false ) )
+ loadLocalConfig( "Default", true ); //force: we need some defaults
+ loadCmdLineArgs(KCmdLineArgs::parsedArgs());
+ mThemePrefix += ( mActiveTheme + "/" );
+}
+
+ObjKsTheme::~ObjKsTheme()
+{
+}
+
+bool ObjKsTheme::loadThemeRc( const QString& activeTheme, bool force )
+{
+ //kdDebug() << "ObjKsTheme::loadThemeRc: " << activeTheme << endl;
+ QString prefix("Themes/");
+ QString themeFile;
+ KConfig *cf = 0L;
+
+ // Try our best to find a theme file.
+ themeFile = locate( "appdata", prefix + activeTheme + "/" + QString("Theme.rc") );
+ themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+QString("Theme.RC")):themeFile;
+ themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+QString("theme.rc")):themeFile;
+ themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+activeTheme+QString(".rc")):themeFile;
+
+ if( !themeFile.isEmpty() )
+ cf = new KConfig( themeFile );
+
+ if( cf )
+ {
+ mActiveTheme = activeTheme;
+ mThemeDir = prefix + activeTheme+"/";
+ if( loadKConfig( cf, activeTheme, force ) )
+ {
+ mThemeConfig = cf;
+ return true;
+ }
+ else
+ delete cf;
+ }
+ return false;
+}
+
+bool ObjKsTheme::loadLocalConfig( const QString& activeTheme, bool force )
+{
+ //kdDebug() << "ObjKsTheme::loadLocalConfig" << endl;
+ KConfig *cfg = kapp->config();
+ return( loadKConfig( cfg, activeTheme, force ) );
+}
+
+// ObjKsConfig::loadKConfig(): Load our settings from a KConfig object.
+bool ObjKsTheme::loadKConfig( KConfig *cfg, const QString& activeTheme, bool force )
+{
+ //kdDebug() << "ObjKsTheme::loadKConfig" << endl;
+ if( !cfg )
+ return false;
+
+ // Themes are always stored in the group [KSplash Theme: ThemeName],
+ // and ThemeName should always be the same name as the themedir, if any.
+ // If we can't find this theme group, then we can't load.
+ if( !cfg->hasGroup( QString("KSplash Theme: %1").arg(activeTheme) ) && !force )
+ return false;
+
+ cfg->setGroup( QString("KSplash Theme: %1").arg(activeTheme) );
+ mThemeConfig = cfg;
+
+ mThemeEngine = cfg->readEntry( "Engine", "Default" );
+
+ m_icons.clear();
+ m_icons.append( cfg->readEntry( "Icon1", "filetypes" ) );
+ m_icons.append( cfg->readEntry( "Icon2", "exec" ) );
+ m_icons.append( cfg->readEntry( "Icon3", "key_bindings" ) );
+ m_icons.append( cfg->readEntry( "Icon4", "window_list" ) );
+ m_icons.append( cfg->readEntry( "Icon5", "desktop" ) );
+ m_icons.append( cfg->readEntry( "Icon6", "style" ) );
+ m_icons.append( cfg->readEntry( "Icon7", "kcmsystem" ) );
+ m_icons.append( cfg->readEntry( "Icon8", "go" ) );
+
+ m_text.clear();
+ m_text.append( cfg->readEntry( "Message1", i18n("Setting up interprocess communication") ) );
+ m_text.append( cfg->readEntry( "Message2", i18n("Initializing system services") ) );
+ m_text.append( cfg->readEntry( "Message3", i18n("Initializing peripherals") ) );
+ m_text.append( cfg->readEntry( "Message4", i18n("Loading the window manager") ) );
+ m_text.append( cfg->readEntry( "Message5", i18n("Loading the desktop") ) );
+ m_text.append( cfg->readEntry( "Message6", i18n("Loading the panel") ) );
+ m_text.append( cfg->readEntry( "Message7", i18n("Restoring session") ) );
+ m_text.append( cfg->readEntry( "Message8", i18n("KDE is up and running") ) );
+
+ return true;
+}
+
+/*
+ * ObjKsTheme::loadCmdLineArgs(): Handle any overrides which the user might have
+ * specified.
+ */
+void ObjKsTheme::loadCmdLineArgs( KCmdLineArgs *args )
+{
+
+ mManagedMode = args->isSet( "managed" );
+ mTesting = args->isSet("test");
+ mLoColor = ( QPixmap::defaultDepth() <= 8 );
+ QString theme = args->getOption( "theme" );
+ if( theme != mActiveTheme && !theme.isNull() )
+ if( loadThemeRc( theme, false ) )
+ mActiveTheme = theme;
+ //args->clear();
+}
+
+QString ObjKsTheme::locateThemeData( const QString &resource )
+{
+ if ( !mLoColor )
+ return locate( "appdata", mThemePrefix+resource );
+ else
+ {
+ QString res = locate( "appdata", mThemePrefix+"locolor/"+resource );
+ if ( res.isEmpty() )
+ res = locate( "appdata", mThemePrefix+resource );
+ return res;
+ }
+}
diff --git a/ksplashml/themeengine/objkstheme.h b/ksplashml/themeengine/objkstheme.h
new file mode 100644
index 000000000..9685d4529
--- /dev/null
+++ b/ksplashml/themeengine/objkstheme.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifndef __OBJKSTHEME_H__
+#define __OBJKSTHEME_H__
+
+#include <kcmdlineargs.h>
+
+#include <qstring.h>
+#include <qstringlist.h>
+
+class KConfig;
+/**
+ * @short Theme reader.
+ * A Theme is read in from the file
+ * <KDEDIR>/share/apps/ksplash/Themes/<theme>/Theme.rc
+ * This controls the behavior, graphics, and appearance
+ * of KSplash completely, and offers a friendlier way
+ * of installing custom splash screens.
+ */
+class KDE_EXPORT ObjKsTheme : public QObject
+{
+ Q_OBJECT
+public:
+ explicit ObjKsTheme( const QString& );
+ virtual ~ObjKsTheme();
+
+ void loadCmdLineArgs( KCmdLineArgs * );
+
+ QString theme() const { return( mActiveTheme ); }
+ QString themeEngine() const { return( mThemeEngine ); }
+ KConfig *themeConfig() const { return( mThemeConfig ); }
+ QString themeDir() const { return( mThemeDir ); }
+ bool loColor() const { return( mLoColor ); }
+ bool testing() const { return( mTesting ); }
+ bool managedMode() const { return( mManagedMode ); }
+ QString icon( int i ) { return (m_icons[i-1].isNull()?(QString::null):m_icons[i-1]); }
+ QString text( int i ) { return (m_text[i-1].isNull()?(QString::null):m_text[i-1]); }
+ QString locateThemeData( const QString &resource );
+ int xineramaScreen() const { return mXineramaScreen; }
+
+protected:
+ bool loadThemeRc( const QString&, bool );
+ bool loadLocalConfig( const QString&, bool );
+ bool loadKConfig( KConfig *, const QString&, bool );
+
+private:
+ QString mActiveTheme, mThemeDir;
+ KConfig *mThemeConfig;
+
+ int mXineramaScreen;
+ bool mLoColor, mTesting, mManagedMode;
+ QString mThemeEngine;
+ QString mThemePrefix;
+
+ QStringList m_icons, m_text;
+
+ class ObjKsThemePrivate;
+ ObjKsThemePrivate *d;
+};
+
+#endif
diff --git a/ksplashml/themeengine/redmond/Makefile.am b/ksplashml/themeengine/redmond/Makefile.am
new file mode 100644
index 000000000..70f8cfb1c
--- /dev/null
+++ b/ksplashml/themeengine/redmond/Makefile.am
@@ -0,0 +1,18 @@
+SUBDIRS = pics
+
+INCLUDES = -I$(top_srcdir)/ksplashml/themeengine $(all_includes)
+
+ksplashredmond_la_SOURCES = previewredmond.cpp themeredmond.cpp
+ksplashredmond_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module $(KDE_PLUGIN)
+ksplashredmond_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) ../libksplashthemes.la
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = ksplashredmond.la
+
+noinst_HEADERS = themeredmond.h previewredmond.h
+
+servicesdir = $(kde_servicesdir)
+services_DATA = ksplashredmond.desktop
+
+themedir = $(kde_datadir)/ksplash/Themes/Redmond
+theme_DATA = Theme.rc
diff --git a/ksplashml/themeengine/redmond/Theme.rc b/ksplashml/themeengine/redmond/Theme.rc
new file mode 100644
index 000000000..3c5b0687e
--- /dev/null
+++ b/ksplashml/themeengine/redmond/Theme.rc
@@ -0,0 +1,2 @@
+[KSplash Theme: Redmond]
+Engine=Redmond
diff --git a/ksplashml/themeengine/redmond/ksplashredmond.desktop b/ksplashml/themeengine/redmond/ksplashredmond.desktop
new file mode 100644
index 000000000..fd70c5f3a
--- /dev/null
+++ b/ksplashml/themeengine/redmond/ksplashredmond.desktop
@@ -0,0 +1,96 @@
+[Desktop Entry]
+Type=Service
+Comment=KSplash Plugin
+Comment[af]=KSplash Inprop module
+Comment[ar]=ملحق للشاشة الافتتاحية
+Comment[az]=KSplash Əlavəsi
+Comment[be]=Утулка KSplash
+Comment[bg]=Приставка KSplash
+Comment[bn]=কে-স্প্ল্যাশ প্লাগ-ইন
+Comment[br]=Lugent KSplash
+Comment[bs]=KSplash dodatak
+Comment[ca]=Connector per a KSplash
+Comment[cs]=Modul aplikaci KSplash
+Comment[csb]=Plugins KSplash
+Comment[cy]=Ategyn KCroeso
+Comment[da]=KSplash-plugin
+Comment[de]=KSplash-Plugin
+Comment[el]=Πρόσθετο KSplash
+Comment[eo]=Ksalutŝilda kromaĵo
+Comment[es]=Complemento KSplash
+Comment[et]=KSplashi plugin
+Comment[eu]=KSplash plugina
+Comment[fa]=وصلۀ KSplash
+Comment[fi]=KSplash-liitännäinen
+Comment[fr]=Modules de KSplash
+Comment[fy]=KSplash-plugin
+Comment[ga]=Breiseán KSplash
+Comment[gl]=Plugin de KSplash
+Comment[he]=תוסף KSplash
+Comment[hi]=के-स्प्लैश प्लगइन
+Comment[hr]=KSplash dodatak
+Comment[hu]=KSplash bővítőmodul
+Comment[is]=KSplash íforrit
+Comment[it]=Plugin KSplash
+Comment[ja]=KSplash プラグイン
+Comment[ka]=KSplash პლაგინი
+Comment[kk]=KSplash модулі
+Comment[km]=កម្មវិធី​ជំនួយ​ខាង​ក្នុង​របស់ KSplash
+Comment[lt]=KSplash įskiepis
+Comment[lv]=KSplash spraudnis
+Comment[mk]=Приклучок за KSplash
+Comment[ms]=Plugin KSplash
+Comment[mt]=Plugin ta' KSplash
+Comment[nb]=Programtillegg Ksplash
+Comment[ne]=के स्प्लयास प्लगइन
+Comment[nl]=KSplash-plugin
+Comment[nn]=KSplash-programtillegg
+Comment[pa]=ਕੇ-ਸਪਲੇਸ ਪਲੱਗਇਨ
+Comment[pl]=Wtyczka KSplash
+Comment[pt]='Plugin' do KSplash
+Comment[pt_BR]=Plug-in do KSplash
+Comment[ro]=Modul KSplash
+Comment[ru]=Модуль KSplash
+Comment[rw]=Icomeka rya K-Gukwiza
+Comment[se]=KSplash-lassemoduvla
+Comment[sk]=Modul KSplash
+Comment[sl]=Vstavek KSplash
+Comment[sr]=KSplash прикључак
+Comment[sr@Latn]=KSplash priključak
+Comment[sv]=Insticksprogram för startskärm
+Comment[ta]=Kஸ்ப்ளாஷ் செருகு பொருள்
+Comment[tg]=Мутассалкунандаи KSplash
+Comment[th]=ปลั๊กอิน KSplash
+Comment[tr]=KSplash Eklentisi
+Comment[tt]=KSplash atlı Östämä
+Comment[uk]=Втулок KSplash
+Comment[uz]=KSplash plagini
+Comment[uz@cyrillic]=KSplash плагини
+Comment[vi]=Trình bổ sung Chào mừng KDE
+Comment[wa]=Tchôke-divins KSplash (waitroûle d' enondaedje)
+Comment[zh_CN]=KSplash 插件
+Comment[zh_TW]=KSplash 外掛程式
+Name=KSplashRedmond
+Name[af]=KSplash Redmond
+Name[be]=Тэма Redmond
+Name[ca]=KSplash de Redmond
+Name[cs]=Redmond
+Name[cy]=KCroesoRedmond
+Name[de]=KSplash Redmond
+Name[eo]=Redmondo
+Name[et]=KSplash Redmond
+Name[hi]=के-स्प्लैश-रेडमण्ड
+Name[ne]=के स्प्लयास रेडमोन्ड
+Name[pa]=ਕੇਸਪਲੇਸਰੀਮੋਂਡ
+Name[pt_BR]=Tela de Apresentação de Redmond
+Name[sv]=Redmond startskärm
+Name[ta]=Kஸ்ப்ளாஷ்ரெட்மான்
+Name[tg]=РайдмондиKSplash
+Name[th]=KSplash แบบเรดมอนด์
+Name[vi]=Chào mừng KDE Redmond
+Name[zh_TW]=KSplachRedmond
+ServiceTypes=KSplash/Plugin
+X-KDE-Library=ksplashredmond
+X-KSplash-Default=true
+X-KSplash-PluginName=Redmond
+X-KSplash-ObjectName=ThemeRedmond
diff --git a/ksplashml/themeengine/redmond/main.cpp b/ksplashml/themeengine/redmond/main.cpp
new file mode 100644
index 000000000..2da3c5f09
--- /dev/null
+++ b/ksplashml/themeengine/redmond/main.cpp
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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 <kstandarddirs.h>
+
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <qwidget.h>
+
+#include "themeredmond.h"
+
+extern "C"
+{
+ ThemeEngineConfig *KsThemeConfig( QWidget *parent, KConfig *config )
+ {
+ return new CfgRedmond( parent, config );
+ }
+
+ QStringList KsThemeSupports()
+ {
+ return ThemeRedmond::names();
+ }
+
+ void* KsThemeInit( QWidget *parent, ObjKsTheme *theme )
+ {
+ return new ThemeRedmond( parent, theme );
+ }
+}
+
diff --git a/ksplashml/themeengine/redmond/pics/Background.png b/ksplashml/themeengine/redmond/pics/Background.png
new file mode 100644
index 000000000..a38a55d42
--- /dev/null
+++ b/ksplashml/themeengine/redmond/pics/Background.png
Binary files differ
diff --git a/ksplashml/themeengine/redmond/pics/Makefile.am b/ksplashml/themeengine/redmond/pics/Makefile.am
new file mode 100644
index 000000000..31181e3ae
--- /dev/null
+++ b/ksplashml/themeengine/redmond/pics/Makefile.am
@@ -0,0 +1,4 @@
+EXTRA_DIST=Preview.png Background.png
+
+themedir = $(kde_datadir)/ksplash/Themes/Redmond
+theme_DATA = $(EXTRA_DIST)
diff --git a/ksplashml/themeengine/redmond/pics/Preview.png b/ksplashml/themeengine/redmond/pics/Preview.png
new file mode 100644
index 000000000..a52ec2644
--- /dev/null
+++ b/ksplashml/themeengine/redmond/pics/Preview.png
Binary files differ
diff --git a/ksplashml/themeengine/redmond/previewredmond.cpp b/ksplashml/themeengine/redmond/previewredmond.cpp
new file mode 100644
index 000000000..6685a6987
--- /dev/null
+++ b/ksplashml/themeengine/redmond/previewredmond.cpp
@@ -0,0 +1,113 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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 <klocale.h>
+
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qwidget.h>
+
+#include "previewredmond.h"
+#include "previewredmond.moc"
+/*
+ * PreviewRedmond::PreviewRedmond(): Constructor. Set up some basic
+ * things.
+ */
+PreviewRedmond::PreviewRedmond( QWidget* parent )
+ :QWidget( parent ),
+
+ /* Using direct constructors to prevent memory blit. */
+ m_welcomeString (i18n("Welcome")),
+ m_userString (i18n("(Your Name)")),
+
+ m_welcomeFont (QFont( "Arial", 16, QFont::Bold )),
+ m_userFont (QFont( "Arial", 16 )),
+ m_statusFont (QFont( "Arial", 12, QFont::Bold )),
+
+ m_welcomeColor (Qt::white),
+ m_welcomeShadowColor (Qt::darkGray),
+ m_userColor (Qt::darkGray),
+ m_statusColor (Qt::white),
+
+ m_icon (DesktopIcon("kmenu")),
+
+ m_showWelcomeString (true),
+ m_showUserString (true),
+ m_showUserIcon (true),
+ m_showStatusString (true)
+{
+ _updateCache();
+}
+
+void PreviewRedmond::paintEvent( QPaintEvent* pe )
+{
+ QPainter p;
+ p.begin( this );
+ p.drawPixmap( pe->rect(), m_cache );
+ p.end();
+}
+
+void PreviewRedmond::resizeEvent( QResizeEvent *re )
+{
+ QWidget::resizeEvent( re );
+ _updateCache();
+}
+
+// PreviewRedmond::_updateCache(): Based on our current settings, we need
+// to adjust our cached image. We'll slick it and create a new QPixmap
+// from size(), just to be sure we're not missing anything.
+void PreviewRedmond::_updateCache()
+{
+ m_cache = QPixmap( size() );
+ QPainter p;
+ p.begin( &m_cache );
+
+ p.fillRect( rect(), Qt::gray );
+
+ m_welcomeFont.setItalic( true );
+ p.setFont( m_welcomeFont );
+
+ QPoint welcomeTextPos( rect().width()/2 - p.fontMetrics().width( m_welcomeString ),
+ rect().height()/2 + p.fontMetrics().height()/2 );
+
+ if( m_showWelcomeString )
+ {
+ p.setPen( m_welcomeShadowColor );
+ p.drawText( welcomeTextPos.x()+2, welcomeTextPos.y()+2, m_welcomeString );
+ p.setPen( m_welcomeColor );
+ p.drawText( welcomeTextPos, m_welcomeString );
+ }
+
+ if( m_showUserString )
+ {
+ p.setPen( m_userColor );
+ p.setFont( m_userFont );
+ QPoint userTextPos( rect().width()/2 + m_icon.width() + 20,
+ rect().height()/2 + p.fontMetrics().height()/2 );
+ p.drawText( userTextPos, m_userString );
+ }
+
+ if( m_showUserIcon )
+ p.drawPixmap( rect().width()/2 + 10, rect().height()/2, m_icon );
+
+ if( m_showStatusString )
+ {
+ QPoint statusTextPos( rect().width()/2 + m_icon.width() + 20,
+ rect().height()/2 + (int)(p.fontMetrics().height()*0.85) + 15 );
+ p.setPen( m_statusColor );
+ p.setFont( m_statusFont );
+ p.drawText( statusTextPos, i18n("Starting KDE...") );
+ }
+
+ p.end();
+ update( rect() );
+}
diff --git a/ksplashml/themeengine/redmond/previewredmond.h b/ksplashml/themeengine/redmond/previewredmond.h
new file mode 100644
index 000000000..3b67f293b
--- /dev/null
+++ b/ksplashml/themeengine/redmond/previewredmond.h
@@ -0,0 +1,104 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifndef __PREVIEWREDMOND_H__
+#define __PREVIEWREDMOND_H__
+
+#include <kiconloader.h>
+
+#include <qcolor.h>
+#include <qfont.h>
+#include <qwidget.h>
+
+/*
+ * class PreviewRedmond: Provides a sneak peek at how certain Redmond
+ * settings will look. This will not be able to render any background
+ * images, so we'll just use a nice shade of gray or black as the
+ * background...
+ */
+class PreviewRedmond: public QWidget
+{
+ Q_OBJECT
+public:
+
+ PreviewRedmond( QWidget* );
+
+ inline void setWelcomeString( const QString& s )
+ {
+ m_welcomeString = s;
+ _updateCache();
+ }
+ inline void setUserString( const QString& s )
+ {
+ m_userString = s;
+ _updateCache();
+ }
+
+ inline void setWelcomeFont( const QFont& f )
+ {
+ m_welcomeFont = f;
+ _updateCache();
+ }
+ inline void setUserFont( const QFont& f )
+ {
+ m_userFont = f;
+ _updateCache();
+ }
+ inline void setStatusFont( const QFont& f )
+ {
+ m_statusFont = f;
+ _updateCache();
+ }
+
+ inline void setWelcomeColor( const QColor& c )
+ {
+ m_welcomeColor = c;
+ _updateCache();
+ }
+ inline void setWelcomeShadowColor( const QColor& c )
+ {
+ m_welcomeShadowColor = c;
+ _updateCache();
+ }
+ inline void setUserColor( const QColor& c )
+ {
+ m_userColor = c;
+ _updateCache();
+ }
+ inline void setStatusColor( const QColor& c )
+ {
+ m_statusColor = c;
+ _updateCache();
+ }
+
+ inline void setIcon( const QString& s )
+ {
+ m_icon = DesktopIcon( s );
+ _updateCache();
+ }
+
+protected:
+ void _updateCache();
+ void paintEvent( QPaintEvent* );
+ void resizeEvent( QResizeEvent* );
+
+ QPixmap m_cache;
+
+ QString m_welcomeString, m_userString;
+ QFont m_welcomeFont, m_userFont, m_statusFont;
+ QColor m_welcomeColor, m_welcomeShadowColor, m_userColor, m_statusColor;
+ QPixmap m_icon;
+
+ bool m_showWelcomeString, m_showUserString, m_showUserIcon, m_showStatusString;
+};
+
+#endif
diff --git a/ksplashml/themeengine/redmond/themeredmond.cpp b/ksplashml/themeengine/redmond/themeredmond.cpp
new file mode 100644
index 000000000..6181980b6
--- /dev/null
+++ b/ksplashml/themeengine/redmond/themeredmond.cpp
@@ -0,0 +1,365 @@
+/***************************************************************************
+ * 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 <pwd.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <kfontcombo.h>
+#include <kgenericfactory.h>
+#include <kglobalsettings.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kuser.h>
+#include <kemailsettings.h>
+
+#include <qcheckbox.h>
+#include <qdesktopwidget.h>
+#include <qlabel.h>
+#include <qpainter.h>
+#include <qrect.h>
+#include <qstringlist.h>
+#include <qwidget.h>
+
+#include <objkstheme.h>
+#include "themeredmond.h"
+#include "previewredmond.h"
+#include "themeredmond.moc"
+
+K_EXPORT_COMPONENT_FACTORY( ksplashredmond, KGenericFactory<ThemeRedmond>( "ksplash" ) )
+
+CfgRedmond::CfgRedmond( QWidget *p, KConfig *c )
+ :ThemeEngineConfig( p, c )
+{
+ QVBox *vbox = new QVBox( this );
+ vbox->setSpacing( KDialog::spacingHint() );
+
+ QFont defaultFont( "Arial", 48, QFont::Bold );
+ defaultFont.setItalic( true );
+ QFont defaultUsernameFont( "Arial", 16, QFont::Bold );
+ QFont defaultActionFont( "Arial", 12, QFont::Bold );
+ QColor defaultDarkColor( 3, 47, 156 );
+ QColor defaultWhiteColor( Qt::white );
+
+ QHBox *hbox = new QHBox( vbox );
+ hbox->setFrameStyle( QFrame::WinPanel );
+ hbox->setFrameShadow( QFrame::Sunken );
+ PreviewRedmond* _preview = new PreviewRedmond( hbox );
+ _preview->setFixedSize( 320, 200 );
+
+ _preview->setWelcomeString( c->readEntry( "Welcome Text", i18n("Welcome") ) );
+
+ _preview->setWelcomeFont( c->readFontEntry( "Welcome Font", &defaultFont ) );
+ _preview->setUserFont( c->readFontEntry( "Username Font", &defaultUsernameFont ) );
+ _preview->setStatusFont( c->readFontEntry( "Action Font", &defaultActionFont ) );
+
+ _preview->setWelcomeColor( c->readColorEntry( "Welcome Text Color", &defaultWhiteColor ) );
+ _preview->setWelcomeShadowColor( c->readColorEntry( "Welcome Shadow Color", &defaultDarkColor ) );
+ _preview->setUserColor( c->readColorEntry( "Username Text Color", &defaultWhiteColor ) );
+ _preview->setStatusColor( c->readColorEntry( "Action Text Color", &defaultDarkColor ) );
+
+ _preview->setIcon( c->readEntry( "User Icon", "kmenu" ) );
+
+ QLabel *lbl = new QLabel( vbox );
+ lbl->setText( i18n("(Sorry, but I haven't finished writing this one yet...)") );
+}
+
+ThemeRedmond::ThemeRedmond( QWidget *parent, const char *name, const QStringList &args )
+ :ThemeEngine( parent, name, args )
+{
+ _readSettings();
+ _initUi();
+}
+
+void ThemeRedmond::_initUi()
+{
+ const QRect screen = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
+ //QRect fullScreen = KGlobalSettings::desktopGeometry(0L);
+
+ mImage.resize( screen.width(), screen.height() );
+
+ QPainter p;
+ p.begin( &mImage );
+ p.fillRect( screen, QColor(3,47,156) );
+ p.setPen( mActionTextColor );
+
+ QString bgimg;
+
+ // Start by seeing if the theme prefers a particular image.
+ if( !mBackgroundImage.isEmpty() )
+ bgimg = mTheme->locateThemeData( mBackgroundImage );
+
+ /*
+ * See if there is a resolution-specific background in THEMEDIR
+ * before looking for the "generic" one. Having a Background.png
+ * file for each resolution will greatly reduce the amount of time
+ * it takes to initialize this ThemeEngine when running, due to
+ * the fact that no scaling will be necessary to display the image.
+ *
+ * File must be named THEMEDIR/Background-WWWxHHH.png -- for example,
+ * Mytheme/Background-1024x768.png
+ *
+ * ADDITIONAL NOTE: The resolution you specify will be obtained from
+ * the PRIMARY SCREEN ONLY when running in XINERAMA mode. Be sure to
+ * provide backgrounds using common resolutions (I recommend at least
+ * providing 640x480 [unofficially unsupported by KDE], 800x600, and
+ * 1024x768 images.)
+ */
+ if( bgimg.isEmpty() )
+ bgimg = mTheme->locateThemeData( QString( "Background-%2x%3.png" ).arg( screen.width() ).arg( screen.height() ) );
+
+ // If that can't be found, look for THEMEDIR/Background.png
+ if( bgimg.isNull() && !mTheme->themeDir().isNull() )
+ bgimg = mTheme->locateThemeData( "Background.png" );
+
+ if( mPixmap.isNull() )
+ mPixmap = DesktopIcon( "kmenu", 48 );
+
+ QPixmap pix( bgimg );
+
+ if( !pix.isNull() )
+ {
+
+ QPixmap tmp( QSize(screen.width(), screen.height() ) );
+ float sw = (float)screen.width() / pix.width();
+ float sh = (float)(screen.height()) / pix.height();
+
+ QWMatrix matrix;
+ matrix.scale( sw, sh );
+ tmp = pix.xForm( matrix );
+
+ p.drawPixmap( 0, 0, tmp );
+ }
+
+ QFont f = mWelcomeFont;
+ if( mWelcomeFontItalic )
+ f.setItalic( true ); // this SHOULD BE stored in the QFont entry, dang it.
+ p.setFont( f );
+ QFontMetrics met( f );
+ QSize fmet = met.size( 0L, mWelcomeText );
+
+ // Paint the "Welcome" message, if we are instructed to. Optionally dispense with the
+ // shadow.
+ if ( mShowWelcomeText )
+ {
+ if( mWelcomeTextPosition == QPoint( 0, 0 ) )
+ {
+ mWelcomeTextPosition = QPoint( (screen.width()/2) - fmet.width() - 25,
+ (screen.height()/2) - (fmet.height()/2) + fmet.height() );
+ }
+ }
+
+ if( mShowWelcomeText )
+ {
+ if( mShowWelcomeTextShadow )
+ {
+ p.setPen( mWelcomeTextShadowColor );
+ p.drawText( mWelcomeTextPosition+QPoint(2,2), mWelcomeText );
+ }
+ p.setPen( mWelcomeTextColor );
+ p.drawText( mWelcomeTextPosition, mWelcomeText );
+ }
+
+ // The current theme wants to say something in particular, rather than display the
+ // account's fullname.
+ KUser user;
+ QString greetingString = ( !mUsernameText.isNull() ) ? mUsernameText : user.fullName();
+ // when we use KUser (system account data) we should also check KEMailSettings (e-mail settings and kcm_useraccount)
+ // people often write real names only in e-mail settings
+ if ( greetingString.isEmpty() )
+ {
+ KEMailSettings kes;
+ greetingString = kes.getSetting( KEMailSettings::RealName );
+ }
+
+ // Try to load the user's KDM icon... TODO: Make this overridable by the Theme.
+ if( mUseKdmUserIcon )
+ {
+ const QString defSys( ".default.face.icon" ); // The system-wide default image
+ const int fAdminOnly = 1;
+ const int fAdminFirst = fAdminOnly+1;
+ const int fUserFirst = fAdminFirst+1;
+ const int fUserOnly = fUserFirst+1;
+
+ int faceSource = fAdminOnly;
+ KConfig *kdmconfig = new KConfig("kdm/kdmrc", true);
+ kdmconfig->setGroup("X-*-Greeter");
+ QString userPicsDir = kdmconfig->readEntry( "FaceDir", KGlobal::dirs()->resourceDirs("data").last() + "kdm/faces" ) + '/';
+ QString fs = kdmconfig->readEntry( "FaceSource" );
+ if (fs == QString::fromLatin1("UserOnly"))
+ faceSource = fUserOnly;
+ else if (fs == QString::fromLatin1("PreferUser"))
+ faceSource = fUserFirst;
+ else if (fs == QString::fromLatin1("PreferAdmin"))
+ faceSource = fAdminFirst;
+ else
+ faceSource = fAdminOnly; // Admin Only
+ delete kdmconfig;
+
+ QPixmap userp;
+ if ( faceSource == fAdminFirst )
+ {
+ // If the administrator's choice takes preference
+ userp = QPixmap( userPicsDir + user.loginName() + ".face.icon" );
+ if ( userp.isNull() )
+ faceSource = fUserOnly;
+ }
+ if ( faceSource >= fUserFirst)
+ {
+ // If the user's choice takes preference
+ userp = QPixmap( user.homeDir() + "/.face.icon" );
+ if ( userp.isNull() && faceSource == fUserFirst ) // The user has no face, should we check for the admin's setting?
+ userp = QPixmap( userPicsDir + user.loginName() + ".face.icon" );
+ if ( userp.isNull() )
+ userp = QPixmap( userPicsDir + defSys );
+ }
+ else if ( faceSource <= fAdminOnly )
+ {
+ // Admin only
+ userp = QPixmap( userPicsDir + user.loginName() + ".face.icon" );
+ if ( userp.isNull() )
+ userp = QPixmap( userPicsDir + defSys );
+ }
+ if( !userp.isNull() )
+ mPixmap = userp;
+ }
+
+ if( mShowIcon )
+ {
+ QPoint pos = mIconPosition;
+ if( pos == QPoint( 0, 0 ) )
+ {
+ pos = QPoint( (screen.width()/2) + 10, (screen.height()/2) );
+ }
+ p.drawPixmap( pos, mPixmap );
+ }
+
+ // User name font. Leave this nailed-up for now.
+ f = mUsernameFont;
+ p.setFont( f );
+ met = QFontMetrics( f );
+ fmet = met.size( 0L, greetingString );
+
+ if( mShowUsernameText )
+ {
+ QPoint pos = mUsernameTextPosition;
+ if( pos == QPoint( 0, 0 ) )
+ {
+ pos = QPoint(
+ (screen.width()/2) + mPixmap.width() + 20,
+ (screen.height()/2) - (fmet.height()/2) + fmet.height()
+ );
+ }
+ p.setPen( mUsernameTextColor );
+ p.drawText( pos, greetingString );
+ }
+
+ p.end();
+
+ setFixedSize( screen.width(), screen.height() );
+ move( screen.topLeft() );
+}
+
+void ThemeRedmond::paintEvent( QPaintEvent *pe )
+{
+ const QRect screen = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
+
+ QPainter p;
+ p.begin( this );
+
+ QRect r = pe->rect();
+
+ bitBlt( this, r.x(), r.y(),
+ &mImage, r.x(), r.y(), r.width(), r.height() );
+
+ if (mShowActionText)
+ {
+ p.setPen( mActionTextColor );
+ QFont f = mActionFont;
+ p.setFont( f );
+ QFontMetrics met( f );
+ QSize fmet = met.size( 0L, mText );
+
+ mMsgPos = mActionTextPosition;
+ if( mMsgPos == QPoint( 0, 0 ) )
+ {
+ mMsgPos = QPoint(
+ (screen.width()/2) + mPixmap.width() + 20,
+ (screen.height()/2) + (int)(fmet.height()*0.85) + 15
+ );
+ }
+ p.drawText( mMsgPos, mText );
+ }
+ p.end();
+}
+
+void ThemeRedmond::_readSettings()
+{
+ const QRect screen = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
+ //QRect fullScreen = KGlobalSettings::desktopGeometry(0L);
+
+ if( !mTheme )
+ return;
+ KConfig *cfg = mTheme->themeConfig();
+ if( !cfg )
+ return;
+
+ //if( !cfg->hasGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) ) )
+ // return;
+ cfg->setGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) );
+
+ // Overall appearance
+ mBackgroundImage = cfg->readEntry( "Background Image", QString::null );
+ mIcon = cfg->readEntry( "User Icon", "kmenu" );
+ mWelcomeText = cfg->readEntry( "Welcome Text", i18n("Welcome") );
+ mUsernameText = cfg->readEntry( "Username Text", QString::null );
+
+ // If any of these are set to (0,0), then we will autoposition the text later (and it _will_
+ // be centered on the screen!). The Theme may move this text however the author desires.
+ QPoint absZero( 0, 0 );
+ mWelcomeTextPosition = cfg->readPointEntry( QString("Welcome Text Position %1").arg(screen.width()), &absZero );
+ mUsernameTextPosition = cfg->readPointEntry( QString("Username Text Position %1").arg(screen.width()), &absZero );
+ mActionTextPosition = cfg->readPointEntry( QString("Action Text Position %1").arg(screen.width()), &absZero );
+ mIconPosition = cfg->readPointEntry( QString("Icon Position %1").arg(screen.width()), &absZero );
+
+ // Allow the Theme to hide particular components.
+ mShowWelcomeText = cfg->readBoolEntry( "Show Welcome Text", true );
+ mShowWelcomeTextShadow = cfg->readBoolEntry( "Show Welcome Shadow", true );
+ mShowUsernameText = cfg->readBoolEntry( "Show Username", true );
+ mShowActionText = cfg->readBoolEntry( "Show Action", true );
+ mShowIcon = cfg->readBoolEntry( "Show Icon", true );
+ mUseKdmUserIcon = cfg->readBoolEntry( "Use KDM User Icon", true );
+
+ // Setup our fonts. There are only 3 elements which use 'em, so this is fairly
+ // straightforward.
+ QFont defaultFont( "Arial", 48, QFont::Bold );
+ defaultFont.setItalic( true );
+ QFont defaultUsernameFont( "Arial", 16, QFont::Bold );
+ QFont defaultActionFont( "Arial", 12, QFont::Bold );
+
+ mWelcomeFont = cfg->readFontEntry( "Welcome Font", &defaultFont );
+ mWelcomeFontItalic = cfg->readBoolEntry( "Welcome Font Italic", true );
+ mUsernameFont = cfg->readFontEntry( "Username Font", &defaultUsernameFont );
+ mActionFont = cfg->readFontEntry( "Action Font", &defaultActionFont );
+
+ QColor defaultDarkColor( 3, 47, 156 );
+ QColor defaultWhiteColor( Qt::white );
+
+ mWelcomeTextColor = cfg->readColorEntry( "Welcome Text Color", &defaultWhiteColor );
+ mWelcomeTextShadowColor = cfg->readColorEntry( "Welcome Shadow Color", &defaultDarkColor );
+ mUsernameTextColor = cfg->readColorEntry( "Username Text Color", &defaultWhiteColor );
+ mActionTextColor = cfg->readColorEntry( "Action Text Color", &defaultWhiteColor );
+}
diff --git a/ksplashml/themeengine/redmond/themeredmond.h b/ksplashml/themeengine/redmond/themeredmond.h
new file mode 100644
index 000000000..a35662181
--- /dev/null
+++ b/ksplashml/themeengine/redmond/themeredmond.h
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifndef __THEMEREDMOND_H__
+#define __THEMEREDMOND_H__
+
+#include <kdebug.h>
+#include <kpixmap.h>
+
+#include <themeengine.h>
+
+class KFontCombo;
+class QCheckBox;
+
+class CfgRedmond: public ThemeEngineConfig
+{
+ Q_OBJECT
+public:
+ CfgRedmond( QWidget *, KConfig * );
+
+protected:
+ QCheckBox *mShowUsername;
+ QCheckBox *mShowIcon;
+ QCheckBox *mShowWelcome;
+ KFontCombo *mWelcomeFont;
+ KFontCombo *mUsernameFont;
+ KFontCombo *mActionFont;
+};
+
+class ObjKsTheme;
+class ThemeRedmond: public ThemeEngine
+{
+ Q_OBJECT
+public:
+ ThemeRedmond( QWidget *, const char *, const QStringList& );
+
+ inline const QString name() { return( QString("Redmond") ); }
+ static QStringList names()
+ {
+ QStringList Names;
+ Names << "Redmond";
+ return( Names );
+ };
+
+public slots:
+ inline void slotSetText( const QString& s )
+ {
+ if( mText != s )
+ {
+ mText = s;
+ repaint( false );
+ }
+ };
+
+private:
+ void paintEvent( QPaintEvent * );
+
+ void _initUi();
+ void _readSettings();
+
+ QString mText;
+ QPixmap mPixmap;
+ bool mRedrawKonqi;
+ QPoint mMsgPos;
+ KPixmap mImage;
+
+ // ThemeEngine configuration.
+ bool mShowWelcomeText;
+ bool mShowWelcomeTextShadow;
+ bool mWelcomeFontItalic;
+ bool mShowUsernameText;
+ bool mShowActionText;
+ bool mShowIcon;
+ bool mUseKdmUserIcon;
+ QString mBackgroundImage;
+ QString mWelcomeText;
+ QString mUsernameText; // Leave this undefined to autodetect the username.
+ QString mIcon;
+ QFont mWelcomeFont;
+ QFont mUsernameFont;
+ QFont mActionFont;
+ QColor mWelcomeTextColor;
+ QColor mWelcomeTextShadowColor;
+ QColor mUsernameTextColor;
+ QColor mActionTextColor;
+ QPoint mWelcomeTextPosition; // Set this to (0,0) to autoposition the text.
+ QPoint mUsernameTextPosition; // Likewise.
+ QPoint mActionTextPosition; // Likewise likewise.
+ QPoint mIconPosition; // ...
+
+}
+;
+
+#endif
diff --git a/ksplashml/themeengine/simple/Makefile.am b/ksplashml/themeengine/simple/Makefile.am
new file mode 100644
index 000000000..8f1e8ac93
--- /dev/null
+++ b/ksplashml/themeengine/simple/Makefile.am
@@ -0,0 +1,7 @@
+
+INCLUDES = $(all_includes)
+
+bin_PROGRAMS = ksplashsimple
+ksplashsimple_SOURCES = main.cpp
+ksplashsimple_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+ksplashsimple_LDADD = $(LIB_XINERAMA) $(LIB_X11)
diff --git a/ksplashml/themeengine/simple/configure.in.in b/ksplashml/themeengine/simple/configure.in.in
new file mode 100644
index 000000000..e049bf94d
--- /dev/null
+++ b/ksplashml/themeengine/simple/configure.in.in
@@ -0,0 +1,27 @@
+LIB_XINERAMA=
+
+AC_ARG_WITH([xinerama],
+ AC_HELP_STRING([--without-xinerama], [Disable xinerama extension support (default: check)]) )
+
+if test "x$with_xinerama" != "xno"; then
+ xinerama_save_ldflags="$LDFLAGS"
+ LDFLAGS="$X_LDFLAGS"
+
+ KDE_CHECK_HEADER(X11/extensions/Xinerama.h,
+ [
+ AC_CHECK_LIB(Xinerama,XineramaQueryExtension,
+ [
+ AC_DEFINE(HAVE_XINERAMA, 1, [Define if you have the Xinerama extension])
+ LIB_XINERAMA="-lXinerama -lXext"
+ ],
+ [],
+ [ $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ])
+ ], [],
+ [
+ #include <X11/Xlib.h>
+ ] )
+
+ AC_SUBST(LIB_XINERAMA)
+ LDFLAGS="$xinerama_save_ldflags"
+fi
+
diff --git a/ksplashml/themeengine/simple/main.cpp b/ksplashml/themeengine/simple/main.cpp
new file mode 100644
index 000000000..940ecc874
--- /dev/null
+++ b/ksplashml/themeengine/simple/main.cpp
@@ -0,0 +1,182 @@
+/***************************************************************************
+ * Copyright 2004 Lubos Lunak <[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 <config.h>
+
+#include <X11/Xlib.h>
+#ifdef HAVE_XINERAMA
+extern "C" { // for older XFree86 versions
+#include <X11/extensions/Xinerama.h>
+}
+#endif
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+
+//#define DEBUG
+
+int main( int argc, char* argv[])
+ {
+ if( fork() != 0 )
+ return 0;
+ Display* dpy = XOpenDisplay( NULL );
+ if( dpy == NULL )
+ return 1;
+ bool test = false;
+ if( argc == 2 && strcmp( argv[ 1 ], "--test" ) == 0 )
+ test = true;
+ int sx, sy, sw, sh;
+#ifdef HAVE_XINERAMA
+ // Xinerama code from Qt
+ XineramaScreenInfo *xinerama_screeninfo = 0;
+ int unused;
+ bool use_xinerama = XineramaQueryExtension( dpy, &unused, &unused )
+ && XineramaIsActive( dpy );
+ if (use_xinerama)
+ {
+ int screenCount;
+ xinerama_screeninfo = XineramaQueryScreens( dpy, &screenCount );
+ sx = xinerama_screeninfo[ 0 ].x_org;
+ sy = xinerama_screeninfo[ 0 ].y_org;
+ sw = xinerama_screeninfo[ 0 ].width;
+ sh = xinerama_screeninfo[ 0 ].height;
+ }
+ else
+#endif
+ {
+ sx = sy = 0;
+ sw = WidthOfScreen( ScreenOfDisplay( dpy, DefaultScreen( dpy )));
+ sh = HeightOfScreen( ScreenOfDisplay( dpy, DefaultScreen( dpy )));
+ }
+ XSetWindowAttributes attrs;
+ attrs.override_redirect = True;
+ const int states = 6;
+ const int frame = 3;
+ const int segment = sw / 2 / states;
+ const int w = segment * states + 2 * frame;
+ const int h = sh / 20 + frame;
+ Window win = XCreateWindow( dpy, DefaultRootWindow( dpy ), sx + ( sw - w ) / 2, sy + ( sh - h ) /2, w, h,
+ 0, CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attrs );
+ Pixmap pix = XCreatePixmap( dpy, DefaultRootWindow( dpy ), w, h, DefaultDepth( dpy, 0 ));
+ XGCValues values;
+ values.foreground = WhitePixel( dpy, 0 );
+ GC gc = XCreateGC( dpy, pix, GCForeground, &values );
+ XFillRectangle( dpy, pix, gc, 0, 0, w, h );
+ values.foreground = BlackPixel( dpy, 0 );
+ XChangeGC( dpy, gc, GCForeground, &values );
+// XFillRectangle( dpy, pix, gc, 0, 0, w, frame );
+// XFillRectangle( dpy, pix, gc, 0, h - frame, w, frame );
+// XFillRectangle( dpy, pix, gc, 0, 0, frame, h );
+// XFillRectangle( dpy, pix, gc, w - frame, 0, frame, h );
+ XSetWindowBackgroundPixmap( dpy, win, pix );
+ XSelectInput( dpy, win, ButtonPressMask );
+ XSelectInput( dpy, DefaultRootWindow( dpy ), SubstructureNotifyMask );
+ XMapWindow( dpy, win );
+ int pos = 0;
+ int state = 1; // cannot check dcop connection - make this state initial
+ const int delay = 200; // ms
+ time_t final_time = time( NULL ) + 60;
+ time_t test_time = time( NULL ) + 1;
+ Atom kde_splash_progress = XInternAtom( dpy, "_KDE_SPLASH_PROGRESS", False );
+ for(;;)
+ {
+ while( XPending( dpy ))
+ {
+ XEvent ev;
+ XNextEvent( dpy, &ev );
+ if( ev.type == ButtonPress && ev.xbutton.window == win && ev.xbutton.button == Button1 )
+ {
+ final_time = time( NULL );
+ break;
+ }
+ if( ev.type == ConfigureNotify && ev.xconfigure.event == DefaultRootWindow( dpy ))
+ XRaiseWindow( dpy, win );
+ if( ev.type == ClientMessage && ev.xclient.window == DefaultRootWindow( dpy )
+ && ev.xclient.message_type == kde_splash_progress )
+ {
+ // based on ksplash
+ const char* s = ev.xclient.data.b;
+#ifdef DEBUG
+ fprintf( stderr,"MESSAGE: %s\n", s );
+#endif
+ if( strcmp( s, "dcop" ) == 0 && state < 1 )
+ state = 1; // not actually used, state starts from 1, because dcop cannot be checked
+ else if( strcmp( s, "kded" ) == 0 && state < 2 )
+ state = 2;
+ else if( strcmp( s, "kcminit" ) == 0 )
+ ; // unused
+ else if( strcmp( s, "ksmserver" ) == 0 && state < 3 )
+ state = 3;
+ else if( strcmp( s, "wm started" ) == 0 && state < 4 )
+ state = 4;
+ else if( strcmp( s, "kdesktop" ) == 0 && state < 5 )
+ state = 5;
+ else if(( strcmp( s, "kicker" ) == 0 || strcmp( s, "session ready" ) == 0 ) && state < 6 )
+ state = 6;
+ }
+ }
+ if( test && time( NULL ) >= test_time )
+ {
+ ++state;
+ test_time = time( NULL ) + 1;
+ }
+ if( pos != state )
+ {
+ while( pos < state && pos < states )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "POS: %d\n", pos );
+#endif
+ final_time = time( NULL ) + 60;
+ XFillRectangle( dpy, pix, gc, frame + pos * segment, frame, segment, h - 2 * frame );
+ XSetWindowBackgroundPixmap( dpy, win, pix );
+ XClearWindow( dpy, win );
+ ++pos;
+ if( pos >= states )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "CLOSING DOWN\n" );
+#endif
+ final_time = time( NULL ) + 2;
+ }
+ }
+ }
+ fd_set set;
+ FD_ZERO( &set );
+ FD_SET( XConnectionNumber( dpy ), &set );
+ struct timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = delay * 1000;
+ select( XConnectionNumber( dpy ) + 1, &set, NULL, NULL, &tv );
+ if( time( NULL ) >= final_time )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "EXITING\n" );
+#endif
+ break; // --->
+ }
+ }
+ XFreePixmap( dpy, pix );
+ XDestroyWindow( dpy, win );
+ XFreeGC( dpy, gc );
+ XCloseDisplay( dpy );
+ }
diff --git a/ksplashml/themeengine/standard/Makefile.am b/ksplashml/themeengine/standard/Makefile.am
new file mode 100644
index 000000000..c627f6d3c
--- /dev/null
+++ b/ksplashml/themeengine/standard/Makefile.am
@@ -0,0 +1,23 @@
+SUBDIRS = pics
+
+INCLUDES = -I$(top_srcdir)/ksplashml/themeengine $(all_includes)
+
+noinst_LTLIBRARIES = libthemestandard.la
+libthemestandard_la_SOURCES = themestandard.cpp wndicon.cpp wndstatus.cpp
+libthemestandard_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+libthemestandard_la_LIBADD = $(LIB_KDEUI) ../libksplashthemes.la
+
+kde_module_LTLIBRARIES = ksplashstandard.la
+
+ksplashstandard_la_SOURCES = themestandardlib.cpp
+ksplashstandard_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(KDE_PLUGIN) -module
+ksplashstandard_la_LIBADD = $(LIB_KDEUI) ../libksplashthemes.la libthemestandard.la
+METASOURCES = AUTO
+
+noinst_HEADERS = themestandard.h wndicon.h wndstatus.h
+
+servicesdir = $(kde_servicesdir)
+services_DATA = ksplashstandard.desktop
+
+themedir = $(kde_datadir)/ksplash/Themes/Standard
+theme_DATA = Theme.rc
diff --git a/ksplashml/themeengine/standard/Preview.png b/ksplashml/themeengine/standard/Preview.png
new file mode 100644
index 000000000..58603e1e6
--- /dev/null
+++ b/ksplashml/themeengine/standard/Preview.png
Binary files differ
diff --git a/ksplashml/themeengine/standard/Theme.rc b/ksplashml/themeengine/standard/Theme.rc
new file mode 100644
index 000000000..2ae13af53
--- /dev/null
+++ b/ksplashml/themeengine/standard/Theme.rc
@@ -0,0 +1,2 @@
+[KSplash Theme: Standard]
+Engine=Standard
diff --git a/ksplashml/themeengine/standard/ksplashstandard.desktop b/ksplashml/themeengine/standard/ksplashstandard.desktop
new file mode 100644
index 000000000..125c2a54d
--- /dev/null
+++ b/ksplashml/themeengine/standard/ksplashstandard.desktop
@@ -0,0 +1,97 @@
+[Desktop Entry]
+Type=Service
+Comment=KSplash Plugin
+Comment[af]=KSplash Inprop module
+Comment[ar]=ملحق للشاشة الافتتاحية
+Comment[az]=KSplash Əlavəsi
+Comment[be]=Утулка KSplash
+Comment[bg]=Приставка KSplash
+Comment[bn]=কে-স্প্ল্যাশ প্লাগ-ইন
+Comment[br]=Lugent KSplash
+Comment[bs]=KSplash dodatak
+Comment[ca]=Connector per a KSplash
+Comment[cs]=Modul aplikaci KSplash
+Comment[csb]=Plugins KSplash
+Comment[cy]=Ategyn KCroeso
+Comment[da]=KSplash-plugin
+Comment[de]=KSplash-Plugin
+Comment[el]=Πρόσθετο KSplash
+Comment[eo]=Ksalutŝilda kromaĵo
+Comment[es]=Complemento KSplash
+Comment[et]=KSplashi plugin
+Comment[eu]=KSplash plugina
+Comment[fa]=وصلۀ KSplash
+Comment[fi]=KSplash-liitännäinen
+Comment[fr]=Modules de KSplash
+Comment[fy]=KSplash-plugin
+Comment[ga]=Breiseán KSplash
+Comment[gl]=Plugin de KSplash
+Comment[he]=תוסף KSplash
+Comment[hi]=के-स्प्लैश प्लगइन
+Comment[hr]=KSplash dodatak
+Comment[hu]=KSplash bővítőmodul
+Comment[is]=KSplash íforrit
+Comment[it]=Plugin KSplash
+Comment[ja]=KSplash プラグイン
+Comment[ka]=KSplash პლაგინი
+Comment[kk]=KSplash модулі
+Comment[km]=កម្មវិធី​ជំនួយ​ខាង​ក្នុង​របស់ KSplash
+Comment[lt]=KSplash įskiepis
+Comment[lv]=KSplash spraudnis
+Comment[mk]=Приклучок за KSplash
+Comment[ms]=Plugin KSplash
+Comment[mt]=Plugin ta' KSplash
+Comment[nb]=Programtillegg Ksplash
+Comment[ne]=के स्प्लयास प्लगइन
+Comment[nl]=KSplash-plugin
+Comment[nn]=KSplash-programtillegg
+Comment[pa]=ਕੇ-ਸਪਲੇਸ ਪਲੱਗਇਨ
+Comment[pl]=Wtyczka KSplash
+Comment[pt]='Plugin' do KSplash
+Comment[pt_BR]=Plug-in do KSplash
+Comment[ro]=Modul KSplash
+Comment[ru]=Модуль KSplash
+Comment[rw]=Icomeka rya K-Gukwiza
+Comment[se]=KSplash-lassemoduvla
+Comment[sk]=Modul KSplash
+Comment[sl]=Vstavek KSplash
+Comment[sr]=KSplash прикључак
+Comment[sr@Latn]=KSplash priključak
+Comment[sv]=Insticksprogram för startskärm
+Comment[ta]=Kஸ்ப்ளாஷ் செருகு பொருள்
+Comment[tg]=Мутассалкунандаи KSplash
+Comment[th]=ปลั๊กอิน KSplash
+Comment[tr]=KSplash Eklentisi
+Comment[tt]=KSplash atlı Östämä
+Comment[uk]=Втулок KSplash
+Comment[uz]=KSplash plagini
+Comment[uz@cyrillic]=KSplash плагини
+Comment[vi]=Trình bổ sung Chào mừng KDE
+Comment[wa]=Tchôke-divins KSplash (waitroûle d' enondaedje)
+Comment[zh_CN]=KSplash 插件
+Comment[zh_TW]=KSplash 外掛程式
+Name=KSplashStandard
+Name[af]=KSplash Standaard
+Name[be]=Стандартная тэма
+Name[ca]=KSplash estàndard
+Name[cs]=Standardní
+Name[cy]=KCroesoSafonol
+Name[de]=KSplash Standard
+Name[eo]=Normala
+Name[et]=KSplash Standard
+Name[hi]=के-स्प्लैश-स्टैण्डर्ड
+Name[ne]=के स्प्लयास मानक
+Name[pa]=ਕੇਸਪਲੇਸ ਸਟੈਂਡਰਡ
+Name[pt_BR]=Tela de Apresentação Padrão
+Name[rw]=K-GukwizaBisanzwe
+Name[sv]=Vanlig startskärm
+Name[ta]=Kஸ்ப்ளாஷ்நிலையான
+Name[tg]=СтандартиKSplash
+Name[th]=KSplash แบบมาตรฐาน
+Name[vi]=Chào mừng KDE Tiêu chuẩn
+Name[wa]=KSplashStandård
+ServiceTypes=KSplash/Plugin
+X-KDE-Library=ksplashstandard
+X-KSplash-Default=true
+X-KSplash-PluginName=Standard
+X-KSplash-ObjectName=ThemeStandard
diff --git a/ksplashml/themeengine/standard/pics/Makefile.am b/ksplashml/themeengine/standard/pics/Makefile.am
new file mode 100644
index 000000000..54a91876d
--- /dev/null
+++ b/ksplashml/themeengine/standard/pics/Makefile.am
@@ -0,0 +1,4 @@
+EXTRA_DIST=Preview.png
+
+themedir = $(kde_datadir)/ksplash/Themes/Standard
+theme_DATA = $(EXTRA_DIST)
diff --git a/ksplashml/themeengine/standard/pics/Preview.png b/ksplashml/themeengine/standard/pics/Preview.png
new file mode 100644
index 000000000..b4e7d4a88
--- /dev/null
+++ b/ksplashml/themeengine/standard/pics/Preview.png
Binary files differ
diff --git a/ksplashml/themeengine/standard/themestandard.cpp b/ksplashml/themeengine/standard/themestandard.cpp
new file mode 100644
index 000000000..ff7929bfe
--- /dev/null
+++ b/ksplashml/themeengine/standard/themestandard.cpp
@@ -0,0 +1,167 @@
+/***************************************************************************
+ * 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 <kdebug.h>
+#include <kdialogbase.h>
+#include <kglobalsettings.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kconfig.h>
+
+#include <qdesktopwidget.h>
+#include <qlabel.h>
+#include <qpalette.h>
+#include <qpixmap.h>
+#include <qwidget.h>
+
+#include <objkstheme.h>
+#include "themestandard.h"
+#include "themestandard.moc"
+#include "wndicon.h"
+#include "wndstatus.h"
+
+ThemeStandard::ThemeStandard( QWidget *parent, const char *name, const QStringList &args )
+ :ThemeEngine( parent, name, args ), mIcon(0L), mPrevIcon(0L), mIconCount(0), mStdIconWidth(-1),
+ mIconPos(WndIcon::HBottomLeft), mSbAtTop(false), mSbVisible(true), mSbPbVisible(true), mSbFontName("helvetica"),
+ mSbFontSz(16), mSbFontBold(true), mSbFontItalic(false), mSbFont(QFont()), mSbFg(QColor()), mSbBg(QColor()),
+ mSbIcon("run"), mIconsVisible(true), mIconsJumping(true), mSplashScreen("(Default)")
+{
+ _readSettings();
+ _initUi();
+}
+
+void ThemeStandard::_initUi()
+{
+ setFrameStyle( QFrame::NoFrame );
+
+ QString pixName = mTheme->locateThemeData( mSplashScreen );
+
+ if( mSplashScreen == "(Default)" || pixName.isEmpty() )
+ {
+ QString resource_prefix = "pics/";
+ if ( mTheme->loColor() )
+ resource_prefix += "locolor/";
+ pixName = locate( "appdata", resource_prefix + "splash.png");
+ }
+
+ QPixmap px = QPixmap( pixName );
+
+ if( !px.isNull() )
+ {
+ //kdDebug() << "Loaded splash " << mSplashScreen << endl;
+ int pw = px.width();
+ int ph = px.height();
+
+ QLabel *lbl = new QLabel( this );
+ lbl->setBackgroundMode( NoBackground );
+ lbl->setFixedSize( pw, ph );
+ lbl->setPixmap( px );
+
+ resize( pw, ph );
+ }
+ else
+ {
+ //kdDebug() << "Couldn't load splash " << mSplashScreen << endl;
+ resize( 0, 0 );
+ }
+
+ const QRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
+ // KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.
+
+ move( rect.x() + (rect.width() - size().width())/2,
+ rect.y() + (rect.height() - size().height())/2 );
+
+ mStatus = new WndStatus( QPalette(), mTheme->xineramaScreen(), mSbAtTop, mSbPbVisible, mSbFont, mSbFg, mSbBg, mSbIcon );
+}
+
+void ThemeStandard::showEvent( QShowEvent * )
+{
+
+ ThemeEngine::show();
+
+ if( mSbVisible )
+ {
+ mStatus->show();
+ mStatusBarHeight = mStatus->height();
+ }
+ else
+ {
+ mStatusBarHeight = 0L;
+ }
+}
+
+// Adjust the visible icon.
+void ThemeStandard::slotSetPixmap( const QString& pxn )
+{
+ QPixmap px = DesktopIcon( pxn );
+
+ if ( px.isNull() )
+ px = DesktopIcon( "go" );
+
+ if ( !mIconsVisible )
+ return;
+
+ /* (We only use prev_i if jumping is enabled...) */
+ if ( mIconsJumping && mPrevIcon )
+ emit mPrevIcon->slotStopJumping();
+
+ if ( mStdIconWidth < 0 )
+ mStdIconWidth = DesktopIcon( "go" ).width();
+
+ mIcon = new WndIcon( ++mIconCount, mStdIconWidth, mStatusBarHeight, mTheme->xineramaScreen(),
+ px, QString::null, mIconPos, mSbAtTop, mIconsJumping );
+ mIcon->show();
+
+ if( mIconsJumping )
+ {
+ emit mIcon->slotJump();
+ mPrevIcon = mIcon;
+ }
+}
+
+void ThemeStandard::_readSettings()
+{
+
+ if ( !mTheme )
+ return;
+
+ KConfig *cfg = mTheme->themeConfig();
+ if ( !cfg )
+ return;
+
+ //if ( !cfg->hasGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) ) )
+ // return;
+ cfg->setGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) );
+
+ QString sbpos = cfg->readEntry( "Statusbar Position", "Bottom" ).upper();
+ mSbAtTop = ( sbpos == "TOP" );
+ mSbVisible = cfg->readBoolEntry( "Statusbar Visible", true);
+ mSbPbVisible = cfg->readBoolEntry( "Progress Visible", true);
+
+ mSbFontName = cfg->readEntry( "Statusbar Font", "Sans Serif" );
+ mSbFontSz = cfg->readNumEntry( "Statusbar Font Size", 16 );
+ mSbFontBold = cfg->readBoolEntry( "Statusbar Font Bold", true );
+ mSbFontItalic = cfg->readBoolEntry( "Statusbar Font Italic", false );
+ mSbFont = QFont( mSbFontName, mSbFontSz, ( mSbFontBold? QFont::Bold : QFont::Normal ) );
+ if( mSbFontItalic )
+ mSbFont.setItalic( true );
+
+ mSbFg = cfg->readColorEntry( "Statusbar Foreground", &Qt::white );
+ mSbBg = cfg->readColorEntry( "Statusbar Background", &Qt::black );
+ mSbIcon = cfg->readEntry( "Statusbar Icon", "run" );
+ mIconsVisible = cfg->readBoolEntry( "Icons Visible", true);
+ mIconsJumping = cfg->readBoolEntry( "Icons Jumping", true);
+ mIconPos = (WndIcon::Position)cfg->readNumEntry( "Icon Position", 0 );
+ mSplashScreen = cfg->readEntry( "Splash Screen", "(Default)");
+ // cfg->readBoolEntry( "Allow Configuration", true );
+}
diff --git a/ksplashml/themeengine/standard/themestandard.h b/ksplashml/themeengine/standard/themestandard.h
new file mode 100644
index 000000000..a24f668db
--- /dev/null
+++ b/ksplashml/themeengine/standard/themestandard.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifndef __THEMESTANDARD_H__
+#define __THEMESTANDARD_H__
+
+#include <themeengine.h>
+
+#include "wndicon.h"
+#include "wndstatus.h"
+
+/*
+ * Special Note: The "Standard" engine is treated a little bit differently than
+ * the other ThemeEngines in this program. Because we don't ever want to end up
+ * in a situation in which there is _no_ user interface, this ThemeEngine will
+ * be statically linked in with the ksplash binary itself, so that no dynamic
+ * loading is necessary to access it. The disadvantage that this presents is
+ * immediately obvious: The control center module is no longer able to dynamically
+ * load a configuration object for this theme, since this engine doesn't reside in
+ * a shared-object library like the other ones do. Therefore, we will have to
+ * implement the ThemeEngineConfig object for this engine in the kcmksplash
+ * subsystem, in such a manner that it is statically linked in with the control
+ * panel. I know, this is really nasty, but I would rather have slightly uglier
+ * code, so long as it makes the End User Experience of this program somewhat more
+ * predictable (i.e., even if we can't do exactly what the user wants, we can still
+ * do _something_...)
+ *
+ * Therefore, you will find the CfgStandard class in the ../kcmksplash/ directory.
+ */
+
+/**
+ * @short The default KSplash splash screen.
+ */
+class ThemeStandard: public ThemeEngine
+{
+ Q_OBJECT
+public:
+ ThemeStandard( QWidget *, const char*, const QStringList& );
+ //inline const ThemeEngineConfig *config( QWidget *p, KConfig *kc ) { return 0L; }
+
+public slots:
+ inline void slotUpdateProgress( int i )
+ {
+ if( mStatus ) mStatus->slotUpdateProgress( i );
+ }
+ inline void slotUpdateSteps( int i )
+ {
+ if( mStatus ) mStatus->slotUpdateSteps( i );
+ }
+ inline void slotSetText( const QString& s )
+ {
+ if( mStatus ) mStatus->slotSetMessage( s );
+ }
+ void slotSetPixmap( const QString& );
+
+private:
+ void showEvent( QShowEvent * );
+ void _readSettings();
+ void _initUi();
+
+ WndStatus *mStatus;
+ WndIcon *mIcon, *mPrevIcon;
+ int mIconCount;
+ int mStatusBarHeight;
+ int mStdIconWidth;
+
+ WndIcon::Position mIconPos;
+ bool mSbAtTop;
+ bool mSbVisible;
+ bool mSbPbVisible;
+ QString mSbFontName;
+ int mSbFontSz;
+ bool mSbFontBold;
+ bool mSbFontItalic;
+ QFont mSbFont;
+ QColor mSbFg;
+ QColor mSbBg;
+ QString mSbIcon;
+ bool mIconsVisible;
+ bool mIconsJumping;
+ QString mSplashScreen;
+};
+
+#endif
diff --git a/ksplashml/themeengine/standard/themestandardlib.cpp b/ksplashml/themeengine/standard/themestandardlib.cpp
new file mode 100644
index 000000000..acdb6958f
--- /dev/null
+++ b/ksplashml/themeengine/standard/themestandardlib.cpp
@@ -0,0 +1,15 @@
+/***************************************************************************
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <kgenericfactory.h>
+
+#include "themestandard.h"
+
+K_EXPORT_COMPONENT_FACTORY( ksplashstandard, KGenericFactory<ThemeStandard>( "ksplash" ) )
diff --git a/ksplashml/themeengine/standard/wndicon.cpp b/ksplashml/themeengine/standard/wndicon.cpp
new file mode 100644
index 000000000..0440a0181
--- /dev/null
+++ b/ksplashml/themeengine/standard/wndicon.cpp
@@ -0,0 +1,310 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <kapplication.h>
+#include <kcursor.h>
+#include <kdebug.h>
+#include <kdebug.h>
+#include <kglobalsettings.h>
+#include <kwin.h>
+
+#include <qdesktopwidget.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <qpoint.h>
+#include <qtimer.h>
+#include <qwidget.h>
+
+#include "wndicon.h"
+#include "wndicon.moc"
+
+WndIcon::WndIcon(
+ unsigned int icon_num,
+ unsigned int icon_std_width,
+ unsigned int status_height,
+ int xineramaScreen,
+ const KPixmap& pix,
+ const QString& text,
+ Position icon_position,
+ bool statusAtTop,
+ bool iconsJumping )
+ :QHBox( 0, "wndSplash", WStyle_Customize|WX11BypassWM ),
+ mStatusText(text), mIconPos(icon_position), mXineramaScreen( xineramaScreen ), mPosX(0), mPosY(0), mGroundX(0), mGroundY(0),
+ mVelocity(8.0), mInitialVelocity(8.0), mGravity(0.8),
+ mIconNum(icon_num), mStatusHeight(status_height), mIconSize(icon_std_width), mStatusAtTop(statusAtTop),
+ mStopJump(false), mIconJumping(iconsJumping)
+{
+ setFrameStyle( QFrame::NoFrame );
+
+ QLabel *w = new QLabel( this );
+ w->setFixedSize( pix.width(), pix.height() );
+ w->setPixmap( pix );
+ if(pix.mask())
+ {
+ setMask(*pix.mask());
+ w->setMask(*pix.mask());
+ }
+
+ resize( pix.width(), pix.height() );
+
+ // Set initial position of icon, and ground.
+ QPoint p = determinePosition();
+ mGroundX = mPosX = p.x();
+ mGroundY = mPosY = p.y();
+ move( p + kapp->desktop()->screenGeometry( mXineramaScreen ).topLeft() );
+
+ if( mIconJumping )
+ {
+ QTimer *t = new QTimer( this );
+ connect(t, SIGNAL(timeout()), SLOT(slotJump()));
+ t->start( 50, false );
+ }
+}
+
+void WndIcon::show()
+{
+ emit setStatusText( mStatusText );
+ QHBox::show();
+}
+
+// Emit our EXTRA signal without becoming visible.
+void WndIcon::noshow()
+{
+ emit setStatusText( mStatusText );
+}
+
+/*
+ * WndIcon::determinePosition(): Based on the information we've
+ * stored within us, determine where we should be placed on the
+ * screen. This is placed in its own function due to the massive
+ * complexity required by the variables involved.
+ */
+QPoint WndIcon::determinePosition()
+{
+ int DW, DH, SBH, wid, X, Y, x, y, nSlot, topshift, bottomshift;
+
+ bottomshift = topshift = 0;
+ const QRect srect = kapp->desktop()->screenGeometry( mXineramaScreen );
+ // KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.
+ DW = srect.width();
+ DH = srect.height();
+ SBH = mStatusHeight;
+ wid = mIconSize;
+ x = mIconNum;
+ y = 1;
+
+ if(mStatusAtTop)
+ topshift = mStatusHeight;
+ else
+ bottomshift = mStatusHeight;
+
+ // Different starting positions require different positioning
+ // rules. The horizontal rules and the vertical rules can be
+ // grouped together, as they are innately similar.
+ switch( mIconPos )
+ {
+ // HORIZONTAL: Top Left -> Top Right
+ case( WndIcon::HTopLeft ):
+ nSlot = ( DW / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (3) + ((x - 1) * wid);
+ Y = topshift + 3 + ( (y-1) * wid );
+ break;
+
+ // HORIZONTAL: Bottom Left -> Bottom Right
+ case( WndIcon::HBottomLeft ):
+ nSlot = ( DW / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (3) + ((x - 1) * wid);
+ Y = (DH-3) - (y * wid) - bottomshift;
+ break;
+
+ // HORIZONTAL: Top Right -> Top Left
+ case( WndIcon::HTopRight ):
+ nSlot = ( DW / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (DW - 3) - (( x ) * wid );
+ Y = topshift + (3) + ( (y-1) * wid );
+ break;
+
+ // HORIZONTAL: Bottom Right -> Bottom Left
+ case( WndIcon::HBottomRight ):
+ nSlot = ( DW / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (DW - 3) - (( x ) * wid );
+ Y = (DH-3) - (y * wid) - bottomshift;
+ break;
+
+ // VERTICAL: Top Left -> Bottom Left
+ case( WndIcon::VTopLeft ):
+ nSlot = ( DH / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (3) + (( y - 1 ) * wid );
+ Y = topshift + (3) + ((x-1) * wid);
+ break;
+
+ // VERTICAL: Top Right -> Bottom Right
+ case( WndIcon::VTopRight ):
+ nSlot = ( DH / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (DW - 3) - (( y ) * wid );
+ Y = topshift + (3) + ((x-1) * wid);
+ break;
+
+ // VERTICAL: Bottom Left -> Top Left
+ case( WndIcon::VBottomLeft ):
+ nSlot = ( DH / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (3) + (( y - 1 ) * wid );
+ Y = (DH-3) - (x * wid) - bottomshift;
+ break;
+
+ // VERTICAL: Bottom Right -> Top Right
+ case( WndIcon::VBottomRight ):
+ nSlot = ( DH / wid );
+ while( x > nSlot )
+ {
+ x = QMAX(0,x-nSlot);
+ y++;
+ }
+ X = (DW - 3) - (( y ) * wid );
+ Y = (DH-3) - (x * wid) - bottomshift;
+ break;
+
+ // Unknown Condition. Reconfigure variable and
+ // retry. Recursively, of course! ;)
+ default:
+ mIconPos = HBottomLeft;
+ return(determinePosition());
+ break;
+ }
+ return( QPoint( X, Y ) );
+}
+
+// Make the icons jump in a macosx-like way (Thanks, Jone!:)
+void WndIcon::slotJump()
+{
+ // Based on our position, bounce around.
+ switch( mIconPos )
+ {
+ // LEFT
+ case( WndIcon::VTopLeft ):
+ case( WndIcon::VBottomLeft ):
+ mVelocity -= mGravity;
+ if( mStopJump )
+ {
+ if( mPosX <= mGroundX )
+ {
+ mPosX = mGroundX;
+ mVelocity = mGravity = 0.0;
+ }
+ }
+ else
+ if( mPosX <= mGroundX )
+ mVelocity = mInitialVelocity;
+ mPosX = (int)((float)mPosX + mVelocity);
+ break;
+
+ // RIGHT
+ case( WndIcon::VTopRight ):
+ case( WndIcon::VBottomRight ):
+ mVelocity -= mGravity;
+ if( mStopJump )
+ {
+ if( mPosX >= mGroundX )
+ {
+ mPosX = mGroundX;
+ mVelocity = mGravity = 0.0;
+ }
+ }
+ else
+ if( mPosX >= mGroundX )
+ mVelocity = mInitialVelocity;
+ mPosX = (int)((float)mPosX - mVelocity);
+ break;
+
+ // TOP
+ case( WndIcon::HTopLeft ):
+ case( WndIcon::HTopRight ):
+ mVelocity -= mGravity;
+ if( mStopJump )
+ {
+ if( mPosY <= mGroundY )
+ {
+ mPosY = mGroundY;
+ mVelocity = mGravity = 0.0;
+ }
+ }
+ else
+ if( mPosY <= mGroundY )
+ mVelocity = mInitialVelocity;
+ mPosY = (int)((float)mPosY + mVelocity );
+ break;
+
+ // BOTTOM
+ case( WndIcon::HBottomLeft ):
+ case( WndIcon::HBottomRight ): default:
+ mVelocity -= mGravity;
+ if( mStopJump )
+ {
+ if( mPosY >= mGroundY )
+ {
+ mPosY = mGroundY;
+ mVelocity = mGravity = 0.0;
+ }
+ }
+ else
+ if( mPosY >= mGroundY )
+ mVelocity = mInitialVelocity;
+ mPosY = (int)((float)mPosY - mVelocity );
+ break;
+ }
+ move( QPoint( mPosX, mPosY ) + kapp->desktop()->screenGeometry( mXineramaScreen ).topLeft() );
+}
+
+void WndIcon::slotStopJumping()
+{
+ mStopJump = true;
+}
diff --git a/ksplashml/themeengine/standard/wndicon.h b/ksplashml/themeengine/standard/wndicon.h
new file mode 100644
index 000000000..a47082ae6
--- /dev/null
+++ b/ksplashml/themeengine/standard/wndicon.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+// This file exists for the convenience of other KDE headers. It may change between
+// different versions of KDE, and may disappear altogether. Do NOT include this
+// directly in your program. We mean it.
+
+
+#ifndef __WNDICON_H__
+#define __WNDICON_H__
+
+#include <kpixmap.h>
+
+#include <qhbox.h>
+
+/**
+ * @short Displays an icon on the screen.
+ */
+class WndIcon:
+ public QHBox
+{
+ Q_OBJECT
+public:
+
+ enum Position
+ {
+ HBottomLeft = 0,
+ HBottomRight = 1,
+ HTopLeft = 2,
+ HTopRight = 3,
+ VBottomLeft = 10,
+ VBottomRight = 11,
+ VTopLeft = 12,
+ VTopRight = 13
+ };
+
+ WndIcon( unsigned int, unsigned int, unsigned int, int, const KPixmap&, const QString&, Position, bool, bool );
+
+signals:
+ void setStatusText( const QString& );
+
+public slots:
+ void show();
+ void noshow();
+ void slotStopJumping();
+ void slotJump();
+
+private:
+ QPoint determinePosition();
+
+protected:
+ QString mStatusText;
+ Position mIconPos;
+ int mXineramaScreen;
+ int mPosX, mPosY, mGroundX, mGroundY;
+ float mVelocity, mInitialVelocity, mGravity;
+ int mIconNum, mStatusHeight, mIconSize;
+ bool mStatusAtTop, mStopJump, mIconJumping;
+};
+
+#endif
diff --git a/ksplashml/themeengine/standard/wndstatus.cpp b/ksplashml/themeengine/standard/wndstatus.cpp
new file mode 100644
index 000000000..3b8582c89
--- /dev/null
+++ b/ksplashml/themeengine/standard/wndstatus.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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 <qdesktopwidget.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qpoint.h>
+#include <qrect.h>
+
+#include "wndstatus.h"
+#include "wndstatus.moc"
+
+// WndStatus::WndStatus(): Display a nifty status bar at
+// the bottom of the screen, so the user always knows what's
+// happening to his system.
+WndStatus::WndStatus( QPalette /*pal*/,
+ int xineramaScreen,
+ bool atTop, bool pbVisible,
+ const QFont& font,
+ const QColor& fgc, const QColor & bgc,
+ const QString& icon
+ )
+ :QHBox( 0, "wndStatus", WStyle_Customize|WX11BypassWM )
+{
+ setFrameStyle( QFrame::NoFrame );
+ //setPalette( pal );
+ setPaletteBackgroundColor( bgc );
+ setPaletteForegroundColor( fgc );
+ setCursor( KCursor::blankCursor() );
+ setSpacing( 5 );
+
+ const QRect rect = kapp->desktop()->screenGeometry( xineramaScreen );
+ // KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.
+
+ QLabel *pix = new QLabel( this );
+ QPixmap _icon( SmallIcon(icon.isNull()||icon.isEmpty()?QString("run"):icon) );
+ pix->setPixmap( _icon );
+ setStretchFactor(pix,0);
+ pix->setFixedWidth(16);
+
+ m_label = new QLabel( this );
+ m_label->setFont( font );
+ m_label->setPaletteBackgroundColor( bgc );
+ m_label->setPaletteForegroundColor( fgc );
+ //QFontMetrics metrics( font );
+ //m_label->setFixedHeight( metrics.height() );
+ m_label->setText(QString(""));
+ 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);
+
+ QWidget *widg = new QWidget( 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 WndStatus::slotSetMessage( const QString& msg )
+{
+ raise();
+ m_label->setText( msg );
+}
+
+void WndStatus::slotUpdateProgress( int i )
+{
+ raise();
+ m_progress->setProgress( i );
+}
+
+void WndStatus::slotUpdateSteps( int i )
+{
+ m_progress->setTotalSteps( i );
+}
diff --git a/ksplashml/themeengine/standard/wndstatus.h b/ksplashml/themeengine/standard/wndstatus.h
new file mode 100644
index 000000000..fa1d735d9
--- /dev/null
+++ b/ksplashml/themeengine/standard/wndstatus.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <[email protected]> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * *
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+// This file exists for the convenience of other KDE headers. It may change between
+// different versions of KDE, and may disappear altogether. Do NOT include this
+// directly in your program. We mean it.
+
+
+#ifndef __WNDSTATUS_H__
+#define __WNDSTATUS_H__
+
+#include <qhbox.h>
+
+class QLabel;
+class KProgress;
+
+/** @short Window displaying status and progress bar. */
+class WndStatus:
+ public QHBox
+{
+ Q_OBJECT
+public:
+ WndStatus( QPalette,
+ int, // Xinerama screen
+ bool, // At top?
+ bool, // Progress indicator visible?
+ const QFont&, // Status bar font
+ const QColor&, const QColor &, // Foreground/Background color
+ const QString& // Icon
+ );
+
+public slots:
+ void slotSetMessage( const QString& );
+ void slotUpdateProgress( int );
+ void slotUpdateSteps( int );
+
+protected:
+ QLabel *m_label;
+ KProgress *m_progress;
+};
+#endif
diff --git a/ksplashml/themeengine/themeengine.cpp b/ksplashml/themeengine/themeengine.cpp
new file mode 100644
index 000000000..0b58587f7
--- /dev/null
+++ b/ksplashml/themeengine/themeengine.cpp
@@ -0,0 +1,136 @@
+/***************************************************************************
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <kwin.h>
+
+#include <qevent.h>
+#include <qfile.h>
+#include <qwidget.h>
+
+#include <X11/Xlib.h>
+
+#ifdef HAVE_XCURSOR
+# include <X11/Xlib.h>
+# include <X11/Xcursor/Xcursor.h>
+#endif
+
+#include "objkstheme.h"
+#include "themeengine.h"
+#include "themeengine.moc"
+
+struct ThemeEngine::ThemeEnginePrivate
+{
+ QValueList< Window > mSplashWindows;
+};
+
+ThemeEngine::ThemeEngine( QWidget *, const char *, const QStringList& args )
+ : QVBox( 0, "wndSplash", WStyle_Customize|WX11BypassWM ), d(0)
+{
+ d = new ThemeEnginePrivate;
+ kapp->installX11EventFilter( this );
+ kapp->installEventFilter( this );
+ (void)kapp->desktop();
+ XWindowAttributes rootAttr;
+ XGetWindowAttributes(qt_xdisplay(), RootWindow(qt_xdisplay(),
+ qt_xscreen()), &rootAttr);
+ XSelectInput( qt_xdisplay(), qt_xrootwin(),
+ SubstructureNotifyMask | rootAttr.your_event_mask );
+ if (args.isEmpty())
+ mTheme = new ObjKsTheme( "Default" );
+ else
+ mTheme = new ObjKsTheme( args.first() );
+ mTheme->loadCmdLineArgs( KCmdLineArgs::parsedArgs() );
+}
+
+ThemeEngine::~ThemeEngine()
+{
+ delete d;
+}
+
+/*
+ This is perhaps a bit crude, but I'm not aware of any better way
+ of fixing #85030 and keeping backwards compatibility if there
+ are any 3rd party splashscreens. Check all toplevel windows,
+ force them to be WX11BypassWM (so that ksplash can handle their stacking),
+ and keep them on top, even above all windows handled by KWin.
+*/
+bool ThemeEngine::eventFilter( QObject* o, QEvent* e )
+{
+ if( e->type() == QEvent::Show && o->isWidgetType())
+ addSplashWindow( static_cast< QWidget* >( o ));
+ return false;
+}
+
+namespace
+{
+class HackWidget : public QWidget { friend class ::ThemeEngine; };
+}
+
+void ThemeEngine::addSplashWindow( QWidget* w )
+{
+ if( !w->isTopLevel())
+ return;
+ if( d->mSplashWindows.contains( w->winId()))
+ return;
+ if( !w->testWFlags( WX11BypassWM ))
+ { // All toplevel widgets should be probably required to be WX11BypassWM
+ // for KDE4 instead of this ugly hack.
+ static_cast< HackWidget* >( w )->setWFlags( WX11BypassWM );
+ XSetWindowAttributes attrs;
+ attrs.override_redirect = True;
+ XChangeWindowAttributes( qt_xdisplay(), w->winId(), CWOverrideRedirect, &attrs );
+ }
+ d->mSplashWindows.prepend( w->winId());
+ connect( w, SIGNAL( destroyed( QObject* )), SLOT( splashWindowDestroyed( QObject* )));
+ w->raise();
+}
+
+void ThemeEngine::splashWindowDestroyed( QObject* obj )
+{
+ d->mSplashWindows.remove( static_cast< QWidget* >( obj )->winId());
+}
+
+bool ThemeEngine::x11Event( XEvent* e )
+{
+ if( e->type != ConfigureNotify && e->type != MapNotify )
+ return false;
+ if( e->type == ConfigureNotify && e->xconfigure.event != qt_xrootwin())
+ return false;
+ if( e->type == MapNotify && e->xmap.event != qt_xrootwin())
+ return false;
+ if( d->mSplashWindows.count() == 0 )
+ return false;
+ // this restacking is written in a way so that
+ // if the stacking positions actually don't change,
+ // all restacking operations will be no-op,
+ // and no ConfigureNotify will be generated,
+ // thus avoiding possible infinite loops
+ XRaiseWindow( qt_xdisplay(), d->mSplashWindows.first()); // raise topmost
+ // and stack others below it
+ Window* stack = new Window[ d->mSplashWindows.count() ];
+ int count = 0;
+ for( QValueList< Window >::ConstIterator it = d->mSplashWindows.begin();
+ it != d->mSplashWindows.end();
+ ++it )
+ stack[ count++ ] = *it;
+ XRestackWindows( x11Display(), stack, count );
+ delete[] stack;
+ return false;
+}
diff --git a/ksplashml/themeengine/themeengine.h b/ksplashml/themeengine/themeengine.h
new file mode 100644
index 000000000..62461cd4e
--- /dev/null
+++ b/ksplashml/themeengine/themeengine.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ * 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.) *
+ * *
+ ***************************************************************************/
+
+#ifndef THEMEENGINE_H
+#define THEMEENGINE_H
+
+#include <qstringlist.h>
+#include <qvbox.h>
+#include <qwidget.h>
+
+#include <kdemacros.h>
+
+class KConfig;
+class ObjKsTheme;
+class QMouseEvent;
+
+/**
+ * @short The base for the ThemeEngine's configuration widget.
+ */
+class KDE_EXPORT ThemeEngineConfig: public QVBox
+{
+ Q_OBJECT
+public:
+
+ ThemeEngineConfig( QWidget *p, KConfig *c )
+ :QVBox( p ), mConfig( c )
+ {}
+
+ KConfig* config()const { return mConfig; }
+
+public slots:
+ virtual void load() {}
+ virtual void save() {}
+
+protected:
+ KConfig *mConfig;
+};
+
+/**
+ * @short Base class for all theme engines. Member functions need to be
+ * overridden by derived classes in order to provide actual functionality.
+ */
+class KDE_EXPORT ThemeEngine: public QVBox
+{
+ Q_OBJECT
+public:
+ ThemeEngine( QWidget *parent, const char *name, const QStringList &args );
+ virtual ~ThemeEngine() = 0;
+ virtual const ThemeEngineConfig *config( QWidget *, KConfig * ) { return 0L; }
+ virtual ObjKsTheme *ksTheme() { return mTheme; }
+ virtual bool eventFilter( QObject* o, QEvent* e );
+
+public slots:
+ virtual void slotUpdateProgress( int ) {}
+ virtual void slotUpdateSteps( int ) {}
+ virtual void slotSetText( const QString& ) {}
+ virtual void slotSetPixmap( const QString& ) {} // use DesktopIcon() to load this.
+
+protected:
+ void addSplashWindow( QWidget* );
+
+protected:
+ ObjKsTheme *mTheme;
+ virtual bool x11Event( XEvent* );
+
+private slots:
+ void splashWindowDestroyed( QObject* );
+
+private:
+ class ThemeEnginePrivate;
+ ThemeEnginePrivate *d;
+};
+
+#endif