variable names.
: QMainWindow(parent)
{
qDebug() << __PRETTY_FUNCTION__;
- loggedIn = false;
+ m_loggedIn = false;
createViews();
- setCentralWidget(situareViews);
+ setCentralWidget(m_situareViews);
createMenus();
setWindowTitle(tr("List view"));
//this->show();
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();
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()
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;
void MainWindow::loginScreenClosed()
{
- qDebug() << __PRETTY_FUNCTION__ << loggedIn;
- if (loggedIn) {
+ qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
+ if (m_loggedIn) {
//this->show();
return;
}
void MainWindow::loginOK()
{
- qDebug() << __PRETTY_FUNCTION__ << loggedIn;
- loggedIn = true;
+ qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
+ m_loggedIn = true;
}
class QStackedWidget;
/**
-* @Main Window Class
+* @brief Main Window Class
*
* @class MainWindow mainwindow.h "src/ui/mainwindow.h"
*/
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();
};
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();
}
*/