Vibration setting is now saved
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Sat, 23 Jul 2011 09:02:17 +0000 (12:02 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Sat, 23 Jul 2011 09:02:17 +0000 (12:02 +0300)
main.cpp
seascene.cpp

index 2ebb39f..ba9a9c9 100644 (file)
--- 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;
index 24c4a0c..084afd9 100644 (file)
@@ -32,6 +32,7 @@
 #include <QPushButton>
 #include <QLabel>
 #include <QVBoxLayout>
+#include <QSettings>
 
 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_)