[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kcontrol/style
From:       Karol Szwed <gallium () kde ! org>
Date:       2003-06-15 13:00:43
[Download RAW message or body]

CVS commit by gallium: 

Remove 0.5s delay when switching styles by popular request.
If there are any outstanding issues, let me know.


  M +14 -2     kcmstyle.cpp   1.53
  M +3 -4      kcmstyle.h   1.11


--- kdebase/kcontrol/style/kcmstyle.cpp  #1.52:1.53
@@ -166,4 +166,14 @@ KCMStyle::KCMStyle( QWidget* parent, con
         m_bToolbarsDirty = false;
 
+        // Obtain the keyboard repeat rate and delay.
+        // This enables us to use a QTimer that only switches the style preview
+        // after a user releases the up/down arrow keys. This helps prevent
+        // repetitive (and slow) style changing whilst cycling through the style
+        // list with a keyboard.
+        KConfig config("kcminputrc");
+        config.setGroup("Keyboard");
+        styleChangeDelay =  config.readNumEntry("RepeatRate", 30);
+        styleChangeDelay += config.readNumEntry("RepeatDelay", 250);
+
         KGlobal::dirs()->addResourceType("themes",
                 KStandardDirs::kde_default("data") + "kstyle/themes");
@@ -190,4 +200,5 @@ KCMStyle::KCMStyle( QWidget* parent, con
 
         // Connect all required stuff
+        connect(lvStyle, SIGNAL(clicked(QListViewItem*)), this, \
                SLOT(styleChanged()));
         connect(lvStyle, SIGNAL(currentChanged(QListViewItem*)), this, \
                SLOT(updateStyleTimer(QListViewItem*)));
         connect(&switchStyleTimer, SIGNAL(timeout()), this, SLOT(styleChanged()));
@@ -741,5 +752,5 @@ void KCMStyle::updateStyleTimer( QListVi
 {
         currentStyle = item->text(2);
-        switchStyleTimer.start(500, TRUE);
+        switchStyleTimer.start(styleChangeDelay, TRUE);
 }
 
@@ -747,4 +758,5 @@ void KCMStyle::updateStyleTimer( QListVi
 void KCMStyle::styleChanged()
 {
+        switchStyleTimer.stop();
         switchStyle( currentStyle );
 }

--- kdebase/kcontrol/style/kcmstyle.h  #1.10:1.11
@@ -91,7 +91,6 @@ protected slots:
 
 private:
-        bool m_bMacDirty, m_bEffectsDirty, m_bStyleDirty,
-//               m_bGeneralDirty, 
-                 m_bToolbarsDirty;
+        bool m_bMacDirty, m_bEffectsDirty, m_bStyleDirty, m_bToolbarsDirty;
+        int styleChangeDelay; 
 
         QVBoxLayout* mainLayout;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic