--- /dev/null
+ /*
+ 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 "engine.h"
+
+SituareEngine::SituareEngine(QMainWindow *parent)
+ : QObject(parent)
+{
+ m_networkManager = new QNetworkAccessManager;
+ m_situareService = new SituareService(this,m_networkManager);
+
+ m_loggedIn = false;
+ m_facebookAuthenticator = new FacebookAuthentication();
+ connect(m_facebookAuthenticator, SIGNAL(credentialsReady()), this, SLOT(loginOk()));
+ connect(m_facebookAuthenticator, SIGNAL(userExit()), this, SLOT(loginScreenClosed()));
+}
+
+SituareEngine::~SituareEngine()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
+void SituareEngine::start()
+{
+ m_facebookAuthenticator->start();
+}
+
+
+void SituareEngine::loginOk()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ m_loggedIn = true;
+ m_facebookAuthenticator->close();
+}
+void SituareEngine::loginScreenClosed()
+{
+ qDebug() << __PRETTY_FUNCTION__ << m_loggedIn;
+ if (m_loggedIn) {
+ emit engine_showMainWindow();
+ return;
+ }
+ else {
+ emit engine_closeMainWindow();
+ }
+}
+void SituareEngine::updateFriendsList()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ //code here
+}
--- /dev/null
+ /*
+ 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 ENGINE_H
+#define ENGINE_H
+
+#include <QWidget>
+#include <QtDebug>
+#include "facebookservice/facebookauthentication.h"
+#include "situareservice/situareservice.h"
+#include <QNetworkAccessManager>
+
+/**
+* @brief Engine class for Situare Application
+*
+* This class handles all the underlaying login of the Situare
+* application.
+*
+* @class SituareEngine engine.h "engine/engine.h"
+*/
+class SituareEngine : public QObject
+{
+ Q_OBJECT
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent
+ */
+ SituareEngine(QMainWindow *parent = 0);
+
+ /**
+ * @brief Destructor
+ */
+ ~SituareEngine();
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+ /**
+ * @brief Function to start engine component
+ */
+ void start();
+
+public slots:
+ /**
+ * @brief Slot to intercept signal from login screen closure
+ */
+ void loginScreenClosed();
+
+ /**
+ * @brief Slot to intercept signal from successful login
+ */
+ void loginOk();
+
+ void updateFriendsList();
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+ /**
+ * @brief Signal that is emitted when UI must be showed
+ */
+ void engine_showMainWindow();
+
+ /**
+ * @brief Signal that is emitted when UI must be closed
+ */
+ void engine_closeMainWindow();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ 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
+};
+
+#endif // ENGINE_H
ui/infotab.cpp \
ui/updatelocation/updatelocationdialog.cpp \
ui/updatelocation/texteditautoresizer.cpp \
+ engine/engine.cpp \
user/user.cpp \
ui/settingsdialog.cpp
HEADERS += ui/mainwindow.h \
facebookservice/facebookcredentials.h \
facebookservice/facebookauthentication.h \
facebookservice/facebookcommon.h \
+ engine/engine.h \
user/user.h \
ui/settingsdialog.h
QT += network \
m_personalInfo->setTime("1 hour ago");
m_personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
- m_locationDialog = new UpdateLocationDialog(this);
+
m_widgetProxy = new QGraphicsProxyWidget();
m_widgetProxy->setWidget(m_personalInfo);
void ListViewScreen::updateMessage()
{
qDebug() << __PRETTY_FUNCTION__;
- m_locationDialog->exec();
+// m_locationDialog->exec();
}
#include <QtGui>
#include "infotab.h"
#include "pixmap.h"
-#include "updatelocation/updatelocationdialog.h"
+
/**
* @brief List View class. Used for displaying List of friends
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
+public:
+ InfoTab *m_personalInfo; ///< Personal info tab
+
private:
QVBoxLayout *m_vbox; ///< Holds the graphics view
- InfoTab *m_personalInfo; ///< Personal info tab
Pixmap *m_arrowbutton; ///< Button which reveals/hides the info tab when pressed
QGraphicsProxyWidget *m_widgetProxy; ///< Embeds InfoTab to graphics view
QAbstractTransition *m_trans1; ///< Animation transition from hidden state to visible
QPropertyAnimation *m_anim2; ///< Animation for arrowbutton from hidden to visible
QPropertyAnimation *m_anim3; ///< Animation for infotab from visible to hidden
QPropertyAnimation *m_anim4; ///< Animation for arrowbutton from visible to hidden
- UpdateLocationDialog *m_locationDialog; ///< Message dialog
};
#endif // LISTVIEWTAB_H
#include "settingsdialog.h"
#include "facebookservice/facebookauthentication.h"
#include "situareservice/situareservice.h"
+#include "engine/engine.h"
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_situareEngine = new SituareEngine(this);
+ connect(m_situareEngine, SIGNAL(engine_showMainWindow()), this, SLOT(show()));
+ connect(m_situareEngine, SIGNAL(engine_closeMainWindow()), this, SLOT(close()));
+
+ m_locationDialog = new UpdateLocationDialog(this);
+// connect(m_listViewScreen->m_personalInfo,
+// SIGNAL(launchUpdateFriendsStatus()),
+// m_situareEngine,
+// SLOT(updateFriendsList()));
+ connect(m_listViewScreen->m_personalInfo,SIGNAL(launchMessageUpdate()),
+ this,SLOT(openLocationUpdateDialog()));
- m_networkManager = new QNetworkAccessManager;
- m_situareService = new SituareService(this,m_networkManager);
+ m_situareEngine->start();
}
MainWindow::~MainWindow()
void MainWindow::createViews()
{
qDebug() << __PRETTY_FUNCTION__;
+ m_listViewScreen = new ListViewScreen(this);
+ m_mapViewScreen = new MapViewScreen(this);
+
m_situareViews = new QStackedWidget;
- m_situareViews->addWidget(new ListViewScreen);
- m_situareViews->addWidget(new MapViewScreen);
+ m_situareViews->addWidget(m_listViewScreen);
+ m_situareViews->addWidget(m_mapViewScreen);
}
void MainWindow::toListView()
}
}
+void MainWindow::openLocationUpdateDialog()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ m_locationDialog->exec();
+}
+
void MainWindow::openSettingsDialog()
{
qDebug() << __PRETTY_FUNCTION__;
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();
-}
#include <QtGui/QMainWindow>
#include <QWidget>
#include <QDebug>
+#include <QObject>
#include "facebookservice/facebookauthentication.h"
#include "situareservice/situareservice.h"
#include <QNetworkAccessManager>
+#include "engine/engine.h"
+#include "listviewscreen.h"
+#include "mapviewscreen.h"
+#include "updatelocation/updatelocationdialog.h"
class QLabel;
class QStackedWidget;
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
-
public slots:
/**
* @brief Public slot, which open settings dialog
/**
* @brief Method used to switch active view.
*
- * @param nextIndex 0 for listview, 1 for mapview
+ * @paraDaily scrum 2010-03-26m 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();
-
+ void openLocationUpdateDialog();
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
- 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
+ SituareEngine *m_situareEngine;
+
+ ListViewScreen *m_listViewScreen;
+ MapViewScreen *m_mapViewScreen;
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
+ UpdateLocationDialog *m_locationDialog; ///< Message dialog
};
#endif // MAINWINDOW_H