version 0.3, initial support to liblocation
[googlelatitude] / src / latitude.cpp
index 00e7243..2661345 100644 (file)
@@ -2,29 +2,47 @@
 
 LatitudeGUI::LatitudeGUI(QMainWindow *parent) : QMainWindow(parent) {
     glatitude = new GoogleLatitude(this);
+    gps = new GpsMaemo5(this);
     setting = new QSettings();
     urllogin = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview&continue=http://www.google.com/maps/m?mode=latitude");
 
     show_lat();
 
     connect(glatitude, SIGNAL(getOK()), this, SLOT(get_loc()));
+    connect(gps, SIGNAL(getOK()), this, SLOT(get_maemo5()));
+    connect(gps, SIGNAL(getOK_acwp()), this, SLOT(get_acwp()));
+    connect(gps, SIGNAL(getOK_agnss()), this, SLOT(get_agnss()));
     connect(glatitude, SIGNAL(setOK()), this, SLOT(set_OK()));
     connect(glatitude, SIGNAL(setERROR()), this, SLOT(set_ERROR()));
+
 }
 
 void LatitudeGUI::get_loc() {
     location_lat->setText(QString::number(glatitude->get_lat()));
     location_lon->setText(QString::number(glatitude->get_lon()));
     location_acc->setText(QString::number(glatitude->get_acc()));
-    status->setText(tr("Using google.com/loc"));
+    status->setText(tr("Using google.com/loc, ip-based"));
+}
+
+void LatitudeGUI::get_maemo5() {
+    location_lat->setText(QString::number(gps->get_lat()));
+    location_lon->setText(QString::number(gps->get_lon()));
+    location_acc->setText(QString::number(gps->get_acc()));
+    status->setText(tr("Using liblocation"));
 }
 
-void LatitudeGUI::get_cell() {
-    status->setText(tr("Using cell... TODO"));
+void LatitudeGUI::get_acwp() {
+    location_lat->setText(QString::number(gps->get_lat()));
+    location_lon->setText(QString::number(gps->get_lon()));
+    location_acc->setText(QString::number(gps->get_acc()));
+    status->setText(tr("Using acwp, cell-based "));
 }
 
-void LatitudeGUI::get_gps() {
-    status->setText(tr("Using gps... TODO"));
+void LatitudeGUI::get_agnss() {
+    location_lat->setText(QString::number(gps->get_lat()));
+    location_lon->setText(QString::number(gps->get_lon()));
+    location_acc->setText(QString::number(gps->get_acc()));
+    status->setText(tr("Using agnss, gps-based "));
 }
 
 void LatitudeGUI::set() {
@@ -37,7 +55,7 @@ void LatitudeGUI::set() {
 }
 
 void LatitudeGUI::set_OK() {
-    status->setText(tr("Location Updated !"));
+    status->setText(tr("Updated Location !"));
 }
 
 void LatitudeGUI::set_ERROR() {
@@ -103,8 +121,8 @@ void LatitudeGUI::show_lat() {
     layout_source->addWidget(source_gps);
     // source connect
     connect(source_loc, SIGNAL(clicked()), glatitude, SLOT(get()));
-    connect(source_cell, SIGNAL(clicked()), this, SLOT(get_cell()));
-    connect(source_gps, SIGNAL(clicked()), this, SLOT(get_gps()));
+    connect(source_cell, SIGNAL(clicked()), gps, SLOT(get_acwp()));
+    connect(source_gps, SIGNAL(clicked()), gps, SLOT(get_agnss()));
 
     // main layout
     location = new QWidget();