Made some minor cosmetic changes (due to recently added settingsdialog files) and...
authorKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Wed, 28 Apr 2010 12:41:39 +0000 (15:41 +0300)
committerKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Wed, 28 Apr 2010 12:41:39 +0000 (15:41 +0300)
src/src.pro
src/ui/buttonitem.cpp
src/ui/infotab.cpp
src/ui/mainwindow.cpp
src/ui/mainwindow.h
src/ui/pixmap.cpp
src/ui/situareuser.cpp
src/ui/updatelocation/texteditautoresizer.h
src/ui/updatelocation/updatelocationdialog.h

index 2d54734..c0c920b 100644 (file)
@@ -29,7 +29,8 @@ SOURCES += main.cpp \
     user/user.cpp \
     ui/buttonitem.cpp \
     ui/situareuser.cpp \
-    engine/engine.cpp
+    engine/engine.cpp \
+    ui/settingsdialog.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -55,7 +56,8 @@ HEADERS += ui/mainwindow.h \
     ui/buttonitem.h \
     ui/situareuser.h \
     engine/engine.h \
-    user/user.h
+    user/user.h \
+    ui/settingsdialog.h
 QT += network \
     webkit
 
index f0173d6..d699875 100644 (file)
@@ -31,6 +31,8 @@ ButtonItem::ButtonItem(QWidget *parent)
 
 void ButtonItem::paintEvent(QPaintEvent *aPaintEvent)
 {
+    Q_UNUSED(aPaintEvent);
+
     //Look and feel settings
     int roundness(4);
 
index c020a09..3e290dd 100644 (file)
@@ -92,6 +92,7 @@ InfoTab::InfoTab(QWidget *parent)
 
 void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
 {
+    Q_UNUSED(aPaintEvent);
 
     QRect widgetRect = this->rect();
 
index 035ba02..e0c3e03 100644 (file)
@@ -24,6 +24,7 @@
 #include "mainwindow.h"
 #include "listviewscreen.h"
 #include "mapviewscreen.h"
+#include "settingsdialog.h"
 #include "facebookservice/facebookauthentication.h"
 #include "situareservice/situareservice.h"
 
@@ -31,13 +32,18 @@ MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
-
+    m_loggedIn = false;
     createViews();
     setCentralWidget(m_situareViews);
     createMenus();
     setWindowTitle(tr("List view"));
     this->hide();
 
+    m_facebookAuthenticator = new FacebookAuthentication(this);
+    connect(m_facebookAuthenticator, SIGNAL(credentialsReady()), this, SLOT(loginOK()));
+    connect(m_facebookAuthenticator, SIGNAL(userExit()), this, SLOT(loginScreenClosed()));
+    m_facebookAuthenticator->start();
+
     m_locationDialog = new UpdateLocationDialog(this);
     connect(m_listViewScreen->m_personalInfo,SIGNAL(launchMessageUpdate()),
             this,SLOT(openLocationUpdateDialog()));
@@ -45,6 +51,9 @@ MainWindow::MainWindow(QWidget *parent)
     connect(this, SIGNAL(reverseGeoReady(QString)), m_locationDialog, SLOT(setAddress(QString)));
     connect(m_locationDialog, SIGNAL(statusUpdate(QString,bool)), this,
             SIGNAL(statusUpdate(QString,bool)));
+    
+    m_networkManager = new QNetworkAccessManager;
+    m_situareService = new SituareService(this,m_networkManager);
 }
 
 MainWindow::~MainWindow()
@@ -52,6 +61,7 @@ MainWindow::~MainWindow()
     qDebug() << __PRETTY_FUNCTION__;
     delete m_toListViewAct;
     delete m_toMapViewAct;
+    delete m_toSettingsAct;
     delete m_situareViews;
 }
 
@@ -64,9 +74,13 @@ void MainWindow::createMenus()
     m_toMapViewAct = new QAction(tr("Map"), this);
     m_toMapViewAct->setObjectName(tr("Map"));
     connect(m_toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
+    m_toSettingsAct = new QAction(tr("Settings"), this);
+    m_toSettingsAct->setObjectName(tr("Settings"));
+    connect(m_toSettingsAct, SIGNAL(triggered()), this, SLOT(openSettingsDialog()));
     m_viewMenu = menuBar()->addMenu(tr("View"));
     m_viewMenu->addAction(m_toListViewAct);
     m_viewMenu->addAction(m_toMapViewAct);
+    m_viewMenu->addAction(m_toSettingsAct);
     m_viewMenu->setObjectName(tr("View Menu"));
 }
 
