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

List:       kde-core-devel
Subject:    [PATCH] Animations enable/disable system wide [TAKE 2]
From:       Rafael =?utf-8?q?Fern=C3=A1ndez_L=C3=B3pez?= <ereslibre () kde ! org>
Date:       2008-02-20 3:02:56
Message-ID: 200802200403.00677.ereslibre () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi all,

The patch is almost finished. I would like to know what do you think about it, 
and more in particular with the KCM. I really don't know where to place this 
combo box. Right now is in a very, very bad place, probably the worst place 
in earth.

So, where do you think this combo should go on the KCM ?

For those which aren't going to test the patches, the KCM look is: 
http://media.ereslibre.es/2008/02/stylekcm.png

What do you think about the rest of the patch ?

Let's say, I will commit next Monday (25) if no objections are presented. Note 
that the KCM is excluded from this. The KCM will be improved till that day, 
I'm talking about the rest of the patch.


Bye, 
Rafael Fernández López

GPG Fingerprint: B9F4 4730 43F8 FFDD CC5E BA8E 724E 406E 3F01 D070

["kdelibs.diff" (text/x-diff)]

Index: kio/kio/kfileitemdelegate.cpp
===================================================================
--- kio/kio/kfileitemdelegate.cpp	(revisión: 777211)
+++ kio/kio/kfileitemdelegate.cpp	(copia de trabajo)
@@ -22,7 +22,6 @@
 #include <config.h>
 
 #include "kfileitemdelegate.h"
-#include "kfileitemdelegate.moc"
 
 #include <QApplication>
 #include <QStyle>
@@ -42,6 +41,7 @@
 #include <kdirmodel.h>
 #include <kfileitem.h>
 #include <kcolorscheme.h>
+#include <kglobalsettings.h>
 
 #include "delegateanimationhandler_p.h"
 
@@ -687,6 +687,10 @@ KIO::AnimationState *KFileItemDelegate::
                                                                 const QModelIndex \
                &index,
                                                                 const \
QAbstractItemView *view) const  {
+    if (!(KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects)) { +        return NULL;
+    }
+
     if (index.column() == KDirModel::Name)
         return animationHandler->animationState(option, index, view);
 
@@ -1335,4 +1339,7 @@ bool KFileItemDelegate::helpEvent(QHelpE
 }
 
 
+#include "kfileitemdelegate.moc"
+
+
 // kate: space-indent on; indent-width 4; replace-tabs on;
Index: kio/kfile/kimagefilepreview.cpp
===================================================================
--- kio/kfile/kimagefilepreview.cpp	(revisión: 777211)
+++ kio/kfile/kimagefilepreview.cpp	(copia de trabajo)
@@ -2,6 +2,7 @@
  * This file is part of the KDE project
  * Copyright (C) 2001 Martin R. Jones <mjones@kde.org>
  *               2001 Carsten Pfeiffer <pfeiffer@kde.org>
+ *               2008 Rafael Fernández López <ereslibre@kde.org>
  *
  * You can Freely distribute this program under the GNU Library General Public
  * License. See the file "COPYING" for the exact licensing terms.
@@ -19,6 +20,7 @@
 #include <QtCore/QTimeLine>
 
 #include <kapplication.h>
+#include <kglobalsettings.h>
 #include <kconfig.h>
 #include <kglobal.h>
 #include <kiconloader.h>
@@ -176,6 +178,7 @@ KIO::PreviewJob * KImageFilePreview::cre
 void KImageFilePreview::gotPreview( const KFileItem& item, const QPixmap& pm )
 {
     if (item.url() == d->currentURL) {  // should always be the case
+        if (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) {  if (d->m_timeLine->state() == \
QTimeLine::Running) {  d->m_timeLine->setCurrentTime(0);
         }
@@ -186,6 +189,11 @@ void KImageFilePreview::gotPreview( cons
         d->m_timeLine->setDirection(QTimeLine::Forward);
         d->m_timeLine->start();
     }
+        else
+        {
+            d->imageLabel->setPixmap(pm);
+        }
+    }
 }
 
 void KImageFilePreview::KImageFilePreviewPrivate::_k_slotFailed( const KFileItem& \
item ) @@ -250,12 +258,18 @@ void KImageFilePreview::clearPreview()
         return;
     }
 
+    if (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) {  d->m_pmTransition = QPixmap();
     d->m_timeLine->setCurrentTime(0);
     d->m_timeLine->setDirection(QTimeLine::Backward);
     d->m_timeLine->start();
     d->currentURL = KUrl();
     d->clear = true;
+    }
+    else
+    {
+        d->imageLabel->clear();
+    }
 }
 
 #include "kimagefilepreview.moc"
