Implemented List and Map views as widget stack. Views filled with
authorKaj Wallin <kaj.wallin@ixonos.com>
Mon, 29 Mar 2010 10:06:25 +0000 (13:06 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Mon, 29 Mar 2010 10:06:25 +0000 (13:06 +0300)
dummy widgets.

src/ui/mainwindow.cpp
src/ui/mainwindow.h

index ffcb436..a6114da 100644 (file)
@@ -28,16 +28,16 @@ MainWindow::MainWindow(QWidget *parent)
 {
     QWidget *widget = new QWidget;
     setCentralWidget(widget);
-//    createViews();
+    createViews();
 
-    QVBoxLayout *mainleiska = new QVBoxLayout;
+    QVBoxLayout *mainLayout = new QVBoxLayout;
     infoLabel = new QLabel(tr("This is the beginning"),this);
-    mainleiska->addWidget(infoLabel);
+    mainLayout->addWidget(infoLabel);
+    mainLayout->addWidget(situareViews);
+    widget->setLayout(mainLayout);
 
-    widget->setLayout(mainleiska);
     this->setWindowTitle(tr("Situare"));
     createMenus();
-
 }
 
 MainWindow::~MainWindow()
@@ -58,12 +58,14 @@ void MainWindow::createMenus()
 
 void MainWindow::toListView()
 {
-    infoLabel->setText(tr("List view invoked"));
+    this->situareViews->setCurrentIndex(0);
+    infoLabel->setText(tr("Current: %1").arg(situareViews->currentIndex()));
 }
 
 void MainWindow::toMapView()
 {
-    infoLabel->setText(tr("Map view invoked"));
+    this->situareViews->setCurrentIndex(1);
+    infoLabel->setText(tr("Current: %1").arg(situareViews->currentIndex()));
 }
 
 void MainWindow::createViews()
@@ -85,7 +87,7 @@ SituareListView::SituareListView(QWidget *parent)
 SituareMapView::SituareMapView(QWidget *parent)
     : QWidget(parent)
 {
-    QPushButton *mapViewButton = new QPushButton(tr("THIS IS MAPVIEW !!"));
+    QPushButton *mapViewButton = new QPushButton(tr("THIS IS MAPVIEEEEEW!"));
     QHBoxLayout *mapViewLayout = new QHBoxLayout;
     mapViewLayout->addWidget(mapViewButton);
     setLayout(mapViewLayout);
index 46f6997..ae4a600 100644 (file)
@@ -31,6 +31,11 @@ class QAction;
 class QStackedWidget;
 class QLabel;
 
+/**
+* @Main Window Class
+*
+* @class MainWindow mainwindow.h "src/ui/mainwindow.h"
+*/
 class MainWindow : public QMainWindow
 {
     Q_OBJECT
@@ -40,27 +45,78 @@ public:
     ~MainWindow();
 
 private:
+    /**
+    * @brief Private method to create the Menu items
+    *
+    * @fn createMenus
+    */
     void createMenus();
+    /**
+    * @brief Private method to create List and Map views as a stacked widget
+    *
+    * @fn createViews
+    */
     void createViews();
 
     QMenu *viewMenu;
+    /**
+    * @brief Action item for changing view to List View
+    *
+    * @var toListViewAct
+    */
     QAction *toListViewAct;
+    /**
+    * @brief Action item for changing view to Map View
+    *
+    * @var toMapViewAct
+    */
     QAction *toMapViewAct;
+    /**
+    * @brief Widget Stack object for the List and Map Views
+    *
+    * @var situareViews
+    */
     QStackedWidget *situareViews;
 
+    /**
+    * @brief DUMMY LABEL, REMOVE WHEN BOTH VIEWS ARE COMPLETE
+    *
+    * @var infoLabel
+    * @todo REMOVE THIS
+    */
     QLabel *infoLabel;
 
 private slots:
+    /**
+    * @brief Private slot, which initiates toListViewAct action
+    *
+    * @fn toListView
+    */
     void toListView();
+    /**
+    * @brief Private slots, which initiates toMapViewAct action
+    *
+    * @fn toMapView
+    */
     void toMapView();
 };
 
+/**
+* @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: