Merge branch 'friendlist' into integration
[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 "listviewscreen.h"
35 #include "mapviewscreen.h"
36 #include "updatelocation/updatelocationdialog.h"
37 #include "ui/mainwindow.h"
38
39 class QLabel;
40 class QStackedWidget;
41
42 /**
43 * @brief Main Window Class
44 *
45 * @class MainWindow mainwindow.h "src/ui/mainwindow.h"
46 */
47 class MainWindow : public QMainWindow
48 {
49     Q_OBJECT
50
51 public:
52     /**
53     * @brief Constructor
54     *
55     * @param parent Parent
56     */
57     MainWindow(QWidget *parent = 0);
58
59     /**
60     * @brief Destructor
61     */
62     ~MainWindow();
63
64 /*******************************************************************************
65  * MEMBER FUNCTIONS AND SLOTS
66  ******************************************************************************/
67 public slots:
68     /**
69     * @brief Public slot, which open settings dialog
70     */
71     void openSettingsDialog();
72
73     /**
74     * @brief Public slot, which initiates toListViewAct action to switch view
75     */
76     void toListView();
77
78     /**
79     * @brief Public slot, which initiates toMapViewAct action to switch view
80     */
81     void toMapView();
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 Private method to create List and Map views as a stacked widget
93     */
94     void createViews();
95
96     /**
97     * @brief Method used to switch active view.
98     *
99     * @param nextIndex 0 for listview, 1 for mapview
100     */
101     void switchView(int);
102
103 private slots:
104
105     /**
106     * @brief Private slot, which starts UpdateLocationDialog
107     *
108     */
109     void openLocationUpdateDialog();
110
111 /*******************************************************************************
112  * SIGNALS
113  ******************************************************************************/
114  signals:
115     /**
116     * @brief Signal for requesting reverseGeo from SituareEngine
117     *
118     */
119     void requestReverseGeo();
120
121     /**
122     * @brief Signals, when address data is ready
123     *
124     * @param address Street address
125     */
126     void reverseGeoReady(const QString &address);
127
128     /**
129     * @brief Signal for requestLocationUpdate from SituareEngine
130     *
131     * @param status Status message
132     * @param publish Publish on Facebook
133     */
134     void statusUpdate(const QString &status, const bool &publish);
135
136     void userLocationReady(User *user);
137     void friendsLocationsReady(QList<User *> &friendsList);
138     void refreshUserData();
139
140     void userDataChanged(User*,QList<User*>&);
141
142 /*******************************************************************************
143  * DATA MEMBERS
144  ******************************************************************************/
145 private:
146     ListViewScreen *m_listViewScreen; ///< Instance of the list view
147     UpdateLocationDialog *m_locationDialog; ///< Message dialog
148     MapViewScreen *m_mapViewScreen; ///< Instance of the map view
149     QStackedWidget *m_situareViews; ///< Stacked widget that hold both view widgets
150     QAction *m_toListViewAct; ///< Action to trigger switch to list view
151     QAction *m_toMapViewAct; ///< Action to trigger switch to map view
152     QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
153     QMenu *m_viewMenu; ///< Object that hold the view menu items
154 };
155
156 #endif // MAINWINDOW_H