9e81a8689c1f9774d800a1629bc3a02cf7ddd9e9
[situare] / src / engine / engine.h
1  /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Kaj Wallin - kaj.wallin@ixonos.com
6         Henri Lampela - henri.lampela@ixonos.com
7
8     Situare is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License
10     version 2 as published by the Free Software Foundation.
11
12     Situare is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with Situare; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
20     USA.
21  */
22
23
24 #ifndef ENGINE_H
25 #define ENGINE_H
26
27 #include <QWidget>
28 #include <QtDebug>
29 #include "facebookservice/facebookauthentication.h"
30 #include "situareservice/situareservice.h"
31 #include <QNetworkAccessManager>
32 #include "../ui/mainwindow.h"
33
34 /**
35 * @brief Engine class for Situare Application
36 *
37 * This class handles all the underlaying login of the Situare
38 * application.
39 *
40 * @class SituareEngine engine.h "engine/engine.h"
41 */
42 class SituareEngine : public QObject
43 {
44     Q_OBJECT
45 public:
46     /**
47     * @brief Constructor
48     *
49     * @param parent
50     */
51     SituareEngine(QMainWindow *parent = 0);
52
53     /**
54     * @brief Destructor
55     */
56     ~SituareEngine();
57
58 /*******************************************************************************
59  * MEMBER FUNCTIONS AND SLOTS
60  ******************************************************************************/
61 public:
62     /**
63     * @brief Function to start engine component
64     */
65     void start();
66
67 public slots:
68
69     /**
70     * @brief Slot to intercept signal from successful login
71     */
72     void loginOk();
73
74     /**
75     * @brief Calls reverseGeo from SituareService to translate coordinates to street address
76     *
77     */
78     void requestAddress();
79
80     /**
81     * @brief Calls updateLocation from SituareService to send the location update to
82     *        Situare server.
83     *
84     * @param status Status message
85     * @param publish Publish on Facebook
86     */
87     void requestUpdateLocation(const QString &status, const bool &publish);
88
89     void updateFriendsList();
90
91 /*******************************************************************************
92  * SIGNALS
93  ******************************************************************************/
94 signals:
95     /**
96     * @brief Signal that is emitted when UI must be showed
97     */
98     void engine_showMainWindow();
99
100     /**
101     * @brief Signal that is emitted when UI must be closed
102     */
103     void engine_closeMainWindow();
104
105 /*******************************************************************************
106  * DATA MEMBERS
107  ******************************************************************************/
108 private:
109     MainWindow *m_ui;
110     FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
111     QNetworkAccessManager *m_networkManager; ///< NetworkManager that is passed on to SituareService
112     SituareService *m_situareService; ///< Instance of the situare server communication service
113     bool m_loggedIn; ///< Boolean value to indicate whether login has been successfull or not
114 };
115
116 #endif // ENGINE_H