00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Henri Lampela - henri.lampela@ixonos.com 00006 Sami Rämö - sami.ramo@ixonos.com 00007 00008 Situare is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 version 2 as published by the Free Software Foundation. 00011 00012 Situare is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Situare; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 USA. 00021 */ 00022 00023 #ifndef GEOCODINGSERVICE_H 00024 #define GEOCODINGSERVICE_H 00025 00026 #include <QObject> 00027 00028 #include "location.h" 00029 00030 class QNetworkReply; 00031 class QUrl; 00032 00033 class NetworkAccessManager; 00034 00044 class GeocodingService : public QObject 00045 { 00046 Q_OBJECT 00047 00048 public: 00054 GeocodingService(QObject *parent = 0); 00055 00056 /******************************************************************************* 00057 * MEMBER FUNCTIONS AND SLOTS 00058 ******************************************************************************/ 00059 public slots: 00065 void requestFinished(QNetworkReply *reply); 00066 00072 void requestLocation(const QString &location); 00073 00074 private: 00080 void parseSearchResults(const QByteArray &jsonReply); 00081 00087 void sendRequest(const QUrl &url); 00088 00089 /******************************************************************************* 00090 * SIGNALS 00091 ******************************************************************************/ 00092 signals: 00099 void error(const int context, const int error); 00100 00106 void locationDataParsed(const QList<Location> &result); 00107 00108 /******************************************************************************* 00109 * DATA MEMBERS 00110 ******************************************************************************/ 00111 private: 00112 QList<Location> m_searchResults; 00113 00114 NetworkAccessManager *m_networkManager; 00115 }; 00116 00117 #endif // GEOCODINGSERVICE_H