Moved tab data to separate files to allow easy modification.
authorKaj Wallin <kaj.wallin@ixonos.com>
Tue, 30 Mar 2010 10:28:48 +0000 (13:28 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Tue, 30 Mar 2010 10:28:48 +0000 (13:28 +0300)
Situare.pro
src/ui/listviewtab.cpp [new file with mode: 0644]
src/ui/listviewtab.h [new file with mode: 0644]
src/ui/mainwindow.cpp
src/ui/mainwindow.h
src/ui/mapviewtab.cpp [new file with mode: 0644]
src/ui/mapviewtab.h [new file with mode: 0644]

index 26f1ef4..7feb438 100644 (file)
@@ -1,14 +1,12 @@
-#-------------------------------------------------
-#
+# -------------------------------------------------
 # Project created by QtCreator 2010-03-26T07:57:35
-#
-#-------------------------------------------------
-
+# -------------------------------------------------
 TARGET = Situare
 TEMPLATE = app
-
-
-SOURCES += src/main.cpp\
-        src/ui/mainwindow.cpp
-
-HEADERS  += src/ui/mainwindow.h
+SOURCES += src/main.cpp \
+    src/ui/mainwindow.cpp \
+    src/ui/listviewtab.cpp \
+    src/ui/mapviewtab.cpp
+HEADERS += src/ui/mainwindow.h \
+    src/ui/listviewtab.h \
+    src/ui/mapviewtab.h
diff --git a/src/ui/listviewtab.cpp b/src/ui/listviewtab.cpp
new file mode 100644 (file)
index 0000000..b32684e
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+      Kaj Wallin - kaj.wallin@ixonos.com
+
+   Situare is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
+
+   Situare is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with Situare; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+   USA.
+*/
+
+#include "listviewtab.h"
+
+SituareListView::SituareListView(QWidget *parent)
+   : QWidget(parent)
+{
+   QPushButton *listViewButton = new QPushButton(tr("This is listview"));
+   QHBoxLayout *listViewLayout = new QHBoxLayout;
+   listViewLayout->addWidget(listViewButton);
+   setLayout(listViewLayout);
+}
diff --git a/src/ui/listviewtab.h b/src/ui/listviewtab.h
new file mode 100644 (file)
index 0000000..1dc669a
--- /dev/null
@@ -0,0 +1,39 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+       Kaj Wallin - kaj.wallin@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+ */
+
+
+#ifndef LISTVIEWTAB_H
+#define LISTVIEWTAB_H
+
+#include <QtGui>
+
+/**
+* @brief List View class. Used for displaying List of friends
+*
+* @class SituareListView mainwindow.h "src/ui/mainwindow.h"
+*/
+class SituareListView : public QWidget
+{
+public:
+    SituareListView(QWidget *parent = 0);
+};
+
+#endif // LISTVIEWTAB_H
index 882b082..7b8d2c3 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <QtGui>
 #include "mainwindow.h"
+#include "listviewtab.h"
+#include "mapviewtab.h"
 
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
@@ -30,11 +32,14 @@ MainWindow::MainWindow(QWidget *parent)
     setCentralWidget(widget);
     createViews();
 
-    QHBoxLayout *tabsLayout = new QHBoxLayout;
-    QLabel *tabFieldLabel = new QLabel;
-    tabFieldLabel->setText(tr("This is TabBar label"));
-    tabsLayout->addWidget(situareTabs);
-    tabsLayout->addWidget(tabFieldLabel);
+    QGridLayout *tabsLayout = new QGridLayout;
+    tabFieldLabel = new QLabel;
+    QFont font;
+    font.setPixelSize(10);
+    tabFieldLabel->setFont(font);
+    tabFieldLabel->setText(tr("This is TabBar label\nCurrent StackedWidget index: %1\nTsdaa: %2").arg(situareViews->currentIndex()).arg(2));
+    tabsLayout->addWidget(situareTabs,0,0,1,1);
+    tabsLayout->addWidget(tabFieldLabel,0,1,1,2);
 
     QVBoxLayout *mainLayout = new QVBoxLayout;
     mainLayout->addLayout(tabsLayout);
@@ -59,22 +64,10 @@ void MainWindow::createViews()
     situareTabs->addTab(tr("List"));
     situareTabs->addTab(tr("Map"));
     connect(situareTabs, SIGNAL(currentChanged(int)), situareViews, SLOT(setCurrentIndex(int)));
+    connect(situareTabs, SIGNAL(currentChanged(int)), this, SLOT(updateTabLabel()));
 }
 
