From: Rodrigo Linfati Date: Sun, 9 May 2010 02:08:42 +0000 (+0200) Subject: ifdef for maemo X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=commitdiff_plain;h=e1790861d041d0aec07947dcec23fd61b31cce50;ds=sidebyside ifdef for maemo --- diff --git a/googlelatitude.pro b/googlelatitude.pro index 6ca7dca..8eb75e0 100644 --- a/googlelatitude.pro +++ b/googlelatitude.pro @@ -7,6 +7,10 @@ MOC_DIR = build DESTDIR = build TEMPLATE = app -QT += network webkit maemo5 -CONFIG += link_pkgconfig -PKGCONFIG += glib-2.0 liblocation +QT += network webkit + +contains(QT_CONFIG, maemo5) { + QT += maemo5 + CONFIG += link_pkgconfig + PKGCONFIG += glib-2.0 liblocation +} diff --git a/src/gps.cpp b/src/gps.cpp index b7ed336..0fb4ba7 100644 --- a/src/gps.cpp +++ b/src/gps.cpp @@ -1,5 +1,7 @@ #include "gps.h" +#ifdef Q_WS_MAEMO_5 + GpsMaemo5::GpsMaemo5(QObject *parent) : QObject(parent) { latitude = 0; longitude = 0; @@ -26,3 +28,5 @@ void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) { } } } + +#endif // Q_WS_MAEMO_5 diff --git a/src/gps.h b/src/gps.h index ca5ea9d..2d9cfdf 100644 --- a/src/gps.h +++ b/src/gps.h @@ -3,6 +3,8 @@ #include +#ifdef Q_WS_MAEMO_5 + extern "C" { #include #include @@ -33,4 +35,21 @@ private: void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps); +#else // Q_WS_MAEMO_5 + +class GpsMaemo5 : public QObject { + Q_OBJECT + +signals: + void fix(); + +public: + GpsMaemo5(QObject *parent = 0) { Q_UNUSED(parent); } + double get_lat() { return 0; } + double get_lon() { return 0; } + double get_acc() { return 0; } +}; + +#endif // Q_WS_MAEMO_5 + #endif // GPS_H diff --git a/src/latitude.cpp b/src/latitude.cpp index c215f01..aa742f1 100644 --- a/src/latitude.cpp +++ b/src/latitude.cpp @@ -1,8 +1,10 @@ #include "latitude.h" LatitudeGUI::LatitudeGUI(QMainWindow *parent) : QMainWindow(parent) { +#ifdef Q_WS_MAEMO_5 setAttribute(Qt::WA_Maemo5AutoOrientation, true); - setWindowTitle(tr("Google Latitude Updater")); +#endif + setWindowTitle(tr("Latitude & Buzz")); setting = new QSettings(); @@ -41,7 +43,11 @@ LatitudeGUI::LatitudeGUI(QMainWindow *parent) : QMainWindow(parent) { } void LatitudeGUI::set() { - QMaemo5InformationBox::information(this, "New gps position", 1000); +#ifdef Q_WS_MAEMO_5 + QMaemo5InformationBox::information(this, "new position...", 1000); +#else + qDebug() << "new position..."; +#endif glatitude->login(setting->value("user","my_username").toString(), setting->value("pass","my_password").toString()); glatitude->set(gps->get_lat(), @@ -50,11 +56,19 @@ void LatitudeGUI::set() { } void LatitudeGUI::latitude_OK() { - QMaemo5InformationBox::information(this, "Location Sent!", 1000); +#ifdef Q_WS_MAEMO_5 + QMaemo5InformationBox::information(this, "...location Sent!", 1000); +#else + qDebug() << "...location Sent!"; +#endif } void LatitudeGUI::latitude_ERROR() { +#ifdef Q_WS_MAEMO_5 QMaemo5InformationBox::information(this, "Error in Authentification !", 3000); +#else + qDebug() << "Error in Authentification !"; +#endif } void LatitudeGUI::save_user(QString _user) { diff --git a/src/latitude.h b/src/latitude.h index 7f54190..4f2362d 100644 --- a/src/latitude.h +++ b/src/latitude.h @@ -3,9 +3,11 @@ #include #include -#include #include "glatitude.h" #include "gps.h" +#ifdef Q_WS_MAEMO_5 +#include +#endif class LatitudeGUI : public QMainWindow { Q_OBJECT diff --git a/src/main.cpp b/src/main.cpp index a80b29c..c85dc20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,3 +11,10 @@ int main(int argc, char *argv[]) { return app.exec(); } + +/* + TODO: + on auth error -> stop gps + on new pos, only set it + send new pos every 120s, only if is diferent + */