Added friend find button to FriendListItem.
[situare] / src / ui / mainwindow.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5       Henri Lampela - henri.lampela@ixonos.com
6       Kaj Wallin - kaj.wallin@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 MAINWINDOW_H
25 #define MAINWINDOW_H
26
27 #include <QtGui/QMainWindow>
28 #include <QWidget>
29 #include <QDebug>
30 #include <QObject>
31 #include "facebookservice/facebookauthentication.h"
32 #include "situareservice/situareservice.h"
33 #include <QNetworkAccessManager>
34 #include "mapviewscreen.h"
35 #include "updatelocation/updatelocationdialog.h"
36 #include "ui/mainwindow.h"
37
38 class QLabel;
39
40 /**
41 * @brief Main Window Class
42 *
43 * @class MainWindow mainwindow.h "src/ui/mainwindow.h"
44 */
45 class MainWindow : public QMainWindow
46 {
47     Q_OBJECT
48
49 public:
50     /**
51     * @brief Constructor
52     *
53     * @param parent Parent
54     */
55     MainWindow(QWidget *parent = 0);
56
57 /*******************************************************************************
58  * MEMBER FUNCTIONS AND SLOTS
59  ******************************************************************************/
60 public slots:
61     /**
62     * @brief Slot for auto centering enabling.
63     *
64     * @param checked true if button state is checked, false otherwise
65     */
66     void autoCenteringToggled(bool checked);
67
68     /**
69     * @brief Slot for map location change.
70     */
71     void mapLocationChanged();
72
73     /**
74     * @brief Public slot, which open settings dialog
75     */
76     void openSettingsDialog();
77
78     /**
79     * @brief Toggle progress indicator.
80     *
81     * @param state true if progress indicator should be shown, false otherwise
82     */
83     void toggleProgressIndicator(bool state);
84
85 private:
86     /**
87     * @brief Private method to create the Menu items
88     */
89     void createMenus();
90
91         /**
92     * @brief Show Maemo information box with message.
93     *
94     * @brief message information message
95     */
96     void showMaemoInformationBox(const QString &message);
97
98 private slots:
99         /**
100     * @brief Slot for gps enabling.
101     *
102     * @param checked true if button state is checked, false otherwise
103     */
104     void gpsActionToggled(bool checked);
105
106     /**
107     * @brief Slot for gps timeout.
108     *
109     * Called when request timeout occurs.
110     */
111     void gpsTimeout();
112
113     /**
114     * @brief Slot for gps error.
115     *
116     * @param message error message
117     */
118     void gpsError(const QString &message);
119
120     /**
121     * @brief Private slot, which starts UpdateLocationDialog
122     *
123     */
124     void openLocationUpdateDialog();
125
126 /*******************************************************************************
127  * SIGNALS
128  ******************************************************************************/
129 signals:
130         /**
131     * @brief Signal for map auto centering
132     *
133     * @param enabled true if map should auto center to gps location
134     */
135     void enableAutoCentering(bool enabled);
136
137         /**
138     * @brief Signal for gps enabling.
139     *
140     * @param enabled true if gps should be enabled
141     */
142     void enableGPS(bool enabled);
143
144         /**
145     * @brief Signal for friend location ready.
146     *
147     * @param friendsList
148     */
149     void friendsLocationsReady(QList<User *> &friendsList);
150
151         /**
152     * @brief Signal for gps position.
153     *
154     * @param position longitude and latitude values
155     */
156     void positionReceived(QPointF position);
157
158         /**
159     * @brief Signal for refreshing user data.
160     *
161     */
162     void refreshUserData();
163
164     /**
165     * @brief Signal for requesting reverseGeo from SituareEngine
166     *
167     */
168     void requestReverseGeo();
169
170     /**
171     * @brief Signals, when address data is ready
172     *
173     * @param address Street address
174     */
175     void reverseGeoReady(const QString &address);
176
177     /**
178     * @brief Signal for requestLocationUpdate from SituareEngine
179     *
180     * @param status Status message
181     * @param publish Publish on Facebook
182     */
183     void statusUpdate(const QString &status, const bool &publish);
184
185     /**
186     * @brief Signal for use location ready.
187     *
188     * @param user User object
189     */
190     void userLocationReady(User *user);
191
192 /*******************************************************************************
193  * DATA MEMBERS
194  ******************************************************************************/
195 private:
196     UpdateLocationDialog *m_locationDialog; ///< Message dialog
197     MapViewScreen *m_mapViewScreen; ///< Instance of the map view
198         QAction *m_autoCenteringAct;    ///< Action to auto center map using gps position
199     QAction *m_gpsToggleAct;    ///< Action to trigger gps toggle       
200         QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
201     QMenu *m_viewMenu; ///< Object that hold the view menu items
202 };
203
204 #endif // MAINWINDOW_H