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 "listviewtab.h"
26 #include "mapviewtab.h"
28 MainWindow::MainWindow(QWidget *parent)
31 QWidget *widget = new QWidget;
32 setCentralWidget(widget);
34 QVBoxLayout *mainLayout = new QVBoxLayout;
35 infoLabel = new QLabel(tr("Click \"view\", to change between views"),this);
36 infoLabel->setAttribute(Qt::WA_TranslucentBackground, true);
37 mainLayout->addWidget(infoLabel);
38 mainLayout->addWidget(situareViews);
39 widget->setLayout(mainLayout);
42 this->setWindowTitle(tr("View"));
45 MainWindow::~MainWindow()
48 * Add delete's if you get memory leak warnings with cppcheck
56 void MainWindow::createMenus()
58 toListViewAct = new QAction(tr("List"), this);
59 connect(toListViewAct, SIGNAL(triggered()), this, SLOT(toListView()));
60 toMapViewAct = new QAction(tr("Map"), this);
61 connect(toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
62 viewMenu = menuBar()->addMenu(tr("View"));
63 viewMenu->addAction(toListViewAct);
64 viewMenu->addAction(toMapViewAct);
67 void MainWindow::createViews()
69 situareViews = new QStackedWidget(this);
70 situareViews->addWidget(new SituareListView(this));
71 situareViews->addWidget(new SituareMapView(this));
74 void MainWindow::toListView()
76 this->situareViews->setCurrentIndex(0);
77 infoLabel->setText(tr("Current: %1").arg(situareViews->currentIndex()));
78 this->setWindowTitle("List");
81 void MainWindow::toMapView()
83 this->situareViews->setCurrentIndex(1);
84 infoLabel->setText(tr("Current: %1").arg(situareViews->currentIndex()));
85 this->setWindowTitle("Map");