From 38beff7cdff5e7e52fe16247bf72949b429c137d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Sat, 23 Jul 2011 12:02:17 +0300 Subject: [PATCH] Vibration setting is now saved --- main.cpp | 1 + seascene.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/main.cpp b/main.cpp index 2ebb39f..ba9a9c9 100644 --- a/main.cpp +++ b/main.cpp @@ -27,6 +27,7 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setApplicationName("Ghosts Overboard"); + a.setOrganizationName("Ghosts Overboard"); a.setApplicationVersion("0.2.1"); a.setWindowIcon(QIcon(":/pix/laiva_3aave.png")); SeaView w; diff --git a/seascene.cpp b/seascene.cpp index 24c4a0c..084afd9 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -32,6 +32,7 @@ #include #include #include +#include const QString ghostImageFilename_ = ":/pix/aave.png"; const QString rockImageFilename_ =":/pix/kari.png"; @@ -75,6 +76,8 @@ SeaScene::SeaScene(QObject *parent) : pVibrateAction_ = new QAction(tr("Vibration effects"),this); pVibrateAction_->setCheckable(true); connect(pVibrateAction_,SIGNAL(toggled(bool)),this,SLOT(vibrationActivate(bool))); + QSettings settings; + pVibrateAction_->setChecked(settings.value("vibration",false).toBool()); pPauseAction_ = new QAction(tr("Pause"),this); @@ -409,13 +412,20 @@ void SeaScene::handleScreenTapped() else if (pItem == pSettingsItem_) { //Temporary code for settings, likely to be turned into a QML dialog + QSettings settings; 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); + settings.setValue("vibration",true); + } if (buttonpressed == QMessageBox::No) + { pVibrateAction_->setChecked(false); + settings.setValue("vibration",false); + } } else if (pItem == pAboutItem_) -- 1.7.9.5