882b08232bf50f6173cd91106ee1a56b15734283
[situare] / src / ui / mainwindow.cpp
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Henri Lampela - henri.lampela@ixonos.com
6        Kaj Wallin - kaj.wallin@ixonos.com
7
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.
11
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.
16
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,
20     USA.
21  */
22
23 #include <QtGui>
24 #include "mainwindow.h"
25
26 MainWindow::MainWindow(QWidget *parent)
27     : QMainWindow(parent)
28 {
29     QWidget *widget = new QWidget;
30     setCentralWidget(widget);
31     createViews();
32
33     QHBoxLayout *tabsLayout = new QHBoxLayout;
34     QLabel *tabFieldLabel = new QLabel;
35     tabFieldLabel->setText(tr("This is TabBar label"));
36     tabsLayout->addWidget(situareTabs);
37     tabsLayout->addWidget(tabFieldLabel);
38
39     QVBoxLayout *mainLayout = new QVBoxLayout;
40     mainLayout->addLayout(tabsLayout);
41     mainLayout->addWidget(situareViews);
42     widget->setLayout(mainLayout);
43
44     this->setWindowTitle(tr("Situare"));
45 }
46
47 MainWindow::~MainWindow()
48 {
49
50 }
51
52 void MainWindow::createViews()
53 {
54     situareViews = new QStackedWidget(this);
55     situareViews->addWidget(new SituareListView(this));
56     situareViews->addWidget(new SituareMapView(this));
57
58     situareTabs = new QTabBar(this);
59     situareTabs->addTab(tr("List"));
60     situareTabs->addTab(tr("Map"));
61     connect(situareTabs, SIGNAL(currentChanged(int)), situareViews, SLOT(setCurrentIndex(int)));
62 }
63
64 SituareListView::SituareListView(QWidget *parent)
65     : QWidget(parent)
66 {
67     QPushButton *listViewButton = new QPushButton(tr("This is listview"));
68     QHBoxLayout *listViewLayout = new QHBoxLayout;
69     listViewLayout->addWidget(listViewButton);
70     setLayout(listViewLayout);
71 }
72
73 SituareMapView::SituareMapView(QWidget *parent)
74     : QWidget(parent)
75 {
76     QPushButton *mapViewButton = new QPushButton(tr("THIS IS MAPVIEEEEEW!"));
77     QHBoxLayout *mapViewLayout = new QHBoxLayout;
78     mapViewLayout->addWidget(mapViewButton);
79     setLayout(mapViewLayout);
80 }