void init();
/**
- * @brief Helper for setting view location based on latitude and longitude
- * coordinates
- *
- * @param latLonCoordinate Latitude & longitude coordinates for location
- */
- void setViewLocation(QPointF latLonCoordinate);
-
- /**
* @brief Getter for scene
*
* @return QGraphicsScene
void setLocation(QPoint sceneCoordinate);
/**
+ * @brief Helper for setting view location based on latitude and longitude
+ * coordinates
+ *
+ * @param latLonCoordinate Latitude & longitude coordinates for location
+ */
+ void setViewLocation(QPointF latLonCoordinate);
+
+ /**
* @brief Slot for view resizing.
*
* @param size view size
gps/gpspositioninterface.h
QT += network \
webkit
-DEFINES += QT_NO_DEBUG_OUTPUT
+#DEFINES += QT_NO_DEBUG_OUTPUT
!maemo5 {
SOURCES += gps/gpspositionmockup.cpp
#include "friendlistitem.h"
#include "../user/user.h"
#include "avatarimage.h"
+#include "imagebutton.h"
FriendListItem::FriendListItem(QWidget *parent)
: QWidget(parent)
m_distanceLabel = new QLabel();
m_distanceLabel->setFixedHeight(IMAGE_HEIGHT);
- QLabel *button = new QLabel();
- button->setPixmap(QPixmap(":/res/images/show_position.png"));
- button->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
+// QLabel *button = new QLabel();
+// button->setPixmap(QPixmap(":/res/images/show_position.png"));
+// button->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
+ m_findButton = new ImageButton(this, ":/res/images/show_position.png",
+ ":/res/images/show_position_s.png");
m_updatedLabel = new QLabel();
m_updatedLabel->setWordWrap(true);
topLayout->addWidget(m_nameLabel, 1);
topLayout->addWidget(m_distanceLabel);
- bottomLayout->addWidget(button, 0, Qt::AlignTop);
+ bottomLayout->addWidget(m_findButton, 0, Qt::AlignTop);
bottomLayout->addLayout(infoLayout);
layout->addLayout(topLayout, 0);
m_backgroundTopImage.load(":/res/images/list_item_top.png");
m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
+
+ connect(m_findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
}
void FriendListItem::setData(User *user)
painter.drawPixmap(middleRect, m_backgroundMiddleImage);
painter.drawPixmap(bottomRect, m_backgroundBottomImage);
}
+
+void FriendListItem::findButtonClicked()
+{
+ emit findFriend(m_user->coordinates());
+}
#include "../user/user.h"
class QLabel;
+class ImageButton;
/**
* @brief FriendListItem shows friend data in expandable item.
*/
void setText(bool expanded);
+private slots:
+ /**
+ * @brief Slot for find button click
+ *
+ * @param coordinates friend's geo coordinates
+ */
+ void findButtonClicked();
+
/******************************************************************************
* SIGNALS
******************************************************************************/
signals:
- void locationButtonClicked(const QPointF &coordinates);
+
+ void findFriend(const QPointF &coordinates);
/******************************************************************************
* DATA MEMBERS
QPixmap m_backgroundBottomImage; ///< Bottom background image
bool m_expanded; ///< Item expanded state
QLabel *m_distanceLabel; ///< Distance to friend label
+ ImageButton *m_findButton; ///< Friend find button
QLabel *m_imageLabel; ///< Image label
QLabel *m_locationLabel; ///< Location label
QPoint m_mousePosition; ///< Current mouse press position
foreach (User *user, friendList) {
FriendListItem *item = new FriendListItem(m_friendListView);
item->setData(user);
+ connect(item, SIGNAL(findFriend(QPointF)), this, SIGNAL(findFriend(QPointF)));
m_friendListView->addWidget(item);
}
}
void reDrawFriendsPanel(int width, int height);
/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+ void findFriend(const QPointF &coordinates);
+
+/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
foreach (QWidget *widget, widgets) {
m_friendListLayout->removeWidget(widget);
widgets.removeOne(widget);
+ disconnect(widget, 0, 0, 0);
delete widget;
}
}
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_mapViewScreen, SIGNAL(friendsLocationsReady(QList<User*>&)));
- connect(this, SIGNAL(enableAutoCentering(bool)),
+ connect(this, SIGNAL(enableAutoCentering(bool)),
m_mapViewScreen, SLOT(enableAutoCentering(bool)));
connect(this, SIGNAL(positionReceived(QPointF)),
m_mapViewScreen, SLOT(positionReceived(QPointF)));
+ connect(m_mapViewScreen, SIGNAL(mapLocationChanged()), this, SLOT(mapLocationChanged()));
this->toggleProgressIndicator(true);
}
m_autoCenteringAct->setCheckable(true);
m_autoCenteringAct->setChecked(true);
connect(m_autoCenteringAct, SIGNAL(toggled(bool)), this, SLOT(autoCenteringToggled(bool)));
-
- m_viewMenu = menuBar()->addMenu(tr("Main"));
+
+ m_viewMenu = menuBar()->addMenu(tr("Main"));
m_viewMenu->addAction(m_toSettingsAct);
m_viewMenu->addAction(m_gpsToggleAct);
showMaemoInformationBox(message);
}
+void MainWindow::mapLocationChanged()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_autoCenteringAct->setChecked(false);
+}
+
void MainWindow::autoCenteringToggled(bool checked)
{
qDebug() << __PRETTY_FUNCTION__ << " " << checked;
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public slots:
- /**
+ /**
* @brief Slot for auto centering enabling.
*
* @param checked true if button state is checked, false otherwise
void autoCenteringToggled(bool checked);
/**
+ * @brief Slot for map location change.
+ */
+ void mapLocationChanged();
+
+ /**
* @brief Public slot, which open settings dialog
*/
void openSettingsDialog();
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
+ connect(friendsListPanel, SIGNAL(findFriend(QPointF)),
+ mapEngine, SLOT(setViewLocation(QPointF)));
connect(this, SIGNAL(userLocationReady(User*)),
mapEngine, SLOT(receiveOwnLocation(User*)));
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
+ connect(mapView, SIGNAL(viewScrolled(QPoint)), this, SLOT(locationChanged()));
+
QHBoxLayout *mapViewLayout = new QHBoxLayout;
osmLicense = new QLabel(this);
height - osmLicense->fontMetrics().height());
}
+void MapViewScreen::locationChanged()
+{
+ qDebug() << __PRETTY_FUNCTION__ << " m_autoCentering: " << m_autoCenteringEnabled;
+
+ if (m_autoCenteringEnabled)
+ emit mapLocationChanged();
+}
+
void MapViewScreen::positionReceived(QPointF position)
{
qDebug() << __PRETTY_FUNCTION__;
void drawOsmLicense(int width, int height);
/**
+ * @brief Slot for map location change.
+ */
+ void locationChanged();
+
+ /**
* @brief Slot for GPS position.
*
* @param position latitude and longitude values
void userLocationReady(User *user);
/**
+ * @brief Signal for map location change.
+ */
+ void mapLocationChanged();
+
+ /**
* @brief Signal when friend list locations are fetched
*
* Forwarded to map engine and friends list panel