@@ -113,6 +127,7 @@ void MainWindow::switchView(int nextIndex)
             break;
     }
 }
+
 void MainWindow::openLocationUpdateDialog()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -120,3 +135,29 @@ void MainWindow::openLocationUpdateDialog()
     emit requestReverseGeo();
     m_locationDialog->exec();
 }
+
+void MainWindow::openSettingsDialog()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    SettingsDialog *dialog = new SettingsDialog(this);
+    dialog->show();
+}
+
+void MainWindow::loginScreenClosed()
+{
+    qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
+    if (m_loggedIn) {
+        this->show();
+        return;
+    }
+    else {
+        this->close();
+    }
+}
+
+void MainWindow::loginOK()
+{
+    qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
+    m_loggedIn = true;
+    m_facebookAuthenticator->close();
+}
index ff0a93f..3ea7fa0 100644 (file)
@@ -66,9 +66,15 @@ public:
  ******************************************************************************/
 public slots:
     /**
+    * @brief Public slot, which open settings dialog
+    */
+     void openSettingsDialog();
+
+    /**
     * @brief Public slot, which initiates toListViewAct action to switch view
     */
     void toListView();
+
     /**
     * @brief Public slot, which initiates toMapViewAct action to switch view
     */
@@ -88,11 +94,20 @@ private:
     /**
     * @brief Method used to switch active view.
     *
-    * @paraDaily scrum 2010-03-26m nextIndex 0 for listview, 1 for mapview
+    * @param nextIndex 0 for listview, 1 for mapview
     */
     void switchView(int);
 
 private slots:
+    /**
+    * @brief Slot to change value of m_loggedIn to true
+    */
+    void loginOK();
+
+    /**
+    * @brief Slot to check login status and exits if necessary
+    */
+    void loginScreenClosed();
 
     /**
     * @brief Private slot, which starts UpdateLocationDialog
@@ -135,9 +150,14 @@ private:
     ListViewScreen *m_listViewScreen;
     UpdateLocationDialog *m_locationDialog; ///< Message dialog
     MapViewScreen *m_mapViewScreen;
+    FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
+    QNetworkAccessManager *m_networkManager; ///< NetworkManager that is passed on to SituareService
+    SituareService *m_situareService; ///< Instance of the situare server communication service
+    bool m_loggedIn; ///< Boolean value to indicate whether login has been successfull or not
     QStackedWidget *m_situareViews; ///< Stacked widget that hold both view widgets
     QAction *m_toListViewAct; ///< Action to trigger switch to list view
     QAction *m_toMapViewAct; ///< Action to trigger switch to map view
+    QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
     QMenu *m_viewMenu; ///< Object that hold the view menu items
 };
 
index 1cf2984..2a2ac9c 100644 (file)
@@ -29,6 +29,8 @@ Pixmap::Pixmap(const QPixmap &picture, QGraphicsObject *parent)
 
 void Pixmap::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
+    Q_UNUSED(event);
+
     emit clicked();
     qDebug() << __PRETTY_FUNCTION__;
 }
index 94e5e9d..d457e7f 100644 (file)
@@ -31,6 +31,7 @@ SituareUser::SituareUser(QWidget *parent)
 
 void SituareUser::paintEvent(QPaintEvent *aPaintEvent)
 {
+    Q_UNUSED(aPaintEvent);
 
     int roundness(9);
 
index 64c4af6..52a3ca8 100755 (executable)
@@ -45,6 +45,9 @@ public:
     */
     TextEditAutoResizer(QWidget *parent = 0);
 
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
 private slots:
     /**
     * @brief Private slot which indicate when textEdit has been changed
@@ -52,7 +55,9 @@ private slots:
     * @fn textEditChanged
     */
     void textEditChanged();
-
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
 private:
     QFrame *m_edit; ///< Pointer to Frame
     QPlainTextEdit *m_plainTextEdit; ///< Pointer to PlainTextEdit
@@ -60,4 +65,3 @@ private:
 };
 
 #endif // TEXTEDITAUTORESIZER_H
-
index 9ebbd29..820bd1c 100755 (executable)
@@ -34,9 +34,9 @@ class QDialogButtonBox;
 class QGroupBox;
 class QLabel;
 class QLineEdit;
-class QTextEdit;
 class QPushButton;
 class QScrollArea;
+class QTextEdit;
 
 /**
 * @brief Update Location UI