<file>res/images/list_item_bottom.png</file>
<file>res/images/list_item_middle.png</file>
<file>res/images/list_item_top.png</file>
- <file>res/dummy/nmealog.txt</file>
+ <file>res/images/show_position.png</file>
+ <file>res/images/show_position_s.png</file>
++ <file>res/dummy/nmealog.txt</file>
</qresource>
</RCC>
void SituareEngine::loginOk()
{
qDebug() << __PRETTY_FUNCTION__;
- m_facebookAuthenticator->hide();
+
+ m_facebookAuthenticator->setAttribute(Qt::WA_DeleteOnClose);
+ m_facebookAuthenticator->close();
m_ui->show();
m_situareService->fetchLocations(); // request user locations
+ enableGPS(true);
}
void SituareEngine::requestAddress()
void userDataChanged(User *user, QList<User *> &friendsList);
/**
+ * @brief Slot for gps enabling.
+ *
+ * @parma enabled true if gps should be enabled, false otherwise
+ */
+ void enableGPS(bool enabled);
++
++ /**
+ * @brief Slot to intercept signal when user has cancelled login process
+ *
+ */
+ void quitApplication();
/*******************************************************************************
* SIGNALS
--- /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 GPSPOSITION_H
+#define GPSPOSITION_H
+
+#include <QGeoPositionInfoSource>
+#include <QPointF>
+
+QTM_USE_NAMESPACE
+
+/**
+* @brief GPSPosition class use GPS to receive location information.
+*
+* @class GPSPosition engine.h "gps/gpsposition.h"
+*/
+class GPSPosition : public QObject
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Start GPS.
+ */
+ GPSPosition(QObject *parent = 0);
+ ~GPSPosition();
+
+/******************************************************************************
+* MEMBER FUNCTIONS AND SLOTS
+******************************************************************************/
+public:
+ /**
+ * @brief Checks if GPS is running.
+ *
+ * @return true if GPS running, false otherwise
+ */
+ bool isRunning();
+
+ /**
+ * @brief Start GPS.
+ */
+ void start();
+
+ /**
+ * @brief Stop GPS.
+ */
+ void stop();
+
+ /**
+ * @brief Request GPS update.
+ */
+ void update();
+
+private slots:
+
+ /**
+ * @brief Slot for received position update.
+ *
+ * @param positionInfo Geo position info.
+ */
+ void positionUpdated(QGeoPositionInfo positionInfo);
+
+ /**
+ * @brief Slot for update timeout.
+ *
+ * Called when request timeout occurs.
+ */
+ void updateTimeout();
+
+/******************************************************************************
+* SIGNALS
+******************************************************************************/
+signals:
+ /**
+ * @brief Signal for position information.
+ *
+ * @param latLonCoordinate latitude and longitude values
+ */
+ void position(QPointF latLonCoordinate);
+
+ /**
+ * @brief Signal for timeout.
+ */
+ void timeout();
+
+ /**
+ * @brief Signal for error.
+ *
+ * @param message error message
+ */
+ void error(const QString &message);
+
+private:
- const int DEFAULT_UPDATE_INTERVAL = 5000; ///< Default update interval
-
+ QGeoPositionInfoSource *m_gpsSource; ///< GPS position info source
+ bool m_running; ///< GPS is running
++ int m_updateInterval; ///< GPS update interval
+};
+
++const int DEFAULT_UPDATE_INTERVAL = 5000; ///< Default update interval
++
+#endif // GPSPOSITION_H
ui/friendlistview.cpp \
ui/friendlistitem.cpp \
user/user.cpp \
- ui/buttonitem.cpp \
- ui/situareuser.cpp \
+ ui/avatarimage.cpp \
engine/engine.cpp \
ui/settingsdialog.cpp \
+ ui/logindialog.cpp \
map/maptilerequest.cpp \
- gps/gpsposition.cpp
+ ui/imagebutton.cpp \
+ ui/friendlistpanel.cpp \
+ ui/userpanel.cpp \
+ ui/panelsidebar.cpp \
+ ui/panelsliderbar.cpp \
+ map/friendgroupitem.cpp \
- map/frienditemshandler.cpp
++ map/frienditemshandler.cpp \
++ gps/gpsposition.cpp
HEADERS += ui/mainwindow.h \
ui/mapviewscreen.h \
ui/listviewscreen.h \
ui/friendlistview.h \
ui/friendlistitem.h \
user/user.h \
- ui/buttonitem.h \
- ui/situareuser.h \
+ ui/avatarimage.h \
engine/engine.h \
ui/settingsdialog.h \
+ ui/logindialog.h \
map/maptilerequest.h \
- gps/gpsposition.h
+ ui/imagebutton.h \
+ ui/friendlistpanel.h \
+ ui/userpanel.h \
+ ui/panelcommon.h \
+ ui/panelsidebar.h \
+ ui/panelsliderbar.h \
+ map/friendgroupitem.h \
- map/frienditemshandler.h
++ map/frienditemshandler.h \
++ gps/gpsposition.h
QT += network \
webkit
+
+CONFIG += mobility
- MOBILITY += location
++
++MOBILITY = location
+
DEFINES += QT_NO_DEBUG_OUTPUT
- !maemo5 {
+ !maemo5 {
message(QJson built in)
message(Make sure you have QJson development headers installed)
message(install headers with: sudo apt-get install libqjson-dev)
connect(m_listViewScreen, SIGNAL(updateFriendsData()),
this, SIGNAL(refreshUserData()));
- connect(this, SIGNAL(autoCenteringEnabled(bool)),
- m_mapViewScreen, SLOT(autoCenteringEnabled(bool)));
++ connect(this, SIGNAL(enableAutoCentering(bool)),
++ m_mapViewScreen, SLOT(enableAutoCentering(bool)));
+ connect(this, SIGNAL(positionReceived(QPointF)),
+ m_mapViewScreen, SLOT(positionReceived(QPointF)));
+
this->toggleProgressIndicator(true);
+
+ //Debug, use settings instead
+ autoCenteringToggled(true);
}
MainWindow::~MainWindow()
SettingsDialog *dialog = new SettingsDialog(this);
dialog->show();
}
+
+void MainWindow::gpsActionToggled(bool checked)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (checked) {
+ emit enableGPS(true);
+ m_gpsToggleAct->setText(tr("GPS enabled"));
+ showMaemoInformationBox(tr("GPS enabled"));
++ m_autoCenteringAct->setEnabled(true);
+ }
+ else {
+ emit enableGPS(false);
+ m_gpsToggleAct->setText(tr("GPS disabled"));
+ showMaemoInformationBox(tr("GPS disabled"));
++ m_autoCenteringAct->setEnabled(false);
+ }
+}
+
+void MainWindow::gpsTimeout()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ showMaemoInformationBox(tr("GPS timeout"));
+}
+
+void MainWindow::gpsError(const QString &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ showMaemoInformationBox(message);
+}
+
+void MainWindow::autoCenteringToggled(bool checked)
+{
+ qDebug() << __PRETTY_FUNCTION__ << " " << checked;
+
+ if (checked) {
+ emit enableAutoCentering(true);
+ m_autoCenteringAct->setText(tr("Auto centering enabled"));
+ showMaemoInformationBox(tr("Auto centering enabled"));
+ }
+ else {
+ emit enableAutoCentering(false);
+ m_autoCenteringAct->setText(tr("Auto centering disabled"));
+ showMaemoInformationBox(tr("Auto centering disabled"));
+ }
+}
+
+void MainWindow::showMaemoInformationBox(const QString &message)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+#ifdef Q_WS_MAEMO_5
+ QMaemo5InformationBox::information(this, message,
+ QMaemo5InformationBox::DefaultTimeout);
+#endif // Q_WS_MAEMO_5
+}
#include "../map/mapview.h"
#include "../map/mapengine.h"
#include "infotab.h"
+ #include "friendlistpanel.h"
+ #include "userpanel.h"
+ #include "panelcommon.h"
+
+ #include "panelsidebar.h"
MapViewScreen::MapViewScreen(QWidget *parent)
- : QWidget(parent)
+ : QWidget(parent),
+ m_autoCenteringEnabled(false)
{
MapView *mapView = new MapView(this);
mapEngine = new MapEngine(this);
void MapViewScreen::drawOsmLicense(int width, int height)
{
qDebug() << __PRETTY_FUNCTION__ << width << "x" << height;
- osmLicense->move(width-osmLicense->fontMetrics().width(OSM_LICENSE),
- height-osmLicense->fontMetrics().height());
+ osmLicense->move(width - osmLicense->fontMetrics().width(OSM_LICENSE) - PANEL_PEEK_AMOUNT,
+ height - osmLicense->fontMetrics().height());
}
+
+void MapViewScreen::positionReceived(QPointF position)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (m_autoCenteringEnabled)
+ mapEngine->setViewLocation(position);
+}
+
- void MapViewScreen::autoCenteringEnabled(bool enabled)
++void MapViewScreen::enableAutoCentering(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_autoCenteringEnabled = enabled;
+}
******************************************************************************/
private slots:
++
+ /**
- * @brief Debug method for centering to given coordinates
- */
- void searchMap();
-
- /**
- * @brief Slot to catch signal when user location is fetched
- *
- * @param user User data
- */
- void userLocationReady(User *user);
- /**
- * @brief Slot to catch signal when friend list locations are fetched
++ * @brief Slot for enabling auto centering.
+ *
- * @param friendsList Friends list data
++ * @param enabled true if map should center to GPS position, false otherwise
+ */
- void friendsLocationsReady(QList<User *> &friendsList);
++ void enableAutoCentering(bool enabled);
+
/**
* @brief Slot for drawing the Open Street Map license text
*
*/
void drawOsmLicense(int width, int height);
+ /**
- * @brief Slot for gps position.
++ * @brief Slot for GPS position.
+ *
- * @param position longitude and latitude values
++ * @param position latitude and longitude values
+ */
+ void positionReceived(QPointF position);
+
- void autoCenteringEnabled(bool enabled);
+ /*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+ signals:
+ /**
+ * @brief Signal when user location is fetched
+ *
+ * @param user User data
+ */
+ void userLocationReady(User *user);
+
+ /**
+ * @brief Signal when friend list locations are fetched
+ *
+ * Forwarded to map engine and friends list panel
+ *
+ * @param friendsList Friends list data
+ */
+ void friendsLocationsReady(QList<User *> &friendsList);
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
+
private:
++ bool m_autoCenteringEnabled; ///< Enable
+ FriendListPanel *friendsListPanel; ///< Instance of friends list panel
MapEngine *mapEngine; ///< MapEngine
- //DEBUG
QLabel *osmLicense; ///< Label for Open Street Map license
- QPushButton *zoomIn; ///< Debug button for zooming in
- QPushButton *zoomOut; ///< Debug button for zooming out
- QLineEdit latLine; ///< Debug input field for latitude
- QLineEdit lonLine; ///< Debug input field for longitude
- QPushButton *search; ///< Debug button for centering to given coordinates
- bool m_autoCenteringEnabled;
+ UserInfoPanel *userPanel; ///< Instance of the user information panel
};
#endif // MAPVIEWTAB_H