#include "mainwindow.h"
#include "listviewscreen.h"
#include "mapviewscreen.h"
+//#include "facebookservice/facebookauthentication.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
viewMenu->addAction(toListViewAct);
viewMenu->addAction(toMapViewAct);
viewMenu->setObjectName(tr("View Menu"));
-// QList<QAction*> actionit = viewMenu->actions();
-// qDebug() << "AKTIONIT" << actionit;
-
/*
- testClose1Act = new QAction(tr("login fail"),this);
- connect(testClose1Act, SIGNAL(triggered()), this, SLOT(testClose1()));
- testClose2Act = new QAction(tr("login ok"), this);
- connect(testClose2Act, SIGNAL(triggered()), this, SLOT(testClose2()));
- viewMenu->addAction(testClose1Act);
- viewMenu->addAction(testClose2Act);
+ FBAuth = new FacebookAuthentication(this);
+ FBAuth->show();
+ FBAuth->start();
+
+ connect(FBAuth, SIGNAL(credentialsReady()), this, SLOT(loginOK()));
+ connect(FBAuth, SIGNAL(userExit()), this, SLOT(loginScreenClosed()));
*/
}
}
}
-/*
-void MainWindow::testClose1()
+void MainWindow::loginScreenClosed()
{
- qDebug() << tr("Login window closed with FAIL");
- this->loggedIn = false;
- emit testLoginClosed();
+ qDebug() << __PRETTY_FUNCTION__ << loggedIn;
+ if (loggedIn) {
+ //this->show();
+ return;
+ }
+ else {
+ this->close();
+ }
}
-void MainWindow::testClose2()
+void MainWindow::loginOK()
{
- qDebug() << tr("Login window closed with OK");
- this->loggedIn = true;
- emit testLoginClosed();
+ qDebug() << __PRETTY_FUNCTION__ << loggedIn;
+ loggedIn = true;
}
-*/
#include <QtGui/QMainWindow>
#include <QWidget>
#include <QDebug>
+//#include "facebookservice/facebookauthentication.h"
class QLabel;
class QStackedWidget;
*/
QAction *toMapViewAct;
-/*
- QAction *testClose1Act;
- QAction *testClose2Act;
-*/
-
/**
* @brief Method used to switch active view.
*
* @fn toMapView
*/
void toMapView();
-/*
- void testClose1();
- void testClose2();
-*/
-/*
-signals:
- void testLoginClosed();
-*/
+
+private slots:
+ /**
+ * @brief Intercepts signal fom closing login window. Checks login status and exits if necessary
+ *
+ * @fn loginScreenClosed
+ */
+ void loginScreenClosed();
+
+ void loginOK();
};
#endif // MAINWINDOW_H