VibraResource acquired only when needed
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Thu, 13 Oct 2011 16:53:28 +0000 (19:53 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Thu, 13 Oct 2011 16:53:28 +0000 (19:53 +0300)
At start and upon returning from pause, VibraResource is requested only
if vibration is on. Since vibration can only be changed when paused
(menu is not visible otherwise), this is sufficient.

seascene.cpp

index f3a64da..310a98b 100644 (file)
@@ -137,8 +137,10 @@ SeaScene::SeaScene(QObject *parent) :
     connect(pResourceSet_,SIGNAL(resourcesDenied()),this,SLOT(resourcesLost()));
     pResourceSet_->setAlwaysReply();
 
-    pResourceSet_->acquire();
-
+    if (pVibrateAction_->isChecked()) //ask for the resource only if its used
+    {
+        pResourceSet_->acquire();
+    }
 
 }
 
@@ -424,8 +426,12 @@ void SeaScene::pause(bool paused)
 
             autopauseTimer.start(); //Start counting towards autopause
 
-            pResourceSet_->acquire(); //Ask to get the vibration resource back
-        }
+
+            if (pVibrateAction_->isChecked())
+            {
+               pResourceSet_->acquire(); //Ask to get the vibration resource back
+            }
+         }
 
         else
         {