-SituareListView::SituareListView(QWidget *parent)
-    : QWidget(parent)
+void MainWindow::updateTabLabel()
 {
-    QPushButton *listViewButton = new QPushButton(tr("This is listview"));
-    QHBoxLayout *listViewLayout = new QHBoxLayout;
-    listViewLayout->addWidget(listViewButton);
-    setLayout(listViewLayout);
-}
-
-SituareMapView::SituareMapView(QWidget *parent)
-    : QWidget(parent)
-{
-    QPushButton *mapViewButton = new QPushButton(tr("THIS IS MAPVIEEEEEW!"));
-    QHBoxLayout *mapViewLayout = new QHBoxLayout;
-    mapViewLayout->addWidget(mapViewButton);
-    setLayout(mapViewLayout);
+    tabFieldLabel->setText(tr("This is TabBar label\nCurrent StackedWidget index: %1\nTsdaa: %2").arg(situareViews->currentIndex()).arg(2));
 }
index 80e2df7..e84873c 100644 (file)
@@ -20,6 +20,7 @@
     USA.
  */
 
+
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 
@@ -45,7 +46,6 @@ public:
     MainWindow(QWidget *parent = 0);
     ~MainWindow();
 
-private:
     /**
     * @brief Private method to create List and Map views as a stacked widget
     *
@@ -62,6 +62,7 @@ private:
     QStackedWidget *situareViews;
 
     QTabBar *situareTabs;
+    QLabel *tabFieldLabel;
 
     /**
     * @brief DUMMY LABEL, REMOVE WHEN BOTH VIEWS ARE COMPLETE
@@ -70,28 +71,9 @@ private:
     * @todo REMOVE THIS
     */
     QLabel *infoLabel;
-};
-
-/**
-* @brief List View class. Used for displaying List of friends
-*
-* @class SituareListView mainwindow.h "src/ui/mainwindow.h"
-*/
-class SituareListView : public QWidget
-{
-public:
-    SituareListView(QWidget *parent = 0);
-};
 
-/**
-* @brief Map View class. Used to display Map
-*
-* @class SituareMapView mainwindow.h "src/ui/mainwindow.h"
-*/
-class SituareMapView : public QWidget
-{
-public:
-    SituareMapView(QWidget *parent = 0);
+public slots:
+    void updateTabLabel();
 };
 
 #endif // MAINWINDOW_H
diff --git a/src/ui/mapviewtab.cpp b/src/ui/mapviewtab.cpp
new file mode 100644 (file)
index 0000000..37c65be
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+      Kaj Wallin - kaj.wallin@ixonos.com
+
+   Situare is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
+
+   Situare is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with Situare; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+   USA.
+*/
+
+#include "mapviewtab.h"
+
+SituareMapView::SituareMapView(QWidget *parent)
+   : QWidget(parent)
+{
+   QPushButton *mapViewButton = new QPushButton(tr("This is MAPVIEW"));
+   QHBoxLayout *mapViewLayout = new QHBoxLayout;
+   mapViewLayout->addWidget(mapViewButton);
+   setLayout(mapViewLayout);
+}
diff --git a/src/ui/mapviewtab.h b/src/ui/mapviewtab.h
new file mode 100644 (file)
index 0000000..9d2c2ae
--- /dev/null
@@ -0,0 +1,39 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+       Kaj Wallin - kaj.wallin@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+ */
+
+
+#ifndef MAPVIEWTAB_H
+#define MAPVIEWTAB_H
+
+#include <QtGui>
+
+/**
+* @brief Map View class. Used to display Map
+*
+* @class SituareMapView mainwindow.h "src/ui/mainwindow.h"
+*/
+class SituareMapView : public QWidget
+{
+public:
+    SituareMapView(QWidget *parent = 0);
+};
+
+#endif // MAPVIEWTAB_H