Index: kio/kfile/kimagefilepreview.h
===================================================================
--- kio/kfile/kimagefilepreview.h	(revisión: 777211)
+++ kio/kfile/kimagefilepreview.h	(copia de trabajo)
@@ -3,6 +3,7 @@
  * This file is part of the KDE project.
  * Copyright (C) 2001 Martin R. Jones <mjones@kde.org>
  *               2001 Carsten Pfeiffer <pfeiffer@kde.org>
+ *               2008 Rafael Fernández López <ereslibre@kde.org>
  *
  * You can Freely distribute this program under the GNU Library General Public
  * License. See the file "COPYING" for the exact licensing terms.
Index: kdeui/kernel/kglobalsettings.h
===================================================================
--- kdeui/kernel/kglobalsettings.h	(revisión: 777211)
+++ kdeui/kernel/kglobalsettings.h	(copia de trabajo)
@@ -407,6 +407,33 @@ public:
      */
     static bool showIconsOnPushButtons();
 
+    enum GraphicEffect {
+        NoEffects               = 0x0000, ///< GUI with no effects at all.
+        GradientEffects         = 0x0001, ///< GUI with only gradients enabled.
+        SimpleAnimationEffects  = 0x0002, ///< GUI with simple animations enabled.
+        ComplexAnimationEffects = 0x0006  ///< GUI with complex animations enabled.
+                                          ///< Note that ComplexAnimationsEffects \
implies SimpleAnimationEffects. +    };
+
+    Q_DECLARE_FLAGS(GraphicEffects, GraphicEffect)
+
+    /**
+     * This function determines the desired level of effects on the GUI.
+     *
+     * @return Returns true if user wants builtin animations to be enabled.
+     *
+     * @since 4.1
+     */
+    static GraphicEffects graphicEffectsLevel();
+
+    /**
+     * This function determines the default level of effects on the GUI
+     * depending on the system capabilities.
+     *
+     * @since 4.1
+     */
+    static GraphicEffects graphicEffectsLevelDefault();
+
     /**
      * This function determines if the user wishes to see previews
      * for the selected url
@@ -550,4 +577,6 @@ private:
     Q_PRIVATE_SLOT(d, void _k_slotNotifyChange(int, int))
 };
 
+Q_DECLARE_OPERATORS_FOR_FLAGS(KGlobalSettings::GraphicEffects)
+
 #endif
Index: kdeui/kernel/kglobalsettings.cpp
===================================================================
--- kdeui/kernel/kglobalsettings.cpp	(revisión: 777211)
+++ kdeui/kernel/kglobalsettings.cpp	(copia de trabajo)
@@ -86,6 +86,7 @@ static QFont *_taskbarFont = 0;
 static QFont *_largeFont = 0;
 static QFont *_smallestReadableFont = 0;
 //static QColor *_buttonBackground = 0;
+static KGlobalSettings::GraphicEffects _grafficEffects = KGlobalSettings::NoEffects;
 
 static KGlobalSettings::KMouseSettings *s_mouseSettings = 0;
 
@@ -126,17 +127,21 @@ class KGlobalSettings::Private
          */
         static void initPaths();
         /**
-         * drop cached values for fonts (called by KApplication)
+         * drop cached values for fonts
          */
         static void rereadFontSettings();
         /**
-         * drop cached values for paths (called by KApplication)
+         * drop cached values for paths
          */
         static void rereadPathSettings();
         /**
-         * drop cached values for mouse settings (called by KApplication)
+         * drop cached values for mouse settings
          */
         static void rereadMouseSettings();
