<file>res/images/walk_icon_gray.png</file>
<file>res/images/zoom_in.png</file>
<file>res/images/zoom_out.png</file>
+ <file>res/images/meet_people.png</file>
+ <file>res/images/chat_button.png</file>
+ <file>res/images/chat_button_s.png</file>
</qresource>
</RCC>
ui/routingpanel.cpp \
ui/routewaypointlistitem.cpp \
ui/routewaypointlistview.cpp \
- user/user.cpp
+ user/user.cpp \
+ ui/meetpeoplepanel.cpp
HEADERS += application.h \
common.h \
coordinates/geocoordinate.h \
ui/routingpanel.h \
ui/routewaypointlistitem.h \
ui/routewaypointlistview.h \
- user/user.h
+ user/user.h \
+ ui/meetpeoplepanel.h
QT += network \
webkit
#include "indicatorbuttonpanel.h"
#include "logindialog.h"
#include "mapscale.h"
+#include "meetpeoplepanel.h"
#include "panelcommon.h"
#include "routingpanel.h"
#include "tabbedpanel.h"
m_mapScale, SLOT(updateMapResolution(qreal)));
}
+void MainWindow::buildMeetPeoplePanel()
+{
+ m_meetPeoplePanel = new MeetPeoplePanel(this);
+
+ connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
+ m_meetPeoplePanel, SLOT(populateNearbyFriendListView(QList<User*>&)));
+
+ connect(this, SIGNAL(friendImageReady(User*)),
+ m_meetPeoplePanel, SLOT(friendImageReady(User*)));
+}
+
void MainWindow::buildOsmLicense()
{
qDebug() << __PRETTY_FUNCTION__;
buildUserInfoPanel();
buildFriendListPanel();
buildRoutingPanel();
+ buildMeetPeoplePanel();
m_tabbedPanel = new TabbedPanel(this);
m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png"));
m_tabbedPanel->addTab(m_friendsListPanel, QIcon(":/res/images/friend_list.png"));
- m_tabbedPanel->addTab(m_routingPanel, QIcon(":/res/images/routing.png"));
+ //m_tabbedPanel->addTab(m_routingPanel, QIcon(":/res/images/routing.png"));
+ m_tabbedPanel->addTab(m_meetPeoplePanel, QIcon(":/res/images/meet_people.png"));
connect(m_mapView, SIGNAL(viewResized(QSize)),
m_tabbedPanel, SLOT(resizePanel(QSize)));
class MapScale;
class MapScene;
class MapView;
+class MeetPeoplePanel;
class Route;
class RoutingPanel;
class TabbedPanel;
void buildManualLocationCrosshair();
/**
+ * @brief Build meet people panel and connect slots
+ */
+ void buildMeetPeoplePanel();
+
+ /**
* @brief Build map and connect slots
*/
void buildMap();
IndicatorButtonPanel *m_indicatorButtonPanel; ///< Instance of direction indicator button
MapScale *m_mapScale; ///< Instance of the map scale
MapView *m_mapView; ///< Instance of the map view
+ MeetPeoplePanel *m_meetPeoplePanel; ///< Instance of MeetPeoplePanel
NetworkCookieJar *m_cookieJar; ///< Placeholder for QNetworkCookies
RoutingPanel *m_routingPanel; ///< Instance of routing panel
TabbedPanel *m_tabbedPanel; ///< Widget for tabbed panels
--- /dev/null
+#include <QDebug>
+#include <QVBoxLayout>
+
+#include "friendlistitem.h"
+#include "friendlistitemdelegate.h"
+#include "friendlistview.h"
+#include "imagebutton.h"
+#include "panelcommon.h"
+#include "user/user.h"
+
+#include "meetpeoplepanel.h"
+
+MeetPeoplePanel::MeetPeoplePanel(QWidget *parent)
+ : PanelBase(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QVBoxLayout *meetPeopleLayout = new QVBoxLayout;
+ meetPeopleLayout->setMargin(0);
+ meetPeopleLayout->setSpacing(0);
+ setLayout(meetPeopleLayout);
+
+ m_nearbyFriendListView = new FriendListView(this);
+ m_nearbyFriendListView->setItemDelegate(new FriendListItemDelegate(this));
+
+ QVBoxLayout *listViewLayout = new QVBoxLayout;
+ listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
+ PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
+ listViewLayout->addWidget(m_nearbyFriendListView);
+ meetPeopleLayout->addLayout(listViewLayout);
+
+ ImageButton *searchPeopleButton = new ImageButton(0, ":/res/images/search.png",
+ ":/res/images/search_s.png");
+ m_contextButtonList.append(searchPeopleButton);
+
+ m_chatButton = new ImageButton(0, ":/res/images/chat_button", ":/res/images/chat_button_s.png");
+ m_contextButtonList.append(m_chatButton);
+
+ connect(m_nearbyFriendListView, SIGNAL(listItemSelectionChanged()),
+ this, SLOT(setChatButtonDisabled()));
+}
+
+void MeetPeoplePanel::friendImageReady(User *user)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ FriendListItem *item =
+ static_cast<FriendListItem*>(m_nearbyFriendListView->listItem(user->userId()));
+
+ if (item)
+ item->setAvatarImage(user->profileImage());
+}
+
+void MeetPeoplePanel::populateNearbyFriendListView(QList<User *> &nearbyFriendList)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ foreach (User *nearbyFriend, nearbyFriendList) {
+ FriendListItem *item = new FriendListItem();
+ item->setUserData(nearbyFriend);
+ m_nearbyFriendListView->addListItem(nearbyFriend->userId(), item);
+ }
+
+ m_nearbyFriendListView->scrollToTop();
+}
+
+void MeetPeoplePanel::setChatButtonDisabled()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_chatButton->setDisabled(m_nearbyFriendListView->selectedItems().isEmpty());
+}
--- /dev/null
+#ifndef MEETPEOPLEPANEL_H
+#define MEETPEOPLEPANEL_H
+
+#include "panelbase.h"
+
+class FriendListView;
+class ImageButton;
+class User;
+
+class MeetPeoplePanel : public PanelBase
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Default constructor
+ *
+ * @param parent
+ */
+ MeetPeoplePanel(QWidget *parent = 0);
+
+private slots:
+ /**
+ * @brief Slot to update friend item's image
+ *
+ * @param user Friend
+ */
+ void friendImageReady(User *user);
+
+ /**
+ * @brief Populates nearby friends list view.
+ *
+ * @param nearbyFriendList list of nearby friends
+ */
+ void populateNearbyFriendListView(QList<User *> &nearbyFriendList);
+
+ /**
+ * @brief Sets chat button disabled.
+ *
+ * Disabled if there isn't any list item selected.
+ */
+ void setChatButtonDisabled();
+
+private:
+ ImageButton *m_chatButton; ///< Chat button
+
+ FriendListView *m_nearbyFriendListView; ///< Nearby friend list view
+};
+
+#endif // MEETPEOPLEPANEL_H