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