From a382b3ab3160bc265983c538cb235eb51b87a4c5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 14 Sep 2011 20:11:45 +0000 Subject: [PATCH] Add new "Unified" splash screen git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1253671 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksmserver/startup.cpp | 2 +- ksplashml/pics/themes/CMakeLists.txt | 1 + ksplashml/pics/themes/unified/CMakeLists.txt | 14 +++ ksplashml/pics/themes/unified/Theme.rc | 16 +++ ksplashml/themeengine/CMakeLists.txt | 1 + ksplashml/themeengine/themeengine.h | 1 + ksplashml/themeengine/unified/CMakeLists.txt | 45 +++++++ ksplashml/themeengine/unified/Makefile.am | 17 +++ .../unified/ksplashunified.desktop | 78 ++++++++++++ ksplashml/themeengine/unified/main.cpp | 17 +++ .../themeengine/unified/themeunified.cpp | 118 ++++++++++++++++++ ksplashml/themeengine/unified/themeunified.h | 101 +++++++++++++++ ksplashml/wndmain.cpp | 8 ++ ksplashml/wndmain.h | 1 + 14 files changed, 419 insertions(+), 1 deletion(-) create mode 100644 ksplashml/pics/themes/unified/CMakeLists.txt create mode 100644 ksplashml/pics/themes/unified/Theme.rc create mode 100644 ksplashml/themeengine/unified/CMakeLists.txt create mode 100644 ksplashml/themeengine/unified/Makefile.am create mode 100644 ksplashml/themeengine/unified/ksplashunified.desktop create mode 100644 ksplashml/themeengine/unified/main.cpp create mode 100644 ksplashml/themeengine/unified/themeunified.cpp create mode 100644 ksplashml/themeengine/unified/themeunified.h diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp index 4527aadaf..00cf57714 100644 --- a/ksmserver/startup.cpp +++ b/ksmserver/startup.cpp @@ -98,7 +98,7 @@ void KSMServer::restoreSession( TQString sessionName ) showFancyLogin = KConfigGroup(KGlobal::config(), "Login").readBoolEntry("showFancyLogin", true); KConfig ksplashcfg( "ksplashrc", true ); ksplashcfg.setGroup( "KSplash" ); - if ( ksplashcfg.readEntry( "Theme", "Default" ) != TQString("None") ) + if ( ksplashcfg.readEntry( "Theme", "Default" ) != TQString("Unified") ) showFancyLogin = false; if( state != Idle ) diff --git a/ksplashml/pics/themes/CMakeLists.txt b/ksplashml/pics/themes/CMakeLists.txt index 3cd91738d..92ecf4aa0 100644 --- a/ksplashml/pics/themes/CMakeLists.txt +++ b/ksplashml/pics/themes/CMakeLists.txt @@ -11,5 +11,6 @@ add_subdirectory( blue-bend ) add_subdirectory( default ) +add_subdirectory( unified ) add_subdirectory( none ) add_subdirectory( simple ) 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/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 + +# 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 index 0d4192299..ad8d5821b 100644 --- a/ksplashml/themeengine/CMakeLists.txt +++ b/ksplashml/themeengine/CMakeLists.txt @@ -10,6 +10,7 @@ ################################################# add_subdirectory( default ) +add_subdirectory( unified ) add_subdirectory( standard ) add_subdirectory( redmond ) add_subdirectory( simple ) diff --git a/ksplashml/themeengine/themeengine.h b/ksplashml/themeengine/themeengine.h index c9fdd3528..0ffb0f72b 100644 --- a/ksplashml/themeengine/themeengine.h +++ b/ksplashml/themeengine/themeengine.h @@ -62,6 +62,7 @@ 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: 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..e3f522751 --- /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) +libthemedefault_la_LIBADD = $(LIB_KDEUI) ../libksplashthemes.la + +kde_module_LTLIBRARIES = ksplashdefault.la + +ksplashdefault_la_SOURCES = main.cpp +ksplashdefault_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(KDE_PLUGIN) -module +ksplashdefault_la_LIBADD = $(LIB_KDEUI) ../libksplashthemes.la libthemedefault.la +METASOURCES = AUTO + +servicesdir = $(kde_servicesdir) +services_DATA = ksplashdefault.desktop diff --git a/ksplashml/themeengine/unified/ksplashunified.desktop b/ksplashml/themeengine/unified/ksplashunified.desktop new file mode 100644 index 000000000..408daab5f --- /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 KDE +Comment[wa]=Tchôke-divins KSplash (waitroûle d' enondaedje) +Comment[zh_CN]=KSplash 插件 +Comment[zh_TW]=KSplash 外掛程式 +Name=KSplashUnified +ServiceTypes=KSplash/Plugin +X-KDE-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 * + * Copyright Ravikiran Rajagopal 2003 * + * ravi@ee.eng.ohio-state.edu * + * * + * 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 + +#include "themeunified.h" + +K_EXPORT_COMPONENT_FACTORY( ksplashunified, KGenericFactory( "ksplash" ) ) diff --git a/ksplashml/themeengine/unified/themeunified.cpp b/ksplashml/themeengine/unified/themeunified.cpp new file mode 100644 index 000000000..e552e9909 --- /dev/null +++ b/ksplashml/themeengine/unified/themeunified.cpp @@ -0,0 +1,118 @@ +/*************************************************************************** + * Copyright Brian Ledbetter 2001-2003 * + * Copyright Ravikiran Rajagopal 2003 * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License (version 2) as * + * published by the Free Software Foundation. (The original KSplash/ML * + * codebase (upto version 0.95.3) is BSD-licensed.) * + * * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "objkstheme.h" +#include "themeengine.h" +#include "themeunified.h" +#include "themeunified.moc" + +UnifiedConfig::UnifiedConfig( TQWidget *parent, KConfig *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 = tqsizeHint(); + TQRect rect1 = KGlobalSettings::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; + + KConfig *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..a8f9e12e2 --- /dev/null +++ b/ksplashml/themeengine/unified/themeunified.h @@ -0,0 +1,101 @@ +/*************************************************************************** + * Copyright Brian Ledbetter 2001-2003 * + * Copyright Ravikiran Rajagopal 2003 * + * ravi@ee.eng.ohio-state.edu * + * * + * 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 + +#include +#include + +#include + +#include "themeengine.h" +class TQPixmap; +class TQTimer; + +class TQCheckBox; + +class UnifiedConfig: public ThemeEngineConfig +{ + Q_OBJECT +public: + UnifiedConfig( TQWidget *, KConfig * ); + 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, KConfig *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 index c037438ab..5287df4cd 100644 --- a/ksplashml/wndmain.cpp +++ b/ksplashml/wndmain.cpp @@ -110,6 +110,7 @@ void KSplash::prepareIconList() mCurrentAction = mActionList.first(); slotSetText( mCurrentAction->ItemText ); + slotSetTextIndex( mActionList.find(mCurrentAction) ); slotSetPixmap( mCurrentAction->ItemPixmap ); emit progressChanged( mStep ); @@ -148,6 +149,7 @@ void KSplash::nextIcon() if( mCurrentAction ) { slotSetText( mCurrentAction->ItemText ); + slotSetTextIndex( mActionList.find(mCurrentAction) ); slotSetPixmap( mCurrentAction->ItemPixmap ); emit progressChanged( ++mStep ); } @@ -396,6 +398,12 @@ void KSplash::slotSetText( const TQString& s ) mThemeEngine->slotSetText( s ); } +void KSplash::slotSetTextIndex( const int i ) +{ + if( mThemeEngine ) + mThemeEngine->slotSetTextIndex( i ); +} + void KSplash::slotSetPixmap( const TQString& px ) { if( mThemeEngine ) diff --git a/ksplashml/wndmain.h b/ksplashml/wndmain.h index 40457ad0d..ea596cd91 100644 --- a/ksplashml/wndmain.h +++ b/ksplashml/wndmain.h @@ -90,6 +90,7 @@ private slots: void slotReadProperties( KConfig * ); void slotSetText( const TQString& ); + void slotSetTextIndex( const int ); void slotSetPixmap( const TQString& ); void loadTheme( const TQString& );