Merge branch 'master' into situare_interact
[situare] / src / ui / mainwindow.cpp
index 5ec1c40..63a1719 100644 (file)
@@ -43,6 +43,8 @@
 #include "map/mapcommon.h"
 #include "map/mapview.h"
 #include "mapscale.h"
+#include "meetpeoplepanel.h"
+#include "notificationpanel.h"
 #include "panelcommon.h"
 #include "routingpanel.h"
 #include "searchdialog.h"
@@ -182,8 +184,8 @@ void MainWindow::buildFriendListPanel()
     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&)));
@@ -333,6 +335,44 @@ void MainWindow::buildMapScale()
             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>&)),
+            m_meetPeoplePanel, SLOT(populateInterestingPeopleListView(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)));
+}
+
+void MainWindow::buildNotificationPanel()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_notificationPanel = new NotificationPanel(this);
+
+    connect(this, SIGNAL(notificationsReceived(QList<Notification>&)),
+            m_notificationPanel, SLOT(populateNotificationListView(QList<Notification>&)));
+
+    connect(m_notificationPanel, SIGNAL(requestNotifications()),
+            this, SIGNAL(requestNotifications()));
+
+    connect(this, SIGNAL(friendImageReady(QString,QPixmap)),
+            m_notificationPanel, SLOT(setImage(QString,QPixmap)));
+}
+
 void MainWindow::buildOsmLicense()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -357,6 +397,8 @@ void MainWindow::buildPanels()
     buildFriendListPanel();
     buildLocationSearchPanel();
     buildRoutingPanel();
+    buildMeetPeoplePanel();
+    buildNotificationPanel();
 
     m_tabbedPanel = new TabbedPanel(this);
 
@@ -366,8 +408,12 @@ void MainWindow::buildPanels()
     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_notificationPanel, QIcon(":/res/images/notification.png")));
 
     connect(m_mapView, SIGNAL(viewResized(QSize)),
             m_tabbedPanel, SLOT(resizePanel(QSize)));
@@ -399,7 +445,16 @@ void MainWindow::buildPanels()
     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_notificationPanel, 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)));
 
@@ -408,6 +463,12 @@ void MainWindow::buildPanels()
 
     connect(m_routingPanel, SIGNAL(listItemSelectionChanged(bool)),
             m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+    connect(m_meetPeoplePanel, SIGNAL(listItemSelectionChanged(bool)),
+            m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+    connect(m_notificationPanel, SIGNAL(listItemSelectionChanged(bool)),
+            m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
 }
 
 void MainWindow::buildRoutingPanel()
@@ -458,6 +519,9 @@ void MainWindow::buildUserInfoPanel()
 
     connect(m_userInfoPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
             this, SLOT(buildInformationBox(QString, bool)));
+
+    connect(this, SIGNAL(userImageReady(QString,QPixmap)),
+            m_userInfoPanel, SLOT(setImage(QString,QPixmap)));
 }
 
 void MainWindow::buildWebView()
@@ -1011,7 +1075,15 @@ void MainWindow::startLocationSearch()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    SearchDialog *searchDialog = new SearchDialog();
+    SearchDialog *searchDialog = new SearchDialog(SearchDialog::Location);
+    queueDialog(searchDialog);
+}
+
+void MainWindow::startPeopleSearch()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    SearchDialog *searchDialog = new SearchDialog(SearchDialog::People);
     queueDialog(searchDialog);
 }