#include <QMessageBox>
#include "common.h"
+#include "engine/updatelocation.h"
#include "error.h"
#include "friendlistpanel.h"
#include "fullscreenbutton.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"
m_crosshair(0),
m_fullScreenButton(0),
m_indicatorButtonPanel(0),
- m_mapScale(0),
- m_updateLocation(0)
+ m_mapScale(0)
{
qDebug() << __PRETTY_FUNCTION__;
#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()
qDeleteAll(m_error_queue.begin(), m_error_queue.end());
m_error_queue.clear();
-
- QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
-
- if (!m_backupMessage.isEmpty()) {
- settings.setValue(USER_UNSEND_MESSAGE, m_backupMessage.toAscii());
- settings.setValue(USER_UNSEND_MESSAGE_PUBLISH, m_backupFacebookPublishPolicity);
- } else {
- settings.remove(USER_UNSEND_MESSAGE);
- settings.remove(USER_UNSEND_MESSAGE_PUBLISH);
- }
}
void MainWindow::automaticUpdateDialogFinished(int result)
m_automaticUpdateLocationDialog->deleteLater();
}
-void MainWindow::backupUpdateLocationDialogData(const QString &status, bool publish)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_backupMessage = status;
- m_backupFacebookPublishPolicity = publish;
-}
-
void MainWindow::buildCrosshair()
{
qDebug() << __PRETTY_FUNCTION__;
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()
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(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()
this, SIGNAL(draggingModeTriggered()));
}
-void MainWindow::clearUpdateLocationDialogData()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_backupMessage.clear();
- m_backupFacebookPublishPolicity = false;
-}
-
void MainWindow::createMenus()
{
qDebug() << __PRETTY_FUNCTION__;
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();
} else {
m_loginAct->setText(tr("Login"));
m_userInfoPanel->showUserInfo(false);
+ m_updateLocationController->clear();
}
updateItemVisibility(logged);
}
}
}
-void MainWindow::restoreUnsendMessage()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
- m_backupMessage = settings.value(USER_UNSEND_MESSAGE).toString();
- m_backupFacebookPublishPolicity = settings.value(USER_UNSEND_MESSAGE_PUBLISH, false).toBool();
-}
-
void MainWindow::setCrosshairVisibility(bool visibility)
{
qDebug() << __PRETTY_FUNCTION__;
#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__;
{
qDebug() << __PRETTY_FUNCTION__;
- delete m_updateLocation;
- m_updateLocation = new UpdateLocationDialog(m_backupMessage, m_backupFacebookPublishPolicity,
- this);
+ UpdateLocationDialog *updateLocationDialog
+ = new UpdateLocationDialog(m_updateLocationController, this);
connect(this, SIGNAL(reverseGeoReady(QString)),
- m_updateLocation, SLOT(setAddress(QString)));
-
- connect(m_updateLocation, SIGNAL(statusUpdate(QString, bool)),
- this, SIGNAL(statusUpdate(QString, bool)));
+ updateLocationDialog, SLOT(setAddress(QString)));
- connect(m_updateLocation, SIGNAL(statusUpdate(QString, bool)),
- this, SLOT(backupUpdateLocationDialogData(QString, bool)));
-
- connect(m_updateLocation, SIGNAL(finished(int)),
- this, SLOT(updateLocationDialogFinished(int)));
-
- m_updateLocation->show();
+ updateLocationDialog->show();
emit requestReverseGeo();
}
-void MainWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
+void MainWindow::startLocationSearch()
{
- qWarning() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__;
- reply->ignoreSslErrors();
+ SearchDialog *searchDialog = new SearchDialog(SearchDialog::Location);
+ queueDialog(searchDialog);
}
-void MainWindow::startLocationSearch()
+void MainWindow::startPeopleSearch()
{
qDebug() << __PRETTY_FUNCTION__;
- SearchDialog *searchDialog = new SearchDialog();
+ SearchDialog *searchDialog = new SearchDialog(SearchDialog::PeopleTag);
queueDialog(searchDialog);
}
+void MainWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ Q_UNUSED(errors)
+ reply->ignoreSslErrors();
+}
+
void MainWindow::toggleFullScreen()
{
qDebug() << __PRETTY_FUNCTION__;
m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, loggedIn);
}
-
-void MainWindow::updateLocationDialogFinished(int reason)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- Q_UNUSED(reason);
-
- if (m_updateLocation) {
- disconnect(this, SIGNAL(reverseGeoReady(QString)),
- m_updateLocation, SLOT(setAddress(QString)));
-
- disconnect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
-
- disconnect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
- this, SLOT(backupUpdateLocationDialogData(QString,bool)));
-
- disconnect(m_updateLocation, SIGNAL(finished(int)),
- this, SLOT(updateLocationDialogFinished(int)));
-
- m_updateLocation->deleteLater();
- m_updateLocation = 0;
- }
-}