+        /**
+         * drop cached values for settings that aren't in any of the previous groups
+         */
+        static void rereadOtherSettings();
 
         KGlobalSettings *q;
 };
@@ -736,6 +741,29 @@ bool KGlobalSettings::showIconsOnPushBut
                        KDE_DEFAULT_ICON_ON_PUSHBUTTON);
 }
 
+KGlobalSettings::GraphicEffects KGlobalSettings::graphicEffectsLevel()
+{
+    // This variable stores whether _grafficEffects has the default value because it \
has not been +    // loaded yet, or if it has been loaded from the user settings or \
defaults and contains a valid +    // value.
+    static bool _grafficEffectsInitialized = false;
+
+    if (!_grafficEffectsInitialized) {
+        _grafficEffectsInitialized = true;
+        Private::rereadOtherSettings();
+    }
+
+    return _grafficEffects;
+}
+
+KGlobalSettings::GraphicEffects KGlobalSettings::graphicEffectsLevelDefault()
+{
+    // For now, let always enable animations by default. The plan is to make
+    // this code a bit smarter. (ereslibre)
+
+    return ComplexAnimationEffects;
+}
+
 bool KGlobalSettings::showFilePreview(const KUrl &url)
 {
     KConfigGroup g(KGlobal::config(), "PreviewSettings");
@@ -792,6 +820,7 @@ void KGlobalSettings::Private::_k_slotNo
 
     case SettingsChanged: {
         KGlobal::config()->reparseConfiguration();
+        rereadOtherSettings();
         SettingsCategory category = static_cast<SettingsCategory>(arg);
         if (category == SETTINGS_PATHS) {
             KGlobalSettings::Private::rereadPathSettings();
@@ -988,6 +1017,23 @@ void KGlobalSettings::Private::kdisplayS
 }
 
 
+void KGlobalSettings::Private::rereadOtherSettings()
+{
+    KConfigGroup g( KGlobal::config(), "KDE-Global GUI Settings" );
+
+    // Asking for hasKey we do not ask for graphicEffectsLevelDefault() that can
+    // contain some very slow code. If we can save that time, do it. (ereslibre)
+
+    if (g.hasKey("GrafficEffectsLevel")) {
+        _grafficEffects = ((GraphicEffects) g.readEntry("GrafficEffectsLevel", \
QVariant((int) NoEffects)).toInt()); +
+        return;
+    }
+
+    _grafficEffects = KGlobalSettings::graphicEffectsLevelDefault();
+}
+
+
 void KGlobalSettings::Private::applyCursorTheme()
 {
 #if defined(Q_WS_X11) && defined(HAVE_XCURSOR)
Index: kdeui/widgets/kfadewidgeteffect.cpp
===================================================================
--- kdeui/widgets/kfadewidgeteffect.cpp	(revisión: 777211)
+++ kdeui/widgets/kfadewidgeteffect.cpp	(copia de trabajo)
@@ -22,6 +22,7 @@
 #include "kfadewidgeteffect_p.h"
 #include <QtCore/QEvent>
 #include <QtGui/QPainter>
+#include <kglobalsettings.h>
 
 KFadeWidgetEffectPrivate::KFadeWidgetEffectPrivate(QWidget *_destWidget)
     : destWidget(_destWidget)
@@ -29,9 +30,10 @@ KFadeWidgetEffectPrivate::KFadeWidgetEff
 }
 
 KFadeWidgetEffect::KFadeWidgetEffect(QWidget *destWidget)
-    : QWidget(destWidget && destWidget->parentWidget() ? destWidget->parentWidget() \
: destWidget) +    : QWidget(destWidget)
     , d_ptr(new KFadeWidgetEffectPrivate(destWidget))
 {
+    if (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) {  Q_D(KFadeWidgetEffect);
     d->q_ptr = this;
     Q_ASSERT(destWidget && destWidget->parentWidget());
@@ -41,6 +43,9 @@ KFadeWidgetEffect::KFadeWidgetEffect(QWi
     connect(&d->timeLine, SIGNAL(finished()), SLOT(finished()));
     connect(&d->timeLine, SIGNAL(frameChanged(int)), SLOT(repaint()));
     show();
+    } else {
+        deleteLater();
+    }
 }
 
 KFadeWidgetEffect::~KFadeWidgetEffect()
Index: kdeui/widgets/klineedit.cpp
===================================================================
--- kdeui/widgets/klineedit.cpp	(revisión: 777211)
+++ kdeui/widgets/klineedit.cpp	(copia de trabajo)
@@ -89,6 +89,15 @@ public:
 //        delete completionBox;
     }
 
+    void _k_slotSettingsChanged(int category)
+    {
+        Q_UNUSED(category);
+
+        if (clearButton) {
+            clearButton->setAnimationsEnabled(KGlobalSettings::graphicEffectsLevel() \
& KGlobalSettings::SimpleAnimationEffects); +        }
+    }
+
     static bool initialized;
     static bool backspacePerformsCompletion; // Configuration option
 
@@ -186,6 +195,8 @@ void KLineEdit::init()
                       mode == KGlobalSettings::CompletionAuto);
     connect( this, SIGNAL(selectionChanged()), this, \
SLOT(slotRestoreSelectionColors()));  
+    connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)), this, \
SLOT(_k_slotSettingsChanged(int))); +
     QPalette p = palette();
     if ( !d->previousHighlightedTextColor.isValid() )
       d->previousHighlightedTextColor=p.color(QPalette::Normal,QPalette::HighlightedText);
                
