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(m_situareViews);
37 setWindowTitle(tr("List view"));
40 connect(this,SIGNAL(testLoginClosed()), this, SLOT(loginScreenClosed()));
44 MainWindow::~MainWindow()
46 qDebug() << __PRETTY_FUNCTION__;
47 delete m_toListViewAct;
48 delete m_toMapViewAct;
49 delete m_situareViews;
52 void MainWindow::createMenus()
54 qDebug() << __PRETTY_FUNCTION__;
55 m_toListViewAct = new QAction(tr("List"), this);
56 m_toListViewAct->setObjectName(tr("List"));
57 connect(m_toListViewAct, SIGNAL(triggered()), this, SLOT(toListView()));
58 m_toMapViewAct = new QAction(tr("Map"), this);
59 m_toMapViewAct->setObjectName(tr("Map"));
60 connect(m_toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
61 m_viewMenu = menuBar()->addMenu(tr("View"));
62 m_viewMenu->addAction(m_toListViewAct);
63 m_viewMenu->addAction(m_toMapViewAct);
64 m_viewMenu->setObjectName(tr("View Menu"));
66 m_openUpdateDialog = new QAction(tr("D_Update"), this);
67 connect(m_openUpdateDialog, SIGNAL(triggered()), this, SLOT(openUpdateDialog()));
68 m_viewMenu->addAction(m_openUpdateDialog);
71 FBAuth = new FacebookAuthentication(this);
75 connect(FBAuth, SIGNAL(credentialsReady()), this, SLOT(loginOK()));
76 connect(FBAuth, SIGNAL(userExit()), this, SLOT(loginScreenClosed()));
80 void MainWindow::createViews()
82 qDebug() << __PRETTY_FUNCTION__;
83 m_situareViews = new QStackedWidget;
84 m_situareViews->addWidget(new ListViewScreen);
85 m_situareViews->addWidget(new 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";
121 void MainWindow::loginScreenClosed()
123 qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
133 void MainWindow::loginOK()
135 qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
140 void MainWindow::openUpdateDialog()
142 qDebug() << "JIIHAA!";