Moved settings saving from mainwindow to engine.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 14 May 2010 10:26:11 +0000 (13:26 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 14 May 2010 10:26:11 +0000 (13:26 +0300)
src/engine/engine.cpp
src/engine/engine.h

index 4f69067..1c43872 100644 (file)
@@ -33,7 +33,9 @@
 #endif
 
 SituareEngine::SituareEngine(QMainWindow *parent)
-    : QObject(parent)
+    : QObject(parent),
+      m_autoCenteringEnabled(false),
+      m_gpsEnabled(false)
 {
     qDebug() << __PRETTY_FUNCTION__;
     m_ui = new MainWindow;
@@ -109,6 +111,12 @@ SituareEngine::~SituareEngine()
     qDebug() << __PRETTY_FUNCTION__;
 
     delete m_ui;
+
+    QSettings settings(DIRECTORY_NAME, FILE_NAME);
+    qDebug() << __PRETTY_FUNCTION__ << m_gpsEnabled;
+    qDebug() << __PRETTY_FUNCTION__ << m_autoCenteringEnabled;
+    settings.setValue(GPS_ENABLED, m_gpsEnabled);
+    settings.setValue(AUTO_CENTERING_ENABLED, m_autoCenteringEnabled);
 }
 
 void SituareEngine::loginProcessCancelled()
@@ -182,6 +190,8 @@ void SituareEngine::enableGPS(bool enabled)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    m_gpsEnabled = enabled;
+
     if (enabled) {
         m_gps->lastPosition();
         m_gps->start();
@@ -197,6 +207,8 @@ void SituareEngine::enableAutoCentering(bool enabled)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    m_autoCenteringEnabled = enabled;
+
     if (enabled) {
         m_ui->setAutoCenteringButton(true);
         m_ui->autoCenteringEnabled(true);
index 3b51cea..8aa2595 100644 (file)
@@ -152,6 +152,8 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
+    bool m_autoCenteringEnabled;    ///< Auto centering enabled
+    bool m_gpsEnabled;              ///< GPS enabled
     FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
     GPSPositionInterface *m_gps;   ///< Instance of the gps position
     MainWindow *m_ui; ///< Instance of the MainWindow UI