Added signal for successful update
[situare] / src / engine / engine.h
index ab4206d..df940d5 100644 (file)
@@ -3,6 +3,7 @@
     Copyright (C) 2010  Ixonos Plc. Authors:
 
         Kaj Wallin - kaj.wallin@ixonos.com
+        Henri Lampela - henri.lampela@ixonos.com
 
     Situare is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
 
 
 #ifndef ENGINE_H
+#define ENGINE_H
+
 #include <QWidget>
 #include <QtDebug>
+#include "facebookservice/facebookauthentication.h"
+#include "situareservice/situareservice.h"
+#include <QNetworkAccessManager>
+#include "../ui/mainwindow.h"
 
 /**
 * @brief Engine class for Situare Application
 *
 * @class SituareEngine engine.h "engine/engine.h"
 */
-class SituareEngine : public QWidget
+class SituareEngine : public QObject
 {
+    Q_OBJECT
 public:
     /**
     * @brief Constructor
     *
     * @param parent
     */
-    SituareEngine(QWidget *parent = 0);
-};
+    SituareEngine(QMainWindow *parent = 0);
 
-#define ENGINE_H
+    /**
+    * @brief Destructor
+    */
+    ~SituareEngine();
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+    /**
+    * @brief Function to start engine component
+    */
+    void start();
+
+public slots:
+
+    /**
+    * @brief Slot to intercept error signal from ImageFetcher and SituareService
+    *
+    * @param error Error message
+    */
+    void error(const QString &error);
+
+    /**
+    * @brief Slot to intercept signal from successful login
+    */
+    void loginOk();
+
+    /**
+    * @brief Calls reverseGeo from SituareService to translate coordinates to street address
+    *
+    */
+    void requestAddress();
+
+    /**
+    * @brief Calls updateLocation from SituareService to send the location update to
+    *        Situare server.
+    *
+    * @param status Status message
+    * @param publish Publish on Facebook
+    */
+    void requestUpdateLocation(const QString &status, const bool &publish);
+
+    void updateFriendsList();
+
+    void updateWasSuccessful();
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+    /**
+    * @brief Signal that is emitted when UI must be showed
+    */
+    void engine_showMainWindow();
+
+    /**
+    * @brief Signal that is emitted when UI must be closed
+    */
+    void engine_closeMainWindow();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+    MainWindow *m_ui;
+    FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
+    QNetworkAccessManager *m_networkManager; ///< NetworkManager that is passed on to SituareService
+    SituareService *m_situareService; ///< Instance of the situare server communication service
+    bool m_loggedIn; ///< Boolean value to indicate whether login has been successfull or not
+};
 
 #endif // ENGINE_H