Branch: master

e861c618 2014-03-24 23:27:22 Michele Calgaro
Fixed KSplash icon flashing position problem for 'default' theme engine.
Removed nasty hardcoded hack and added 'Icon Offsets' option to Theme.rc file.
M doc/ksplashml/index.docbook
M ksplashml/pics/themes/TDE-Classic/Theme.rc
M ksplashml/pics/themes/default/Theme.rc
M ksplashml/themeengine/default/themelegacy.cpp
M ksplashml/themeengine/default/themelegacy.h
diff --git a/doc/ksplashml/index.docbook b/doc/ksplashml/index.docbook
index bdd73ce..f92e36a 100644
--- a/doc/ksplashml/index.docbook
+++ b/doc/ksplashml/index.docbook
@@ -238,6 +238,16 @@
 <entry>[true/false]</entry>
 <entry>Indicates whether icons should <quote>flash</quote>. Default is true.</entry>
 </row>
+<row>
+<entry>Icon Offsets</entry>
+<entry>[7-int list]</entry>
+<entry>A comma separated list of 7 integers, default is 0, 0, 0, 0, 0, 0, 0. 
+By default, each of the 7 icons is allowed 58 pixels on the screen. If some icons are
+wider or narrower, you can use this list to specify an offset to the default x-coordinate
+start point of each icon (0, 58, 116, 174, 232, 290, 348). For example, if the first 3 icons
+are 68, 53 and 53 pixels wide, you will need to specify the offsets as follow: 0, 10, 5, 0, 0, 0, 0.
+</entry>
+</row>
 </tbody>
 </tgroup>
 </table>
diff --git a/ksplashml/pics/themes/TDE-Classic/Theme.rc b/ksplashml/pics/themes/TDE-Classic/Theme.rc
index f18415a..a03e5d2 100644
--- a/ksplashml/pics/themes/TDE-Classic/Theme.rc
+++ b/ksplashml/pics/themes/TDE-Classic/Theme.rc
@@ -17,3 +17,6 @@
 
 # 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 723b775..00896eb 100644
--- a/ksplashml/pics/themes/default/Theme.rc
+++ b/ksplashml/pics/themes/default/Theme.rc
@@ -15,9 +15,5 @@
 # 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 7cebc5a..0e12421 100644
--- a/ksplashml/themeengine/default/themelegacy.cpp
+++ b/ksplashml/themeengine/default/themelegacy.cpp
@@ -25,11 +25,14 @@
 #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 )
@@ -59,6 +62,8 @@
 
   mActivePixmap = mInactivePixmap = 0L;
   mState = 0;
+  for (int i=0; i<MAX_ICONS; ++i)
+    mIconOffsets[i]=0;
 
   _readSettings();
   _initUi();
@@ -197,11 +202,11 @@
 // Attempt to find overrides elsewhere?
 void ThemeDefault::_readSettings()
 {
-  if( !mTheme )
+  if (!mTheme)
     return;
 
   TDEConfig *cfg = mTheme->themeConfig();
-  if( !cfg )
+  if (!cfg)
     return;
 
   cfg->setGroup( TQString("KSplash Theme: %1").arg(mTheme->theme()) );
@@ -209,6 +214,14 @@
   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;
+  }
 }
 
 /*
@@ -219,8 +232,8 @@
  */
 void ThemeDefault::slotUpdateState()
 {
-  if( mState > 8 )
-    mState = 8;
+  if (mState >= MAX_STATES)
+    mState = MAX_STATES-1;
 
   if( mIconsFlashing )
   {
@@ -230,7 +243,7 @@
     mBarLabel->setPixmap(*mFlashPixmap2);
     mFlashTimer->stop();
 
-    if( mState < 8 )
+    if( mState < MAX_STATES )
       mFlashTimer->start(400);
   }
   else
@@ -252,8 +265,6 @@
   TQPixmap x;
   if( !mActivePixmap ) return( x );
 #if BIDI
-
-
   if( TQApplication::reverseLayout() )
     {
       if ( state > 7 ) 
@@ -261,12 +272,10 @@
     }
 #endif
 
-  offs = state * 58;
-  if (state == 3)
-    offs += 8;
-  else if (state == 6)
-    offs -= 8;
-
+  offs = state*58;
+  if (state>=0 && state<MAX_ICONS)
+    offs += mIconOffsets[state];
+  
   TQPixmap tmp(*mActivePixmap);
   TQPainter p(&tmp);
 #if BIDI
diff --git a/ksplashml/themeengine/default/themelegacy.h b/ksplashml/themeengine/default/themelegacy.h
index 0f73e80..1f56d05 100644
--- a/ksplashml/themeengine/default/themelegacy.h
+++ b/ksplashml/themeengine/default/themelegacy.h
@@ -19,6 +19,9 @@
 #include <tqwidget.h>
 
 #include "themeengine.h"
+
+static const int MAX_ICONS=7;
+
 class TQPixmap;
 class TQTimer;
 
@@ -88,8 +91,9 @@
   TQString _findPicture( const TQString &pic );
 
   // Configurable Options
-  bool mIconsFlashing;
+  bool    mIconsFlashing;
   TQColor mLabelForeground;
+  int     mIconOffsets[MAX_ICONS];
 
   // Internals.
   KProgress *mProgressBar;
278d7577 2014-03-24 23:28:54 Alex Couture
Updated images for KSplash default theme. These resolves bug 2013.
M ksplashml/pics/themes/default/Preview.png
M ksplashml/pics/themes/default/splash_active_bar.png
M ksplashml/pics/themes/default/splash_inactive_bar.png
M ksplashml/pics/themes/default/splash_top.png
diff --git a/ksplashml/pics/themes/default/Preview.png b/ksplashml/pics/themes/default/Preview.png
index eebaa96..25eae17 100644
--- a/ksplashml/pics/themes/default/Preview.png
+++ b/ksplashml/pics/themes/default/Preview.png
Binary files differ
diff --git a/ksplashml/pics/themes/default/splash_active_bar.png b/ksplashml/pics/themes/default/splash_active_bar.png
index edbb751..10bef1e 100644
--- a/ksplashml/pics/themes/default/splash_active_bar.png
+++ b/ksplashml/pics/themes/default/splash_active_bar.png
Binary files differ
diff --git a/ksplashml/pics/themes/default/splash_inactive_bar.png b/ksplashml/pics/themes/default/splash_inactive_bar.png
index 75fe4f3..e1690ee 100644
--- a/ksplashml/pics/themes/default/splash_inactive_bar.png
+++ b/ksplashml/pics/themes/default/splash_inactive_bar.png
Binary files differ
diff --git a/ksplashml/pics/themes/default/splash_top.png b/ksplashml/pics/themes/default/splash_top.png
index c6486e8..d7c0c12 100644
--- a/ksplashml/pics/themes/default/splash_top.png
+++ b/ksplashml/pics/themes/default/splash_top.png
Binary files differ