Edited header files to match coding conventions. Changed member
authorKaj Wallin <kaj.wallin@ixonos.com>
Mon, 19 Apr 2010 07:25:09 +0000 (10:25 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Mon, 19 Apr 2010 07:25:09 +0000 (10:25 +0300)
variable names.

src/ui/mainwindow.cpp
src/ui/mainwindow.h
tests/ui/mainwindow/mainwindow_test.cpp

index 39076b7..451972b 100644 (file)
@@ -30,9 +30,9 @@ MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
-    loggedIn = false;
+    m_loggedIn = false;
     createViews();
-    setCentralWidget(situareViews);
+    setCentralWidget(m_situareViews);
     createMenus();
     setWindowTitle(tr("List view"));
     //this->show();
@@ -44,24 +44,25 @@ MainWindow::MainWindow(QWidget *parent)
 MainWindow::~MainWindow()
 {
     qDebug() << __PRETTY_FUNCTION__;
-    delete toListViewAct;
-    delete toMapViewAct;
-    delete situareViews;
+    delete m_toListViewAct;
+    delete m_toMapViewAct;
+    delete m_situareViews;
 }
 
 void MainWindow::createMenus()
 {
     qDebug() << __PRETTY_FUNCTION__;
-    toListViewAct = new QAction(tr("List"), this);
-    toListViewAct->setObjectName(tr("List"));
-    connect(toListViewAct, SIGNAL(triggered()), this, SLOT(toListView()));
-    toMapViewAct = new QAction(tr("Map"), this);
-    toMapViewAct->setObjectName(tr("Map"));
-    connect(toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
-    viewMenu = menuBar()->addMenu(tr("View"));
-    viewMenu->addAction(toListViewAct);
-    viewMenu->addAction(toMapViewAct);
-    viewMenu->setObjectName(tr("View Menu"));
+    m_toListViewAct = new QAction(tr("List"), this);
+    m_toListViewAct->setObjectName(tr("List"));
+    connect(m_toListViewAct, SIGNAL(triggered()), this, SLOT(toListView()));
+    m_toMapViewAct = new QAction(tr("Map"), this);
+    m_toMapViewAct->setObjectName(tr("Map"));
+    connect(m_toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
+    m_viewMenu = menuBar()->addMenu(tr("View"));
+    m_viewMenu->addAction(m_toListViewAct);
+    m_viewMenu->addAction(m_toMapViewAct);
+    m_viewMenu->setObjectName(tr("View Menu"));
+    this->show();
 /*
     FBAuth = new FacebookAuthentication(this);
     FBAuth->show();
@@ -75,9 +76,9 @@ void MainWindow::createMenus()
 void MainWindow::createViews()
 {
     qDebug() << __PRETTY_FUNCTION__;
-    situareViews = new QStackedWidget;
-    situareViews->addWidget(new ListViewScreen);
-    situareViews->addWidget(new MapViewScreen);
+    m_situareViews = new QStackedWidget;
+    m_situareViews->addWidget(new ListViewScreen);
+    m_situareViews->addWidget(new MapViewScreen);
 }
 
 void MainWindow::toListView()
@@ -99,8 +100,8 @@ void MainWindow::switchView(int nextIndex)
         qDebug() << tr("Illegal parameter value in MainWindow::switchView");
         return;
     }
-    situareViews->setCurrentIndex(nextIndex);
-    switch (situareViews->currentIndex()) {
+    m_situareViews->setCurrentIndex(nextIndex);
+    switch (m_situareViews->currentIndex()) {
         case 0:
             setWindowTitle(tr("List view"));
             break;
@@ -115,8 +116,8 @@ void MainWindow::switchView(int nextIndex)
 
 void MainWindow::loginScreenClosed()
 {
-    qDebug() << __PRETTY_FUNCTION__ << loggedIn;
-    if (loggedIn) {
+    qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
+    if (m_loggedIn) {
         //this->show();
         return;
     }
@@ -127,6 +128,6 @@ void MainWindow::loginScreenClosed()
 
 void MainWindow::loginOK()
 {
-    qDebug() << __PRETTY_FUNCTION__ << loggedIn;
-    loggedIn = true;
+    qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
+    m_loggedIn = true;
 }
index bdb50f5..fe308d2 100644 (file)
@@ -33,7 +33,7 @@ class QLabel;
 class QStackedWidget;
 
 /**
-* @Main Window Class
+* @brief Main Window Class
 *
 * @class MainWindow mainwindow.h "src/ui/mainwindow.h"
 */
@@ -42,81 +42,63 @@ class MainWindow : public QMainWindow
     Q_OBJECT
 
 public:
-    MainWindow(QWidget *parent = 0);
-    ~MainWindow();
-
-private:
     /**
-    * @brief Flag to indicate whether successful login has been done
+    * @brief Constructor
     *
-    * @var loggedIn
+    * @param parent Parent
     */
-    bool loggedIn;
+    MainWindow(QWidget *parent = 0);
 
     /**
-    * @brief Private method to create List and Map views as a stacked widget
-    *
-    * @fn createViews
+    * @brief Destructor
     */
-    void createViews();
+    ~MainWindow();
+
+public slots:
     /**
-    * @brief Widget Stack object for the List and Map Views
-    *
-    * @var situareViews
+    * @brief Public slot, which initiates toListViewAct action to switch view
     */
-    QStackedWidget *situareViews;
+    void toListView();
 
     /**
-    * @brief Private method to create the Menu items
-    *
-    * @fn createMenus
+    * @brief Public slot, which initiates toMapViewAct action to switch view
     */
-    void createMenus();
-    QMenu *viewMenu;
+    void toMapView();
 
+private:
     /**
-    * @brief Action item for changing view to List View
-    *
-    * @var toListViewAct
+    * @brief Private method to create List and Map views as a stacked widget
     */
-    QAction *toListViewAct;
+    void createViews();
+
     /**
-    * @brief Action item for changing view to Map View
-    *
-    * @var toMapViewAct
+    * @brief Private method to create the Menu items
     */
-    QAction *toMapViewAct;
+    void createMenus();
 
     /**
     * @brief Method used to switch active view.
     *
-    * @fn switchView
-    * @param int 0 for listview, 1 for mapview
+    * @param nextIndex 0 for listview, 1 for mapview
     */
     void switchView(int);
 
-public slots:
-    /**
-    * @brief Public slot, which initiates toListViewAct action to switch view
-    *
-    * @fn toListView
-    */
-    void toListView();
-    /**
-    * @brief Public slot, which initiates toMapViewAct action to switch view
-    *
-    * @fn toMapView
-    */
-    void toMapView();
+private:
+    bool m_loggedIn; ///< Boolean value to indicate whether login has been successfull or not
+    QStackedWidget *m_situareViews; ///< Stacked widget that hold both view widgets
+    QMenu *m_viewMenu; ///< Object that hold the view menu items
+    QAction *m_toListViewAct; ///< Action to trigger switch to list view
+    QAction *m_toMapViewAct; ///< Action to trigger switch to map view
 
 private slots:
     /**
-    * @brief Intercepts signal fom closing login window. Checks login status and exits if necessary
-    *
-    * @fn loginScreenClosed
+    * @brief Slot to check login status and exits if necessary
     */
     void loginScreenClosed();
 
+    /**
+    * @brief Slot to change value of m_loggedIn to true
+    */
     void loginOK();
 };
 
index 5edbf1d..5bff78e 100644 (file)
@@ -40,36 +40,35 @@ private slots:
 void testMainWindow::testViewSwitch()
 {
     MainWindow mainwindow;
-    QStackedWidget *testStack = dynamic_cast<QStackedWidget*>(mainwindow.centralWidget());
+    QStackedWidget *m_testStack = dynamic_cast<QStackedWidget*>(mainwindow.centralWidget());
     mainwindow.toListView();
-    QCOMPARE(testStack->currentIndex(), 0);
+    QCOMPARE(m_testStack->currentIndex(), 0);
     QCOMPARE(mainwindow.windowTitle(),QString(tr("List view")));
     mainwindow.toMapView();
-    QCOMPARE(testStack->currentIndex(), 1);
+    QCOMPARE(m_testStack->currentIndex(), 1);
     QCOMPARE(mainwindow.windowTitle(),QString(tr("Map view")));
     mainwindow.toMapView();
-    QCOMPARE(testStack->currentIndex(), 1);
+    QCOMPARE(m_testStack->currentIndex(), 1);
     QCOMPARE(mainwindow.windowTitle(),QString(tr("Map view")));
     mainwindow.toListView();
-    QCOMPARE(testStack->currentIndex(), 0);
+    QCOMPARE(m_testStack->currentIndex(), 0);
     QCOMPARE(mainwindow.windowTitle(),QString(tr("List view")));
-
 }
 void testMainWindow::verifyStackItems()
 {
     MainWindow mainwindow;
-    QStackedWidget *testStack = dynamic_cast<QStackedWidget*>(mainwindow.centralWidget());
-    QCOMPARE(testStack->count(), 2);
-    QCOMPARE(testStack->widget(0)->objectName(),QString(tr("List view")));
-    QCOMPARE(testStack->widget(1)->objectName(),QString(tr("Map view")));
+    QStackedWidget *m_testStack = dynamic_cast<QStackedWidget*>(mainwindow.centralWidget());
+    QCOMPARE(m_testStack->count(), 2);
+    QCOMPARE(m_testStack->widget(0)->objectName(),QString(tr("List view")));
+    QCOMPARE(m_testStack->widget(1)->objectName(),QString(tr("Map view")));
 }
 
 /* NON-WORKING TEST
 void testMainWindow::verifyMenuItems()
 {
     MainWindow mainwindow;
-    QWidget *testMenu = mainwindow.menuWidget();
-    qDebug() << testMenu->actions();
+    QWidget *m_testMenu = mainwindow.menuWidget();
+    qDebug() << m_testMenu->actions();
 }
 */