#include <QtGui/QWidget>
#include <QtGui/QPushButton>
-#include <QtGui/QLineEdit>
#include <QtGui/QLabel>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QRadioButton>
#include <QtGui/QButtonGroup>
+#include <QtGui/QRadioButton>
#include <QtGui/QSlider>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QHBoxLayout>
#include <QtGui/QDesktopServices>
+#include <QtCore/QProcess>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtCore/QFile>
#include "googlelatitude.h"
#include "gpscontrol.h"
void gl_GotToken() {
qDebug() << "LatitudeGUI::gl_GotToken";
do_oauth->setDisabled(true);
- do_start->setEnabled(true);
- do_stop->setDisabled(true);
+ if (system("killall -0 LatitudeUpdaterDaemon 2> /dev/null" )) {
+ do_start->setEnabled(true);
+ do_stop->setDisabled(true);
+ } else {
+ do_start->setDisabled(true);
+ do_stop->setEnabled(true);
+ }
}
void gl_NotToken() {
qDebug() << "LatitudeGUI::gl_NotToken";
qDebug() << "LatitudeGUI::gps_start";
do_start->setDisabled(true);
do_stop->setEnabled(true);
- gps.startUpdates();
+ if (demonioOpt.exists()) {
+ qDebug() << "LatitudeGUI:: demonio opt";
+ cli.startDetached(demonioOpt.fileName());
+ } else if (demonioSdk.exists()) {
+ qDebug() << "LatitudeGUI:: demonio sdk";
+ cli.startDetached(demonioSdk.fileName());
+ } else {
+ qDebug() << "LatitudeGUI:: demonio none";
+ gps.startUpdates();
+ }
}
void gps_stop() {
qDebug() << "LatitudeGUI::gps_stop";
do_start->setEnabled(true);
do_stop->setDisabled(true);
- gps.stopUpdates(true);
- }
- void get_gps() {
- qDebug() << "LatitudeGUI::get_gps";
- pos_lat->setText(QString("%1").arg(gps.getCurrentLatitude()));
- pos_lon->setText(QString("%1").arg(gps.getCurrentLongitude()));
- pos_acc->setText(QString("%1").arg(gps.getCurrentAccuracy()));
- pos_tis->setText(QString("%1").arg(gps.getCurrentTimestamp()));
+ if (demonioOpt.exists() || demonioSdk.exists() ) {
+ qDebug() << "LatitudeGUI:: demonio kill" << system("killall LatitudeUpdaterDaemon 2> /dev/null");
+ } else {
+ gps.stopUpdates(true);
+ }
}
void set_latitude() {
qDebug() << "LatitudeGUI::set_latitude";
- latitude.setCurrentLocation(pos_lat->text().toDouble(),
- pos_lon->text().toDouble(),
- pos_acc->text().toDouble());
+ latitude.setCurrentLocation(gps.getCurrentLatitude(),
+ gps.getCurrentLongitude(),
+ gps.getCurrentAccuracy());
latitude.sendCurrentLocation();
}
void set_method() {
private:
GoogleLatitude latitude;
GpsControl gps;
+ QFile demonioOpt;
+ QFile demonioSdk;
+ QProcess cli;
QHBoxLayout *layout_row1;
QPushButton *do_oauth;
QPushButton *do_stop;
QHBoxLayout *layout_row2;
- QLabel *pos_label;
- QLineEdit *pos_lat;
- QLineEdit *pos_lon;
- QLineEdit *pos_acc;
- QLineEdit *pos_tis;
-
- QHBoxLayout *layout_row3;
QLabel *gps_method;
QButtonGroup *gps_group;
QRadioButton *gps_cell;
QRadioButton *gps_both;
QRadioButton *gps_agps;
- QHBoxLayout *layout_row4;
+ QHBoxLayout *layout_row3;
QLabel *gps_to_label;
QSlider *gps_to_slider;
QLabel *gps_to_slider_value;
- QHBoxLayout *layout_row5;
+ QHBoxLayout *layout_row4;
QLabel *gps_i_label;
QSlider *gps_i_slider;
QLabel *gps_i_slider_value;
- QHBoxLayout *layout_row6;
+ QHBoxLayout *layout_row5;
QLabel *gps_ac_label;
QButtonGroup *gps_ac_group;
QRadioButton *gps_ac_yes;
};
#endif // LATITUDEGUI_H
+