#include <QMessageBox>
#include "common.h"
+#include "engine/updatelocation.h"
#include "error.h"
-#include "facebookloginbrowser.h"
#include "friendlistpanel.h"
#include "fullscreenbutton.h"
#include "indicatorbuttonpanel.h"
#include "locationsearchpanel.h"
-#include "logindialog.h"
#include "map/mapcommon.h"
#include "map/mapview.h"
#include "mapscale.h"
+#include "meetpeoplepanel.h"
+#include "messagedialog.h"
+#include "messagepanel.h"
#include "panelcommon.h"
#include "routingpanel.h"
#include "searchdialog.h"
#include "settingsdialog.h"
#include "situareservice/situarecommon.h"
#include "tabbedpanel.h"
+#include "updatelocation/updatelocationdialog.h"
#include "userinfopanel.h"
#include "zoombuttonpanel.h"
m_progressIndicatorCount(0),
m_loginDialog(0),
m_crosshair(0),
- m_email(), ///< @todo WTF?!?!?!?
- m_password(),
m_fullScreenButton(0),
m_indicatorButtonPanel(0),
m_mapScale(0)
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow);
#endif
+
+ m_updateLocationController = new UpdateLocation(this);
+
+ connect(this, SIGNAL(updateWasSuccessful()), m_updateLocationController, SLOT(clear()));
+ connect(m_updateLocationController, SIGNAL(locationUpdate(QString,bool)),
+ this, SIGNAL(locationUpdate(QString,bool)));
}
MainWindow::~MainWindow()
connect(m_friendsListPanel, SIGNAL(findFriend(GeoCoordinate)),
this, SIGNAL(centerToCoordinates(GeoCoordinate)));
- connect(this, SIGNAL(friendImageReady(User*)),
- m_friendsListPanel, SLOT(friendImageReady(User*)));
+ connect(this, SIGNAL(friendImageReady(QString,QPixmap)),
+ m_friendsListPanel, SLOT(friendImageReady(QString,QPixmap)));
connect(m_friendsListPanel, SIGNAL(routeToFriend(const GeoCoordinate&)),
this, SIGNAL(routeTo(const GeoCoordinate&)));
connect(m_friendsListPanel, SIGNAL(requestContactDialog(const QString &)),
this, SIGNAL(requestContactDialog(const QString &)));
+
+ connect(m_friendsListPanel, SIGNAL(requestMessageDialog(QPair<QString, QString>)),
+ this, SIGNAL(requestMessageDialog(QPair<QString, QString>)));
}
void MainWindow::buildFullScreenButton()
this, SIGNAL(searchHistoryItemClicked(QString)));
}
-void MainWindow::buildLoginDialog(FacebookLoginBrowser *browser)
+void MainWindow::buildLoginDialog(QWebView *browser)
{
- qWarning() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__;
if (!m_loginDialog) {
m_loginDialog = new QDialog(this);
m_mapScale, SLOT(updateMapResolution(qreal)));
}
+void MainWindow::buildMeetPeoplePanel()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_meetPeoplePanel = new MeetPeoplePanel(this);
+
+ connect(this, SIGNAL(friendImageReady(QString,QPixmap)),
+ m_meetPeoplePanel, SLOT(setImage(QString,QPixmap)));
+
+ connect(this, SIGNAL(interestingPeopleReceived(QList<User>&,QList<User>&)),
+ m_meetPeoplePanel, SLOT(populateInterestingPeopleListView(QList<User>&,QList<User>&)));
+
+ connect(m_meetPeoplePanel, SIGNAL(requestInterestingPeople()),
+ this, SIGNAL(requestInterestingPeople()));
+
+ connect(m_meetPeoplePanel, SIGNAL(requestInterestingPeopleSearch()),
+ this, SLOT(startPeopleSearch()));
+
+ connect(m_meetPeoplePanel, SIGNAL(findPerson(GeoCoordinate)),
+ this, SIGNAL(centerToCoordinates(GeoCoordinate)));
+
+ connect(m_meetPeoplePanel, SIGNAL(requestMessageDialog(QPair<QString, QString>)),
+ this, SIGNAL(requestMessageDialog(QPair<QString, QString>)));
+
+ connect(m_meetPeoplePanel, SIGNAL(requestShowFriend(QList<QString>)),
+ m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
+}
+
+void MainWindow::buildMessagePanel()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_messagePanel = new MessagePanel(this);
+
+ connect(this, SIGNAL(messagesReceived(QList<Message>&, QList<Message>&)),
+ m_messagePanel, SLOT(populateMessageListView(QList<Message>&, QList<Message>&)));
+
+ connect(m_messagePanel, SIGNAL(requestMessages()),
+ this, SIGNAL(requestMessages()));
+
+ connect(this, SIGNAL(friendImageReady(QString,QPixmap)),
+ m_messagePanel, SLOT(setImage(QString,QPixmap)));
+
+ connect(m_messagePanel, SIGNAL(requestRemoveMessage(QString)),
+ this, SIGNAL(requestRemoveMessage(QString)));
+
+ connect(m_messagePanel, SIGNAL(findFriend(GeoCoordinate)),
+ this, SIGNAL(centerToCoordinates(GeoCoordinate)));
+
+ connect(m_messagePanel, SIGNAL(requestMessageDialog(QPair<QString, QString>)),
+ this, SIGNAL(requestMessageDialog(QPair<QString, QString>)));
+}
+
void MainWindow::buildOsmLicense()
{
qDebug() << __PRETTY_FUNCTION__;
buildFriendListPanel();
buildLocationSearchPanel();
buildRoutingPanel();
+ buildMeetPeoplePanel();
+ buildMessagePanel();
m_tabbedPanel = new TabbedPanel(this);
m_situareTabsIndexes.append(
m_tabbedPanel->addTab(m_friendsListPanel, QIcon(":/res/images/friend_list.png")));
- m_tabbedPanel->addTab(m_locationSearchPanel, QIcon(":/res/images/location_search.png"));
- m_tabbedPanel->addTab(m_routingPanel, QIcon(":/res/images/routing.png"));
+// m_tabbedPanel->addTab(m_locationSearchPanel, QIcon(":/res/images/location_search.png"));
+// m_tabbedPanel->addTab(m_routingPanel, QIcon(":/res/images/routing.png"));
+ m_situareTabsIndexes.append(
+ m_tabbedPanel->addTab(m_meetPeoplePanel, QIcon(":/res/images/meet_people.png")));
+ m_situareTabsIndexes.append(
+ m_tabbedPanel->addTab(m_messagePanel, QIcon(":/res/images/message.png")));
connect(m_mapView, SIGNAL(viewResized(QSize)),
m_tabbedPanel, SLOT(resizePanel(QSize)));
connect(m_tabbedPanel, SIGNAL(currentChanged(int)),
m_userInfoPanel, SIGNAL(collapse()));
+ connect(m_tabbedPanel, SIGNAL(panelClosed()),
+ m_meetPeoplePanel, SLOT(anyPanelClosed()));
+
+ connect(m_tabbedPanel, SIGNAL(panelClosed()),
+ m_messagePanel, SLOT(anyPanelClosed()));
+
// signals for showing and hiding list item context buttons
+ connect(m_userInfoPanel, SIGNAL(listItemSelectionChanged(bool)),
+ m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
connect(m_friendsListPanel, SIGNAL(listItemSelectionChanged(bool)),
m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
connect(m_routingPanel, SIGNAL(listItemSelectionChanged(bool)),
m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+ connect(m_meetPeoplePanel, SIGNAL(listItemSelectionChanged(bool)),
+ m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+ connect(m_messagePanel, SIGNAL(listItemSelectionChanged(bool)),
+ m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
}
void MainWindow::buildRoutingPanel()
connect(this, SIGNAL(userLocationReady(User*)),
m_userInfoPanel, SLOT(userDataReceived(User*)));
- connect(this, SIGNAL(reverseGeoReady(QString)),
- m_userInfoPanel, SIGNAL(reverseGeoReady(QString)));
-
- connect(this, SIGNAL(clearUpdateLocationDialogData()),
- m_userInfoPanel, SIGNAL(clearUpdateLocationDialogData()));
-
connect(m_userInfoPanel, SIGNAL(findUser(GeoCoordinate)),
this, SIGNAL(centerToCoordinates(GeoCoordinate)));
- connect(m_userInfoPanel, SIGNAL(requestReverseGeo()),
- this, SIGNAL(requestReverseGeo()));
-
- connect(m_userInfoPanel, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
-
connect(m_userInfoPanel, SIGNAL(refreshUserData()),
this, SIGNAL(refreshUserData()));
- connect(m_userInfoPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
- this, SLOT(buildInformationBox(QString, bool)));
+ connect(m_userInfoPanel, SIGNAL(updateLocationMessageButtonClicked()),
+ this, SLOT(showUpdateLocationDialog()));
+
+ connect(this, SIGNAL(userImageReady(QString,QPixmap)),
+ m_userInfoPanel, SLOT(setImage(QString,QPixmap)));
+
+ connect(m_userInfoPanel, SIGNAL(addTags(QStringList)),
+ this, SIGNAL(addTags(QStringList)));
+
+ connect(m_userInfoPanel, SIGNAL(removeTags(QStringList)),
+ this, SIGNAL(removeTags(QStringList)));
+
+ connect(this, SIGNAL(popularTagsReceived(QHash<QString,QString>&)),
+ m_userInfoPanel, SLOT(populatePopularTags(QHash<QString,QString>&)));
+
+ connect(m_userInfoPanel, SIGNAL(requestPopularTags()),
+ this, SIGNAL(requestPopularTags()));
+
+ connect(this, SIGNAL(userTagsReceived(QHash<QString,QString>&)),
+ m_userInfoPanel, SLOT(userTagsReceived(QHash<QString,QString>&)));
}
void MainWindow::buildZoomButtonPanel()
void MainWindow::destroyLoginDialog()
{
- qWarning() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__;
if (m_loginDialog) {
m_loginDialog->hide();
QDialog *dialog = m_queue.takeFirst();
SearchDialog *searchDialog = qobject_cast<SearchDialog *>(dialog);
- if ((searchDialog) && (status != 0))
- emit searchForLocation(searchDialog->input());
-
- dialog->deleteLater();
+ MessageDialog *messageDialog = qobject_cast<MessageDialog *>(dialog);
+
+ if ((searchDialog) && (status != 0)) {
+ if (searchDialog->type() == SearchDialog::Location)
+ emit searchForLocation(searchDialog->input());
+ else if (searchDialog->type() == SearchDialog::PeopleTag)
+ emit requestSearchPeopleByTag(searchDialog->input());
+
+ searchDialog->deleteLater();
+ } else if ((messageDialog) && (status != 0)) {
+ emit sendMessage(messageDialog->input().first, messageDialog->input().second,
+ messageDialog->isAddCoordinatesSelected());
+ messageDialog->deleteLater();
+ }
if(!m_error_queue.isEmpty() && m_errorShown == false) {
showErrorInformationBox();
void MainWindow::loggedIn(bool logged)
{
- /// @todo OLD CODE
qDebug() << __PRETTY_FUNCTION__;
m_loggedIn = logged;
if(logged) {
m_loginAct->setText(tr("Logout"));
} else {
-// clearCookieJar();
- m_email.clear();
- m_password.clear();
-
m_loginAct->setText(tr("Login"));
m_userInfoPanel->showUserInfo(false);
+ m_updateLocationController->clear();
}
- updateItemVisibility();
-}
-
-void MainWindow::loginFailed()
-{
- /// @todo OLD CODE
- qDebug() << __PRETTY_FUNCTION__;
-
-// clearCookieJar();
- startLoginProcess();
-}
-
-bool MainWindow::loginState()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- return m_loggedIn;
+ updateItemVisibility(logged);
}
void MainWindow::mapCenterHorizontalShiftingChanged(int shifting)
#endif
}
+void MainWindow::showMessageDialog(const QPair<QString, QString> &receiver)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ MessageDialog *messageDialog = new MessageDialog(receiver.first, receiver.second);
+ queueDialog(messageDialog);
+}
+
void MainWindow::showEnableAutomaticUpdateLocationDialog(const QString &text)
{
qDebug() << __PRETTY_FUNCTION__;
}
}
-void MainWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
+void MainWindow::showUpdateLocationDialog()
{
- qWarning() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__;
- reply->ignoreSslErrors();
+ UpdateLocationDialog *updateLocationDialog
+ = new UpdateLocationDialog(m_updateLocationController, this);
+
+ connect(this, SIGNAL(reverseGeoReady(QString)),
+ updateLocationDialog, SLOT(setAddress(QString)));
+
+ updateLocationDialog->show();
+
+ emit requestReverseGeo();
}
void MainWindow::startLocationSearch()
{
qDebug() << __PRETTY_FUNCTION__;
- SearchDialog *searchDialog = new SearchDialog();
+ SearchDialog *searchDialog = new SearchDialog(SearchDialog::Location);
queueDialog(searchDialog);
}
-void MainWindow::startLoginProcess()
+void MainWindow::startPeopleSearch()
{
qDebug() << __PRETTY_FUNCTION__;
- LoginDialog *loginDialog = new LoginDialog();
-
- emit fetchUsernameFromSettings();
-
- loginDialog->clearTextFields();
+ SearchDialog *searchDialog = new SearchDialog(SearchDialog::PeopleTag);
+ queueDialog(searchDialog);
+}
- if(!m_email.isEmpty())
- loginDialog->setEmailField(m_email);
+void MainWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
+{
+ qDebug() << __PRETTY_FUNCTION__;
- queueDialog(loginDialog);
+ Q_UNUSED(errors)
+ reply->ignoreSslErrors();
}
void MainWindow::toggleFullScreen()
#endif // Q_WS_MAEMO_5
}
-void MainWindow::updateItemVisibility()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, m_loggedIn);
-}
-
-const QString MainWindow::username()
+void MainWindow::updateItemVisibility(bool loggedIn)
{
qDebug() << __PRETTY_FUNCTION__;
- return m_email;
+ m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, loggedIn);
}