Fixed bug that causes application to ask for new login even if
[situare] / src / ui / mainwindow.h
index 5f55c0c..dad12bf 100644 (file)
 #include <QtGui/QMainWindow>
 #include <QWidget>
 #include <QDebug>
+#include "facebookservice/facebookauthentication.h"
+#include "situareservice/situareservice.h"
+#include <QNetworkAccessManager>
 
 class QLabel;
 class QStackedWidget;
 
 /**
-* @Main Window Class
+* @brief Main Window Class
 *
 * @class MainWindow mainwindow.h "src/ui/mainwindow.h"
 */
@@ -41,85 +44,67 @@ class MainWindow : public QMainWindow
     Q_OBJECT
 
 public:
-    MainWindow(QWidget *parent = 0);
-    ~MainWindow();
-
-private:
     /**
-    * @brief Flag to indicate whether successful login has been done
+    * @brief Constructor
     *
-    * @var loggedIn
+    * @param parent Parent
     */
-    bool loggedIn;
+    MainWindow(QWidget *parent = 0);
 
     /**
-    * @brief Private method to create List and Map views as a stacked widget
-    *
-    * @fn createViews
+    * @brief Destructor
     */
-    void createViews();
+    ~MainWindow();
+
+public slots:
     /**
-    * @brief Widget Stack object for the List and Map Views
-    *
-    * @var situareViews
+    * @brief Public slot, which initiates toListViewAct action to switch view
     */
-    QStackedWidget *situareViews;
+    void toListView();
 
     /**
-    * @brief Private method to create the Menu items
-    *
-    * @fn createMenus
+    * @brief Public slot, which initiates toMapViewAct action to switch view
     */
-    void createMenus();
-    QMenu *viewMenu;
+    void toMapView();
 
+private:
     /**
-    * @brief Action item for changing view to List View
-    *
-    * @var toListViewAct
+    * @brief Private method to create the Menu items    w.show();
     */
-    QAction *toListViewAct;
+    void createMenus();
+
     /**
-    * @brief Action item for changing view to Map View
-    *
-    * @var toMapViewAct
+    * @brief Private method to create List and Map views as a stacked widget
     */
-    QAction *toMapViewAct;
-
-/*
-    QAction *testClose1Act;
-    QAction *testClose2Act;
-*/
+    void createViews();
 
     /**
     * @brief Method used to switch active view.
     *
-    * @fn switchView
-    * @param int 0 for listview, 1 for mapview
+    * @param nextIndex 0 for listview, 1 for mapview
     */
     void switchView(int);
 
-public slots:
+private:
+    FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
+    QNetworkAccessManager *m_networkManager; ///< NetworkManager that is passed on to SituareService
+    SituareService *m_situareService; ///< Instance of the situare server communication service
+    bool m_loggedIn; ///< Boolean value to indicate whether login has been successfull or not
+    QStackedWidget *m_situareViews; ///< Stacked widget that hold both view widgets
+    QAction *m_toListViewAct; ///< Action to trigger switch to list view
+    QAction *m_toMapViewAct; ///< Action to trigger switch to map view
+    QMenu *m_viewMenu; ///< Object that hold the view menu items
+
+private slots:
     /**
-    * @brief Public slot, which initiates toListViewAct action to switch view
-    *
-    * @fn toListView
+    * @brief Slot to change value of m_loggedIn to true
     */
-    void toListView();
+    void loginOK();
+
     /**
-    * @brief Public slot, which initiates toMapViewAct action to switch view
-    *
-    * @fn toMapView
+    * @brief Slot to check login status and exits if necessary
     */
-    void toMapView();
-/*
-    void testClose1();
-    void testClose2();
-*/
-/*
-signals:
-    void testLoginClosed();
-*/
+    void loginScreenClosed();
 };
 
 #endif // MAINWINDOW_H