From e861c6188bc38088422b32b505daff627915d53b Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 25 Mar 2014 13:27:22 +0900 Subject: Fixed KSplash icon flashing position problem for 'default' theme engine. Removed nasty hardcoded hack and added 'Icon Offsets' option to Theme.rc file. --- ksplashml/pics/themes/TDE-Classic/Theme.rc | 3 +++ ksplashml/pics/themes/default/Theme.rc | 8 ++---- ksplashml/themeengine/default/themelegacy.cpp | 35 +++++++++++++++++---------- ksplashml/themeengine/default/themelegacy.h | 6 ++++- 4 files changed, 32 insertions(+), 20 deletions(-) (limited to 'ksplashml') diff --git a/ksplashml/pics/themes/TDE-Classic/Theme.rc b/ksplashml/pics/themes/TDE-Classic/Theme.rc index f18415a0c..a03e5d2fb 100644 --- a/ksplashml/pics/themes/TDE-Classic/Theme.rc +++ b/ksplashml/pics/themes/TDE-Classic/Theme.rc @@ -17,3 +17,6 @@ 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/default/Theme.rc b/ksplashml/pics/themes/default/Theme.rc index 723b77571..00896eb33 100644 --- a/ksplashml/pics/themes/default/Theme.rc +++ b/ksplashml/pics/themes/default/Theme.rc @@ -15,9 +15,5 @@ Engine = Default # Should icons blink ala TDE, 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 TDE... -#Message1[es] = Por favor escuchar, estarto TDE... -#Message2 = Loading ... +# 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/themeengine/default/themelegacy.cpp b/ksplashml/themeengine/default/themelegacy.cpp index 7cebc5a33..0e1242120 100644 --- a/ksplashml/themeengine/default/themelegacy.cpp +++ b/ksplashml/themeengine/default/themelegacy.cpp @@ -25,12 +25,15 @@ #include #include #include +#include #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 ) { @@ -59,6 +62,8 @@ ThemeDefault::ThemeDefault( TQWidget *parent, const char *name, const TQStringLi mActivePixmap = mInactivePixmap = 0L; mState = 0; + for (int i=0; ithemeConfig(); - if( !cfg ) + if (!cfg) return; cfg->setGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) ); @@ -209,6 +214,14 @@ void ThemeDefault::_readSettings() mIconsFlashing = cfg->readBoolEntry( "Icons Flashing", true ); TQColor df(Qt::white); mLabelForeground = cfg->readColorEntry( "Label Foreground", &df ); + TQValueList io_list=cfg->readIntListEntry("Icon Offsets"); + if (io_list.size() == MAX_ICONS) + { + TQValueList::iterator io_it; + int i=0; + for (io_it = io_list.begin(); io_it != io_list.end(); ++io_it, ++i) + mIconOffsets[i]=*io_it; + } } /* @@ -219,8 +232,8 @@ void ThemeDefault::_readSettings() */ void ThemeDefault::slotUpdateState() { - if( mState > 8 ) - mState = 8; + if (mState >= MAX_STATES) + mState = MAX_STATES-1; if( mIconsFlashing ) { @@ -230,7 +243,7 @@ void ThemeDefault::slotUpdateState() mBarLabel->setPixmap(*mFlashPixmap2); mFlashTimer->stop(); - if( mState < 8 ) + if( mState < MAX_STATES ) mFlashTimer->start(400); } else @@ -252,8 +265,6 @@ TQPixmap ThemeDefault::updateBarPixmap( int state ) TQPixmap x; if( !mActivePixmap ) return( x ); #if BIDI - - if( TQApplication::reverseLayout() ) { if ( state > 7 ) @@ -261,12 +272,10 @@ TQPixmap ThemeDefault::updateBarPixmap( int state ) } #endif - offs = state * 58; - if (state == 3) - offs += 8; - else if (state == 6) - offs -= 8; - + offs = state*58; + if (state>=0 && state #include "themeengine.h" + +static const int MAX_ICONS=7; + class TQPixmap; class TQTimer; @@ -88,8 +91,9 @@ private: TQString _findPicture( const TQString &pic ); // Configurable Options - bool mIconsFlashing; + bool mIconsFlashing; TQColor mLabelForeground; + int mIconOffsets[MAX_ICONS]; // Internals. KProgress *mProgressBar; -- cgit v1.2.1