connect(m_ui, SIGNAL(findFriend(GeoCoordinate)),
m_mapEngine, SLOT(centerToCoordinates(GeoCoordinate)));
+ // signals from routing tab
connect(m_ui, SIGNAL(locationItemClicked(GeoCoordinate&,GeoCoordinate&)),
- m_mapEngine, SLOT(locationItemClicked(GeoCoordinate&,GeoCoordinate&)));
+ m_mapEngine, SLOT(showMapArea(GeoCoordinate&,GeoCoordinate&)));
// signals from distence indicator button
connect(m_ui, SIGNAL(autoCenteringTriggered(bool)),
return (centerTile != temp);
}
-void MapEngine::locationItemClicked(GeoCoordinate &swBound, GeoCoordinate &neBound)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QRect area;
- area.setTopRight(SceneCoordinate(neBound).toPointF().toPoint());
- area.setBottomLeft(SceneCoordinate(swBound).toPointF().toPoint());
-
- centerAndZoomTo(area, false);
-}
-
void MapEngine::mapImageReceived(int zoomLevel, int x, int y, const QPixmap &image)
{
qDebug() << __PRETTY_FUNCTION__;
m_tilesGridSize.setWidth(gridWidth);
}
+void MapEngine::showMapArea(GeoCoordinate &swBound, GeoCoordinate &neBound)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QRect area;
+ area.setTopRight(SceneCoordinate(neBound).toPointF().toPoint());
+ area.setBottomLeft(SceneCoordinate(swBound).toPointF().toPoint());
+
+ centerAndZoomTo(area, false);
+}
+
void MapEngine::updateViewTilesSceneRect()
{
qDebug() << __PRETTY_FUNCTION__;
void gpsPositionUpdate(GeoCoordinate position, qreal accuracy);
/**
- * @brief Called when location item is clicked.
- *
- * Calls centerAndZoomTo() with bounds.
- * @param swBound south-west bound of location item
- * @param neBound north-east bound of location item
- */
- void locationItemClicked(GeoCoordinate &swBound, GeoCoordinate &neBound);
-
- /**
* @brief Slot for received map tile images
*
* Does receive map tile images from MapFetcher. Calls MapScene::addTile() for creating and adding
void setRoute(Route &route);
/**
+ * @brief Shows map area defined by bounds.
+ *
+ * Calls centerAndZoomTo() with area defined by bounds.
+ * @param swBound south-west bound of location item
+ * @param neBound north-east bound of location item
+ */
+ void showMapArea(GeoCoordinate &swBound, GeoCoordinate &neBound);
+
+ /**
* @brief Slot for actions after view zoom is finished
*
* Does run removeOutOfViewTiles
ui/panelbar.cpp \
ui/panelcontent.cpp \
ui/panelbase.cpp \
- user/user.cpp
+ user/user.cpp \
+ ui/routingpanel.cpp
HEADERS += application.h \
common.h \
engine/engine.h \
ui/tabbedpanel.h \
ui/panelbar.h \
ui/panelcontent.h \
- ui/panelbase.h
+ ui/panelbase.h \
+ ui/routingpanel.h
QT += network \
webkit
}
}
-
-
ListItem *ListView::listItem(const QString &itemID)
{
qDebug() << __PRETTY_FUNCTION__;
return dynamic_cast<ListItem*>(m_listItems.value(itemID));
}
+ListItem *ListView::listItemAt(int index)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QHashIterator<QString, ListItem*> itemIterator(m_listItems);
+ ListItem *item = 0;
+ int counter = 0;
+
+ while (itemIterator.hasNext()) {
+ itemIterator.next();
+ if (index == counter) {
+ item = itemIterator.value();
+ break;
+ }
+ counter++;
+ }
+
+ return item;
+}
ListView::~ListView()
{
*/
ListItem *listItem(const QString &itemID);
+ /**
+ * @brief Returns ListItem by index.
+ *
+ * @param index item's index
+ * @return ListItem
+ */
+ ListItem *listItemAt(int index);
+
protected slots:
/**
* @brief Slot for list item clicked.
#include "logindialog.h"
#include "mapscale.h"
#include "panelcommon.h"
+#include "routingpanel.h"
#include "tabbedpanel.h"
#include "searchdialog.h"
#include "settingsdialog.h"
buildUserInfoPanel();
buildFriendListPanel();
+ buildRoutingPanel();
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"));
connect(m_mapView, SIGNAL(viewResized(QSize)),
m_tabbedPanel, SLOT(resizePanel(QSize)));
}
+void MainWindow::buildRoutingPanel()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_routingPanel = new RoutingPanel(this);
+
+ connect(this, SIGNAL(locationDataParsed(QList<Location>&)),
+ m_routingPanel, SLOT(populateLocationListView(QList<Location>&)));
+
+ connect(m_routingPanel, SIGNAL(locationItemClicked(GeoCoordinate&,GeoCoordinate&)),
+ this, SIGNAL(locationItemClicked(GeoCoordinate&,GeoCoordinate&)));
+}
+
void MainWindow::buildUserInfoPanel()
{
qDebug() << __PRETTY_FUNCTION__;
class MapScale;
class MapScene;
class MapView;
+class RoutingPanel;
class TabbedPanel;
class SettingsDialog;
class SceneCoordinate;
void buildPanels();
/**
+ * @brief Build routing panel and connect slots
+ */
+ void buildRoutingPanel();
+
+ /**
* @brief Build user info panel and connect slots
*/
void buildUserInfoPanel();
MapScale *m_mapScale; ///< Instance of the map scale
MapView *m_mapView; ///< Instance of the map view
NetworkCookieJar *m_cookieJar; ///< Placeholder for QNetworkCookies
+ RoutingPanel *m_routingPanel; ///< Instance of routing panel
TabbedPanel *m_tabbedPanel; ///< Widget for tabbed panels
UserInfoPanel *m_userInfoPanel; ///< Instance of the user information panel
ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
--- /dev/null
+#include "coordinates/geocoordinate.h"
+#include "locationlistitem.h"
+#include "locationlistview.h"
+#include "extendedlistitemdelegate.h"
+#include "routing/location.h"
+#include "panelcommon.h"
+
+#include "routingpanel.h"
+
+RoutingPanel::RoutingPanel(QWidget *parent)
+ : QWidget(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QVBoxLayout *routingLayout = new QVBoxLayout;
+ routingLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+ setLayout(routingLayout);
+
+ m_locationListView = new LocationListView(this);
+ m_locationListView->setItemDelegate(new ExtendedListItemDelegate(this));
+ routingLayout->addWidget(m_locationListView);
+
+ connect(m_locationListView, SIGNAL(locationItemClicked(GeoCoordinate&,GeoCoordinate&)),
+ this, SIGNAL(locationItemClicked(GeoCoordinate&,GeoCoordinate&)));
+}
+
+void RoutingPanel::populateLocationListView(QList<Location> &locations)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_locationListView->clearList();
+
+ for (int i = 0; i < locations.size(); ++i) {
+ LocationListItem *item = new LocationListItem();
+ item->setLocationData(locations.at(i));
+ m_locationListView->addListItem(QString::number(i), item);
+ }
+
+ //openPanel();
+
+ if (locations.size() == 1) {
+ ListItem *item = m_locationListView->listItemAt(0);
+
+ if (item)
+ m_locationListView->listItemClicked(item);
+ }
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef ROUTINGPANEL_H
+#define ROUTINGPANEL_H
+
+#include <QtGui>
+
+class ExtendedListItemDelegate;
+class GeoCoordinate;
+class LocationListView;
+class Location;
+
+/**
+ * @brief Class for sliding routing panel
+ *
+ * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
+ */
+class RoutingPanel : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Default constructor
+ *
+ * @param parent
+ */
+ RoutingPanel(QWidget *parent = 0);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+private slots:
+ /**
+ * @brief Populates location list view.
+ *
+ * @param result list of Location objects
+ */
+ void populateLocationListView(QList<Location> &locations);
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+ /**
+ * @brief Signal for location item clicked.
+ *
+ * @param swBound south-west bound GeoCoordinate
+ * @param neBound north-east bound GeoCoordinate
+ */
+ void locationItemClicked(GeoCoordinate &swBound, GeoCoordinate &neBound);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ LocationListView *m_locationListView; ///< Location list view
+};
+
+#endif // ROUTINGPANEL_H