QTfrontend/hwform.cpp
changeset 6574 ec059b55aa72
parent 6572 0d0af531c1c7
child 6604 9cc612a24b43
--- a/QTfrontend/hwform.cpp	Sun Jan 15 23:14:10 2012 +0100
+++ b/QTfrontend/hwform.cpp	Sun Jan 15 23:35:02 2012 +0100
@@ -220,6 +220,7 @@
     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
     connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
     connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
+    connect(ui.pageOptions->CBFrontendEffects, SIGNAL(toggled(bool)), this, SLOT(onFrontendEffects(bool)) );
     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
 
     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
@@ -283,14 +284,12 @@
     ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
     ui.pageOptions->SchemesName->setModel(ammoSchemeModel);
 
-    wBackground = NULL;
-    if (config->isFrontendEffects()) {
-       wBackground = new BGWidget(this);
-       wBackground->setFixedSize(this->width(), this->height());
-       wBackground->lower();
-       wBackground->init();
-       wBackground->startAnimation();
-    }
+    wBackground = new BGWidget(this);
+    wBackground->setFixedSize(this->width(), this->height());
+    wBackground->lower();
+    wBackground->init();
+    wBackground->enabled = config->isFrontendEffects();
+    wBackground->startAnimation();
 
     //Install all eventFilters :
 
@@ -365,6 +364,15 @@
   }
 }
 
+void HWForm::onFrontendEffects(bool value)
+{
+    wBackground->enabled = value;
+    if (value)
+        wBackground->startAnimation();
+    else
+        wBackground->stopAnimation();
+}
+
 /*
 void HWForm::keyReleaseEvent(QKeyEvent *event)
 {
@@ -585,7 +593,7 @@
     if (id == ID_PAGE_DRAWMAP)
         stopAnim = true;
 
-    if (frontendEffects && !stopAnim)
+    if (!stopAnim)
     {
         /**Start animation :**/
         int coeff = 1;
@@ -597,17 +605,19 @@
         QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(lastid));
         ui.Pages->widget(lastid)->setGraphicsEffect(effectLast);
 #endif
+        // no effects, means 0 effect duration :D
+        int duration = config->isFrontendEffects() ? 500 : 0;
 
         //New page animation
         animationNewSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
-        animationNewSlide->setDuration(500);
+        animationNewSlide->setDuration(duration);
         animationNewSlide->setStartValue(QPoint(width()/coeff, 0));
         animationNewSlide->setEndValue(QPoint(0, 0));
         animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
 
 #ifndef Q_OS_MAC
         animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
-        animationNewOpacity->setDuration(500);
+        animationNewOpacity->setDuration(duration);
         animationNewOpacity->setStartValue(0.01);
         animationNewOpacity->setEndValue(1);
         animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -617,14 +627,14 @@
         ui.Pages->widget(lastid)->setHidden(false);
 
         animationOldSlide = new QPropertyAnimation(ui.Pages->widget(lastid), "pos");
-        animationOldSlide->setDuration(500);
+        animationOldSlide->setDuration(duration);
         animationOldSlide->setStartValue(QPoint(0, 0));
         animationOldSlide->setEndValue(QPoint(-width()/coeff, 0));
         animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
 
 #ifndef Q_OS_MAC
         animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
-        animationOldOpacity->setDuration(500);
+        animationOldOpacity->setDuration(duration);
         animationOldOpacity->setStartValue(1);
         animationOldOpacity->setEndValue(0.01);
         animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -692,7 +702,7 @@
 
     /**Start animation :**/
 
-    if (curid != 0 && frontendEffects && !stopAnim)
+    if (curid != 0 && !stopAnim)
     {
         int coeff = 1;
 #ifndef Q_OS_MAC
@@ -704,17 +714,19 @@
         QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(curid));
         ui.Pages->widget(curid)->setGraphicsEffect(effectLast);
 #endif
+        // no effects, means 0 effect duration :D
+        int duration = config->isFrontendEffects() ? 500 : 0;
 
         //Last page animation
         animationOldSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
-        animationOldSlide->setDuration(500);
+        animationOldSlide->setDuration(duration);
         animationOldSlide->setStartValue(QPoint(-width()/coeff, 0));
         animationOldSlide->setEndValue(QPoint(0, 0));
         animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
 
 #ifndef Q_OS_MAC
         animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
-        animationOldOpacity->setDuration(500);
+        animationOldOpacity->setDuration(duration);
         animationOldOpacity->setStartValue(1);
         animationOldOpacity->setEndValue(0.01);
         animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -723,14 +735,14 @@
         ui.Pages->widget(curid)->setHidden(false);
 
         animationNewSlide = new QPropertyAnimation(ui.Pages->widget(curid), "pos");
-        animationNewSlide->setDuration(500);
+        animationNewSlide->setDuration(duration);
         animationNewSlide->setStartValue(QPoint(0, 0));
         animationNewSlide->setEndValue(QPoint(width()/coeff, 0));
         animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
 
 #ifndef Q_OS_MAC
         animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
-        animationNewOpacity->setDuration(500);
+        animationNewOpacity->setDuration(duration);
         animationNewOpacity->setStartValue(0.01);
         animationNewOpacity->setEndValue(1);
         animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
@@ -747,8 +759,6 @@
 
         connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
     }
-
-
 }
 
 void HWForm::OpenSnapshotFolder()