From 4d2372fbb866d4d264e91ee3dd7a8808af440bf3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Mon, 25 Jul 2011 14:42:14 +0300 Subject: [PATCH] Togglable vibration effects menu item Does not update its text. --- seascene.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/seascene.cpp b/seascene.cpp index 24c4a0c..7005071 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -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
effects").prepend(menufonthtml)); + QString vibraText(tr("Vibration
effects")); + QString statusText; + if (pVibrateAction_->isChecked()) + { + statusText = "off"; + } + else + { + statusText = "on"; + } + vibraText.append(statusText); + pSettingsItem_->setHtml(vibraText.prepend(menufonthtml)); prepareForMenu(pSettingsItem_); pAboutItem_ = new QGraphicsTextItem; -- 1.7.9.5