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

List:       kde-commits
Subject:    KDE/kdebase/workspace
From:       Rafael Fernández López <ereslibre () kde ! org>
Date:       2008-02-26 0:53:55
Message-ID: 1203987235.716486.23348.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 779390 by ereslibre:

Animations enable/disable system wide. TODO: Do a proper GUI for the style KCM and \
the animations feature.


 M  +23 -0     kcontrol/style/kcmstyle.cpp  
 M  +1 -0      kcontrol/style/kcmstyle.h  
 M  +14 -4     libs/plasma/phase.cpp  


--- trunk/KDE/kdebase/workspace/kcontrol/style/kcmstyle.cpp #779389:779390
@@ -233,6 +233,19 @@
 
 	// Add Page2 (Effects)
 	// -------------------
+	gbWidgetStyle = new QGroupBox( i18n("Graphical User Interface"), page2 );
+	QVBoxLayout *effectsLayout = new QVBoxLayout(gbWidgetStyle);
+	comboGraphicEffectsLevel = new KComboBox( page2 );
+	comboGraphicEffectsLevel->setObjectName( "cbGraphicEffectsLevel" );
+	comboGraphicEffectsLevel->setEditable( false );
+	comboGraphicEffectsLevel->addItem(i18n("Low display resolution and Low CPU"), \
KGlobalSettings::NoEffects); +	comboGraphicEffectsLevel->addItem(i18n("High display \
resolution and Low CPU"), KGlobalSettings::GradientEffects); \
+	comboGraphicEffectsLevel->addItem(i18n("Low display resolution and High CPU"), \
KGlobalSettings::SimpleAnimationEffects); \
+	comboGraphicEffectsLevel->addItem(i18n("High display resolution and High CPU"), \
(int) (KGlobalSettings::SimpleAnimationEffects | KGlobalSettings::GradientEffects)); \
+	comboGraphicEffectsLevel->addItem(i18n("Low display resolution and Very High CPU"), \
KGlobalSettings::ComplexAnimationEffects); \
+	comboGraphicEffectsLevel->addItem(i18n("High display resolution and Very High \
CPU"), (int) (KGlobalSettings::ComplexAnimationEffects | \
KGlobalSettings::GradientEffects)); +	effectsLayout->addWidget( \
comboGraphicEffectsLevel ); +
 	cbEnableEffects = new QCheckBox( i18n("&Enable GUI effects"), page2 );
 	containerFrame = new QFrame( page2 );
 	containerFrame->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
@@ -334,6 +347,7 @@
 	menuContainerLayout->addWidget( menuPreview, 0, 1, 4, 1);
 
 	// Layout page2.
+    page2Layout->addWidget( gbWidgetStyle );
 	page2Layout->addWidget( cbEnableEffects );
 	page2Layout->addWidget( containerFrame );
 	page2Layout->addWidget( hline );
@@ -401,6 +415,7 @@
 	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 +629,8 @@
 
 	// Misc page
 	config.writeEntry( "ShowIconsOnPushButtons", cbIconsOnButtons->isChecked(), \
KConfig::Normal|KConfig::Global); +    KConfigGroup g( &_config, "KDE-Global GUI \
Settings" ); +    g.writeEntry( "GraphicEffectsLevel", \
comboGraphicEffectsLevel->itemData(comboGraphicEffectsLevel->currentIndex()), \
KConfig::Normal|KConfig::Global);  config.writeEntry( "EffectNoTooltip", \
!cbEnableTooltips->isChecked(), KConfig::Normal|KConfig::Global);  
     KConfigGroup generalGroup(&_config, "General");
@@ -734,6 +751,7 @@
 	cbEnableTooltips->setChecked(true);
 	comboToolbarIcons->setCurrentIndex(0);
 	cbIconsOnButtons->setChecked(true);
+	comboGraphicEffectsLevel->setCurrentIndex(comboGraphicEffectsLevel->findData(((int) \
KGlobalSettings::graphicEffectsLevelDefault())));  \
cbTearOffHandles->setChecked(false);  }
 
@@ -1068,6 +1086,9 @@
 	cbEnableTooltips->setChecked(!configGroup.readEntry("EffectNoTooltip", false));
 	cbTearOffHandles->setChecked(configGroup.readEntry("InsertTearOffHandle", false));
 
+	KConfigGroup graphicConfigGroup = config.group("KDE-Global GUI Settings");
+	comboGraphicEffectsLevel->setCurrentIndex(comboGraphicEffectsLevel->findData(graphicConfigGroup.readEntry("GraphicEffectsLevel", \
((int) KGlobalSettings::graphicEffectsLevel())))); +
 	m_bToolbarsDirty = false;
 }
 
@@ -1123,6 +1144,8 @@
 							"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 "
--- trunk/KDE/kdebase/workspace/kcontrol/style/kcmstyle.h #779389:779390
@@ -121,6 +121,7 @@
 	QCheckBox* cbEnableEffects;
 
 	QFrame* containerFrame;
+	QComboBox* comboGraphicEffectsLevel;
 	QGridLayout* containerLayout;
 	QComboBox* comboTooltipEffect;
 	QComboBox* comboComboEffect;
--- trunk/KDE/kdebase/workspace/libs/plasma/phase.cpp #779389:779390
@@ -26,6 +26,7 @@
 #include <KConfigGroup>
 #include <KService>
 #include <KServiceTypeTrader>
+#include <KGlobalSettings>
 
 #include "animator.h"
 #include "widgets/widget.h"
@@ -117,6 +118,10 @@
 
         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 @@
                     break;
             }
         }
+
         Animator* animator;
         int animId;
         int timerId;
@@ -497,7 +503,8 @@
     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 @@
     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 @@
             /*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 @@
     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;*/  


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

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