Index: kdeui/widgets/kmainwindow_p.h
===================================================================
--- kdeui/widgets/kmainwindow_p.h	(revisión: 777211)
+++ kdeui/widgets/kmainwindow_p.h	(copia de trabajo)
@@ -52,6 +52,9 @@ public:
     QString dbusName;
 
     void _k_shuttingDown();
+    // This slot will be called when the style KCM changes settings that need
+    // to be set on the already running applications.
+    void _k_slotSettingsChanged(int category);
 
     void init(KMainWindow *_q);
     void polish(KMainWindow *q);
Index: kdeui/widgets/kmainwindow.h
===================================================================
--- kdeui/widgets/kmainwindow.h	(revisión: 777211)
+++ kdeui/widgets/kmainwindow.h	(copia de trabajo)
@@ -701,6 +701,7 @@ protected:
     KMainWindowPrivate * const k_ptr;
 private:
     Q_PRIVATE_SLOT(k_func(), void _k_shuttingDown())
+    Q_PRIVATE_SLOT(k_func(), void _k_slotSettingsChanged(int))
 };
 
 #define RESTORE(type) { int n = 1;\
Index: kdeui/widgets/klineedit.h
===================================================================
--- kdeui/widgets/klineedit.h	(revisión: 777211)
+++ kdeui/widgets/klineedit.h	(copia de trabajo)
@@ -625,6 +625,8 @@ private:
 private:
     class KLineEditPrivate;
     KLineEditPrivate *const d;
+
+    Q_PRIVATE_SLOT( d, void _k_slotSettingsChanged( int category ) );
 };
 
 #endif
Index: kdeui/widgets/kmainwindow.cpp
===================================================================
--- kdeui/widgets/kmainwindow.cpp	(revisión: 777211)
+++ kdeui/widgets/kmainwindow.cpp	(copia de trabajo)
@@ -58,6 +58,7 @@
 #include <ktoolbar.h>
 #include <kwindowsystem.h>
 #include <kconfiggroup.h>
+#include <kglobalsettings.h>
 
 #if defined Q_WS_X11
 #include <qx11info_x11.h>
@@ -219,6 +220,8 @@ void KMainWindowPrivate::init(KMainWindo
 {
     q = _q;
 
+    q->setAnimated(KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects); +
     q->setAttribute( Qt::WA_DeleteOnClose );
 
     KWhatsThisManager::init ();
@@ -227,6 +230,8 @@ void KMainWindowPrivate::init(KMainWindo
 
     //actionCollection()->setWidget( this );
     QObject::connect(qApp, SIGNAL(aboutToQuit()), q, SLOT(_k_shuttingDown()));
+    QObject::connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)),
+                     q, SLOT(_k_slotSettingsChanged(int)));
 
     // force KMWSessionManager creation - someone a better idea?
     ksm->dummyInit();
