Updates
[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 "facebookservice/facebookauthentication.h"
31 #include "situareservice/situareservice.h"
32 #include <QNetworkAccessManager>
33
34 class QLabel;
35 class QStackedWidget;
36
37 /**
38 * @brief Main Window Class
39 *
40 * @class MainWindow mainwindow.h "src/ui/mainwindow.h"
41 */
42 class MainWindow : public QMainWindow
43 {
44     Q_OBJECT
45
46 public:
47     /**
48     * @brief Constructor
49     *
50     * @param parent Parent
51     */
52     MainWindow(QWidget *parent = 0);
53
54     /**
55     * @brief Destructor
56     */
57     ~MainWindow();
58
59 /*******************************************************************************
60  * MEMBER FUNCTIONS AND SLOTS
61  ******************************************************************************/
62
63 public slots:
64     /**
65     * @brief Public slot, which initiates toListViewAct action to switch view
66     */
67     void toListView();
68
69     /**
70     * @brief Public slot, which initiates toMapViewAct action to switch view
71     */
72     void toMapView();
73
74 private:
75     /**
76     * @brief Private method to create the Menu items
77     */
78     void createMenus();
79
80     /**
81     * @brief Private method to create List and Map views as a stacked widget
82     */
83     void createViews();
84
85     /**
86     * @brief Method used to switch active view.
87     *
88     * @param nextIndex 0 for listview, 1 for mapview
89     */
90     void switchView(int);
91
92 private slots:
93     /**
94     * @brief Slot to change value of m_loggedIn to true
95     */
96     void loginOK();
97
98     /**
99     * @brief Slot to check login status and exits if necessary
100     */
101     void loginScreenClosed();
102
103 /*******************************************************************************
104  * DATA MEMBERS
105  ******************************************************************************/
106
107 private:
108     FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
109     QNetworkAccessManager *m_networkManager; ///< NetworkManager that is passed on to SituareService
110     SituareService *m_situareService; ///< Instance of the situare server communication service
111     bool m_loggedIn; ///< Boolean value to indicate whether login has been successfull or not
112     QStackedWidget *m_situareViews; ///< Stacked widget that hold both view widgets
113     QAction *m_toListViewAct; ///< Action to trigger switch to list view
114     QAction *m_toMapViewAct; ///< Action to trigger switch to map view
115     QMenu *m_viewMenu; ///< Object that hold the view menu items
116
117 };
118
119 #endif // MAINWINDOW_H