diff options
Diffstat (limited to 'ksplashml')
119 files changed, 5655 insertions, 0 deletions
diff --git a/ksplashml/CMakeLists.txt b/ksplashml/CMakeLists.txt new file mode 100644 index 000000000..6cfe72836 --- /dev/null +++ b/ksplashml/CMakeLists.txt @@ -0,0 +1,41 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( themeengine ) +add_subdirectory( pics ) +add_subdirectory( kcmksplash ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/ksplashml/themeengine + ${CMAKE_SOURCE_DIR}/ksplashml/themeengine/default + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES ksplash.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### ksplash (executable) ###################### + +tde_add_executable( ksplash AUTOMOC + SOURCES wndmain.cpp ksplashiface.skel main.cpp + LINK themedefault-static tdeparts-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/ksplashml/Makefile.am b/ksplashml/Makefile.am new file mode 100644 index 000000000..1313d7acc --- /dev/null +++ b/ksplashml/Makefile.am @@ -0,0 +1,18 @@ +SUBDIRS = themeengine pics kcmksplash + +INCLUDES = -I$(srcdir)/themeengine -I$(srcdir)/themeengine/default $(all_includes) + +METASOURCES=AUTO + +bin_PROGRAMS = ksplash +ksplash_SOURCES = wndmain.cpp ksplashiface.skel main.cpp +ksplash_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +ksplash_LDADD = $(LIB_TDEUI) themeengine/default/libthemedefault.la themeengine/libksplashthemes.la $(LIB_TDEIO) + +noinst_HEADERS = ksplashiface.h wndmain.h + +servicesdir = $(kde_servicesdir) +services_DATA = ksplash.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp themeengine/*.cpp -o $(podir)/ksplash.pot diff --git a/ksplashml/kcmksplash/CMakeLists.txt b/ksplashml/kcmksplash/CMakeLists.txt new file mode 100644 index 000000000..864346089 --- /dev/null +++ b/ksplashml/kcmksplash/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( pics ) + + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES ksplashthememgr.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_ksplashthemes (module) ################ + +tde_add_kpart( kcm_ksplashthemes AUTOMOC + SOURCES installer.cpp main.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/ksplashml/kcmksplash/Makefile.am b/ksplashml/kcmksplash/Makefile.am new file mode 100644 index 000000000..47c269a92 --- /dev/null +++ b/ksplashml/kcmksplash/Makefile.am @@ -0,0 +1,18 @@ +# Makefile.am for tdebase/ksplashml/kcmksplash +SUBDIRS=pics + +INCLUDES = $(all_includes) +METASOURCES = AUTO + +kde_module_LTLIBRARIES = kcm_ksplashthemes.la + +kcm_ksplashthemes_la_SOURCES = installer.cpp main.cpp +noinst_HEADERS = installer.h + +kcm_ksplashthemes_la_LIBADD = $(LIB_TDEIO) +kcm_ksplashthemes_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module + +xdg_apps_DATA = ksplashthememgr.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/ksplashthemes.pot diff --git a/ksplashml/kcmksplash/installer.cpp b/ksplashml/kcmksplash/installer.cpp new file mode 100644 index 000000000..d04fbc4ff --- /dev/null +++ b/ksplashml/kcmksplash/installer.cpp @@ -0,0 +1,484 @@ +/*************************************************************************** + * Copyright Ravikiran Rajagopal 2003 * + * [email protected] * + * Copyright (c) 1998 Stefan Taferner <[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. * + * * + ***************************************************************************/ + +#include <unistd.h> +#include <stdlib.h> + +#include <tqdir.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqtextedit.h> + +#include "installer.h" + +#include <kdebug.h> +#include <tdefiledialog.h> +#include <tdeglobalsettings.h> +#include <tdelocale.h> +#include <tdemessagebox.h> +#include <kprocess.h> +#include <kpushbutton.h> +#include <kstandarddirs.h> +#include <ktar.h> +#include <ktrader.h> +#include <kurldrag.h> +#include <tdeio/netaccess.h> + +ThemeListBox::ThemeListBox(TQWidget *parent) + : TDEListBox(parent) +{ + setAcceptDrops(true); + connect(this, TQT_SIGNAL(mouseButtonPressed(int, TQListBoxItem *, const TQPoint &)), + this, TQT_SLOT(slotMouseButtonPressed(int, TQListBoxItem *, const TQPoint &))); +} + +void ThemeListBox::dragEnterEvent(TQDragEnterEvent* event) +{ + event->accept((event->source() != this) && KURLDrag::canDecode(event)); +} + +void ThemeListBox::dropEvent(TQDropEvent* event) +{ + KURL::List urls; + if (KURLDrag::decode(event, urls)) + { + emit filesDropped(urls); + } +} + +void ThemeListBox::slotMouseButtonPressed(int button, TQListBoxItem *item, const TQPoint &p) +{ + if ((button & Qt::LeftButton) == 0) return; + mOldPos = p; + mDragFile = TQString::null; + int cur = index(item); + if (cur >= 0) + mDragFile = text2path[text(cur)]; +} + +void ThemeListBox::mouseMoveEvent(TQMouseEvent *e) +{ + if (((e->state() & Qt::LeftButton) != 0) && !mDragFile.isEmpty()) + { + int delay = TDEGlobalSettings::dndEventDelay(); + TQPoint newPos = e->globalPos(); + if(newPos.x() > mOldPos.x()+delay || newPos.x() < mOldPos.x()-delay || + newPos.y() > mOldPos.y()+delay || newPos.y() < mOldPos.y()-delay) + { + KURL url; + url.setPath(mDragFile); + KURL::List urls; + urls.append(url); + KURLDrag *d = new KURLDrag(urls, this); + d->dragCopy(); + } + } + TDEListBox::mouseMoveEvent(e); +} + +//----------------------------------------------------------------------------- +SplashInstaller::SplashInstaller (TQWidget *aParent, const char *aName, bool aInit) + : TQWidget(aParent, aName), mGui(!aInit) +{ + TDEGlobal::dirs()->addResourceType("ksplashthemes", TDEStandardDirs::kde_default("data") + "ksplash/Themes"); + + if (!mGui) + return; + + TQHBoxLayout* hbox = new TQHBoxLayout( this, 0, KDialog::spacingHint() ); + + TQVBoxLayout* leftbox = new TQVBoxLayout( hbox, KDialog::spacingHint() ); + hbox->setStretchFactor( leftbox, 1 ); + + mThemesList = new ThemeListBox(this); + mThemesList->setSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Expanding ); + connect(mThemesList, TQT_SIGNAL(highlighted(int)), TQT_SLOT(slotSetTheme(int))); + connect(mThemesList, TQT_SIGNAL(filesDropped(const KURL::List&)), TQT_SLOT(slotFilesDropped(const KURL::List&))); + leftbox->addWidget(mThemesList); + + mBtnAdd = new KPushButton( i18n("Add..."), this ); + leftbox->addWidget( mBtnAdd ); + connect(mBtnAdd, TQT_SIGNAL(clicked()), TQT_SLOT(slotAdd())); + + mBtnRemove = new KPushButton( i18n("Remove"), this ); + leftbox->addWidget( mBtnRemove ); + connect(mBtnRemove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemove())); + + mBtnTest = new KPushButton( i18n("Test"), this ); + leftbox->addWidget( mBtnTest ); + connect(mBtnTest, TQT_SIGNAL(clicked()), TQT_SLOT(slotTest())); + + TQVBoxLayout* rightbox = new TQVBoxLayout( hbox, KDialog::spacingHint() ); + hbox->setStretchFactor( rightbox, 3 ); + + mPreview = new TQLabel(this); + mPreview->setSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ); + mPreview->setFrameStyle(TQFrame::Panel|TQFrame::Sunken); + mPreview->setMinimumSize(TQSize(320,240)); + mPreview->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); + rightbox->addWidget(mPreview); + rightbox->setStretchFactor( mPreview, 3 ); + + mText = new TQTextEdit(this); + mText->setSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Preferred ); + mText->setMinimumSize(mText->sizeHint()); + mText->setReadOnly(true); + rightbox->addWidget(mText); + rightbox->setStretchFactor( mText, 1 ); + + readThemesList(); + load(); +} + + +//----------------------------------------------------------------------------- +SplashInstaller::~SplashInstaller() +{ +} + +int SplashInstaller::addTheme(const TQString &path, const TQString &name) +{ + //kdDebug() << "SplashInstaller::addTheme: " << path << " " << name << endl; + TQString tmp(i18n( name.utf8() )); + int i = mThemesList->count(); + while((i > 0) && (mThemesList->text(i-1) > tmp)) + i--; + if ((i > 0) && (mThemesList->text(i-1) == tmp)) + return i-1; + mThemesList->insertItem(tmp, i); + mThemesList->text2path.insert( tmp, path+"/"+name ); + return i; +} + +// Copy theme package into themes directory +void SplashInstaller::addNewTheme(const KURL &srcURL) +{ + TQString dir = TDEGlobal::dirs()->saveLocation("ksplashthemes"); + KURL url; + TQString filename = srcURL.fileName(); + int i = filename.findRev('.'); + // Convert extension to lower case. + if (i >= 0) + filename = filename.left(i)+filename.mid(i).lower(); + url.setPath(locateLocal("tmp",filename)); + + // Remove file from temporary directory if it aleady exists - usually the result of a failed install. + if ( TDEIO::NetAccess::exists( url, true, 0 ) ) + TDEIO::NetAccess::del( url, 0 ); + + bool rc = TDEIO::NetAccess::copy(srcURL, url, 0); + if (!rc) + { + kdWarning() << "Failed to copy theme " << srcURL.fileName() + << " into temporary directory " << url.path() << endl; + return; + } + + // Extract into theme directory: we may have multiple themes in one tarball! + KTar tarFile(url.path()); + if (!tarFile.open(IO_ReadOnly)) + { + kdDebug() << "Unable to open archive: " << url.path() << endl; + return; + } + KArchiveDirectory const *ad = tarFile.directory(); + // Find first directory entry. + TQStringList entries = ad->entries(); + TQString themeName( entries.first() ); +#if 0 + // The isDirectory() call always returns false; why? + for ( TQStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) + { + if ( ad->entry( *it )->isDirectory() ) + { + themeName = *it; + break; + } + } +#endif + // TODO: Make sure we put the entries into a subdirectory if the tarball does not. + // TODO: Warn the user if we overwrite something. + ad->copyTo(locateLocal("ksplashthemes","/")); + tarFile.close(); + TDEIO::NetAccess::del( url, 0 ); + + // TODO: Update only the entries from this installation. + readThemesList(); + mThemesList->setCurrentItem(findTheme(themeName)); + mThemesList->setSelected(mThemesList->currentItem(), true); +} + +//----------------------------------------------------------------------------- +void SplashInstaller::readThemesList() +{ + mThemesList->clear(); + + // Read local themes + TQStringList entryList = TDEGlobal::dirs()->resourceDirs("ksplashthemes"); + //kdDebug() << "readThemesList: " << entryList << endl; + TQDir dir; + TQStringList subdirs; + TQStringList::ConstIterator name; + for(name = entryList.begin(); name != entryList.end(); name++) + { + dir = *name; + if (!dir.exists()) + continue; + subdirs = dir.entryList( TQDir::Dirs ); + // kdDebug() << "readThemesList: " << subdirs << endl; + // TODO: Make sure it contains a *.rc file. + for (TQStringList::Iterator l = subdirs.begin(); l != subdirs.end(); l++ ) + if ( !(*l).startsWith(TQString(".")) ) + { + mThemesList->blockSignals( true ); // Don't activate any theme until all themes are loaded. + addTheme(dir.path(),*l); + mThemesList->blockSignals( false ); + } + } +} + +//----------------------------------------------------------------------------- +void SplashInstaller::defaults() +{ + load( true ); +} + +void SplashInstaller::load() +{ + load( false ); +} + +void SplashInstaller::load( bool useDefaults ) +{ + TDEConfig cnf("ksplashrc"); + cnf.setReadDefaults( useDefaults ); + cnf.setGroup("KSplash"); + TQString curTheme = cnf.readEntry("Theme","Default"); + mThemesList->setCurrentItem(findTheme(curTheme)); + emit changed( useDefaults ); +} + +//----------------------------------------------------------------------------- +void SplashInstaller::save() +{ + TDEConfig cnf("ksplashrc"); + cnf.setGroup("KSplash"); + int cur = mThemesList->currentItem(); + if (cur < 0) + return; + TQString path = mThemesList->text(cur); + if ( mThemesList->text2path.contains( path ) ) + path = mThemesList->text2path[path]; + cur = path.findRev('/'); + cnf.writeEntry("Theme", path.mid(cur+1) ); + cnf.sync(); + emit changed( false ); +} + +//----------------------------------------------------------------------------- +void SplashInstaller::slotRemove() +{ + int cur = mThemesList->currentItem(); + if (cur < 0) + return; + + bool rc = false; + TQString themeName = mThemesList->text(cur); + TQString themeDir = mThemesList->text2path[themeName]; + if (!themeDir.isEmpty()) + { + KURL url; + url.setPath(themeDir); + if (KMessageBox::warningContinueCancel(this,i18n("Delete folder %1 and its contents?").arg(themeDir),"",KGuiItem(i18n("&Delete"),"editdelete"))==KMessageBox::Continue) + rc = TDEIO::NetAccess::del(url,this); + else + return; + } + if (!rc) + { + KMessageBox::sorry(this, i18n("Failed to remove theme '%1'").arg(themeName)); + return; + } + //mThemesList->removeItem(cur); + readThemesList(); + cur = ((unsigned int)cur >= mThemesList->count())?mThemesList->count()-1:cur; + mThemesList->setCurrentItem(cur); +} + + +//----------------------------------------------------------------------------- +void SplashInstaller::slotSetTheme(int id) +{ + bool enabled; + TQString path(TQString::null); + TQString infoTxt; + + if (id < 0) + { + mPreview->setText(TQString::null); + mText->setText(TQString::null); + enabled = false; + } + else + { + TQString error = i18n("(Could not load theme)"); + path = mThemesList->text(id); + if ( mThemesList->text2path.contains( path ) ) + path = mThemesList->text2path[path]; + enabled = false; + KURL url; + TQString themeName; + if (!path.isEmpty()) + { + // Make sure the correct plugin is installed. + int i = path.findRev('/'); + if (i >= 0) + themeName = path.mid(i+1); + url.setPath( path + "/Theme.rc" ); + if (!TDEIO::NetAccess::exists(url, true, 0)) + { + url.setPath( path + "/Theme.RC" ); + if (!TDEIO::NetAccess::exists(url, true, 0)) + { + url.setPath( path + "/theme.rc" ); + if (!TDEIO::NetAccess::exists(url, true, 0)) + url.setPath( path + "/" + themeName + ".rc" ); + } + } + if (TDEIO::NetAccess::exists(url, true, 0)) + { + TDEConfig cnf(url.path()); + cnf.setGroup( TQString("KSplash Theme: %1").arg(themeName) ); + + // Get theme information. + infoTxt = "<qt>"; + if ( cnf.hasKey( "Name" ) ) + infoTxt += i18n( "<b>Name:</b> %1<br>" ).arg( cnf.readEntry( "Name", i18n( "Unknown" ) ) ); + if ( cnf.hasKey( "Description" ) ) + infoTxt += i18n( "<b>Description:</b> %1<br>" ).arg( cnf.readEntry( "Description", i18n( "Unknown" ) ) ); + if ( cnf.hasKey( "Version" ) ) + infoTxt += i18n( "<b>Version:</b> %1<br>" ).arg( cnf.readEntry( "Version", i18n( "Unknown" ) ) ); + if ( cnf.hasKey( "Author" ) ) + infoTxt += i18n( "<b>Author:</b> %1<br>" ).arg( cnf.readEntry( "Author", i18n( "Unknown" ) ) ); + if ( cnf.hasKey( "Homepage" ) ) + infoTxt += i18n( "<b>Homepage:</b> %1<br>" ).arg( cnf.readEntry( "Homepage", i18n( "Unknown" ) ) ); + infoTxt += "</qt>"; + + TQString pluginName( cnf.readEntry( "Engine", "Default" ) ); // Perhaps no default is better? + if ((TDETrader::self()->query("KSplash/Plugin", TQString("[X-KSplash-PluginName] == '%1'").arg(pluginName))).isEmpty()) + { + enabled = false; + error = i18n("This theme requires the plugin %1 which is not installed.").arg(pluginName); + } + else + enabled = true; // Hooray, there is at least one plugin which can handle this theme. + } + else + { + error = i18n("Could not load theme configuration file."); + } + } + mBtnTest->setEnabled(enabled && themeName != "None" ); + mText->setText(infoTxt); + if (!enabled) + { + url.setPath( path + "/" + "Preview.png" ); + if (TDEIO::NetAccess::exists(url, true, 0)) + mPreview->setPixmap(TQPixmap(url.path())); + else + mPreview->setText(i18n("(Could not load theme)")); + KMessageBox::sorry(this, error); + } + else + { + url.setPath( path + "/" + "Preview.png" ); + if (TDEIO::NetAccess::exists(url, true, 0)) + mPreview->setPixmap(TQPixmap(url.path())); + else + mPreview->setText(i18n("No preview available.")); + emit changed(true); + } + } + mBtnRemove->setEnabled( !path.isEmpty() && TQFileInfo(path).isWritable()); +} + + +//----------------------------------------------------------------------------- +void SplashInstaller::slotAdd() +{ + static TQString path; + if (path.isEmpty()) path = TQDir::homeDirPath(); + + KFileDialog dlg(path, "*.tgz *.tar.gz *.tar.bz2|" + i18n( "KSplash Theme Files" ), 0, 0, true); + dlg.setCaption(i18n("Add Theme")); + if (!dlg.exec()) + return; + + path = dlg.baseURL().url(); + addNewTheme(dlg.selectedURL()); +} + +//----------------------------------------------------------------------------- +void SplashInstaller::slotFilesDropped(const KURL::List &urls) +{ + for(KURL::List::ConstIterator it = urls.begin(); + it != urls.end(); + ++it) + addNewTheme(*it); +} + +//----------------------------------------------------------------------------- +int SplashInstaller::findTheme( const TQString &theme ) +{ + // theme is untranslated, but the listbox contains translated items + TQString tmp(i18n( theme.utf8() )); + int id = mThemesList->count()-1; + + while (id >= 0) + { + if (mThemesList->text(id) == tmp) + return id; + id--; + } + + return 0; +} + +//----------------------------------------------------------------------------- +void SplashInstaller::slotTest() +{ + int i = mThemesList->currentItem(); + if (i < 0) + return; + TQString themeName = mThemesList->text2path[mThemesList->text(i)]; + int r = themeName.findRev('/'); + if (r >= 0) + themeName = themeName.mid(r+1); + + // special handling for none and simple splashscreens + if( themeName == "None" ) + return; + if( themeName == "Simple" ) + { + TDEProcess proc; + proc << "ksplashsimple" << "--test"; + if (!proc.start(TDEProcess::Block)) + KMessageBox::error(this,i18n("Unable to start ksplashsimple.")); + return; + } + TDEProcess proc; + proc << "ksplash" << "--test" << "--theme" << themeName; + if (!proc.start(TDEProcess::Block)) + KMessageBox::error(this,i18n("Unable to start ksplash.")); +} + +//----------------------------------------------------------------------------- +#include "installer.moc" diff --git a/ksplashml/kcmksplash/installer.h b/ksplashml/kcmksplash/installer.h new file mode 100644 index 000000000..7a46e368b --- /dev/null +++ b/ksplashml/kcmksplash/installer.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright Ravikiran Rajagopal 2003 * + * [email protected] * + * Copyright (c) 1998 Stefan Taferner <[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. * + * * + ***************************************************************************/ +#ifndef SPLASHINSTALLER_H +#define SPLASHINSTALLER_H + +#include <tqmap.h> +#include <tqpoint.h> + +#include <tdelistbox.h> +#include <kurl.h> + +class TQLabel; +class TQTextEdit; +class TQPushButton; +class ThemeListBox; + +class SplashInstaller : public TQWidget +{ + Q_OBJECT +public: + SplashInstaller(TQWidget *parent=0, const char *aName=0, bool aInit=FALSE); + ~SplashInstaller(); + + virtual void load(); + virtual void load( bool useDefaults ); + virtual void save(); + virtual void defaults(); + +signals: + void changed( bool state ); + +protected slots: + virtual void slotAdd(); + virtual void slotRemove(); + virtual void slotTest(); + virtual void slotSetTheme(int); + void slotFilesDropped(const KURL::List &urls); + +protected: + /** Scan Themes directory for available theme packages */ + virtual void readThemesList(); + /** add a theme to the list, returns the list index */ + int addTheme(const TQString &path, const TQString &name); + void addNewTheme(const KURL &srcURL); + int findTheme( const TQString &theme ); + +private: + bool mGui; + ThemeListBox *mThemesList; + TQPushButton *mBtnAdd, *mBtnRemove, *mBtnTest; + TQTextEdit *mText; + TQLabel *mPreview; +}; + +class ThemeListBox: public TDEListBox +{ + Q_OBJECT +public: + ThemeListBox(TQWidget *parent); + TQMap<TQString, TQString> text2path; + +signals: + void filesDropped(const KURL::List &urls); + +protected: + void dragEnterEvent(TQDragEnterEvent* event); + void dropEvent(TQDropEvent* event); + void mouseMoveEvent(TQMouseEvent *e); + +protected slots: + void slotMouseButtonPressed(int button, TQListBoxItem *item, const TQPoint &p); + +private: + TQString mDragFile; + TQPoint mOldPos; + +}; + +#endif diff --git a/ksplashml/kcmksplash/ksplashthememgr.desktop b/ksplashml/kcmksplash/ksplashthememgr.desktop new file mode 100644 index 000000000..7259b5d1f --- /dev/null +++ b/ksplashml/kcmksplash/ksplashthememgr.desktop @@ -0,0 +1,216 @@ +[Desktop Entry] +Icon=ksplash +Exec=tdecmshell ksplashthememgr +DocPath=ksplashml/index.html + +X-TDE-ModuleType=Library +X-TDE-Library=ksplashthemes +X-TDE-FactoryName=ksplashthemes +X-TDE-ParentApp=kcontrol + +Name=Splash Screen +Name[af]=Spat Skerm +Name[ar]=شاشة بادئة +Name[az]=Açılış Rəsmi +Name[be]=Застаўка загрузкі +Name[bg]=Начален екран +Name[bn]=স্প্ল্যাশ স্ক্রীণ +Name[br]=Skramm-degemer +Name[ca]=Pantalla d'inici +Name[cs]=Úvodní obrazovka +Name[csb]=Ekran na przëwitanié +Name[cy]=Sgrîn Croeso +Name[da]=Splashskærm +Name[de]=Startbildschirm +Name[el]=Αρχική οθόνη +Name[eo]=Salutŝildo +Name[es]=Pantalla anunciadora +Name[et]=Käivitusekraan +Name[eu]=Splash pantaila +Name[fa]=رنگپاشی پرده +Name[fi]=Aloitusruutu +Name[fr]=Écran de démarrage +Name[fy]=Begjinskerm +Name[ga]=Splancscáileán +Name[gl]=Pantalla de Benvida +Name[he]=מצג פתיחה +Name[hi]=स्प्लैश स्क्रीन +Name[hr]=Pozdravni zaslon +Name[hu]=Nyitókép-témák +Name[is]=Upphafsskjár +Name[it]=Schermata d'avvio +Name[ja]=スプラッシュスクリーン +Name[kk]=Бастау экраны +Name[km]=អេក្រង់ស្វាគមន៍ +Name[ko]=시작 화면 +Name[lo]=จอเริ่มการทำงาน +Name[lt]=Pasveikinimo ekranas +Name[lv]=Šļaksta Ekrāns +Name[mk]=Поздравен екран +Name[mn]=Эхлэл дэлгэц +Name[ms]=Splash Screen +Name[nb]=Velkomstbilde +Name[nds]=Startschirm +Name[ne]=स्प्लयास पर्दा +Name[nl]=Opstartscherm +Name[nn]=Velkomstbilete +Name[pa]=ਸਵਾਗਤੀ ਸਕਰੀਨ +Name[pl]=Ekran powitalny +Name[pt]=Ecrã Inicial +Name[pt_BR]=Tela de Apresentação +Name[ro]=Imagine de pornire +Name[ru]=Заставка +Name[rw]=Gukwiza Mugaragaza +Name[se]=Álgošearbma +Name[sk]=Úvodná obrazovka +Name[sl]=Uvodni zaslon +Name[sr]=Сплеш екран +Name[sr@Latn]=Spleš ekran +Name[sv]=Startskärm +Name[ta]=தோன்றும் திரை +Name[tg]=Пардаи оғоз +Name[th]=หน้าจอเริ่มการทำงาน +Name[tr]=Açılış ekranı +Name[tt]=Kürsätmä Täräzä +Name[uk]=Екран заставки +Name[uz]=Splesh oynasi +Name[uz@cyrillic]=Сплэш ойнаси +Name[ven]=U kwasha tshikirini +Name[vi]=Màn hình Chào mừng +Name[wa]=Waitroûle d' enondaedje +Name[zh_CN]=飞溅屏幕 +Name[zh_TW]=啟動畫面 +Name[zu]=Isikrini Sokuphahlaza +Type=Application +Comment=Manager for Splash Screen Themes +Comment[af]=Bestuurder vir Spat Skerm Temas +Comment[ar]=مدير سمات الشاشات الافتتاحية +Comment[az]=Açılış Rəsmi Örtükləri İdarəçisi +Comment[be]=Кіраўнік заставак загрузкі +Comment[bg]=Настройване на началния екран +Comment[bn]=স্প্ল্যাশ স্ক্রীণ থীম ম্যানেজার +Comment[br]=Merour evit gwiskadoù ar skramm degemer +Comment[bs]=Upravitelj temama splash screen-a +Comment[ca]=Gestor per als temes de la pantalla d'inici +Comment[cs]=Správce motivů úvodních obrazovek +Comment[csb]=Menedżer témów ekranu na przëwitanié +Comment[cy]=Rheolydd Themau Sgriniau Croeso +Comment[da]=Håndtering for opstartskærme-temaer +Comment[de]=Verwaltung für Startbildschirmdesigns +Comment[el]=Διαχειριστής για θέματα αρχικής οθόνης +Comment[eo]=Administrilo por la salutŝildo +Comment[es]=Gestor de los temas de la pantalla anunciadora +Comment[et]=Käivitusekraani teemade haldur +Comment[eu]=Splash pantailako gaien kudeatzailea +Comment[fa]=مدیر چهرههای رنگپاشی پرده +Comment[fi]=Hallintaohjelma aloitusruuduille +Comment[fr]=Gestionnaire de thèmes d'écran de démarrage +Comment[fy]=Temabehear foar begjinskerm +Comment[gl]=Xestor dos Temas para a Pantalla de Benvida +Comment[he]=מנהל ערכות נושא למצג הפתיחה +Comment[hi]=स्प्लैश स्क्रीन प्रसंगों के लिए प्रबंधक +Comment[hr]=Upravitelj tema pozdravnih zaslona +Comment[hu]=A nyitókép témájának beállítása +Comment[is]=Stjórna þemum upphafsskjáa +Comment[it]=Gestore dei temi della schermata di avvio +Comment[ja]=スプラッシュスクリーンのテーマを管理 +Comment[kk]=Бастау бейнеперде нақыштарының менеджері +Comment[km]=កម្មវិធីគ្រប់គ្រងស្បែកអេក្រង់ស្វាគមន៍ +Comment[ko]=시작 화면 테마 관리자 +Comment[lt]=Pasveikinimo ekrano temų tvarkyklė +Comment[lv]=Šļakstekrānu tēmu menedžeris +Comment[mk]=Менаџер на теми за поздравни екрани +Comment[mn]=Ажлын тавцанын эхлэл дэлгэцийн хэлбэр удирдагч +Comment[ms]=Pengurus untuk Tema Splash Screen +Comment[mt]=Manager għat-temi tal-Isplash Screen +Comment[nb]=Behandler for velkomstbilder +Comment[nds]=Startschirmmuster instellen +Comment[ne]=स्प्लयास पर्दा विषयवस्तुका लागि प्रबन्धक +Comment[nl]=Themabeheer voor opstartschermen +Comment[nn]=Handsamar for velkomstbilete +Comment[pa]=ਸਵਾਗਤੀ ਪਰਦਾ ਸਰੂਪ ਲਈ ਮੈਨੇਜਰ +Comment[pl]=Menedżer motywów ekranu powitalnego +Comment[pt]=Gestor de Temas do Ecrã Inicial +Comment[pt_BR]=Gerenciador de Temas para a Tela de Apresentação +Comment[ro]=Manager pentru tematicile imaginii de pornire a TDE +Comment[ru]=Менеджер тем экрана-заставки +Comment[rw]=Umuyobozi wo Gukwiza Insanganyamatsiko za Mugaragaza +Comment[se]=Álgošearbmafáttáid gieđahalli +Comment[sk]=Správca tém úvodnej obrazovky +Comment[sl]=Upravitelj tem uvodnih zaslonov +Comment[sr]=Менаџер тема сплеш екрана +Comment[sr@Latn]=Menadžer tema spleš ekrana +Comment[sv]=Hanterare för startskärmsteman +Comment[ta]=தோன்றும் திரை தலைப்புகளுக்கு மேலாளர் +Comment[tg]=Мудири услубҳои пардаи оғоз +Comment[th]=เครื่องมือจัดการชุดตกแต่งของหน้าจอเริ่มการทำงาน +Comment[tr]=Açılış Ekran Teması Yöneticisi +Comment[tt]=Alsürät Tärzäse öçen Tışlaw İdäräçe +Comment[uk]=Менеджер тем екранів заставки +Comment[uz]=Splesh oynasi uchun mavzularni moslash +Comment[uz@cyrillic]=Сплэш ойнаси учун мавзуларни мослаш +Comment[vi]=Trình quản lý các Sắc thái của Màn hình Chào mừng +Comment[wa]=Manaedjeu po les tinmes del waitroûle d' enondaedje +Comment[zh_CN]=飞溅屏幕主题管理器 +Comment[zh_TW]=啟動畫面佈景管理程式 +Keywords=splash screen,splash theme,startup +Keywords[ar]=الشاشة الافتتاحية، سمات الشاشة الافتتاحية، بدء التشغيل +Keywords[az]=splash screen,splash theme,startup,açılış,örtük +Keywords[be]=Застаўка,Загрузка,Запуск,Тэма загрузкі,splash screen,splash theme,startup +Keywords[bg]=стартиране, начален, екран, splash screen, splash theme, startup +Keywords[bs]=splash screen,splash theme,startup,pokretanje,splash +Keywords[ca]=pantalla d'inici,tema d'inici,iniciació +Keywords[cs]=úvodní obrazovka,splash +Keywords[csb]=ekran na przëwitanié,téma ekranu,rozpòczãce,sztart +Keywords[cy]=sgrîn croeso,thema croeso,ymgychwyn +Keywords[da]=opstartsskærm,opstartstema,opstart +Keywords[de]=startbildschirm +Keywords[el]=αρχική οθόνη,θέμα αρχικής οθόνης,ξεκίνημα +Keywords[eo]=Kcm_salutŝildo,Salutŝildo,Saluto +Keywords[es]=pantalla de inicio,tema de inicio,inicio +Keywords[et]=käivitusekraan,käivutusteema,käivitamine +Keywords[eu]=splash pantaila,splash gaia,abioa +Keywords[fa]=رنگپاشی پرده، چهرۀ رنگپاشی، راهاندازی +Keywords[fi]=aloitusruutu,aloitusruututeema,käynnistys +Keywords[fr]=écran de démarrage,thème de démarrage,démarrage,splash screen +Keywords[fy]=opstartscherm,begjinskerm,splash screen +Keywords[ga]=splancscáileán,splancthéama,tosú,tosach +Keywords[gl]=pantalla de benvida,tema de benvida,comezo +Keywords[he]=מצג פתיחה,ערכת נושא למצג פתיחה,הפעלה,splash screen,splash theme,startup +Keywords[hi]=स्प्लैश स्क्रीन,स्प्लैश प्रसंग,प्रारंभ में +Keywords[hr]=splash screen,splash theme,startup,zaslon,pozdravna tema,pokretanje,početni zaslon +Keywords[hu]=nyitókép,indítási téma,indulás +Keywords[it]=schermata di avvio,splash screen,tema schermata di avvio,avvio +Keywords[ja]=スプラッシュスクリーン,スプラッシュテーマ,起動 +Keywords[km]=អេក្រង់ស្វាគមន៍,ស្បែកពេលចាប់ផ្ដើម,ចាប់ផ្ដើម +Keywords[lt]=splash screen,splash theme,startup,pasveikinimo ekranas,pasveikinimo tema +Keywords[lv]=šļakstekrāns,šļakstekrāna tēma,palaišanās +Keywords[mk]=splash screen,splash theme,startup,поздравен екран,поздравна тема +Keywords[mn]=эхлэл дэлгэц,эхлэлийн хэлбэр,эхлэл +Keywords[nb]=oppstart,oppstartsbilde,oppstartstema,velkomstbilde,velkomsttema +Keywords[nds]=splash,starten,Startschirm,Muster,theme +Keywords[ne]=स्प्लयास पर्दा, स्प्लयास विषयवस्तु, सुरुआत +Keywords[nl]=opstartscherm,splash screen +Keywords[nn]=oppstart,velkomstbilete,velkomsttema,oppstartstema +Keywords[pa]=ਸ਼ੁਰੂਆਤੀ ਸਕਰੀਨ, ਸ਼ੁਰੂਆਤੀ ਸੂਰਪ,ਸ਼ੁਰੂਆਤ +Keywords[pl]=ekran powitalny,motyw ekranu powitalnego,rozpoczęcie,start +Keywords[pt]=ecrã inicial,tema do ecrã inicial,arranque +Keywords[pt_BR]=tela de apresentação, tema da tela de apresentação,inicialização +Keywords[ro]=imagine,tematică,întîmpinare,pornire +Keywords[rw]=gukwiza mugaragaza,gukwiza insanganyamatsiko,gutangira +Keywords[sk]=úvodná obrazovka,téma,spustenie,splash +Keywords[sl]=uvodni zaslon,uvodna tema,zagon +Keywords[sr]=splash screen,splash theme,startup,сплеш екран, сплеш тема,покретање,стартни екран +Keywords[sr@Latn]=splash screen,splash theme,startup,spleš ekran, spleš tema,pokretanje,startni ekran +Keywords[sv]=startskärm,starttema,start +Keywords[ta]=தோன்றும் திரை,தோன்றும் தலைப்பு,துவக்கம் +Keywords[th]=หน้าจอเริ่มการทำงาน,ชุดตกแต่ง splash,เริ่มทำงาน +Keywords[tr]=açılış ekranı, açılış teması, başlangıç +Keywords[uk]=екран заставки,тема заставки,запуск,старт +Keywords[uz]=splesh oynasi,splesh mavzusi,ishga tushish +Keywords[uz@cyrillic]=сплэш ойнаси,сплэш мавзуси,ишга тушиш +Keywords[vi]=màn hình chào mừng,sắc thái chào mừng,khởi động +Keywords[wa]=waitroûle d' enondaedje,tinme d' enondaedje,enonde tot seu +Keywords[zh_CN]=splash screen,splash theme,startup,飞溅屏幕,飞溅主题,启动 +Keywords[zh_TW]=splash screen,splash theme,startup,啟動 +Categories=Qt;TDE;X-TDE-settings-looknfeel; diff --git a/ksplashml/kcmksplash/main.cpp b/ksplashml/kcmksplash/main.cpp new file mode 100644 index 000000000..f0b5d1f52 --- /dev/null +++ b/ksplashml/kcmksplash/main.cpp @@ -0,0 +1,105 @@ +/*************************************************************************** + * 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. * + * * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <tqlayout.h> +#include <tqtabwidget.h> + +#include <tdeaboutdata.h> +#include <tdecmodule.h> +#include <kdebug.h> +#include <kgenericfactory.h> +#include <kstandarddirs.h> + +#include "installer.h" + +class KSplashThemeMgr : public TDECModule +{ +public: + KSplashThemeMgr( TQWidget *parent, const char *name, const TQStringList &/*unused*/); + ~KSplashThemeMgr(); + + TQString quickHelp() const; + + virtual void init(); + virtual void save(); + virtual void load(); + virtual void defaults(); + +private: + SplashInstaller *mInstaller; +}; + +typedef KGenericFactory< KSplashThemeMgr, TQWidget > KSplashThemeMgrFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_ksplashthemes, KSplashThemeMgrFactory("ksplashthemes") ) + +// ----------------------------------------------------------------------------------------- + +KSplashThemeMgr::KSplashThemeMgr( TQWidget *parent, const char *name, const TQStringList &) + : TDECModule( KSplashThemeMgrFactory::instance(), parent, name ), mInstaller(new SplashInstaller(this)) +{ + init(); + +#if 0 + TQHBoxLayout *box = new TQHBoxLayout(this); + TQTabWidget *tab = new TQTabWidget(this); // There will be more tabs in the future. + box->addWidget(tab); + tab->addTab( mInstaller, i18n("&Theme Installer") ); +#else + TQHBoxLayout *box = new TQHBoxLayout(this, 0, 0); + box->addWidget(mInstaller); +#endif + connect( mInstaller, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)) ); + TDEAboutData *about = new TDEAboutData( "kcmksplash" + ,I18N_NOOP("TDE splash screen theme manager") + ,"0.1" + ,0 + ,TDEAboutData::License_GPL + ,I18N_NOOP("(c) 2003 KDE developers") ); + about->addAuthor("Ravikiran Rajagopal", 0, "[email protected]"); + about->addCredit("Brian Ledbetter", I18N_NOOP("Original KSplash/ML author"), "[email protected]"); + about->addCredit(I18N_NOOP("TDE Theme Manager authors" ), I18N_NOOP("Original installer code") ); + // Once string freeze is over, replace second argument with "Icon" + about->addCredit("Hans Karlsson", 0, "[email protected]" ); + setAboutData(about); +} + +KSplashThemeMgr::~KSplashThemeMgr() +{ + // Do not delete the installer as it is now owned by the tab widget. +} + +TQString KSplashThemeMgr::quickHelp() const +{ + return i18n("<h1>Splash Screen Theme Manager </h1> Install and view splash screen themes."); +} + +void KSplashThemeMgr::init() +{ + TDEGlobal::dirs()->addResourceType("ksplashthemes", TDEStandardDirs::kde_default("data") + "ksplash/Themes"); +} + +void KSplashThemeMgr::save() +{ + mInstaller->save(); +} + +void KSplashThemeMgr::load() +{ + mInstaller->load(); +} + +void KSplashThemeMgr::defaults() +{ + mInstaller->defaults(); +} diff --git a/ksplashml/kcmksplash/pics/CMakeLists.txt b/ksplashml/kcmksplash/pics/CMakeLists.txt new file mode 100644 index 000000000..189a3a200 --- /dev/null +++ b/ksplashml/kcmksplash/pics/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_install_icons() diff --git a/ksplashml/kcmksplash/pics/Makefile.am b/ksplashml/kcmksplash/pics/Makefile.am new file mode 100644 index 000000000..a4b97f06a --- /dev/null +++ b/ksplashml/kcmksplash/pics/Makefile.am @@ -0,0 +1 @@ +KDE_ICON=AUTO diff --git a/ksplashml/kcmksplash/pics/hi128-app-ksplash.png b/ksplashml/kcmksplash/pics/hi128-app-ksplash.png Binary files differnew file mode 100644 index 000000000..fe0be47ae --- /dev/null +++ b/ksplashml/kcmksplash/pics/hi128-app-ksplash.png diff --git a/ksplashml/kcmksplash/pics/hi16-app-ksplash.png b/ksplashml/kcmksplash/pics/hi16-app-ksplash.png Binary files differnew file mode 100644 index 000000000..cf1cbf3d1 --- /dev/null +++ b/ksplashml/kcmksplash/pics/hi16-app-ksplash.png diff --git a/ksplashml/kcmksplash/pics/hi22-app-ksplash.png b/ksplashml/kcmksplash/pics/hi22-app-ksplash.png Binary files differnew file mode 100644 index 000000000..66e74b5a0 --- /dev/null +++ b/ksplashml/kcmksplash/pics/hi22-app-ksplash.png diff --git a/ksplashml/kcmksplash/pics/hi32-app-ksplash.png b/ksplashml/kcmksplash/pics/hi32-app-ksplash.png Binary files differnew file mode 100644 index 000000000..353385a08 --- /dev/null +++ b/ksplashml/kcmksplash/pics/hi32-app-ksplash.png diff --git a/ksplashml/kcmksplash/pics/hi48-app-ksplash.png b/ksplashml/kcmksplash/pics/hi48-app-ksplash.png Binary files differnew file mode 100644 index 000000000..441a75713 --- /dev/null +++ b/ksplashml/kcmksplash/pics/hi48-app-ksplash.png diff --git a/ksplashml/kcmksplash/pics/hi64-app-ksplash.png b/ksplashml/kcmksplash/pics/hi64-app-ksplash.png Binary files differnew file mode 100644 index 000000000..444b6b927 --- /dev/null +++ b/ksplashml/kcmksplash/pics/hi64-app-ksplash.png diff --git a/ksplashml/ksplash.desktop b/ksplashml/ksplash.desktop new file mode 100644 index 000000000..823049fac --- /dev/null +++ b/ksplashml/ksplash.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Name=KSplash +Name[ar]=الشاشة الافتتاحية +Name[cy]=KCroeso +Name[eo]=Ksalutŝildo +Name[hi]=के-स्प्लैश +Name[ne]=के स्प्लयास +Name[pa]=ਕੇ-ਸਪਲੇਸ +Name[rw]=K-Gukwiza +Name[sv]=Startskärm +Name[ta]=Kஸ்ப்ளாஷ் +Name[vi]=Chào mừng TDE +Exec=ksplash +Icon=ksplash +Type=Service +Terminal=false +Categories=Application;System; diff --git a/ksplashml/ksplashiface.h b/ksplashml/ksplashiface.h new file mode 100644 index 000000000..a3093c0a7 --- /dev/null +++ b/ksplashml/ksplashiface.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * 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 __KSPLASHIFACE_H__ +#define __KSPLASHIFACE_H__ + +#include <dcopobject.h> + +#include <tqstring.h> + +/** @short DCOP interface for KSplash. */ +class KSplashIface : virtual public DCOPObject +{ + K_DCOP +public: + KSplashIface( const char *name = "ksplash" ) : DCOPObject(name) {} + +k_dcop: + virtual ASYNC upAndRunning( TQString ) = 0; + virtual ASYNC setMaxProgress(int) = 0; + virtual ASYNC setProgress(int) = 0; + virtual ASYNC setStartupItemCount( int count ) = 0; + virtual ASYNC programStarted( TQString programIcon, TQString programName, TQString description ) = 0; + virtual ASYNC startupComplete() = 0; + virtual ASYNC close() = 0; + virtual ASYNC hide() = 0; + virtual ASYNC show() = 0; +}; + +#endif diff --git a/ksplashml/main.cpp b/ksplashml/main.cpp new file mode 100644 index 000000000..b36c6a2bd --- /dev/null +++ b/ksplashml/main.cpp @@ -0,0 +1,87 @@ +/*************************************************************************** + * 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 <iostream> +#include <stdlib.h> +#include <unistd.h> + +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <tdelocale.h> +#include <dcopclient.h> + +#include "wndmain.h" + +static TDECmdLineOptions options[] = { + { "managed", I18N_NOOP("Execute KSplash in MANAGED mode"),0 }, + { "test", I18N_NOOP("Run in test mode"), 0 }, + { "nofork", I18N_NOOP("Do not fork into the background"), 0 }, + { "theme <argument>", I18N_NOOP("Override theme"), "" }, + { "nodcop", I18N_NOOP("Do not attempt to start DCOP server"),0 }, + { "steps <number>", I18N_NOOP("Number of steps"), "7" }, + TDECmdLineLastOption +}; + +int main( int argc, char **argv ) +{ + TDEAboutData about( + "ksplash", + I18N_NOOP("KSplash"), + VERSION, + I18N_NOOP("Trinity splash screen"), + TDEAboutData::License_GPL, + I18N_NOOP("(c) 2001 - 2003, Flaming Sword Productions\n (c) 2003 KDE developers"), + "http://www.kde.org"); + about.addAuthor( "Ravikiran Rajagopal", I18N_NOOP("Author and maintainer"), "[email protected]" ); + about.addAuthor( "Brian Ledbetter", I18N_NOOP("Original author"), "[email protected]" ); + + TDECmdLineArgs::init(argc, argv, &about); + TDECmdLineArgs::addCmdLineOptions(options); + TDECmdLineArgs *arg = TDECmdLineArgs::parsedArgs(); + + if ( !( arg->isSet( "dcop" ) ) ) + TDEApplication::disableAutoDcopRegistration(); + else if ( TDEApplication::dcopClient()->attach() ) + TDEApplication::dcopClient()->registerAs( "ksplash", false ); + + TDEApplication app; + + KSplash wndMain("ksplash"); + if ( arg->isSet( "steps" ) ) + { + int steps = TQMAX( arg->getOption( "steps" ).toInt(), 0 ); + if ( steps ) + wndMain.setStartupItemCount( steps ); + } + + // The position of this fork() matters, fork too early and you risk the + // calls to KSplash::programStarted being missed. Now that wndMain has + // been instantiated it is safe to do this. An earlier version of + // this program had this fork occuring before the instantiation, + // and this led to a race condition where if ksplash lost the race it would + // hang because it would wait for signals that had already been sent + if( arg->isSet( "fork" ) ) + { + if (fork()) + exit(0); + } + + app.setMainWidget(&wndMain); + app.setTopWidget(&wndMain); + return(app.exec()); +} diff --git a/ksplashml/pics/CMakeLists.txt b/ksplashml/pics/CMakeLists.txt new file mode 100644 index 000000000..49617244a --- /dev/null +++ b/ksplashml/pics/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( themes ) + +install( FILES splash.png DESTINATION ${DATA_INSTALL_DIR}/ksplash/pics ) diff --git a/ksplashml/pics/Makefile.am b/ksplashml/pics/Makefile.am new file mode 100644 index 000000000..5afb4a43f --- /dev/null +++ b/ksplashml/pics/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS=themes +EXTRA_DIST=splash.png + +ksplashml_pics_datadir = $(kde_datadir)/ksplash/pics +ksplashml_pics_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/splash.png b/ksplashml/pics/splash.png Binary files differnew file mode 100644 index 000000000..1e56bcb9b --- /dev/null +++ b/ksplashml/pics/splash.png diff --git a/ksplashml/pics/themes/CMakeLists.txt b/ksplashml/pics/themes/CMakeLists.txt new file mode 100644 index 000000000..947054ede --- /dev/null +++ b/ksplashml/pics/themes/CMakeLists.txt @@ -0,0 +1,17 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( blue-bend ) +add_subdirectory( default ) +add_subdirectory( unified ) +add_subdirectory( none ) +add_subdirectory( simple ) +add_subdirectory( TDE-Classic ) diff --git a/ksplashml/pics/themes/Makefile.am b/ksplashml/pics/themes/Makefile.am new file mode 100644 index 000000000..84e5124fc --- /dev/null +++ b/ksplashml/pics/themes/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS=$(AUTODIRS) + diff --git a/ksplashml/pics/themes/TDE-Classic/CMakeLists.txt b/ksplashml/pics/themes/TDE-Classic/CMakeLists.txt new file mode 100644 index 000000000..f2ed63cae --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/CMakeLists.txt @@ -0,0 +1,17 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( locolor ) + +install( FILES + Theme.rc Preview.png splash_active_bar.png splash_bottom.png + splash_inactive_bar.png splash_top.png + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/TDE-Classic ) diff --git a/ksplashml/pics/themes/TDE-Classic/Makefile.am b/ksplashml/pics/themes/TDE-Classic/Makefile.am new file mode 100644 index 000000000..7602e6be1 --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS=locolor +EXTRA_DIST=Theme.rc Preview.png splash_active_bar.png splash_bottom.png splash_inactive_bar.png splash_top.png + +ksplashml_pics_default_datadir = $(kde_datadir)/ksplash/Themes/TDE-Classic +ksplashml_pics_default_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/themes/TDE-Classic/Preview.png b/ksplashml/pics/themes/TDE-Classic/Preview.png Binary files differnew file mode 100644 index 000000000..21a6b914f --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/Preview.png diff --git a/ksplashml/pics/themes/TDE-Classic/Theme.rc b/ksplashml/pics/themes/TDE-Classic/Theme.rc new file mode 100644 index 000000000..a03e5d2fb --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/Theme.rc @@ -0,0 +1,22 @@ +# Default KSplash/ML Theme + +[KSplash Theme: TDE-Classic] +Name = TDE 3.5 Splash Screen +Description = Waves of change +Version = 1.0 +Author = Lee Olson <[email protected]> and Timothy Pearson <[email protected]> + +# Theme behaviour settings. +Engine = Default + +# Should icons blink ala Trinity, or not? +Icons Flashing = true + +# Show progress bar? +Always Show Progress = false + +# Status text colour +Label Foreground = #FFFFFF + +# Offset of each of the 7 icons, useful for adjusting flashing positon for different size icons +Icon Offsets = 0, 0, 0, 0, 0, 0, -8 diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/CMakeLists.txt b/ksplashml/pics/themes/TDE-Classic/locolor/CMakeLists.txt new file mode 100644 index 000000000..15c610108 --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/CMakeLists.txt @@ -0,0 +1,15 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + Theme.rc splash_active_bar.png splash_bottom.png + splash_inactive_bar.png splash_top.png + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/TDE-Classic/locolor ) diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/Makefile.am b/ksplashml/pics/themes/TDE-Classic/locolor/Makefile.am new file mode 100644 index 000000000..bfea3e033 --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST=Theme.rc splash_active_bar.png splash_bottom.png splash_inactive_bar.png splash_top.png + +ksplashml_pics_classic_locolor_datadir = $(kde_datadir)/ksplash/Themes/TDE-Classic/locolor +ksplashml_pics_classic_locolor_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/Preview.png b/ksplashml/pics/themes/TDE-Classic/locolor/Preview.png Binary files differnew file mode 100644 index 000000000..21a6b914f --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/Preview.png diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/Theme.rc b/ksplashml/pics/themes/TDE-Classic/locolor/Theme.rc new file mode 100644 index 000000000..f18415a0c --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/Theme.rc @@ -0,0 +1,19 @@ +# Default KSplash/ML Theme + +[KSplash Theme: TDE-Classic] +Name = TDE 3.5 Splash Screen +Description = Waves of change +Version = 1.0 +Author = Lee Olson <[email protected]> and Timothy Pearson <[email protected]> + +# Theme behaviour settings. +Engine = Default + +# Should icons blink ala Trinity, or not? +Icons Flashing = true + +# Show progress bar? +Always Show Progress = false + +# Status text colour +Label Foreground = #FFFFFF diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/splash_active_bar.png b/ksplashml/pics/themes/TDE-Classic/locolor/splash_active_bar.png Binary files differnew file mode 100644 index 000000000..ed4c25f1e --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/splash_active_bar.png diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/splash_bottom.png b/ksplashml/pics/themes/TDE-Classic/locolor/splash_bottom.png Binary files differnew file mode 100644 index 000000000..26c99f3af --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/splash_bottom.png diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/splash_inactive_bar.png b/ksplashml/pics/themes/TDE-Classic/locolor/splash_inactive_bar.png Binary files differnew file mode 100644 index 000000000..c521c8c68 --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/splash_inactive_bar.png diff --git a/ksplashml/pics/themes/TDE-Classic/locolor/splash_top.png b/ksplashml/pics/themes/TDE-Classic/locolor/splash_top.png Binary files differnew file mode 100644 index 000000000..52d5d32b7 --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/locolor/splash_top.png diff --git a/ksplashml/pics/themes/TDE-Classic/splash_active_bar.png b/ksplashml/pics/themes/TDE-Classic/splash_active_bar.png Binary files differnew file mode 100644 index 000000000..ed4c25f1e --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/splash_active_bar.png diff --git a/ksplashml/pics/themes/TDE-Classic/splash_bottom.png b/ksplashml/pics/themes/TDE-Classic/splash_bottom.png Binary files differnew file mode 100644 index 000000000..ef5e14a58 --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/splash_bottom.png diff --git a/ksplashml/pics/themes/TDE-Classic/splash_inactive_bar.png b/ksplashml/pics/themes/TDE-Classic/splash_inactive_bar.png Binary files differnew file mode 100644 index 000000000..c521c8c68 --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/splash_inactive_bar.png diff --git a/ksplashml/pics/themes/TDE-Classic/splash_top.png b/ksplashml/pics/themes/TDE-Classic/splash_top.png Binary files differnew file mode 100644 index 000000000..e0336c5aa --- /dev/null +++ b/ksplashml/pics/themes/TDE-Classic/splash_top.png diff --git a/ksplashml/pics/themes/blue-bend/CMakeLists.txt b/ksplashml/pics/themes/blue-bend/CMakeLists.txt new file mode 100644 index 000000000..76a069a83 --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/CMakeLists.txt @@ -0,0 +1,15 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + Theme.rc Preview.png splash_active_bar.png splash_bottom.png + splash_inactive_bar.png splash_top.png + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/blue-bend ) diff --git a/ksplashml/pics/themes/blue-bend/Makefile.am b/ksplashml/pics/themes/blue-bend/Makefile.am new file mode 100644 index 000000000..4f2063eab --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST=Theme.rc Preview.png splash_active_bar.png splash_bottom.png splash_inactive_bar.png splash_top.png + +ksplashml_pics_default_datadir = $(kde_datadir)/ksplash/Themes/blue-bend +ksplashml_pics_default_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/themes/blue-bend/Preview.png b/ksplashml/pics/themes/blue-bend/Preview.png Binary files differnew file mode 100644 index 000000000..3aee9284d --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/Preview.png diff --git a/ksplashml/pics/themes/blue-bend/Theme.rc b/ksplashml/pics/themes/blue-bend/Theme.rc new file mode 100644 index 000000000..c329290ce --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/Theme.rc @@ -0,0 +1,23 @@ +# +# Blue-Bend KSplash/ML Theme +# + +[KSplash Theme: blue-bend] +Name = Blue-Bend KDE Splash Theme +Description = Load Blue-Bend KDE KSplash theme. +Version = 1.0 +Author = Everaldo Coelho <[email protected]> +Homepage = http://www.everaldo.com + +# Theme behavior settings. +Engine = Default + +# Should icons blink ala KDE, or not? +Icons Flashing = true + +# Configurable Messages. You may specify messages in as many +# languages as you prefer. Messages may be copied verbatim from +# this file, if you wish to maintain the default settings. +#Message1 = Please wait, starting KDE... +#Message1[es] = Por favor escuchar, estarto KDE... +#Message2 = Loading ... diff --git a/ksplashml/pics/themes/blue-bend/splash_active_bar.png b/ksplashml/pics/themes/blue-bend/splash_active_bar.png Binary files differnew file mode 100644 index 000000000..76ebcc43b --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/splash_active_bar.png diff --git a/ksplashml/pics/themes/blue-bend/splash_bottom.png b/ksplashml/pics/themes/blue-bend/splash_bottom.png Binary files differnew file mode 100644 index 000000000..070097af1 --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/splash_bottom.png diff --git a/ksplashml/pics/themes/blue-bend/splash_inactive_bar.png b/ksplashml/pics/themes/blue-bend/splash_inactive_bar.png Binary files differnew file mode 100644 index 000000000..7cfebc0f7 --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/splash_inactive_bar.png diff --git a/ksplashml/pics/themes/blue-bend/splash_top.png b/ksplashml/pics/themes/blue-bend/splash_top.png Binary files differnew file mode 100644 index 000000000..bfcd8637b --- /dev/null +++ b/ksplashml/pics/themes/blue-bend/splash_top.png diff --git a/ksplashml/pics/themes/default/CMakeLists.txt b/ksplashml/pics/themes/default/CMakeLists.txt new file mode 100644 index 000000000..6157c39cd --- /dev/null +++ b/ksplashml/pics/themes/default/CMakeLists.txt @@ -0,0 +1,15 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + Theme.rc Preview.png splash_active_bar.png splash_bottom.png + splash_inactive_bar.png splash_top.png + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Default ) diff --git a/ksplashml/pics/themes/default/Makefile.am b/ksplashml/pics/themes/default/Makefile.am new file mode 100644 index 000000000..20c214004 --- /dev/null +++ b/ksplashml/pics/themes/default/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST=Theme.rc Preview.png splash_active_bar.png splash_bottom.png splash_inactive_bar.png splash_top.png + +ksplashml_pics_default_datadir = $(kde_datadir)/ksplash/Themes/Default +ksplashml_pics_default_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/themes/default/Preview.png b/ksplashml/pics/themes/default/Preview.png Binary files differnew file mode 100644 index 000000000..25eae1721 --- /dev/null +++ b/ksplashml/pics/themes/default/Preview.png diff --git a/ksplashml/pics/themes/default/Theme.rc b/ksplashml/pics/themes/default/Theme.rc new file mode 100644 index 000000000..00896eb33 --- /dev/null +++ b/ksplashml/pics/themes/default/Theme.rc @@ -0,0 +1,19 @@ +# +# Refresh KSplash/ML Theme +# + +[KSplash Theme: Refresh] +Name = Refresh TDE Splash Theme +Description = Load Refresh TDE KSplash theme. +Version = 1.0 +Author = TDE Team +Homepage = trinitydesktop.org + +# Theme behavior settings. +Engine = Default + +# Should icons blink ala TDE, or not? +Icons Flashing = true + +# Offset of each of the 7 icons, useful for adjusting flashing positon for different size icons +# Icon Offsets = 0, 0, 0, 0, 0, 0, 0
\ No newline at end of file diff --git a/ksplashml/pics/themes/default/splash_active_bar.png b/ksplashml/pics/themes/default/splash_active_bar.png Binary files differnew file mode 100644 index 000000000..10bef1e14 --- /dev/null +++ b/ksplashml/pics/themes/default/splash_active_bar.png diff --git a/ksplashml/pics/themes/default/splash_bottom.png b/ksplashml/pics/themes/default/splash_bottom.png Binary files differnew file mode 100644 index 000000000..bceda5097 --- /dev/null +++ b/ksplashml/pics/themes/default/splash_bottom.png diff --git a/ksplashml/pics/themes/default/splash_inactive_bar.png b/ksplashml/pics/themes/default/splash_inactive_bar.png Binary files differnew file mode 100644 index 000000000..e1690ee63 --- /dev/null +++ b/ksplashml/pics/themes/default/splash_inactive_bar.png diff --git a/ksplashml/pics/themes/default/splash_top.png b/ksplashml/pics/themes/default/splash_top.png Binary files differnew file mode 100644 index 000000000..d7c0c12e4 --- /dev/null +++ b/ksplashml/pics/themes/default/splash_top.png diff --git a/ksplashml/pics/themes/none/CMakeLists.txt b/ksplashml/pics/themes/none/CMakeLists.txt new file mode 100644 index 000000000..fce8f9d00 --- /dev/null +++ b/ksplashml/pics/themes/none/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + Theme.rc + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/None ) diff --git a/ksplashml/pics/themes/none/Makefile.am b/ksplashml/pics/themes/none/Makefile.am new file mode 100644 index 000000000..2f439900f --- /dev/null +++ b/ksplashml/pics/themes/none/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST=Theme.rc + +ksplashml_pics_default_datadir = $(kde_datadir)/ksplash/Themes/None +ksplashml_pics_default_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/themes/none/Theme.rc b/ksplashml/pics/themes/none/Theme.rc new file mode 100644 index 000000000..75ef28336 --- /dev/null +++ b/ksplashml/pics/themes/none/Theme.rc @@ -0,0 +1,6 @@ +# Default KSplash/ML Theme + +[KSplash Theme: None] +Name = No Splash Screen +Description = Splash Screen Turned Off +Version = 1.0 diff --git a/ksplashml/pics/themes/simple/CMakeLists.txt b/ksplashml/pics/themes/simple/CMakeLists.txt new file mode 100644 index 000000000..901752d0b --- /dev/null +++ b/ksplashml/pics/themes/simple/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + Theme.rc Preview.png + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Simple ) diff --git a/ksplashml/pics/themes/simple/Makefile.am b/ksplashml/pics/themes/simple/Makefile.am new file mode 100644 index 000000000..cafb7cc83 --- /dev/null +++ b/ksplashml/pics/themes/simple/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST=Theme.rc Preview.png + +ksplashml_pics_default_datadir = $(kde_datadir)/ksplash/Themes/Simple +ksplashml_pics_default_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/themes/simple/Preview.png b/ksplashml/pics/themes/simple/Preview.png Binary files differnew file mode 100644 index 000000000..2e9b39236 --- /dev/null +++ b/ksplashml/pics/themes/simple/Preview.png diff --git a/ksplashml/pics/themes/simple/Theme.rc b/ksplashml/pics/themes/simple/Theme.rc new file mode 100644 index 000000000..45b685986 --- /dev/null +++ b/ksplashml/pics/themes/simple/Theme.rc @@ -0,0 +1,7 @@ +# Default KSplash/ML Theme + +[KSplash Theme: Simple] +Name = Simple Splash Screen +Description = Very Simple Optimized Splash Screen +Version = 1.0 +Author = Lubos Lunak <[email protected]> diff --git a/ksplashml/pics/themes/unified/CMakeLists.txt b/ksplashml/pics/themes/unified/CMakeLists.txt new file mode 100644 index 000000000..0c99ebb00 --- /dev/null +++ b/ksplashml/pics/themes/unified/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + Theme.rc + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Unified ) diff --git a/ksplashml/pics/themes/unified/Makefile.am b/ksplashml/pics/themes/unified/Makefile.am new file mode 100644 index 000000000..c83dcb461 --- /dev/null +++ b/ksplashml/pics/themes/unified/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST=Theme.rc + +ksplashml_pics_default_datadir = $(kde_datadir)/ksplash/Themes/Unified +ksplashml_pics_default_data_DATA = $(EXTRA_DIST) diff --git a/ksplashml/pics/themes/unified/Theme.rc b/ksplashml/pics/themes/unified/Theme.rc new file mode 100644 index 000000000..221bceefd --- /dev/null +++ b/ksplashml/pics/themes/unified/Theme.rc @@ -0,0 +1,16 @@ +# Unified KSplash/ML Theme + +[KSplash Theme: Unified] +Name = Trinity Unified Splash Screen +Description = Unified system startup screen +Version = 1.0 +Author = Timothy Pearson <[email protected]> + +# Theme behaviour settings. +Engine = Unified + +# Show progress bar? +Always Show Progress = false + +# Status text colour +Label Foreground = #FFFFFF diff --git a/ksplashml/themeengine/CMakeLists.txt b/ksplashml/themeengine/CMakeLists.txt new file mode 100644 index 000000000..f5437b9bb --- /dev/null +++ b/ksplashml/themeengine/CMakeLists.txt @@ -0,0 +1,43 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( default ) +add_subdirectory( unified ) +add_subdirectory( standard ) +add_subdirectory( redmond ) +add_subdirectory( simple ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES themeengine.h objkstheme.h DESTINATION ${INCLUDE_INSTALL_DIR}/ksplash ) +install( FILES ksplashplugins.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) + + +##### ksplashthemes (shared) #################### + +tde_add_library( ksplashthemes SHARED AUTOMOC + SOURCES themeengine.cpp objkstheme.cpp + VERSION 0.0.0 + LINK tdeui-shared + DESTINATION ${LIB_INSTALL_DIR} +) diff --git a/ksplashml/themeengine/Makefile.am b/ksplashml/themeengine/Makefile.am new file mode 100644 index 000000000..558404e31 --- /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_TDEUI) $(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/CMakeLists.txt b/ksplashml/themeengine/default/CMakeLists.txt new file mode 100644 index 000000000..ba3866e35 --- /dev/null +++ b/ksplashml/themeengine/default/CMakeLists.txt @@ -0,0 +1,45 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + #${CMAKE_CURRENT_SOURCE_DIR} + #${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/ksplashml/themeengine + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES ksplashdefault.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### ksplashdefault (module) ################### + +tde_add_kpart( ksplashdefault AUTOMOC + SOURCES main.cpp + LINK themedefault-static ksplashthemes-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### themedefault (static) ##################### + +tde_add_library( themedefault STATIC_PIC AUTOMOC + SOURCES themelegacy.cpp + LINK ksplashthemes-shared +) diff --git a/ksplashml/themeengine/default/Makefile.am b/ksplashml/themeengine/default/Makefile.am new file mode 100644 index 000000000..b117cbb29 --- /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) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +libthemedefault_la_LIBADD = $(LIB_TDEUI) ../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_TDEUI) ../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..2f4f3d236 --- /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 TDE +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 TDE Gia tài +Name[wa]=KSplashTayons +ServiceTypes=KSplash/Plugin +X-TDE-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 * + * [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 <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..0e1242120 --- /dev/null +++ b/ksplashml/themeengine/default/themelegacy.cpp @@ -0,0 +1,319 @@ +/*************************************************************************** + * 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 <tdeapplication.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <kgenericfactory.h> +#include <tdeglobalsettings.h> +#include <tdelocale.h> +#include <kstandarddirs.h> +#include <kprogress.h> + +#include <tqcheckbox.h> +#include <tqdesktopwidget.h> +#include <tqlabel.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqwidget.h> +#include <tqtimer.h> +#include <tqvaluelist.h> + +#include "objkstheme.h" +#include "themeengine.h" +#include "themelegacy.h" +#include "themelegacy.moc" + +const int MAX_STATES=8; + +DefaultConfig::DefaultConfig( TQWidget *parent, TDEConfig *config ) + :ThemeEngineConfig( parent, config ) +{ + mConfig->setGroup( TQString("KSplash Theme: Default") ); + TQVBox *hbox = new TQVBox( this ); + mFlash = new TQCheckBox( i18n("Icons flash while they are starting"), hbox ); + mFlash->setChecked( mConfig->readBoolEntry("Icons Flashing",true) ); + mAlwaysShow = new TQCheckBox( i18n("Always show progress bar"), hbox ); + mAlwaysShow->setChecked( mConfig->readBoolEntry("Always Show Progress",true) ); +} + +void DefaultConfig::save() +{ + kdDebug() << "DefaultConfig::save()" << endl; + mConfig->setGroup( TQString("KSplash Theme: Default") ); + mConfig->writeEntry( "Icons Flashing", mFlash->isChecked() ); + mConfig->writeEntry( "Always Show Progress", mAlwaysShow->isChecked() ); + mConfig->sync(); +} + +#define BIDI 0 + +ThemeDefault::ThemeDefault( TQWidget *parent, const char *name, const TQStringList &args ) + :ThemeEngine( parent, name, args ) +{ + + mActivePixmap = mInactivePixmap = 0L; + mState = 0; + for (int i=0; i<MAX_ICONS; ++i) + mIconOffsets[i]=0; + + _readSettings(); + _initUi(); + + if( mIconsFlashing ) + { + mFlashTimer = new TQTimer( this ); + connect( mFlashTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(flash()) ); + mFlashPixmap1 = new TQPixmap(); + mFlashPixmap2 = new TQPixmap(); + + } + else + { + mFlashTimer = 0L; + mFlashPixmap1 = 0L; + mFlashPixmap2 = 0L; + } +} + +ThemeDefault::~ThemeDefault() +{ + delete mFlashPixmap1; + delete mFlashPixmap2; +} + +void ThemeDefault::_initUi() +{ + TQString resource_prefix; + + TQVBox *vbox = new TQVBox( this ); + vbox->setBackgroundMode(NoBackground); + + + TQString activePix, inactivePix; +#if BIDI + if ( TQApplication::reverseLayout() ) + { + activePix = _findPicture(TQString("splash_active_bar_bidi.png")); + inactivePix = _findPicture(TQString("splash_inactive_bar_bidi.png")); + } + else +#endif + { + activePix = _findPicture(TQString("splash_active_bar.png")); + inactivePix = _findPicture(TQString("splash_inactive_bar.png")); + } + kdDebug() << "Inactive pixmap: " << inactivePix << endl; + kdDebug() << "Active pixmap: " << activePix << endl; + + mActivePixmap = new TQPixmap( activePix ); + mInactivePixmap = new TQPixmap( inactivePix ); + + if (mActivePixmap->isNull()) + { + mActivePixmap->resize(200,100); + mActivePixmap->fill(Qt::blue); + } + if (mInactivePixmap->isNull()) + { + mInactivePixmap->resize(200,100); + mInactivePixmap->fill(Qt::black); + } + + TQPixmap tlimage( _findPicture(TQString("splash_top.png")) ); + if (tlimage.isNull()) + { + tlimage.resize(200,100); + tlimage.fill(Qt::blue); + } + TQLabel *top_label = new TQLabel( vbox ); + top_label->setPixmap( tlimage ); + top_label->setFixedSize( tlimage.width(), tlimage.height() ); + top_label->setBackgroundMode(NoBackground); + + mBarLabel = new TQLabel( vbox ); + mBarLabel->setPixmap(*mInactivePixmap); + mBarLabel->setBackgroundMode(NoBackground); + + TQPixmap blimage( _findPicture(TQString("splash_bottom.png")) ); + if (blimage.isNull()) + { + blimage.resize(200,100); + blimage.fill(Qt::black); + } + TQLabel *bottom_label = new TQLabel( vbox ); + bottom_label->setPaletteBackgroundPixmap( blimage ); + + + mLabel = new TQLabel( bottom_label ); + mLabel->setBackgroundOrigin( TQWidget::ParentOrigin ); + mLabel->setPaletteForegroundColor( mLabelForeground ); + mLabel->setPaletteBackgroundPixmap( blimage ); + TQFont f(mLabel->font()); + f.setBold(TRUE); + mLabel->setFont(f); + + mProgressBar = new KProgress( mLabel ); + int h, s, v; + mLabelForeground.getHsv( &h, &s, &v ); + mProgressBar->setPalette( TQPalette( v > 128 ? black : white )); + mProgressBar->setBackgroundOrigin( TQWidget::ParentOrigin ); + mProgressBar->setPaletteBackgroundPixmap( blimage ); + + bottom_label->setFixedWidth( TQMAX(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 (TQApplication::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 TQRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() ); + // TDEGlobalSettings::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; + + TDEConfig *cfg = mTheme->themeConfig(); + if (!cfg) + return; + + cfg->setGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) ); + + mIconsFlashing = cfg->readBoolEntry( "Icons Flashing", true ); + TQColor df(Qt::white); + mLabelForeground = cfg->readColorEntry( "Label Foreground", &df ); + TQValueList<int> io_list=cfg->readIntListEntry("Icon Offsets"); + if (io_list.size() == MAX_ICONS) + { + TQValueList<int>::iterator io_it; + int i=0; + for (io_it = io_list.begin(); io_it != io_list.end(); ++io_it, ++i) + mIconOffsets[i]=*io_it; + } +} + +/* + * 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 >= MAX_STATES) + mState = MAX_STATES-1; + + if( mIconsFlashing ) + { + + *mFlashPixmap1 = updateBarPixmap( mState ); + *mFlashPixmap2 = updateBarPixmap( mState+1 ); + mBarLabel->setPixmap(*mFlashPixmap2); + mFlashTimer->stop(); + + if( mState < MAX_STATES ) + 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. + */ +TQPixmap ThemeDefault::updateBarPixmap( int state ) +{ + int offs; + + TQPixmap x; + if( !mActivePixmap ) return( x ); +#if BIDI + if( TQApplication::reverseLayout() ) + { + if ( state > 7 ) + return ( x ); + } +#endif + + offs = state*58; + if (state>=0 && state<MAX_ICONS) + offs += mIconOffsets[state]; + + TQPixmap tmp(*mActivePixmap); + TQPainter p(&tmp); +#if BIDI + if ( TQApplication::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; + TQPixmap *swap = mFlashPixmap1; + mFlashPixmap1 = mFlashPixmap2; + mFlashPixmap2 = swap; + mBarLabel->setPixmap(*mFlashPixmap2); +} + +TQString ThemeDefault::_findPicture( const TQString &pic ) +{ + // Don't use ObjKsTheme::locateThemeData here for compatibility reasons. + TQString f = pic; + if (mTheme->loColor()) + f = TQString("locolor/")+f; + //kdDebug() << "Searching for " << f << endl; + //kdDebug() << "Theme directory: " << mTheme->themeDir() << endl; + //kdDebug() << "Theme name: " << mTheme->theme() << endl; + TQString p = TQString::null; + if ((p = locate("appdata",mTheme->themeDir()+f)).isEmpty()) + if ((p = locate("appdata",mTheme->themeDir()+"pics/"+f)).isEmpty()) + if ((p = locate("appdata", TQString("pics/")+mTheme->theme()+"/"+f)).isEmpty()) + if ((p = locate("appdata",f)).isEmpty()) + if ((p = locate("appdata",TQString("pics/")+f)).isEmpty()) + if ((p = locate("data",TQString("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..1f56d05b0 --- /dev/null +++ b/ksplashml/themeengine/default/themelegacy.h @@ -0,0 +1,107 @@ +/*************************************************************************** + * 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 __THEMELEGACY_H__ +#define __THEMELEGACY_H__ + +#include <kprogress.h> + +#include <tqlabel.h> +#include <tqwidget.h> + +#include "themeengine.h" + +static const int MAX_ICONS=7; + +class TQPixmap; +class TQTimer; + +class TQCheckBox; + +class DefaultConfig: public ThemeEngineConfig +{ + Q_OBJECT +public: + DefaultConfig( TQWidget *, TDEConfig * ); + void save(); +protected: + TQCheckBox *mFlash, *mAlwaysShow; +}; + +/** + * @short Traditional Trinity splash screen. + */ +class ObjKsTheme; +class KDE_EXPORT ThemeDefault : public ThemeEngine +{ + Q_OBJECT +public: + ThemeDefault( TQWidget *, const char *, const TQStringList& ); + virtual ~ThemeDefault(); + + inline const DefaultConfig *config( TQWidget *p, TDEConfig *c ) + { + return new DefaultConfig( p, c ); + }; + + static TQStringList names() + { + TQStringList Names; + Names << "Default"; + Names << "Classic"; + Names << "Klassic"; + return( Names ); + } + +public slots: + inline void slotSetText( const TQString& 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(); + TQPixmap updateBarPixmap( int ); + void flash(); + +private: + void _initUi(); + void _readSettings(); + TQString _findPicture( const TQString &pic ); + + // Configurable Options + bool mIconsFlashing; + TQColor mLabelForeground; + int mIconOffsets[MAX_ICONS]; + + // Internals. + KProgress *mProgressBar; + TQLabel *mLabel, *mBarLabel; + TQPixmap *mActivePixmap, *mInactivePixmap; + int mState; + TQTimer *mFlashTimer; + TQPixmap *mFlashPixmap1, *mFlashPixmap2; +}; + +#endif diff --git a/ksplashml/themeengine/ksplashplugins.desktop b/ksplashml/themeengine/ksplashplugins.desktop new file mode 100644 index 000000000..09f453bb8 --- /dev/null +++ b/ksplashml/themeengine/ksplashplugins.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=ServiceType +X-TDE-ServiceType=KSplash/Plugin + +[PropertyDef::X-KSplash-PluginName] +Type=TQString + +[PropertyDef::X-KSplash-ObjectName] +Type=TQString + +[PropertyDef::X-KSplash-Default] +Type=bool diff --git a/ksplashml/themeengine/objkstheme.cpp b/ksplashml/themeengine/objkstheme.cpp new file mode 100644 index 000000000..89a9601be --- /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 <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <tdeglobal.h> +#include <tdelocale.h> +#include <kstandarddirs.h> + +#include <tqcolor.h> +#include <tqcursor.h> +#include <tqdesktopwidget.h> +#include <tqfont.h> +#include <tqpixmap.h> +#include <tqrect.h> +#include <tqstring.h> + +#include "objkstheme.h" +#include "objkstheme.moc" + +ObjKsTheme::ObjKsTheme( const TQString& theme ) + :mActiveTheme (theme), mThemeDir("/"), mThemeConfig (0L), mThemePrefix( "Themes/" ), d(0) +{ + // Get Xinerama config. + TDEConfig *config = kapp->config(); + config->setGroup( "Xinerama" ); + TQDesktopWidget *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) + { + TQRect rect = desktop->screenGeometry( mXineramaScreen ); + if (!rect.contains(TQCursor::pos())) + TQCursor::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(TDECmdLineArgs::parsedArgs()); + mThemePrefix += ( mActiveTheme + "/" ); +} + +ObjKsTheme::~ObjKsTheme() +{ +} + +bool ObjKsTheme::loadThemeRc( const TQString& activeTheme, bool force ) +{ + //kdDebug() << "ObjKsTheme::loadThemeRc: " << activeTheme << endl; + TQString prefix("Themes/"); + TQString themeFile; + TDEConfig *cf = 0L; + + // Try our best to find a theme file. + themeFile = locate( "appdata", prefix + activeTheme + "/" + TQString("Theme.rc") ); + themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+TQString("Theme.RC")):themeFile; + themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+TQString("theme.rc")):themeFile; + themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+activeTheme+TQString(".rc")):themeFile; + + if( !themeFile.isEmpty() ) + cf = new TDEConfig( themeFile ); + + if( cf ) + { + mActiveTheme = activeTheme; + mThemeDir = prefix + activeTheme+"/"; + if( loadTDEConfig( cf, activeTheme, force ) ) + { + mThemeConfig = cf; + return true; + } + else + delete cf; + } + return false; +} + +bool ObjKsTheme::loadLocalConfig( const TQString& activeTheme, bool force ) +{ + //kdDebug() << "ObjKsTheme::loadLocalConfig" << endl; + TDEConfig *cfg = kapp->config(); + return( loadTDEConfig( cfg, activeTheme, force ) ); +} + +// ObjKsConfig::loadTDEConfig(): Load our settings from a TDEConfig object. +bool ObjKsTheme::loadTDEConfig( TDEConfig *cfg, const TQString& activeTheme, bool force ) +{ + //kdDebug() << "ObjKsTheme::loadTDEConfig" << 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( TQString("KSplash Theme: %1").arg(activeTheme) ) && !force ) + return false; + + cfg->setGroup( TQString("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("Trinity is up and running") ) ); + + return true; +} + +/* + * ObjKsTheme::loadCmdLineArgs(): Handle any overrides which the user might have + * specified. + */ +void ObjKsTheme::loadCmdLineArgs( TDECmdLineArgs *args ) +{ + + mManagedMode = args->isSet( "managed" ); + mTesting = args->isSet("test"); + mLoColor = ( TQPixmap::defaultDepth() <= 8 ); + TQString theme = args->getOption( "theme" ); + if( theme != mActiveTheme && !theme.isNull() ) + if( loadThemeRc( theme, false ) ) + mActiveTheme = theme; + //args->clear(); +} + +TQString ObjKsTheme::locateThemeData( const TQString &resource ) +{ + if ( !mLoColor ) + return locate( "appdata", mThemePrefix+resource ); + else + { + TQString 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..8959c5537 --- /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 <tdecmdlineargs.h> + +#include <tqstring.h> +#include <tqstringlist.h> + +class TDEConfig; +/** + * @short Theme reader. + * A Theme is read in from the file + * <TDEDIR>/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 TQString& ); + virtual ~ObjKsTheme(); + + void loadCmdLineArgs( TDECmdLineArgs * ); + + TQString theme() const { return( mActiveTheme ); } + TQString themeEngine() const { return( mThemeEngine ); } + TDEConfig *themeConfig() const { return( mThemeConfig ); } + TQString themeDir() const { return( mThemeDir ); } + bool loColor() const { return( mLoColor ); } + bool testing() const { return( mTesting ); } + bool managedMode() const { return( mManagedMode ); } + TQString icon( int i ) { return (m_icons[i-1].isNull()?(TQString::null):m_icons[i-1]); } + TQString text( int i ) { return (m_text[i-1].isNull()?(TQString::null):m_text[i-1]); } + TQString locateThemeData( const TQString &resource ); + int xineramaScreen() const { return mXineramaScreen; } + +protected: + bool loadThemeRc( const TQString&, bool ); + bool loadLocalConfig( const TQString&, bool ); + bool loadTDEConfig( TDEConfig *, const TQString&, bool ); + +private: + TQString mActiveTheme, mThemeDir; + TDEConfig *mThemeConfig; + + int mXineramaScreen; + bool mLoColor, mTesting, mManagedMode; + TQString mThemeEngine; + TQString mThemePrefix; + + TQStringList m_icons, m_text; + + class ObjKsThemePrivate; + ObjKsThemePrivate *d; +}; + +#endif diff --git a/ksplashml/themeengine/redmond/CMakeLists.txt b/ksplashml/themeengine/redmond/CMakeLists.txt new file mode 100644 index 000000000..a6e0b0229 --- /dev/null +++ b/ksplashml/themeengine/redmond/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( pics ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/ksplashml/themeengine + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES Theme.rc DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Redmond ) +install( FILES ksplashredmond.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### ksplashredmond (module) ################### + +tde_add_kpart( ksplashredmond AUTOMOC + SOURCES previewredmond.cpp themeredmond.cpp + LINK ksplashthemes-shared tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/ksplashml/themeengine/redmond/Makefile.am b/ksplashml/themeengine/redmond/Makefile.am new file mode 100644 index 000000000..f3bd64329 --- /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_TDEUI) $(LIB_TDEIO) ../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..1494342a5 --- /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 TDE +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 TDE Redmond +Name[zh_TW]=KSplachRedmond +ServiceTypes=KSplash/Plugin +X-TDE-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..7b4a6bb2e --- /dev/null +++ b/ksplashml/themeengine/redmond/main.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * 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 <kstandarddirs.h> + +#include <tqlabel.h> +#include <tqpixmap.h> +#include <tqwidget.h> + +#include "themeredmond.h" + +extern "C" +{ + ThemeEngineConfig *KsThemeConfig( TQWidget *parent, TDEConfig *config ) + { + return new CfgRedmond( parent, config ); + } + + TQStringList KsThemeSupports() + { + return ThemeRedmond::names(); + } + + void* KsThemeInit( TQWidget *parent, ObjKsTheme *theme ) + { + return new ThemeRedmond( parent, theme ); + } +} + diff --git a/ksplashml/themeengine/redmond/pics/Background.png b/ksplashml/themeengine/redmond/pics/Background.png Binary files differnew file mode 100644 index 000000000..a38a55d42 --- /dev/null +++ b/ksplashml/themeengine/redmond/pics/Background.png diff --git a/ksplashml/themeengine/redmond/pics/CMakeLists.txt b/ksplashml/themeengine/redmond/pics/CMakeLists.txt new file mode 100644 index 000000000..1b4f09de0 --- /dev/null +++ b/ksplashml/themeengine/redmond/pics/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES Preview.png Background.png DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Redmond ) 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 Binary files differnew file mode 100644 index 000000000..a52ec2644 --- /dev/null +++ b/ksplashml/themeengine/redmond/pics/Preview.png diff --git a/ksplashml/themeengine/redmond/previewredmond.cpp b/ksplashml/themeengine/redmond/previewredmond.cpp new file mode 100644 index 000000000..7a31a44b8 --- /dev/null +++ b/ksplashml/themeengine/redmond/previewredmond.cpp @@ -0,0 +1,113 @@ +/*************************************************************************** + * 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 <tdelocale.h> + +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqwidget.h> + +#include "previewredmond.h" +#include "previewredmond.moc" +/* + * PreviewRedmond::PreviewRedmond(): Constructor. Set up some basic + * things. + */ +PreviewRedmond::PreviewRedmond( TQWidget* parent ) + :TQWidget( parent ), + + /* Using direct constructors to prevent memory blit. */ + m_welcomeString (i18n("Welcome")), + m_userString (i18n("(Your Name)")), + + m_welcomeFont (TQFont( "Arial", 16, TQFont::Bold )), + m_userFont (TQFont( "Arial", 16 )), + m_statusFont (TQFont( "Arial", 12, TQFont::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( TQPaintEvent* pe ) +{ + TQPainter p; + p.begin( this ); + p.drawPixmap( pe->rect(), m_cache ); + p.end(); +} + +void PreviewRedmond::resizeEvent( TQResizeEvent *re ) +{ + TQWidget::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 = TQPixmap( size() ); + TQPainter p; + p.begin( &m_cache ); + + p.fillRect( rect(), Qt::gray ); + + m_welcomeFont.setItalic( true ); + p.setFont( m_welcomeFont ); + + TQPoint 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 ); + TQPoint 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 ) + { + TQPoint 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..5fc5558c2 --- /dev/null +++ b/ksplashml/themeengine/redmond/previewredmond.h @@ -0,0 +1,104 @@ +/*************************************************************************** + * 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 __PREVIEWREDMOND_H__ +#define __PREVIEWREDMOND_H__ + +#include <kiconloader.h> + +#include <tqcolor.h> +#include <tqfont.h> +#include <tqwidget.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 TQWidget +{ + Q_OBJECT +public: + + PreviewRedmond( TQWidget* ); + + inline void setWelcomeString( const TQString& s ) + { + m_welcomeString = s; + _updateCache(); + } + inline void setUserString( const TQString& s ) + { + m_userString = s; + _updateCache(); + } + + inline void setWelcomeFont( const TQFont& f ) + { + m_welcomeFont = f; + _updateCache(); + } + inline void setUserFont( const TQFont& f ) + { + m_userFont = f; + _updateCache(); + } + inline void setStatusFont( const TQFont& f ) + { + m_statusFont = f; + _updateCache(); + } + + inline void setWelcomeColor( const TQColor& c ) + { + m_welcomeColor = c; + _updateCache(); + } + inline void setWelcomeShadowColor( const TQColor& c ) + { + m_welcomeShadowColor = c; + _updateCache(); + } + inline void setUserColor( const TQColor& c ) + { + m_userColor = c; + _updateCache(); + } + inline void setStatusColor( const TQColor& c ) + { + m_statusColor = c; + _updateCache(); + } + + inline void setIcon( const TQString& s ) + { + m_icon = DesktopIcon( s ); + _updateCache(); + } + +protected: + void _updateCache(); + void paintEvent( TQPaintEvent* ); + void resizeEvent( TQResizeEvent* ); + + TQPixmap m_cache; + + TQString m_welcomeString, m_userString; + TQFont m_welcomeFont, m_userFont, m_statusFont; + TQColor m_welcomeColor, m_welcomeShadowColor, m_userColor, m_statusColor; + TQPixmap 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..b0e81ba72 --- /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 <tdeapplication.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <tdefontcombo.h> +#include <kgenericfactory.h> +#include <tdeglobalsettings.h> +#include <kiconloader.h> +#include <tdelocale.h> +#include <kstandarddirs.h> +#include <kuser.h> +#include <tdeemailsettings.h> + +#include <tqcheckbox.h> +#include <tqdesktopwidget.h> +#include <tqlabel.h> +#include <tqpainter.h> +#include <tqrect.h> +#include <tqstringlist.h> +#include <tqwidget.h> + +#include <objkstheme.h> +#include "themeredmond.h" +#include "previewredmond.h" +#include "themeredmond.moc" + +K_EXPORT_COMPONENT_FACTORY( ksplashredmond, KGenericFactory<ThemeRedmond>( "ksplash" ) ) + +CfgRedmond::CfgRedmond( TQWidget *p, TDEConfig *c ) + :ThemeEngineConfig( p, c ) +{ + TQVBox *vbox = new TQVBox( this ); + vbox->setSpacing( KDialog::spacingHint() ); + + TQFont defaultFont( "Arial", 48, TQFont::Bold ); + defaultFont.setItalic( true ); + TQFont defaultUsernameFont( "Arial", 16, TQFont::Bold ); + TQFont defaultActionFont( "Arial", 12, TQFont::Bold ); + TQColor defaultDarkColor( 3, 47, 156 ); + TQColor defaultWhiteColor( Qt::white ); + + TQHBox *hbox = new TQHBox( vbox ); + hbox->setFrameStyle( TQFrame::WinPanel ); + hbox->setFrameShadow( TQFrame::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" ) ); + + TQLabel *lbl = new TQLabel( vbox ); + lbl->setText( i18n("(Sorry, but I haven't finished writing this one yet...)") ); +} + +ThemeRedmond::ThemeRedmond( TQWidget *parent, const char *name, const TQStringList &args ) + :ThemeEngine( parent, name, args ) +{ + _readSettings(); + _initUi(); +} + +void ThemeRedmond::_initUi() +{ + const TQRect screen = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() ); + //TQRect fullScreen = TDEGlobalSettings::desktopGeometry(0L); + + mImage.resize( screen.width(), screen.height() ); + + TQPainter p; + p.begin( &mImage ); + p.fillRect( screen, TQColor(3,47,156) ); + p.setPen( mActionTextColor ); + + TQString 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( TQString( "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 ); + + TQPixmap pix( bgimg ); + + if( !pix.isNull() ) + { + + TQPixmap tmp( TQSize(screen.width(), screen.height() ) ); + float sw = (float)screen.width() / pix.width(); + float sh = (float)(screen.height()) / pix.height(); + + TQWMatrix matrix; + matrix.scale( sw, sh ); + tmp = pix.xForm( matrix ); + + p.drawPixmap( 0, 0, tmp ); + } + + TQFont f = mWelcomeFont; + if( mWelcomeFontItalic ) + f.setItalic( true ); // this SHOULD BE stored in the TQFont entry, dang it. + p.setFont( f ); + TQFontMetrics met( f ); + TQSize fmet = met.size( 0L, mWelcomeText ); + + // Paint the "Welcome" message, if we are instructed to. Optionally dispense with the + // shadow. + if ( mShowWelcomeText ) + { + if( mWelcomeTextPosition == TQPoint( 0, 0 ) ) + { + mWelcomeTextPosition = TQPoint( (screen.width()/2) - fmet.width() - 25, + (screen.height()/2) - (fmet.height()/2) + fmet.height() ); + } + } + + if( mShowWelcomeText ) + { + if( mShowWelcomeTextShadow ) + { + p.setPen( mWelcomeTextShadowColor ); + p.drawText( mWelcomeTextPosition+TQPoint(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; + TQString 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 TDM icon... TODO: Make this overridable by the Theme. + if( mUseKdmUserIcon ) + { + const TQString 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; + TDEConfig *tdmconfig = new TDEConfig("tdm/tdmrc", true); + tdmconfig->setGroup("X-*-Greeter"); + TQString userPicsDir = tdmconfig->readEntry( "FaceDir", TDEGlobal::dirs()->resourceDirs("data").last() + "tdm/faces" ) + '/'; + TQString fs = tdmconfig->readEntry( "FaceSource" ); + if (fs == TQString::fromLatin1("UserOnly")) + faceSource = fUserOnly; + else if (fs == TQString::fromLatin1("PreferUser")) + faceSource = fUserFirst; + else if (fs == TQString::fromLatin1("PreferAdmin")) + faceSource = fAdminFirst; + else + faceSource = fAdminOnly; // Admin Only + delete tdmconfig; + + TQPixmap userp; + if ( faceSource == fAdminFirst ) + { + // If the administrator's choice takes preference + userp = TQPixmap( userPicsDir + user.loginName() + ".face.icon" ); + if ( userp.isNull() ) + faceSource = fUserOnly; + } + if ( faceSource >= fUserFirst) + { + // If the user's choice takes preference + userp = TQPixmap( user.homeDir() + "/.face.icon" ); + if ( userp.isNull() && faceSource == fUserFirst ) // The user has no face, should we check for the admin's setting? + userp = TQPixmap( userPicsDir + user.loginName() + ".face.icon" ); + if ( userp.isNull() ) + userp = TQPixmap( userPicsDir + defSys ); + } + else if ( faceSource <= fAdminOnly ) + { + // Admin only + userp = TQPixmap( userPicsDir + user.loginName() + ".face.icon" ); + if ( userp.isNull() ) + userp = TQPixmap( userPicsDir + defSys ); + } + if( !userp.isNull() ) + mPixmap = userp; + } + + if( mShowIcon ) + { + TQPoint pos = mIconPosition; + if( pos == TQPoint( 0, 0 ) ) + { + pos = TQPoint( (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 = TQFontMetrics( f ); + fmet = met.size( 0L, greetingString ); + + if( mShowUsernameText ) + { + TQPoint pos = mUsernameTextPosition; + if( pos == TQPoint( 0, 0 ) ) + { + pos = TQPoint( + (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( TQPaintEvent *pe ) +{ + const TQRect screen = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() ); + + TQPainter p; + p.begin( this ); + + TQRect r = pe->rect(); + + bitBlt( this, r.x(), r.y(), + &mImage, r.x(), r.y(), r.width(), r.height() ); + + if (mShowActionText) + { + p.setPen( mActionTextColor ); + TQFont f = mActionFont; + p.setFont( f ); + TQFontMetrics met( f ); + TQSize fmet = met.size( 0L, mText ); + + mMsgPos = mActionTextPosition; + if( mMsgPos == TQPoint( 0, 0 ) ) + { + mMsgPos = TQPoint( + (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 TQRect screen = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() ); + //TQRect fullScreen = TDEGlobalSettings::desktopGeometry(0L); + + if( !mTheme ) + return; + TDEConfig *cfg = mTheme->themeConfig(); + if( !cfg ) + return; + + //if( !cfg->hasGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) ) ) + // return; + cfg->setGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) ); + + // Overall appearance + mBackgroundImage = cfg->readEntry( "Background Image", TQString::null ); + mIcon = cfg->readEntry( "User Icon", "kmenu" ); + mWelcomeText = cfg->readEntry( "Welcome Text", i18n("Welcome") ); + mUsernameText = cfg->readEntry( "Username Text", TQString::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. + TQPoint absZero( 0, 0 ); + mWelcomeTextPosition = cfg->readPointEntry( TQString("Welcome Text Position %1").arg(screen.width()), &absZero ); + mUsernameTextPosition = cfg->readPointEntry( TQString("Username Text Position %1").arg(screen.width()), &absZero ); + mActionTextPosition = cfg->readPointEntry( TQString("Action Text Position %1").arg(screen.width()), &absZero ); + mIconPosition = cfg->readPointEntry( TQString("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 TDM User Icon", true ); + + // Setup our fonts. There are only 3 elements which use 'em, so this is fairly + // straightforward. + TQFont defaultFont( "Arial", 48, TQFont::Bold ); + defaultFont.setItalic( true ); + TQFont defaultUsernameFont( "Arial", 16, TQFont::Bold ); + TQFont defaultActionFont( "Arial", 12, TQFont::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 ); + + TQColor defaultDarkColor( 3, 47, 156 ); + TQColor 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..d68e004da --- /dev/null +++ b/ksplashml/themeengine/redmond/themeredmond.h @@ -0,0 +1,103 @@ +/*************************************************************************** + * 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 __THEMEREDMOND_H__ +#define __THEMEREDMOND_H__ + +#include <kdebug.h> +#include <kpixmap.h> + +#include <themeengine.h> + +class TDEFontCombo; +class TQCheckBox; + +class CfgRedmond: public ThemeEngineConfig +{ + Q_OBJECT +public: + CfgRedmond( TQWidget *, TDEConfig * ); + +protected: + TQCheckBox *mShowUsername; + TQCheckBox *mShowIcon; + TQCheckBox *mShowWelcome; + TDEFontCombo *mWelcomeFont; + TDEFontCombo *mUsernameFont; + TDEFontCombo *mActionFont; +}; + +class ObjKsTheme; +class ThemeRedmond: public ThemeEngine +{ + Q_OBJECT +public: + ThemeRedmond( TQWidget *, const char *, const TQStringList& ); + + inline const TQString name() { return( TQString("Redmond") ); } + static TQStringList names() + { + TQStringList Names; + Names << "Redmond"; + return( Names ); + }; + +public slots: + inline void slotSetText( const TQString& s ) + { + if( mText != s ) + { + mText = s; + repaint( false ); + } + }; + +private: + void paintEvent( TQPaintEvent * ); + + void _initUi(); + void _readSettings(); + + TQString mText; + TQPixmap mPixmap; + bool mRedrawKonqi; + TQPoint mMsgPos; + KPixmap mImage; + + // ThemeEngine configuration. + bool mShowWelcomeText; + bool mShowWelcomeTextShadow; + bool mWelcomeFontItalic; + bool mShowUsernameText; + bool mShowActionText; + bool mShowIcon; + bool mUseKdmUserIcon; + TQString mBackgroundImage; + TQString mWelcomeText; + TQString mUsernameText; // Leave this undefined to autodetect the username. + TQString mIcon; + TQFont mWelcomeFont; + TQFont mUsernameFont; + TQFont mActionFont; + TQColor mWelcomeTextColor; + TQColor mWelcomeTextShadowColor; + TQColor mUsernameTextColor; + TQColor mActionTextColor; + TQPoint mWelcomeTextPosition; // Set this to (0,0) to autoposition the text. + TQPoint mUsernameTextPosition; // Likewise. + TQPoint mActionTextPosition; // Likewise likewise. + TQPoint mIconPosition; // ... + +} +; + +#endif diff --git a/ksplashml/themeengine/simple/CMakeLists.txt b/ksplashml/themeengine/simple/CMakeLists.txt new file mode 100644 index 000000000..927f4b507 --- /dev/null +++ b/ksplashml/themeengine/simple/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +if( WITH_XINERAMA ) + check_include_file( "X11/extensions/Xinerama.h" X11_EXTENSIONS_XINERAMA_H ) + if( X11_EXTENSIONS_XINERAMA_H ) + check_library_exists( Xinerama XineramaQueryExtension "" HAVE_XINERAMA ) + endif( X11_EXTENSIONS_XINERAMA_H ) + if( NOT HAVE_XINERAMA ) + tde_message_fatal( "xinerama are requested, but not found on your system" ) + endif( NOT HAVE_XINERAMA ) + set( XINERAMA_LIBRARY Xinerama ) +endif( WITH_XINERAMA ) + + +include_directories( + ${CMAKE_BINARY_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### ksplashsimple (executable) ################ + +tde_add_executable( ksplashsimple + SOURCES main.cpp + LINK ${TQT_LIBRARIES} X11 ${XINERAMA_LIBRARY} + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/ksplashml/themeengine/simple/Makefile.am b/ksplashml/themeengine/simple/Makefile.am new file mode 100644 index 000000000..bed3bd5d1 --- /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) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +ksplashsimple_LDADD = $(LIB_XINERAMA) $(LIB_X11) $(LIB_QT) 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/CMakeLists.txt b/ksplashml/themeengine/standard/CMakeLists.txt new file mode 100644 index 000000000..ca85efe96 --- /dev/null +++ b/ksplashml/themeengine/standard/CMakeLists.txt @@ -0,0 +1,47 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( pics ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/ksplashml/themeengine + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES Theme.rc DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Standard ) +install( FILES ksplashstandard.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### ksplashstandard (module) ################## + +tde_add_kpart( ksplashstandard AUTOMOC + SOURCES themestandardlib.cpp + LINK themestandard-static + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### themestandard (static) #################### + +tde_add_library( themestandard STATIC_PIC AUTOMOC + SOURCES themestandard.cpp wndicon.cpp wndstatus.cpp + LINK ksplashthemes-shared +) diff --git a/ksplashml/themeengine/standard/Makefile.am b/ksplashml/themeengine/standard/Makefile.am new file mode 100644 index 000000000..efd1fbeb1 --- /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) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +libthemestandard_la_LIBADD = $(LIB_TDEUI) ../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_TDEUI) ../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 Binary files differnew file mode 100644 index 000000000..438d5490a --- /dev/null +++ b/ksplashml/themeengine/standard/Preview.png 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..91fffeb12 --- /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 TDE +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 TDE Tiêu chuẩn +Name[wa]=KSplashStandård +ServiceTypes=KSplash/Plugin +X-TDE-Library=ksplashstandard +X-KSplash-Default=true +X-KSplash-PluginName=Standard +X-KSplash-ObjectName=ThemeStandard diff --git a/ksplashml/themeengine/standard/pics/CMakeLists.txt b/ksplashml/themeengine/standard/pics/CMakeLists.txt new file mode 100644 index 000000000..01a6355d3 --- /dev/null +++ b/ksplashml/themeengine/standard/pics/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES Preview.png DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Standard ) 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 Binary files differnew file mode 100644 index 000000000..3fd4ce9fe --- /dev/null +++ b/ksplashml/themeengine/standard/pics/Preview.png diff --git a/ksplashml/themeengine/standard/themestandard.cpp b/ksplashml/themeengine/standard/themestandard.cpp new file mode 100644 index 000000000..ce0fd124e --- /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 <tdeapplication.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <tdeglobalsettings.h> +#include <kiconloader.h> +#include <tdelocale.h> +#include <kstandarddirs.h> +#include <tdeconfig.h> + +#include <tqdesktopwidget.h> +#include <tqlabel.h> +#include <tqpalette.h> +#include <tqpixmap.h> +#include <tqwidget.h> + +#include <objkstheme.h> +#include "themestandard.h" +#include "themestandard.moc" +#include "wndicon.h" +#include "wndstatus.h" + +ThemeStandard::ThemeStandard( TQWidget *parent, const char *name, const TQStringList &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(TQFont()), mSbFg(TQColor()), mSbBg(TQColor()), + mSbIcon("run"), mIconsVisible(true), mIconsJumping(true), mSplashScreen("(Default)") +{ + _readSettings(); + _initUi(); +} + +void ThemeStandard::_initUi() +{ + setFrameStyle( TQFrame::NoFrame ); + + TQString pixName = mTheme->locateThemeData( mSplashScreen ); + + if( mSplashScreen == "(Default)" || pixName.isEmpty() ) + { + TQString resource_prefix = "pics/"; + if ( mTheme->loColor() ) + resource_prefix += "locolor/"; + pixName = locate( "appdata", resource_prefix + "splash.png"); + } + + TQPixmap px = TQPixmap( pixName ); + + if( !px.isNull() ) + { + //kdDebug() << "Loaded splash " << mSplashScreen << endl; + int pw = px.width(); + int ph = px.height(); + + TQLabel *lbl = new TQLabel( 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 TQRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() ); + // TDEGlobalSettings::splashScreenDesktopGeometry(); cannot be used here. + + move( rect.x() + (rect.width() - size().width())/2, + rect.y() + (rect.height() - size().height())/2 ); + + mStatus = new WndStatus( TQPalette(), mTheme->xineramaScreen(), mSbAtTop, mSbPbVisible, mSbFont, mSbFg, mSbBg, mSbIcon ); +} + +void ThemeStandard::showEvent( TQShowEvent * ) +{ + + ThemeEngine::show(); + + if( mSbVisible ) + { + mStatus->show(); + mStatusBarHeight = mStatus->height(); + } + else + { + mStatusBarHeight = 0L; + } +} + +// Adjust the visible icon. +void ThemeStandard::slotSetPixmap( const TQString& pxn ) +{ + TQPixmap 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, TQString::null, mIconPos, mSbAtTop, mIconsJumping ); + mIcon->show(); + + if( mIconsJumping ) + { + emit mIcon->slotJump(); + mPrevIcon = mIcon; + } +} + +void ThemeStandard::_readSettings() +{ + + if ( !mTheme ) + return; + + TDEConfig *cfg = mTheme->themeConfig(); + if ( !cfg ) + return; + + //if ( !cfg->hasGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) ) ) + // return; + cfg->setGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) ); + + TQString 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 = TQFont( mSbFontName, mSbFontSz, ( mSbFontBold? TQFont::Bold : TQFont::Normal ) ); + if( mSbFontItalic ) + mSbFont.setItalic( true ); + + mSbFg = cfg->readColorEntry( "Statusbar Foreground", &TQt::white ); + mSbBg = cfg->readColorEntry( "Statusbar Background", &TQt::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..a1fb61ccf --- /dev/null +++ b/ksplashml/themeengine/standard/themestandard.h @@ -0,0 +1,93 @@ +/*************************************************************************** + * 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 __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( TQWidget *, const char*, const TQStringList& ); + //inline const ThemeEngineConfig *config( TQWidget *p, TDEConfig *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 TQString& s ) + { + if( mStatus ) mStatus->slotSetMessage( s ); + } + void slotSetPixmap( const TQString& ); + +private: + void showEvent( TQShowEvent * ); + void _readSettings(); + void _initUi(); + + WndStatus *mStatus; + WndIcon *mIcon, *mPrevIcon; + int mIconCount; + int mStatusBarHeight; + int mStdIconWidth; + + WndIcon::Position mIconPos; + bool mSbAtTop; + bool mSbVisible; + bool mSbPbVisible; + TQString mSbFontName; + int mSbFontSz; + bool mSbFontBold; + bool mSbFontItalic; + TQFont mSbFont; + TQColor mSbFg; + TQColor mSbBg; + TQString mSbIcon; + bool mIconsVisible; + bool mIconsJumping; + TQString 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 * + * [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. * + * * + ***************************************************************************/ + +#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..856547895 --- /dev/null +++ b/ksplashml/themeengine/standard/wndicon.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.) * + * * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <tdeapplication.h> +#include <kcursor.h> +#include <kdebug.h> +#include <kdebug.h> +#include <tdeglobalsettings.h> +#include <twin.h> + +#include <tqdesktopwidget.h> +#include <tqhbox.h> +#include <tqlabel.h> +#include <tqpixmap.h> +#include <tqpoint.h> +#include <tqtimer.h> +#include <tqwidget.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 TQString& text, + Position icon_position, + bool statusAtTop, + bool iconsJumping ) + :TQHBox( 0, "wndSplash", (WFlags)(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( TQFrame::NoFrame ); + + TQLabel *w = new TQLabel( 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. + TQPoint p = determinePosition(); + mGroundX = mPosX = p.x(); + mGroundY = mPosY = p.y(); + move( p + kapp->desktop()->screenGeometry( mXineramaScreen ).topLeft() ); + + if( mIconJumping ) + { + TQTimer *t = new TQTimer( this ); + connect(t, TQT_SIGNAL(timeout()), TQT_SLOT(slotJump())); + t->start( 50, false ); + } +} + +void WndIcon::show() +{ + emit setStatusText( mStatusText ); + TQHBox::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. + */ +TQPoint WndIcon::determinePosition() +{ + int DW, DH, SBH, wid, X, Y, x, y, nSlot, topshift, bottomshift; + + bottomshift = topshift = 0; + const TQRect srect = kapp->desktop()->screenGeometry( mXineramaScreen ); + // TDEGlobalSettings::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 = TQMAX(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 = TQMAX(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 = TQMAX(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 = TQMAX(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 = TQMAX(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 = TQMAX(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 = TQMAX(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 = TQMAX(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( TQPoint( 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( TQPoint( 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..5338835a4 --- /dev/null +++ b/ksplashml/themeengine/standard/wndicon.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.) * + * * + ***************************************************************************/ + +// 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 <tqhbox.h> + +/** + * @short Displays an icon on the screen. + */ +class WndIcon: + public TQHBox +{ + 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 TQString&, Position, bool, bool ); + +signals: + void setStatusText( const TQString& ); + +public slots: + void show(); + void noshow(); + void slotStopJumping(); + void slotJump(); + +private: + TQPoint determinePosition(); + +protected: + TQString 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..9eb8be9a0 --- /dev/null +++ b/ksplashml/themeengine/standard/wndstatus.cpp @@ -0,0 +1,101 @@ +/*************************************************************************** + * Copyright Brian Ledbetter 2001-2003 <[email protected]> * + * Copyright Ravikiran Rajagopal 2003 * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License (version 2) as * + * published by the Free Software Foundation. (The original KSplash/ML * + * codebase (upto version 0.95.3) is BSD-licensed.) * + * * + ***************************************************************************/ + +#include <tdeapplication.h> +#include <kcursor.h> +#include <kdebug.h> +#include <tdeglobalsettings.h> +#include <kiconloader.h> +#include <kprogress.h> +#include <twin.h> + +#include <tqdesktopwidget.h> +#include <tqhbox.h> +#include <tqlabel.h> +#include <tqpoint.h> +#include <tqrect.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( TQPalette /*pal*/, + int xineramaScreen, + bool atTop, bool pbVisible, + const TQFont& font, + const TQColor& fgc, const TQColor & bgc, + const TQString& icon + ) + :TQHBox( 0, "wndStatus", (WFlags)(WStyle_Customize|WX11BypassWM) ) +{ + setFrameStyle( TQFrame::NoFrame ); + //setPalette( pal ); + setPaletteBackgroundColor( bgc ); + setPaletteForegroundColor( fgc ); + setCursor( KCursor::blankCursor() ); + setSpacing( 5 ); + + const TQRect rect = kapp->desktop()->screenGeometry( xineramaScreen ); + // TDEGlobalSettings::splashScreenDesktopGeometry(); cannot be used here. + + TQLabel *pix = new TQLabel( this ); + TQPixmap _icon( SmallIcon(icon.isNull()||icon.isEmpty()?TQString("run"):icon) ); + pix->setPixmap( _icon ); + setStretchFactor(pix,0); + pix->setFixedWidth(16); + + m_label = new TQLabel( this ); + m_label->setFont( font ); + m_label->setPaletteBackgroundColor( bgc ); + m_label->setPaletteForegroundColor( fgc ); + //TQFontMetrics metrics( font ); + //m_label->setFixedHeight( metrics.height() ); + m_label->setText(TQString("")); + m_label->setFixedWidth(rect.width()-105-16-10); // What's this magic number? + m_label->show(); + + m_progress = new KProgress( this ); + setStretchFactor(m_progress,0); + m_progress->setFixedWidth(100); + + TQWidget *widg = new TQWidget( this ); + setStretchFactor(widg,50); + + setFixedSize( rect.width(), TQMAX(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 TQString& 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..bc908779d --- /dev/null +++ b/ksplashml/themeengine/standard/wndstatus.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * 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.) * + * * + ***************************************************************************/ + +// 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 <tqhbox.h> + +class TQLabel; +class KProgress; + +/** @short Window displaying status and progress bar. */ +class WndStatus: + public TQHBox +{ + Q_OBJECT +public: + WndStatus( TQPalette, + int, // Xinerama screen + bool, // At top? + bool, // Progress indicator visible? + const TQFont&, // Status bar font + const TQColor&, const TQColor &, // Foreground/Background color + const TQString& // Icon + ); + +public slots: + void slotSetMessage( const TQString& ); + void slotUpdateProgress( int ); + void slotUpdateSteps( int ); + +protected: + TQLabel *m_label; + KProgress *m_progress; +}; +#endif diff --git a/ksplashml/themeengine/themeengine.cpp b/ksplashml/themeengine/themeengine.cpp new file mode 100644 index 000000000..9a7d3aba5 --- /dev/null +++ b/ksplashml/themeengine/themeengine.cpp @@ -0,0 +1,139 @@ +/*************************************************************************** + * 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 <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <tdeglobal.h> +#include <twin.h> + +#include <tqevent.h> +#include <tqfile.h> +#include <tqwidget.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 +{ + TQValueList< Window > mSplashWindows; +}; + +ThemeEngine::ThemeEngine( TQWidget *, const char *, const TQStringList& args ) + : TQVBox( 0, "wndSplash", (WFlags)(WStyle_Customize|WX11BypassWM) ), d(0), mUseWM(false) +{ + d = new ThemeEnginePrivate; + kapp->installX11EventFilter( this ); + kapp->installEventFilter( this ); + (void)kapp->desktop(); + XWindowAttributes rootAttr; + XGetWindowAttributes(tqt_xdisplay(), RootWindow(tqt_xdisplay(), + tqt_xscreen()), &rootAttr); + XSelectInput( tqt_xdisplay(), tqt_xrootwin(), + SubstructureNotifyMask | rootAttr.your_event_mask ); + if (args.isEmpty()) + mTheme = new ObjKsTheme( "Default" ); + else + mTheme = new ObjKsTheme( args.first() ); + if (args.first() == "Unified") { + mUseWM = true; + } + mTheme->loadCmdLineArgs( TDECmdLineArgs::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( TQObject* o, TQEvent* e ) +{ + if( e->type() == TQEvent::Show && o->isWidgetType()) + addSplashWindow( TQT_TQWIDGET( o )); + return false; +} + +namespace +{ +class HackWidget : public TQWidget { friend class ::ThemeEngine; }; +} + +void ThemeEngine::addSplashWindow( TQWidget* w ) +{ + if( !w->isTopLevel()) + return; + if( d->mSplashWindows.contains( w->winId())) + return; + if( !w->testWFlags( WX11BypassWM ) && (mUseWM == false)) + { // 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( tqt_xdisplay(), w->winId(), CWOverrideRedirect, &attrs ); + } + d->mSplashWindows.prepend( w->winId()); + connect( w, TQT_SIGNAL( destroyed( TQObject* )), TQT_SLOT( splashWindowDestroyed( TQObject* ))); + w->raise(); +} + +void ThemeEngine::splashWindowDestroyed( TQObject* obj ) +{ + d->mSplashWindows.remove( TQT_TQWIDGET( obj )->winId()); +} + +bool ThemeEngine::x11Event( XEvent* e ) +{ + if( e->type != ConfigureNotify && e->type != MapNotify ) + return false; + if( e->type == ConfigureNotify && e->xconfigure.event != tqt_xrootwin()) + return false; + if( e->type == MapNotify && e->xmap.event != tqt_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( tqt_xdisplay(), d->mSplashWindows.first()); // raise topmost + // and stack others below it + Window* stack = new Window[ d->mSplashWindows.count() ]; + int count = 0; + for( TQValueList< 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..fa2f15a65 --- /dev/null +++ b/ksplashml/themeengine/themeengine.h @@ -0,0 +1,84 @@ +/*************************************************************************** + * 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 <tqstringlist.h> +#include <tqvbox.h> +#include <tqwidget.h> + +#include <kdemacros.h> + +class TDEConfig; +class ObjKsTheme; +class TQMouseEvent; + +/** + * @short The base for the ThemeEngine's configuration widget. + */ +class KDE_EXPORT ThemeEngineConfig: public TQVBox +{ + Q_OBJECT +public: + + ThemeEngineConfig( TQWidget *p, TDEConfig *c ) + :TQVBox( p ), mConfig( c ) + {} + + TDEConfig* config()const { return mConfig; } + +public slots: + virtual void load() {} + virtual void save() {} + +protected: + TDEConfig *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 TQVBox +{ + Q_OBJECT +public: + ThemeEngine( TQWidget *parent, const char *name, const TQStringList &args ); + virtual ~ThemeEngine() = 0; + virtual const ThemeEngineConfig *config( TQWidget *, TDEConfig * ) { return 0L; } + virtual ObjKsTheme *ksTheme() { return mTheme; } + virtual bool eventFilter( TQObject* o, TQEvent* e ); + +public slots: + virtual void slotUpdateProgress( int ) {} + virtual void slotUpdateSteps( int ) {} + virtual void slotSetText( const TQString& ) {} + virtual void slotSetTextIndex( const int ) {} + virtual void slotSetPixmap( const TQString& ) {} // use DesktopIcon() to load this. + +protected: + void addSplashWindow( TQWidget* ); + +protected: + ObjKsTheme *mTheme; + virtual bool x11Event( XEvent* ); + +private slots: + void splashWindowDestroyed( TQObject* ); + +private: + class ThemeEnginePrivate; + ThemeEnginePrivate *d; + bool mUseWM; +}; + +#endif diff --git a/ksplashml/themeengine/unified/CMakeLists.txt b/ksplashml/themeengine/unified/CMakeLists.txt new file mode 100644 index 000000000..5200fb060 --- /dev/null +++ b/ksplashml/themeengine/unified/CMakeLists.txt @@ -0,0 +1,45 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + #${CMAKE_CURRENT_SOURCE_DIR} + #${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/ksplashml/themeengine + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES ksplashunified.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### ksplashunified (module) ################### + +tde_add_kpart( ksplashunified AUTOMOC + SOURCES main.cpp + LINK themeunified-static ksplashthemes-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### themeunified (static) ##################### + +tde_add_library( themeunified STATIC_PIC AUTOMOC + SOURCES themeunified.cpp + LINK ksplashthemes-shared +) diff --git a/ksplashml/themeengine/unified/Makefile.am b/ksplashml/themeengine/unified/Makefile.am new file mode 100644 index 000000000..b117cbb29 --- /dev/null +++ b/ksplashml/themeengine/unified/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) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +libthemedefault_la_LIBADD = $(LIB_TDEUI) ../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_TDEUI) ../libksplashthemes.la libthemedefault.la +METASOURCES = AUTO + +servicesdir = $(kde_servicesdir) +services_DATA = ksplashdefault.desktop diff --git a/ksplashml/themeengine/unified/ksplashunified.desktop b/ksplashml/themeengine/unified/ksplashunified.desktop new file mode 100644 index 000000000..08d298f0a --- /dev/null +++ b/ksplashml/themeengine/unified/ksplashunified.desktop @@ -0,0 +1,78 @@ +[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 TDE +Comment[wa]=Tchôke-divins KSplash (waitroûle d' enondaedje) +Comment[zh_CN]=KSplash 插件 +Comment[zh_TW]=KSplash 外掛程式 +Name=KSplashUnified +ServiceTypes=KSplash/Plugin +X-TDE-Library=ksplashunified +X-KSplash-Default=true +X-KSplash-PluginName=Unified +X-KSplash-ObjectName=ThemeUnified diff --git a/ksplashml/themeengine/unified/main.cpp b/ksplashml/themeengine/unified/main.cpp new file mode 100644 index 000000000..a28cf5952 --- /dev/null +++ b/ksplashml/themeengine/unified/main.cpp @@ -0,0 +1,17 @@ +/*************************************************************************** + * 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 <kgenericfactory.h> + +#include "themeunified.h" + +K_EXPORT_COMPONENT_FACTORY( ksplashunified, KGenericFactory<ThemeUnified>( "ksplash" ) ) diff --git a/ksplashml/themeengine/unified/themeunified.cpp b/ksplashml/themeengine/unified/themeunified.cpp new file mode 100644 index 000000000..0a2eb6343 --- /dev/null +++ b/ksplashml/themeengine/unified/themeunified.cpp @@ -0,0 +1,118 @@ +/*************************************************************************** + * 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 <tdeapplication.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <kgenericfactory.h> +#include <tdeglobalsettings.h> +#include <tdelocale.h> +#include <kstandarddirs.h> +#include <kprogress.h> + +#include <tqcheckbox.h> +#include <tqdesktopwidget.h> +#include <tqlabel.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqwidget.h> +#include <tqtimer.h> +#include <tqcursor.h> + +#include "objkstheme.h" +#include "themeengine.h" +#include "themeunified.h" +#include "themeunified.moc" + +UnifiedConfig::UnifiedConfig( TQWidget *parent, TDEConfig *config ) + :ThemeEngineConfig( parent, config ) +{ + mConfig->setGroup( TQString("KSplash Theme: Default") ); + TQVBox *hbox = new TQVBox( this ); + mAlwaysShow = new TQCheckBox( i18n("Always show progress bar"), hbox ); + mAlwaysShow->setChecked( mConfig->readBoolEntry("Always Show Progress",true) ); +} + +void UnifiedConfig::save() +{ + kdDebug() << "UnifiedConfig::save()" << endl; + mConfig->setGroup( TQString("KSplash Theme: Default") ); + mConfig->writeEntry( "Always Show Progress", mAlwaysShow->isChecked() ); + mConfig->sync(); +} + +ThemeUnified::ThemeUnified( TQWidget *parent, const char *name, const TQStringList &args ) + :ThemeEngine( parent, name, args ) +{ + + mState = 0; + + _readSettings(); + _initUi(); +} + +ThemeUnified::~ThemeUnified() +{ + if (mSysModalDialog) { + KSMModalDialog* temp = mSysModalDialog; + mSysModalDialog = NULL; + temp->closeSMDialog(); + } +} + +void ThemeUnified::_initUi() +{ + resize(10,10); + + mSysModalDialog = new KSMModalDialog(this); + mSysModalDialog->setStatusMessage(i18n("Trinity is starting up").append("...")); + mSysModalDialog->show(); + mSysModalDialog->setActiveWindow(); + + const TQRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() ); + + // Center the dialog + TQSize sh = sizeHint(); + TQRect rect1 = TDEGlobalSettings::desktopGeometry(TQCursor::pos()); + move(rect1.x() + (rect1.width() - sh.width())/2, rect1.y() + (rect1.height() - sh.height())/2); +} + +// Attempt to find overrides elsewhere? +void ThemeUnified::_readSettings() +{ + if( !mTheme ) + return; + + TDEConfig *cfg = mTheme->themeConfig(); + if( !cfg ) + return; + + cfg->setGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) ); + + TQColor df(Qt::white); + mLabelForeground = cfg->readColorEntry( "Label Foreground", &df ); +} + +/* + * ThemeUnified::slotUpdateState(): IF in Default mode, THEN adjust the bar + * pixmap label. Whee, phun! + * + * A similar method exists in the old KSplash. + */ +void ThemeUnified::slotUpdateState() +{ + if( mState > 8 ) + mState = 8; + +// mBarLabel->setPixmap( updateBarPixmap( mState ) ); + + mState++; +} diff --git a/ksplashml/themeengine/unified/themeunified.h b/ksplashml/themeengine/unified/themeunified.h new file mode 100644 index 000000000..cd6a1d1ca --- /dev/null +++ b/ksplashml/themeengine/unified/themeunified.h @@ -0,0 +1,101 @@ +/*************************************************************************** + * Copyright Brian Ledbetter 2001-2003 <[email protected]> * + * Copyright Ravikiran Rajagopal 2003 * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License (version 2) as * + * published by the Free Software Foundation. (The original KSplash/ML * + * codebase (upto version 0.95.3) is BSD-licensed.) * + * * + ***************************************************************************/ + +#ifndef __THEMEUNIFIED_H__ +#define __THEMEUNIFIED_H__ + +#include <kprogress.h> + +#include <tqlabel.h> +#include <tqwidget.h> + +#include <kdialog.h> + +#include "themeengine.h" +class TQPixmap; +class TQTimer; + +class TQCheckBox; + +class UnifiedConfig: public ThemeEngineConfig +{ + Q_OBJECT +public: + UnifiedConfig( TQWidget *, TDEConfig * ); + void save(); +protected: + TQCheckBox *mAlwaysShow; +}; + +/** + * @short Traditional Trinity splash screen. + */ +class ObjKsTheme; +class KDE_EXPORT ThemeUnified : public ThemeEngine +{ + Q_OBJECT +public: + ThemeUnified( TQWidget *, const char *, const TQStringList& ); + virtual ~ThemeUnified(); + + inline const UnifiedConfig *config( TQWidget *p, TDEConfig *c ) + { + return new UnifiedConfig( p, c ); + }; + + static TQStringList names() + { + TQStringList Names; + Names << "Unified"; + return( Names ); + } + +public slots: + inline void slotSetText( const TQString& s ) + { + close(); + if (mSysModalDialog) mSysModalDialog->setStatusMessage(TQString(s).append("...")); + } + inline void slotSetTextIndex( const int i ) + { + if (i == 3) { + if (mSysModalDialog) { + KSMModalDialog* temp = mSysModalDialog; + mSysModalDialog = NULL; + temp->closeSMDialog(); + } + } + } + inline void slotUpdateSteps( int s ) + { + } + inline void slotUpdateProgress( int i ) + { + } + + +private slots: + void slotUpdateState(); + +private: + void _initUi(); + void _readSettings(); + + // Configurable Options + TQColor mLabelForeground; + + // Internals. + KSMModalDialog* mSysModalDialog; + int mState; +}; + +#endif diff --git a/ksplashml/wndmain.cpp b/ksplashml/wndmain.cpp new file mode 100644 index 000000000..c37c6e214 --- /dev/null +++ b/ksplashml/wndmain.cpp @@ -0,0 +1,437 @@ +/*************************************************************************** + * 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 <unistd.h> + +#include <tdeapplication.h> +#include <tdeconfig.h> +#include <kcursor.h> +#include <kdebug.h> +#include <kiconloader.h> +#include <klibloader.h> +#include <tdelocale.h> +#include <tdemessagebox.h> +#include <kstandarddirs.h> +#include <ktrader.h> +#include <twin.h> +#include <dcopclient.h> + +#include <tqdir.h> +#include <tqpixmap.h> +#include <tqtimer.h> + +#include "objkstheme.h" +#include "wndmain.h" +#include "wndmain.moc" + +#include "themeengine.h" +#include "themelegacy.h" + +// KSplash::KSplash(): This is a hidden object. Its sole purpose +// is to manage the other objects, which are presented on the screen. +KSplash::KSplash(const char *name) + : DCOPObject( name ), TQWidget( 0, name, (WFlags)(WStyle_Customize|WStyle_NoBorder|WX11BypassWM) ), + mState( 0 ), mMaxProgress( 0 ), mStep( 0 ) +{ + hide(); // We never show this object. + mThemeLibName = TQString::null; + mSessMgrCalled = false; + mTimeToGo = false; + + TDEConfig * config = kapp->config(); + slotReadProperties(config); + + prepareSplashScreen(); + prepareIconList(); + + mCurrentAction = mActionList.first(); + + config->setGroup( "General" ); + if ( config->readBoolEntry( "CloseOnClick", TRUE ) ) + mThemeEngine->installEventFilter( this ); + + connect( mThemeEngine, TQT_SIGNAL(destroyed()), this, TQT_SLOT(close()) ); + connect( this, TQT_SIGNAL(stepsChanged(int)), TQT_SLOT(slotUpdateSteps(int)) ); + connect( this, TQT_SIGNAL(progressChanged(int)), TQT_SLOT(slotUpdateProgress(int)) ); + + if( mKsTheme->testing() ) + { + slotUpdateSteps(7); + TQTimer::singleShot( 1000, this, TQT_SLOT(slotExec())); + } + else + TQTimer::singleShot( 100, this, TQT_SLOT(initDcop())); + + // Make sure we don't stay up forever. + if (!mKsTheme->managedMode()) + { + close_timer = new TQTimer( this ); + connect( close_timer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( close() ) ); + close_timer->start( 60000, TRUE ); + } +} + +KSplash::~KSplash() +{ + delete mThemeEngine; + delete mKsTheme; + delete close_timer; + if (!mThemeLibName.isEmpty()) + KLibLoader::self()->unloadLibrary( mThemeLibName.latin1() ); +} + +void KSplash::slotReadProperties( TDEConfig *config ) +{ + TDECmdLineArgs *arg = TDECmdLineArgs::parsedArgs(); + mTheme = arg->getOption("theme"); + if (mTheme.isEmpty()) + { + config->setGroup( "KSplash" ); + mTheme = config->readEntry( "Theme", "Default" ); + } + loadTheme( mTheme ); // Guaranteed to return a valid theme. +} + +void KSplash::prepareIconList() +{ + // Managed mode icons are specified via DCOP. + if( mKsTheme->managedMode() ) + return; + + slotInsertAction( mKsTheme->icon( 1 ), mKsTheme->text( 1 ) ); + + mCurrentAction = mActionList.first(); + slotSetText( mCurrentAction->ItemText ); + slotSetTextIndex( mActionList.find(mCurrentAction) ); + slotSetPixmap( mCurrentAction->ItemPixmap ); + emit progressChanged( mStep ); + + for (int indx = 2; indx <= 8; indx++) + slotInsertAction( mKsTheme->icon( indx ), mKsTheme->text( indx ) ); +} + +void KSplash::prepareSplashScreen() +{ + mThemeEngine->show(); +} + +void KSplash::slotInsertAction( const TQString& pix, const TQString& msg ) +{ + Action *a = new Action; + a->ItemText = msg; + a->ItemPixmap = pix; + mActionList.append( a ); +} + +void KSplash::slotExec() +{ + TQTimer::singleShot( 200, this, TQT_SLOT(nextIcon())); +} + +void KSplash::nextIcon() +{ + if( !mCurrentAction || mTimeToGo ) + { + TQTimer::singleShot( 1000, this, TQT_SLOT(close())); + return; + } + + mCurrentAction = mActionList.next(); + + if( mCurrentAction ) + { + slotSetText( mCurrentAction->ItemText ); + slotSetTextIndex( mActionList.find(mCurrentAction) ); + slotSetPixmap( mCurrentAction->ItemPixmap ); + emit progressChanged( ++mStep ); + } + + if( mKsTheme->testing() ) + TQTimer::singleShot( 1000, this, TQT_SLOT(nextIcon())); +} + +void KSplash::initDcop() +{ + disconnect( kapp->dcopClient(), TQT_SIGNAL( attachFailed(const TQString&) ), kapp, TQT_SLOT( dcopFailure(const TQString&) ) ); + + if ( kapp->dcopClient()->isAttached() ) + return; + + if ( kapp->dcopClient()->attach() ) + { + if(!mKsTheme->managedMode()) + upAndRunning( "dcop" ); + kapp->dcopClient()->registerAs( "ksplash", false ); + kapp->dcopClient()->setDefaultObject( objId() ); + } + else + { + TQTimer::singleShot( 100, this, TQT_SLOT(initDcop()) ); + } +} + +void KSplash::updateState( unsigned int state ) +{ +// The whole state updating in ksplashml is simply weird, +// nextIcon() and also the themes naively assume all states +// will come, and will come in the expected order, which +// is not guaranteed, and can happen easily with faster machines. +// And upAndRunning() even is written to handle it gracefully. + while( state > mState ) + { + ++mState; + nextIcon(); + } +} + +// For KDE startup only. +void KSplash::upAndRunning( TQString s ) +{ +// This code is written to match ksmserver. Touch it without knowing +// what you are doing and prepare to bite the dust. + bool update = true; + static bool firstTime = true; + + if (firstTime) + { + emit stepsChanged(7); + firstTime = false; + } + if ( close_timer->isActive() ) + close_timer->start( 60000, TRUE ); + + if( s == "dcop" ) + { + if( mState > 1 ) return; + updateState( 1 ); + mStep = 1; + } + else if( s == "kded" ) + { + if( mState > 2 ) return; + updateState( 2 ); + mStep = 2; + } + else if( s == "kcminit" ) + ; // No icon + else if( s == "ksmserver" ) + { + if( mState > 3 ) return; + updateState( 3 ); + mStep = 3; + } + else if( s == "wm started" ) + { + if( mState > 4 ) return; + updateState( 4 ); + mStep = 4; + } + else if( s == "kdesktop" ) + { + if( mState > 5 ) return; + updateState( 5 ); + mStep = 5; + } + else if( s == "kicker" || s == "session ready" ) + { + updateState( 7 ); + mStep = 9; + //if(!mSessMgrCalled) emit nextIcon(); + mTimeToGo = true; + close_timer->stop(); + TQTimer::singleShot( 1000, this, TQT_SLOT(close())); + } + else + { + kdDebug() << "KSplash::upAndRunning(): bad s: " << s << endl; + update = false; + } +} + +// For KDE startup only. +void KSplash::setMaxProgress(int max) +{ + if( max < 1 ) + max = 1; + if( mThemeEngine && mState >= 6 ) // show the progressbar only after kicker is ready + mThemeEngine->slotUpdateSteps( max ); + mMaxProgress = max; +} + +// For KDE startup only. +void KSplash::setProgress(int step) +{ + if( mThemeEngine ) + mThemeEngine->slotUpdateProgress( mMaxProgress - step ); +} + + +/* + * When a program starts, it sends a generic signal to KSplash indicating + * (a) which icon is to be displayed to the user //OR// a generic token-name + * indicating that KSplash can load a pre-configured icon, (b) the textual + * name of the process being started, and (c) a description of what the + * process is handling. Some examples: + * + * programStarted( TQString("desktop"), TQString("kdesktop"), TQString("Preparing your desktop...")); + */ +void KSplash::programStarted( TQString icon, TQString name, TQString desc ) +{ + if (mTimeToGo) + return; + // No isEmpty() here: empty strings are handled by the plugins and can be passed to update the counter. + if (name.isNull() && icon.isNull() && desc.isNull()) + return; + + slotInsertAction( icon, desc ); + mCurrentAction = mActionList.next(); + slotSetText( desc ); + slotSetPixmap( icon ); + emit progressChanged( ++mStep ); +} + +void KSplash::setStartupItemCount( int count ) +{ + emit stepsChanged( count ); + emit progressChanged( mStep ); +} + +void KSplash::startupComplete() +{ + mTimeToGo = true; + TQTimer::singleShot( 1000, this, TQT_SLOT(close())); +} + +void KSplash::close() +{ + TQWidget::close(); +#ifdef USE_QT4 + exit(0); +#endif // USE_QT4 +} + +void KSplash::hide() +{ + TQWidget::hide(); +} + +void KSplash::show() +{ + TQWidget::show(); +} + +// Guaranteed to return a valid theme. +void KSplash::loadTheme( const TQString& theme ) +{ + mKsTheme = new ObjKsTheme( theme ); + // kdDebug() << "KSplash::loadTheme: " << theme << " : "<< mKsTheme->themeEngine() << endl; + mThemeEngine = _loadThemeEngine( mKsTheme->themeEngine(), theme ); + if (!mThemeEngine) + { + mThemeEngine = new ThemeDefault( this, "", theme ); + kdDebug() << "Standard theme loaded." << endl; + } + // The theme engine we get may not be the theme engine we requested. + delete mKsTheme; + mKsTheme = mThemeEngine->ksTheme(); +} + +ThemeEngine *KSplash::_loadThemeEngine( const TQString& pluginName, const TQString& theme ) +{ + // Since we may be called before the DCOP server is active, we cannot use the TDETrader framework for obtaining plugins. In its + // place, we use the following naive heuristic to locate plugins. If we are not in managed mode, and we are not in testing mode + // either, we assume that we have been called by starttde. In this case, we simply try to load the library whose name should + // conform to the following specification: + // TQString("ksplash") + pluginName.lower() + // The object should be called as follows: + // TQString("Theme") + pluginName + KLibFactory *factory = 0L; + TQString libName; + TQString objName; + // Replace this test by a "nodcop" command line option. + if ( /*!mKsTheme->managedMode() ||*/ !TDECmdLineArgs::parsedArgs()->isSet( "dcop" ) ) + { + libName = TQString("ksplash%1").arg(pluginName.lower()); + objName = TQString("Theme%1").arg(pluginName); + // kdDebug() << "*KSplash::_loadThemeEngine: Loading " << objName << " from " << libName << endl; + // libname.latin1() instead of TQFile::encodeName() because these are not user-modifiable files. + if ( (factory = KLibLoader::self()->factory ( libName.latin1() )) ) + mThemeLibName = libName; + } + else + { + // Fancier way of locating plugins. + KService::List list= TDETrader::self()->query("KSplash/Plugin", TQString("[X-KSplash-PluginName] == '%1'").arg(pluginName)); + KService::Ptr ptr; + if (!list.isEmpty()) + { + ptr = list.first(); + // libname.latin1() instead of TQFile::encodeName() because these are not user-modifiable files. + if( (factory = KLibLoader::self()->factory( ptr->library().latin1() )) ) + { + mThemeLibName = ptr->library(); + objName = ptr->property("X-KSplash-ObjectName").toString(); + } + } + } + if (factory) + { + TQStringList themeTitle; + themeTitle << theme; + return static_cast<ThemeEngine *>(TQT_TQWIDGET(factory->create(TQT_TQOBJECT(this), "theme", objName.latin1(), themeTitle))); + } + else + return 0L; +} + +void KSplash::slotSetText( const TQString& s ) +{ + if( mThemeEngine ) + mThemeEngine->slotSetText( s ); +} + +void KSplash::slotSetTextIndex( const int i ) +{ + if( mThemeEngine ) + mThemeEngine->slotSetTextIndex( i ); +} + +void KSplash::slotSetPixmap( const TQString& px ) +{ + if( mThemeEngine ) + mThemeEngine->slotSetPixmap( px ); +} + +void KSplash::slotUpdateSteps( int ) +{ +// ?? +} + +void KSplash::slotUpdateProgress( int ) +{ +// ?? +} + +TQPtrList<Action> KSplash::actionList() +{ + return mActionList; +} + +bool KSplash::eventFilter( TQObject *o, TQEvent *e ) +{ + if ( ( e->type() == TQEvent::MouseButtonRelease ) && ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(mThemeEngine) ) ) + { + TQTimer::singleShot( 0, this, TQT_SLOT(close())); + return TRUE; + } + else + return FALSE; +} diff --git a/ksplashml/wndmain.h b/ksplashml/wndmain.h new file mode 100644 index 000000000..563598c64 --- /dev/null +++ b/ksplashml/wndmain.h @@ -0,0 +1,121 @@ +/*************************************************************************** + * 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 __WNDMAIN_H__ +#define __WNDMAIN_H__ + +#include <tdeapplication.h> + +#include <tqptrlist.h> +#include <tqstring.h> +#include <tqobject.h> + +#include "ksplashiface.h" + +// MAKE SURE THAT THIS MATCHES WHAT'S IN ../kcmksplash/kcmksplash.h!!! +#define N_ACTIONITEMS 8 + +// Action: This represents an "action entry" to any object which is interested +// in knowing this. +typedef struct +{ + TQString ItemPixmap; + TQString ItemText; +} Action; + +class WndStatus; +class ObjKsTheme; +class ThemeEngine; +class TDEConfig; + +class KSplash: public TQWidget, virtual public KSplashIface +{ + Q_OBJECT + + +public: + KSplash(const char *name = "ksplash"); + ~KSplash(); + + TQPtrList<Action> actionList(); + + // DCOP interface + ASYNC upAndRunning( TQString ); + ASYNC setMaxProgress(int); + ASYNC setProgress(int); + ASYNC setStartupItemCount( int count ); + ASYNC programStarted( TQString programIcon, TQString programName, TQString description ); + ASYNC startupComplete(); + ASYNC show(); + ASYNC hide(); + + // [FIXME] How can I more easily let Qt know about these slots? moc-tqt perhaps? + // More importantly, how was this code even running under Qt3? + // Was it somehow running the TQWidget::close() slot instead of the KSplash::close() non-slot method? + // Either way it looks like accidental/undefined behaviour to me... +#ifndef Q_MOC_RUN + ASYNC close(); +#else // Q_MOC_RUN +public slots: + void close(); +#endif // Q_MOC_RUN + +signals: + void stepsChanged(int); + void progressChanged(int); + void actionListChanged(); + +protected: + bool eventFilter( TQObject *o, TQEvent *e ); + +public slots: + void slotUpdateSteps( int ); + void slotUpdateProgress( int ); + +private slots: + void initDcop(); + void prepareIconList(); + void prepareSplashScreen(); + void slotExec(); + void nextIcon(); + void slotInsertAction( const TQString&, const TQString& ); + void slotReadProperties( TDEConfig * ); + + void slotSetText( const TQString& ); + void slotSetTextIndex( const int ); + void slotSetPixmap( const TQString& ); + + void loadTheme( const TQString& ); + +private: + ThemeEngine *_loadThemeEngine( const TQString& pluginName, const TQString& theme ); + void updateState( unsigned int state ); + +protected: + unsigned int mState; + unsigned int mMaxProgress; + unsigned int mStep; // ?? + TQTimer* close_timer; + + bool mSessMgrCalled; + bool mTimeToGo; + + TQString mTheme; + ObjKsTheme *mKsTheme; + + ThemeEngine *mThemeEngine; + TQPtrList<Action> mActionList; + Action *mCurrentAction, *mPreviousAction; + + TQString mThemeLibName; +}; + +#endif |