@@ -1006,6 +1011,19 @@ void KMainWindowPrivate::_k_shuttingDown
     }
 }
 
+void KMainWindowPrivate::_k_slotSettingsChanged(int category)
+{
+    Q_UNUSED(category);
+
+    // This slot will be called when the style KCM changes settings that need
+    // to be set on the already running applications.
+
+    // At this level (KMainWindow) the only thing we need to restore is the
+    // animations setting (whether the user wants builtin animations or not).
+
+    q->setAnimated(KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects); +}
+
 KToolBar *KMainWindow::toolBar( const QString& name )
 {
     QString childName = name;
Index: kdeui/widgets/klineedit_p.h
===================================================================
--- kdeui/widgets/klineedit_p.h	(revisión: 777211)
+++ kdeui/widgets/klineedit_p.h	(copia de trabajo)
@@ -27,6 +27,8 @@
 #include <QPaintEvent>
 #include <QTimeLine>
 
+#include <kglobalsettings.h>
+
 class KLineEditButton : public QWidget
 {
     Q_OBJECT
@@ -67,8 +69,12 @@ public:
             m_timeline->setDuration(250);
         }
 
+        if (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) {  if (m_timeline->state() != \
QTimeLine::Running)  m_timeline->start();
+        } else {
+            setVisible(m_timeline->direction() == QTimeLine::Forward);
+        }
     }
 
     void setPixmap(const QPixmap& p)
@@ -81,11 +87,25 @@ public:
         return m_pixmap;
     }
 
+    void setAnimationsEnabled(bool animationsEnabled)
+    {
+        // We need to set the current time in the case that we had the clear
+        // button shown, for it being painted on the paintEvent(). Otherwise
+        // it wont be painted, resulting (m->timeLine->currentTime() == 0) true,
+        // and therefore a bad painting. This is needed for the case that we
+        // come from a non animated widget and want it animated. (ereslibre)
+        if ((KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) && +            m_timeline->direction() == \
QTimeLine::Forward) { +            m_timeline->setCurrentTime(150);
+        }
+    }
+
 protected:
     void paintEvent(QPaintEvent *event)
     {
         Q_UNUSED(event)
 
+        if (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) {  if (m_pixmap.isNull() || \
m_timeline->currentTime() == 0) {  return;
         }
@@ -95,6 +115,13 @@ protected:
         p.drawPixmap((width() - m_pixmap.width()) / 2,
                      (height() - m_pixmap.height()) / 2,
                      m_pixmap);
+        } else {
+            QPainter p(this);
+            p.setOpacity(1); // make sure
+            p.drawPixmap((width() - m_pixmap.width()) / 2,
+                        (height() - m_pixmap.height()) / 2,
+                        m_pixmap);
+        }
     }
 
 protected slots:


["kdebase.diff" (text/x-diff)]

Index: workspace/kcontrol/style/kcmstyle.h
===================================================================
--- workspace/kcontrol/style/kcmstyle.h	(revisión: 777211)
+++ workspace/kcontrol/style/kcmstyle.h	(copia de trabajo)
@@ -152,6 +152,7 @@ private:
 	QComboBox* comboToolbarIcons;
 
 	QCheckBox* cbIconsOnButtons;
+	QComboBox* comboGraphicEffectsLevel;
 	QCheckBox* cbTearOffHandles;
 };
 
