<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/arrow_turn_continue.png</file>
+ <file>res/images/arrow_turn_left.png</file>
+ <file>res/images/arrow_turn_right.png</file>
+ <file>res/images/arrow_turn_sharp_left.png</file>
+ <file>res/images/arrow_turn_sharp_right.png</file>
+ <file>res/images/arrow_turn_slight_left.png</file>
+ <file>res/images/arrow_turn_slight_right.png</file>
+ <file>res/images/arrow_turn_start.png</file>
</qresource>
</RCC>
connect(m_ui, SIGNAL(refreshUserData()),
this, SLOT(refreshUserData()));
- connect(m_ui, SIGNAL(findUser(GeoCoordinate)),
- m_mapEngine, SLOT(centerToCoordinates(GeoCoordinate)));
-
- // signals from friend list tab
- connect(m_ui, SIGNAL(findFriend(GeoCoordinate)),
+ connect(m_ui, SIGNAL(centerToCoordinates(GeoCoordinate)),
m_mapEngine, SLOT(centerToCoordinates(GeoCoordinate)));
connect(m_routingService, SIGNAL(routeParsed(Route&)),
m_mapEngine, SLOT(setRoute(Route&)));
+
+ connect(m_routingService, SIGNAL(routeParsed(Route&)),
+ m_ui, SIGNAL(routeParsed(Route&)));
}
void SituareEngine::signalsFromSituareService()
segment.setLengthCaption(list.at(4));
segment.setEarthDirection(list.at(5));
segment.setAzimuth(list.at(6).toDouble());
- if (list.count() == 8) {
+ if (list.count() == 9) {
segment.setTurnType(list.at(7));
segment.setTurnAngle(list.at(8).toDouble());
}
ui/panelcontent.cpp \
ui/panelbase.cpp \
user/user.cpp \
- ui/routingpanel.cpp
+ ui/routingpanel.cpp \
+ ui/routewaypointlistview.cpp \
+ ui/routewaypointlistitem.cpp
HEADERS += application.h \
common.h \
engine/engine.h \
ui/panelbar.h \
ui/panelcontent.h \
ui/panelbase.h \
- ui/routingpanel.h
+ ui/routingpanel.h \
+ ui/routewaypointlistview.h \
+ ui/routewaypointlistitem.h
QT += network \
webkit
*/
~LocationListItem();
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
+/******************************************************************************
+* MEMBER FUNCTIONS AND SLOTS
+******************************************************************************/
public:
/**
* @brief Returns location bounds in parameters.
*/
GeoCoordinate coordinates() const;
-/******************************************************************************
-* MEMBER FUNCTIONS AND SLOTS
-******************************************************************************/
-public:
/**
* @brief Set location data for this item.
*
m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
connect(m_friendsListPanel, SIGNAL(findFriend(GeoCoordinate)),
- this, SIGNAL(findFriend(GeoCoordinate)));
+ this, SIGNAL(centerToCoordinates(GeoCoordinate)));
connect(this, SIGNAL(friendImageReady(User*)),
m_friendsListPanel, SLOT(friendImageReady(User*)));
connect(m_routingPanel, SIGNAL(routeToLocation(const GeoCoordinate&)),
this, SIGNAL(routeTo(const GeoCoordinate&)));
+
+ connect(this, SIGNAL(routeParsed(Route&)),
+ m_routingPanel, SLOT(setRoute(Route&)));
+
+ connect(m_routingPanel, SIGNAL(routeWaypointItemClicked(GeoCoordinate)),
+ this, SIGNAL(centerToCoordinates(GeoCoordinate)));
}
void MainWindow::buildUserInfoPanel()
m_userInfoPanel, SIGNAL(clearUpdateLocationDialogData()));
connect(m_userInfoPanel, SIGNAL(findUser(GeoCoordinate)),
- this, SIGNAL(findUser(GeoCoordinate)));
+ this, SIGNAL(centerToCoordinates(GeoCoordinate)));
connect(m_userInfoPanel, SIGNAL(requestReverseGeo()),
this, SIGNAL(requestReverseGeo()));
class MapScale;
class MapScene;
class MapView;
+class Route;
class RoutingPanel;
class TabbedPanel;
class SettingsDialog;
void cancelLoginProcess();
/**
+ * @brief Signal for centering to coordinates.
+ *
+ * @param coordinates geo coordinates to center to.
+ */
+ void centerToCoordinates(const GeoCoordinate &coordinates);
+
+ /**
* @brief View should be centered to new location
*
* @param coordinate Scene coordinates of the new center point
void fetchUsernameFromSettings();
/**
- * @brief Signal for finding user.
- *
- * @param coordinates user geo coordinates
- */
- void findUser(const GeoCoordinate &coordinates);
-
- /**
* @brief Signals when friend's profile image is ready
*
* @param user Friend
void gpsTriggered(bool enabled);
/**
- * @brief Signal for finding friend.
- *
- * @param coordinates friend's geo coordinates
- */
- void findFriend(const GeoCoordinate &coordinates);
-
- /**
* @brief Signal for friend location ready.
*
* @param friendsList
void reverseGeoReady(const QString &address);
/**
+ * @brief Emited when route is parsed and is ready for further processing
+ *
+ * @param route Route item containing parsed route details
+ */
+ void routeParsed(Route &route);
+
+ /**
* @brief Signal for routing to geo coordinates.
*
* @param coordinates destination geo coordinates
--- /dev/null
+#include <QDebug>
+#include <QTime>
+
+#include "avatarimage.h"
+#include "listcommon.h"
+#include "routing/routesegment.h"
+
+#include "routewaypointlistitem.h"
+
+RouteWaypointListItem::RouteWaypointListItem()
+ : ExtendedListItem()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ setSubitemTextWidth(SUBITEM_TEXT_MAX_WIDTH);
+}
+
+GeoCoordinate RouteWaypointListItem::coordinates() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_coordinates;
+}
+
+void RouteWaypointListItem::setRouteWaypointData(const RouteSegment &routeSegment,
+ const GeoCoordinate &coordinate)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_coordinates = coordinate;
+
+ if (routeSegment.turnType() == "C")
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_continue.png"),
+ AvatarImage::Small));
+ else if (routeSegment.turnType() == "TL")
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_left.png"),
+ AvatarImage::Small));
+ else if (routeSegment.turnType() == "TSLL")
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_slight_left.png"),
+ AvatarImage::Small));
+ else if (routeSegment.turnType() == "TSHL")
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_sharp_left.png"),
+ AvatarImage::Small));
+ else if (routeSegment.turnType() == "TR")
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_right.png"),
+ AvatarImage::Small));
+ else if (routeSegment.turnType() == "TSLR")
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_slight_right.png"),
+ AvatarImage::Small));
+ else if (routeSegment.turnType() == "TSHR")
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_sharp_right.png"),
+ AvatarImage::Small));
+ else
+ setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_start.png"),
+ AvatarImage::Small));
+
+ setTitle(shortenText(routeSegment.street(), NAME_TEXT_MAX_WIDTH + MARGIN,
+ ListItem::TEXT_SIZE_NORMAL));
+
+ clearSubItems();
+
+ QTime zeroTime(0, 0);
+ QTime segmentTravelTime = zeroTime.addSecs(routeSegment.time());
+
+ addSubItem(segmentTravelTime.toString("hh:mm:ss"), QPixmap(":/res/images/clock.png"));
+}
+
+RouteWaypointListItem::~RouteWaypointListItem()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
--- /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 ROUTEWAYPOINTLISTITEM_H
+#define ROUTEWAYPOINTLISTITEM_H
+
+#include "coordinates/geocoordinate.h"
+#include "routing/routesegment.h"
+#include "extendedlistitem.h"
+
+/**
+* @brief List item stores information about route waypoints.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
+*/
+class RouteWaypointListItem : public ExtendedListItem
+{
+public:
+ /**
+ * @brief Constructor.
+ *
+ * Sets sub items' text width.
+ */
+ RouteWaypointListItem();
+
+ /**
+ * @brief Destructor.
+ */
+ ~RouteWaypointListItem();
+
+/******************************************************************************
+* MEMBER FUNCTIONS AND SLOTS
+******************************************************************************/
+public:
+ /**
+ * @brief Returns item's coordinates.
+ *
+ * @return item's coordinates
+ */
+ GeoCoordinate coordinates() const;
+
+ /**
+ * @brief Set route waypoint data for this item.
+ *
+ * @param routeSegment RouteSegment data
+ * @param coordinates GeoCoordinate
+ */
+ void setRouteWaypointData(const RouteSegment &routeSegment,
+ const GeoCoordinate &coordinate);
+
+/******************************************************************************
+* DATA MEMBERS
+******************************************************************************/
+private:
+ GeoCoordinate m_coordinates; ///< Route segment coordinates
+ RouteSegment m_routeSegment; ///< Route segment data
+};
+
+#endif // ROUTEWAYPOINTLISTITEM_H
+
--- /dev/null
+#include <QDebug>
+
+#include "routewaypointlistitem.h"
+
+#include "routewaypointlistview.h"
+
+RouteWaypointListView::RouteWaypointListView(QWidget *parent)
+ : ListView(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
+void RouteWaypointListView::listItemClicked(ListItem *item)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ ListView::listItemClicked(item);
+
+ RouteWaypointListItem *routeWaypointItem = dynamic_cast<RouteWaypointListItem*>(item);
+
+ if (routeWaypointItem)
+ emit routeWaypointItemClicked(routeWaypointItem->coordinates());
+}
--- /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 ROUTEWAYPOINTLISTVIEW_H
+#define ROUTEWAYPOINTLISTVIEW_H
+
+#include "listview.h"
+
+/**
+* @brief Shows RouteWaypointListItems in list view.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
+*/
+class RouteWaypointListView : public ListView
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor.
+ *
+ * @param parent QWidget
+ */
+ RouteWaypointListView(QWidget *parent = 0);
+
+/*******************************************************************************
+* MEMBER FUNCTIONS AND SLOTS
+******************************************************************************/
+public slots:
+ /**
+ * @brief Slot for list item clicked.
+ *
+ * @param item ListItem
+ */
+ void listItemClicked(ListItem *item);
+
+/******************************************************************************
+* SIGNALS
+******************************************************************************/
+signals:
+ /**
+ * @brief Signal is emitted when route waypoint item is clicked.
+ *
+ * @param coordinates item's coordinates
+ */
+ void routeWaypointItemClicked(const GeoCoordinate &coordinates);
+};
+
+
+#endif // ROUTEWAYPOINTLISTVIEW_H
#include "locationlistview.h"
#include "extendedlistitemdelegate.h"
#include "routing/location.h"
+#include "routing/route.h"
+#include "routewaypointlistview.h"
+#include "routewaypointlistitem.h"
#include "panelcommon.h"
#include "routingpanel.h"
m_locationListView = new LocationListView(this);
m_locationListView->setItemDelegate(new ExtendedListItemDelegate(this));
+ m_locationListView->hide();
+
+ m_routeWaypointListView = new RouteWaypointListView(this);
+ m_routeWaypointListView->setItemDelegate(new ExtendedListItemDelegate(this));
+ m_routeWaypointListView->hide();
headerLayout->addWidget(m_locationListLabel, 0, Qt::AlignCenter);
listViewLayout->addWidget(m_locationListView);
+ listViewLayout->addWidget(m_routeWaypointListView);
routingLayout->addWidget(m_routeButton);
routingLayout->addWidget(m_locationListHeaderWidget);
connect(m_routeButton, SIGNAL(clicked()),
this, SLOT(routeToSelectedLocation()));
+
+ connect(m_routeWaypointListView, SIGNAL(routeWaypointItemClicked(GeoCoordinate)),
+ this, SIGNAL(routeWaypointItemClicked(GeoCoordinate)));
}
void RoutingPanel::populateLocationListView(const QList<Location> &locations)
m_locationListHeaderWidget->show();
m_locationListLabel->setText(tr("Search results: %1").arg(locations.count()));
+ m_routeWaypointListView->hide();
+ m_locationListView->show();
m_locationListView->clearList();
for (int i = 0; i < locations.size(); ++i) {
if (item)
emit routeToLocation(item->coordinates());
}
+
+void RoutingPanel::setRoute(Route &route)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_locationListView->hide();
+ m_routeWaypointListView->show();
+ m_routeWaypointListView->clear();
+
+ QList<RouteSegment> segments = route.segments();
+ QList<GeoCoordinate> geometryPoints = route.geometryPoints();
+
+ for (int i = 0; i < segments.size(); ++i) {
+ RouteWaypointListItem *item = new RouteWaypointListItem();
+ RouteSegment routeSegment = segments.at(i);
+ item->setRouteWaypointData(routeSegment,
+ geometryPoints.at(routeSegment.positionIndex()));
+
+ m_routeWaypointListView->addListItem(QString::number(i), item);
+ }
+}
class GeoCoordinate;
class LocationListView;
class Location;
+class Route;
+class RouteWaypointListView;
/**
* @brief Class for sliding routing panel
*/
void routeToSelectedLocation();
+ /**
+ * @brief Sets route to the panel.
+ *
+ * Appends route waypoint list with route segments.
+ * @param route Route item containing parsed route details
+ */
+ void setRoute(Route &route);
+
/*******************************************************************************
* SIGNALS
******************************************************************************/
*/
void routeToLocation(const GeoCoordinate &coordinates);
+ void routeWaypointItemClicked(const GeoCoordinate &coordinate);
+
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
QWidget *m_locationListHeaderWidget; ///< Location list header widget
LocationListView *m_locationListView; ///< Location list view
+ RouteWaypointListView *m_routeWaypointListView; ///< Route waypoint list view
};
#endif // ROUTINGPANEL_H