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"
29 MainWindow::MainWindow(QWidget *parent)
32 qDebug() << __PRETTY_FUNCTION__;
35 setCentralWidget(situareViews);
37 setWindowTitle(tr("List view"));
40 connect(this,SIGNAL(testLoginClosed()), this, SLOT(loginScreenClosed()));
44 MainWindow::~MainWindow()
46 qDebug() << __PRETTY_FUNCTION__;
52 void MainWindow::createMenus()
54 qDebug() << __PRETTY_FUNCTION__;
55 toListViewAct = new QAction(tr("List"), this);
56 toListViewAct->setObjectName(tr("List"));
57 connect(toListViewAct, SIGNAL(triggered()), this, SLOT(toListView()));
58 toMapViewAct = new QAction(tr("Map"), this);
59 toMapViewAct->setObjectName(tr("Map"));
60 connect(toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
61 viewMenu = menuBar()->addMenu(tr("View"));
62 viewMenu->addAction(toListViewAct);
63 viewMenu->addAction(toMapViewAct);
64 viewMenu->setObjectName(tr("View Menu"));
66 FBAuth = new FacebookAuthentication(this);
70 connect(FBAuth, SIGNAL(credentialsReady()), this, SLOT(loginOK()));
71 connect(FBAuth, SIGNAL(userExit()), this, SLOT(loginScreenClosed()));
75 void MainWindow::createViews()
77 qDebug() << __PRETTY_FUNCTION__;
78 situareViews = new QStackedWidget;
79 situareViews->addWidget(new ListViewScreen);
80 situareViews->addWidget(new MapViewScreen);
83 void MainWindow::toListView()
85 qDebug() << __PRETTY_FUNCTION__;
89 void MainWindow::toMapView()
91 qDebug() << __PRETTY_FUNCTION__;
95 void MainWindow::switchView(int nextIndex)
97 qDebug() << __PRETTY_FUNCTION__ << ":" << nextIndex;
98 if (nextIndex < 0 || nextIndex > 1) {
99 qDebug() << tr("Illegal parameter value in MainWindow::switchView");
102 situareViews->setCurrentIndex(nextIndex);
103 switch (situareViews->currentIndex()) {
105 setWindowTitle(tr("List view"));
108 setWindowTitle(tr("Map view"));
111 qDebug() << tr("Illegal switch value in MainWindow::switchView");
116 void MainWindow::loginScreenClosed()
118 qDebug() << __PRETTY_FUNCTION__ << loggedIn;
128 void MainWindow::loginOK()
130 qDebug() << __PRETTY_FUNCTION__ << loggedIn;