Merge branch 'master' of https://vcs.maemo.org/git/situare
[situare] / src / ui / mainwindow.h
index a9eb362..331d149 100644 (file)
 /*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
 
-       Henri Lampela - henri.lampela@ixonos.com
+      Henri Lampela - henri.lampela@ixonos.com
+      Kaj Wallin - kaj.wallin@ixonos.com
 
-    Situare is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License
-    version 2 as published by the Free Software Foundation.
+   Situare is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
 
-    Situare is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+   Situare is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with Situare; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+   USA.
+*/
 
-    You should have received a copy of the GNU General Public License
-    along with Situare; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
-    USA.
- */
 
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 
 #include <QtGui/QMainWindow>
-#include <QLabel>
-#include <QUrl>
-#include <QPixmap>
 #include <QWidget>
-#include "mapfetcher.h"
+#include <QDebug>
+#include <QObject>
+#include "facebookservice/facebookauthentication.h"
+#include "situareservice/situareservice.h"
+#include <QNetworkAccessManager>
+#include "engine/engine.h"
+#include "listviewscreen.h"
+#include "mapviewscreen.h"
+#include "updatelocation/updatelocationdialog.h"
+
+class QLabel;
+class QStackedWidget;
 
-class MainWindow : public QWidget
+/**
+* @brief Main Window Class
+*
+* @class MainWindow mainwindow.h "src/ui/mainwindow.h"
+*/
+class MainWindow : public QMainWindow
 {
     Q_OBJECT
 
 public:
+    /**
+    * @brief Constructor
+    *
+    * @param parent Parent
+    */
     MainWindow(QWidget *parent = 0);
-    ~MainWindow();
 
-signals:
-    void fetchImage(const QUrl &url);
+    /**
+    * @brief Destructor
+    */
+    ~MainWindow();
 
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
 public slots:
-    void debug();
-    void imageReceived(const QUrl &url, const QPixmap &image);
+    /**
+    * @brief Public slot, which open settings dialog
+    */
+     void openSettingsDialog();
+
+    /**
+    * @brief Public slot, which initiates toListViewAct action to switch view
+    */
+    void toListView();
+
+    /**
+    * @brief Public slot, which initiates toMapViewAct action to switch view
+    */
+    void toMapView();
 
 private:
-    MapFetcher mapFetcher;
+    /**
+    * @brief Private method to create the Menu items
+    */
+    void createMenus();
+
+    /**
+    * @brief Private method to create List and Map views as a stacked widget
+    */
+    void createViews();
+
+    /**
+    * @brief Method used to switch active view.
+    *
+    * @paraDaily scrum 2010-03-26m nextIndex 0 for listview, 1 for mapview
+    */
+    void switchView(int);
+
+private slots:
+    void openLocationUpdateDialog();
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+
+private:
+    SituareEngine *m_situareEngine;
+
+    ListViewScreen *m_listViewScreen;
+    MapViewScreen *m_mapViewScreen;
+    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
+    QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
+    QMenu *m_viewMenu; ///< Object that hold the view menu items
+
+    UpdateLocationDialog *m_locationDialog; ///< Message dialog
 };
 
 #endif // MAINWINDOW_H