Index: workspace/kcontrol/style/kcmstyle.cpp
===================================================================
--- workspace/kcontrol/style/kcmstyle.cpp	(revisión: 777211)
+++ workspace/kcontrol/style/kcmstyle.cpp	(copia de trabajo)
@@ -210,6 +210,14 @@ KCMStyle::KCMStyle( QWidget* parent, con
 
 	cbIconsOnButtons = new QCheckBox( i18n("Sho&w icons on buttons"), gbWidgetStyle );
 	gbWidgetStyleLayout->addWidget( cbIconsOnButtons );
+	comboGraphicEffectsLevel = new KComboBox( gbWidgetStyle );
+	comboGraphicEffectsLevel->setObjectName( "cbGraphicEffectsLevel" );
+	comboGraphicEffectsLevel->setEditable( false );
+	comboGraphicEffectsLevel->addItem(i18n("No Graphic Effects"), \
KGlobalSettings::NoEffects); +	comboGraphicEffectsLevel->addItem(i18n("Gradient \
Effects"), KGlobalSettings::GradientEffects); \
+	comboGraphicEffectsLevel->addItem(i18n("Simple Animation Effects"), \
KGlobalSettings::SimpleAnimationEffects); \
+	comboGraphicEffectsLevel->addItem(i18n("Complex Animation Effects"), \
KGlobalSettings::ComplexAnimationEffects); +	gbWidgetStyleLayout->addWidget( \
comboGraphicEffectsLevel );  cbEnableTooltips = new QCheckBox( i18n("E&nable \
tooltips"), gbWidgetStyle );  gbWidgetStyleLayout->addWidget( cbEnableTooltips );
 	cbTearOffHandles = new QCheckBox( i18n("Show tear-off handles in &popup menus"), \
gbWidgetStyle ); @@ -401,6 +409,7 @@ KCMStyle::KCMStyle( QWidget* parent, con
 	connect( cbTransparentToolbars, SIGNAL(toggled(bool)),   this, \
SLOT(setToolbarsDirty()));  connect( cbEnableTooltips,     SIGNAL(toggled(bool)),   \
this, SLOT(setEffectsDirty()));  connect( cbIconsOnButtons,     \
SIGNAL(toggled(bool)),   this, SLOT(setEffectsDirty())); +	connect( \
comboGraphicEffectsLevel, SIGNAL(activated(int)),   this, SLOT(setEffectsDirty()));  \
connect( cbTearOffHandles,     SIGNAL(toggled(bool)),   this, \
SLOT(setEffectsDirty()));  connect( comboToolbarIcons,    SIGNAL(activated(int)), \
this, SLOT(setToolbarsDirty()));  
@@ -614,6 +623,8 @@ void KCMStyle::save()
 
 	// Misc page
 	config.writeEntry( "ShowIconsOnPushButtons", cbIconsOnButtons->isChecked(), \
KConfig::Normal|KConfig::Global); +    KConfigGroup g( &_config, "KDE-Global GUI \
Settings" ); +    g.writeEntry( "GrafficEffectsLevel", \
comboGraphicEffectsLevel->itemData(comboGraphicEffectsLevel->currentIndex()), \
KConfig::Normal|KConfig::Global);  config.writeEntry( "EffectNoTooltip", \
!cbEnableTooltips->isChecked(), KConfig::Normal|KConfig::Global);  
     KConfigGroup generalGroup(&_config, "General");
@@ -734,6 +745,7 @@ void KCMStyle::defaults()
 	cbEnableTooltips->setChecked(true);
 	comboToolbarIcons->setCurrentIndex(0);
 	cbIconsOnButtons->setChecked(true);
+	comboGraphicEffectsLevel->setCurrentIndex(comboGraphicEffectsLevel->findData(((int) \
KGlobalSettings::graphicEffectsLevelDefault())));  \
cbTearOffHandles->setChecked(false);  }
 
@@ -1067,6 +1079,8 @@ void KCMStyle::loadMisc( KConfig& config
 	cbIconsOnButtons->setChecked(configGroup.readEntry("ShowIconsOnPushButtons", \
true));  cbEnableTooltips->setChecked(!configGroup.readEntry("EffectNoTooltip", \
false));  cbTearOffHandles->setChecked(configGroup.readEntry("InsertTearOffHandle", \
false)); +    configGroup = config.group("KDE-Global GUI Settings");
+    comboGraphicEffectsLevel->setCurrentIndex(comboGraphicEffectsLevel->findData(configGroup.readEntry("GrafficEffectsLevel", \
((int) KGlobalSettings::graphicEffectsLevel()))));  
 	m_bToolbarsDirty = false;
 }
@@ -1123,6 +1137,8 @@ void KCMStyle::addWhatsThis()
 							"Text is aligned below the icon.") );
 	cbIconsOnButtons->setWhatsThis( i18n( "If you enable this option, KDE Applications \
will "  "show small icons alongside some important buttons.") );
+	comboGraphicEffectsLevel->setWhatsThis( i18n( "If you enable this option, KDE \
Applications will " +							"run internal animations.") );
 	cbTearOffHandles->setWhatsThis( i18n( "If you enable this option some pop-up menus \
                will "
 							"show so called tear-off handles. If you click them, you get the menu "
 							"inside a widget. This can be very helpful when performing "
Index: workspace/libs/plasma/phase.cpp
===================================================================
--- workspace/libs/plasma/phase.cpp	(revisión: 777211)
+++ workspace/libs/plasma/phase.cpp	(copia de trabajo)
@@ -26,6 +26,7 @@
 #include <KConfigGroup>
 #include <KService>
 #include <KServiceTypeTrader>
+#include <KGlobalSettings>
 
 #include "animator.h"
 #include "widgets/widget.h"
@@ -117,6 +118,10 @@ class Phase::Private
 
         qreal calculateProgress(int frames, int currentFrame)
         {
+            if (!(KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects)) { +                return qreal(1.0);
+            }
+
             qreal progress = frames;
             progress = currentFrame / progress;
             progress = qMin(qreal(1.0), qMax(qreal(0.0), progress));
@@ -156,6 +161,7 @@ class Phase::Private
                     break;
             }
         }
+
         Animator* animator;
         int animId;
         int timerId;
@@ -497,7 +503,8 @@ void Phase::timerEvent(QTimerEvent *even
     foreach (AnimationState* state, d->animatedItems) {
         if (state->currentInterval <= elapsed) {
             // we need to step forward!
-            state->currentFrame += qMax(1, elapsed / state->interval);
+            state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) ? +                                   \
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;  
             if (state->currentFrame < state->frames) {
                 qreal progress = d->calculateProgress(state->frames, \
state->currentFrame); @@ -521,7 +528,8 @@ void Phase::timerEvent(QTimerEvent *even
     foreach (MovementState* state, d->movingItems) {
         if (state->currentInterval <= elapsed) {
             // we need to step forward!
-            state->currentFrame += qMax(1, elapsed / state->interval);
+            state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) ? +                                   \
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;  
             if (state->currentFrame < state->frames) {
                 d->performMovement(d->calculateProgress(state->frames, \
state->currentFrame), state); @@ -555,7 +563,8 @@ void Phase::timerEvent(QTimerEvent \
                *even
             /*kDebug() << "stepping forwards element anim " << state->id << " from " \
                << state->currentFrame
                     << " by " << qMax(1, elapsed / state->interval) << " to "
                     << state->currentFrame + qMax(1, elapsed / state->interval) << \
                endl;*/
-            state->currentFrame += qMax(1, elapsed / state->interval);
+            state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) ? +                                   \
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;  // nasty \
                hack because QGraphicsItem::update isn't virtual!
             // FIXME: remove in 4.1 as we will no longer need the caching in \
                Plasma::Widget with Qt 4.4
             Plasma::Widget *widget = dynamic_cast<Plasma::Widget*>(state->item);
@@ -584,7 +593,8 @@ void Phase::timerEvent(QTimerEvent *even
     foreach (CustomAnimationState *state, d->customAnims) {
         if (state->currentInterval <= elapsed) {
             // advance the frame
-            state->currentFrame += qMax(1, elapsed / state->interval);
+            state->currentFrame += (KGlobalSettings::graphicEffectsLevel() & \
KGlobalSettings::SimpleAnimationEffects) ? +                                   \
                qMax(1, elapsed / state->interval) : state->frames - \
                state->currentFrame;
             /*kDebug() << "custom anim for" << state->receiver << "to slot" << \
                state->slot
                      << "with interval of" << state->interval << "at frame" << \
state->currentFrame;*/  


["signature.asc" (application/pgp-signature)]

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

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