Togglable vibration effects menu item
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Mon, 25 Jul 2011 11:42:14 +0000 (14:42 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Mon, 25 Jul 2011 11:42:14 +0000 (14:42 +0300)
Does not update its text.

seascene.cpp

index 24c4a0c..7005071 100644 (file)
@@ -408,14 +408,7 @@ void SeaScene::handleScreenTapped()
 
     else if (pItem == pSettingsItem_)
     {
-    //Temporary code for settings, likely to be turned into a QML dialog
-
-          QMessageBox::StandardButton buttonpressed = QMessageBox::question(NULL,"Settings","Do you wish to have vibration effects enabled?", QMessageBox::Yes | QMessageBox::No);
-
-          if (buttonpressed == QMessageBox::Yes)
-              pVibrateAction_->setChecked(true);
-          if (buttonpressed == QMessageBox::No)
-              pVibrateAction_->setChecked(false);
+        pVibrateAction_->toggle();
     }
 
     else if (pItem == pAboutItem_)
@@ -469,7 +462,18 @@ void SeaScene::createMenuItems()
     prepareForMenu(pRestartLevelItem_);
 
     pSettingsItem_ = new QGraphicsTextItem;
-    pSettingsItem_->setHtml(tr("Vibration <br> effects").prepend(menufonthtml));
+    QString vibraText(tr("Vibration <br> effects"));
+    QString statusText;
+    if (pVibrateAction_->isChecked())
+    {
+        statusText = "off";
+    }
+    else
+    {
+        statusText = "on";
+    }
+    vibraText.append(statusText);
+    pSettingsItem_->setHtml(vibraText.prepend(menufonthtml));
     prepareForMenu(pSettingsItem_);
 
     pAboutItem_ = new QGraphicsTextItem;