2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
6 Kaj Wallin - kaj.wallin@ixonos.com
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.
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.
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,
24 #include "mainwindow.h"
25 #include "listviewscreen.h"
26 #include "mapviewscreen.h"
27 #include "facebookservice/facebookauthentication.h"
28 #include "situareservice/situareservice.h"
29 #include "engine/engine.h"
31 MainWindow::MainWindow(QWidget *parent)
34 qDebug() << __PRETTY_FUNCTION__;
37 setCentralWidget(m_situareViews);
39 setWindowTitle(tr("List view"));
42 m_situareEngine = new SituareEngine(this);
43 connect(m_situareEngine, SIGNAL(engine_showMainWindow()), this, SLOT(show()));
44 connect(m_situareEngine, SIGNAL(engine_closeMainWindow()), this, SLOT(close()));
46 // connect(m_listViewScreen->m_personalInfo,
47 // SIGNAL(launchUpdateFriendsStatus()),
49 // SLOT(updateFriendsList()));
51 m_situareEngine->start();
54 MainWindow::~MainWindow()
56 qDebug() << __PRETTY_FUNCTION__;
57 delete m_toListViewAct;
58 delete m_toMapViewAct;
59 delete m_situareViews;
62 void MainWindow::createMenus()
64 qDebug() << __PRETTY_FUNCTION__;
65 m_toListViewAct = new QAction(tr("List"), this);
66 m_toListViewAct->setObjectName(tr("List"));
67 connect(m_toListViewAct, SIGNAL(triggered()), this, SLOT(toListView()));
68 m_toMapViewAct = new QAction(tr("Map"), this);
69 m_toMapViewAct->setObjectName(tr("Map"));
70 connect(m_toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
71 m_viewMenu = menuBar()->addMenu(tr("View"));
72 m_viewMenu->addAction(m_toListViewAct);
73 m_viewMenu->addAction(m_toMapViewAct);
74 m_viewMenu->setObjectName(tr("View Menu"));
77 void MainWindow::createViews()
79 qDebug() << __PRETTY_FUNCTION__;
80 m_listViewScreen = new ListViewScreen(this);
81 m_mapViewScreen = new MapViewScreen(this);
83 m_situareViews = new QStackedWidget;
84 m_situareViews->addWidget(m_listViewScreen);
85 m_situareViews->addWidget(m_mapViewScreen);
88 void MainWindow::toListView()
90 qDebug() << __PRETTY_FUNCTION__;
94 void MainWindow::toMapView()
96 qDebug() << __PRETTY_FUNCTION__;
100 void MainWindow::switchView(int nextIndex)
102 qDebug() << __PRETTY_FUNCTION__ << ":" << nextIndex;
103 if (nextIndex < 0 || nextIndex > 1) {
104 qDebug() << "Illegal parameter value in MainWindow::switchView";
107 m_situareViews->setCurrentIndex(nextIndex);
108 switch (m_situareViews->currentIndex()) {
110 setWindowTitle(tr("List view"));
113 setWindowTitle(tr("Map view"));
116 qDebug() << "Illegal switch value in MainWindow::switchView";