Added error message for GPS
authorlampehe-local <henri.lampela@ixonos.com>
Thu, 10 Jun 2010 11:11:09 +0000 (14:11 +0300)
committerlampehe-local <henri.lampela@ixonos.com>
Thu, 10 Jun 2010 11:11:09 +0000 (14:11 +0300)
src/common.h
src/engine/engine.cpp
src/gps/gpspositionprivate.cpp
src/gps/gpspositionprivateliblocation.cpp
src/gps/gpspositionprivatestub.cpp
src/ui/mainwindow.cpp
src/ui/mainwindow.h

index 6e53fb0..6888b48 100644 (file)
@@ -58,7 +58,8 @@ namespace SituareError {
         UPDATE_FAILED,
         DATA_RETRIEVAL_FAILED,
         ADDRESS_RETRIEVAL_FAILED,
-        DOWNLOAD_FAILED
+        DOWNLOAD_FAILED,
+        GPS_INITIALIZATION_FAILED
     };
 }
 
index 42e945c..7929783 100644 (file)
@@ -237,7 +237,12 @@ void SituareEngine::error(const int error)
     case SituareError::DOWNLOAD_FAILED:
         m_ui->buildInformationBox(tr("Image download failed"), true);
         break;
+    case SituareError::GPS_INITIALIZATION_FAILED:
+        enableGPS(false);
+        m_ui->buildInformationBox(tr("GPS initialization failed"), true);
+        break;
     default:
+        qCritical() << "QNetworkReply::NetworkError :" << error;
         break;
     }
 
@@ -445,6 +450,9 @@ void SituareEngine::signalsFromMainWindow()
 {
     qDebug() << __PRETTY_FUNCTION__;    
 
+    connect(m_ui, SIGNAL(error(int)),
+            this, SLOT(error(int)));
+
     connect(m_ui, SIGNAL(fetchUsernameFromSettings()),
             this, SLOT(fetchUsernameFromSettings()));
 
@@ -498,9 +506,6 @@ void SituareEngine::signalsFromMainWindow()
     connect(m_ui, SIGNAL(refreshUserData()),
             this, SLOT(refreshUserData()));
 
-//    connect (m_ui, SIGNAL(notificateUpdateFailing(int)),
-//             this, SLOT(error(int)));
-
     connect(m_ui, SIGNAL(findUser(QPointF)),
             m_mapEngine, SLOT(setViewLocation(QPointF)));
 
index fb5c04f..1c4ac9f 100644 (file)
@@ -25,6 +25,7 @@
 #include <QDebug>
 #include <QTimer>
 
+#include "common.h"
 #include "gpscommon.h"
 #include "gpsposition.h"
 #include "gpspositionprivate.h"
@@ -53,7 +54,7 @@ void GPSPositionPrivate::setMode(GPSPosition::Mode mode, const QString &filePath
         m_gpsSource = QGeoPositionInfoSource::createDefaultSource(this);
 
         if (!m_gpsSource) {
-            emit m_parent->error(123);
+            emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
             return;
         }
     }
index e0af1ae..092c421 100644 (file)
@@ -25,6 +25,7 @@
 #include <QDebug>
 #include <QTimer>
 
+#include "common.h"
 #include "gpscommon.h"
 #include "gpsposition.h"
 #include "gpspositionprivateliblocation.h"
@@ -56,7 +57,7 @@ void GPSPositionPrivate::setMode(GPSPosition::Mode mode, const QString &filePath
         m_liblocationWrapper = new LiblocationWrapper(this);
 
         if (!m_liblocationWrapper) {
-            emit m_parent->error(123);  ///Change to correct error code
+            emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
             return;
         }
     }
@@ -137,7 +138,7 @@ void GPSPositionPrivate::locationError(const QString &errorMessage)
 
     Q_UNUSED(errorMessage);
 
-    emit m_parent->error(123);
+    emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
 }
 
 void GPSPositionPrivate::setUpdateInterval(int interval)
index 6a5ed40..7bcbf61 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <QDebug>
 
+#include "common.h"
 #include "gpsposition.h"
 #include "gpspositionprivatestub.h"
 
@@ -58,7 +59,7 @@ void GPSPositionPrivate::start()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    emit m_parent->error(123);
+    emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
 }
 
 void GPSPositionPrivate::stop()
index 4b9e6d6..fc2d0c1 100644 (file)
@@ -909,7 +909,7 @@ void MainWindow::webViewRequestFinished(QNetworkReply *reply)
     qDebug() << __PRETTY_FUNCTION__;
 
     if(reply->error()) {
-        qDebug() << reply->error() << reply->errorString();
+        emit error(reply->error());
         toggleProgressIndicator(false);
     }
 }
index 19dbc18..714240b 100644 (file)
@@ -406,6 +406,13 @@ signals:
     void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs);
 
     /**
+    * @brief Signals error
+    *
+    * @param error Error code
+    */
+    void error(const int error);
+
+    /**
     * @brief Signal for requesting username from settings
     *
     */
@@ -485,13 +492,6 @@ signals:
       */
     void minZoomLevelReached();
 
-//    /**
-//    * @brief Signal that used to inform user that his message/location update tp Situare server
-//    *        was failed.
-//    *        This signal is originally sended from UserInfo
-//    */
-//    void notificateUpdateFailing(const QString &message);
-
     /**
      * @brief Forwarding signal from MapEngine to MapScale
      */