projects
/
googlelatitude
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
be compatible with qt 4.6/4.5
[googlelatitude]
/
src
/
glatitude.cpp
diff --git
a/src/glatitude.cpp
b/src/glatitude.cpp
index
be927e9
..
2f9dcac
100644
(file)
--- a/
src/glatitude.cpp
+++ b/
src/glatitude.cpp
@@
-6,6
+6,7
@@
GoogleLatitude::GoogleLatitude(QObject *parent) : QObject(parent) {
latitude = 0.;
longitude = 0.;
accuracy = 0.;
latitude = 0.;
longitude = 0.;
accuracy = 0.;
+ interval = 120;
worker = new QNetworkAccessManager();
connect(worker, SIGNAL(finished(QNetworkReply *)), this, SLOT(finishedreply(QNetworkReply *)));
worker = new QNetworkAccessManager();
connect(worker, SIGNAL(finished(QNetworkReply *)), this, SLOT(finishedreply(QNetworkReply *)));
@@
-24,16
+25,26
@@
void GoogleLatitude::login(QString u, QString p) {
pass = p;
}
pass = p;
}
+void GoogleLatitude::freq(int f) {
+ interval = f;
+}
+
+void GoogleLatitude::reset() {
+ lastupdate = 0;
+ login_error = false;
+ set(latitude, longitude, accuracy);
+}
+
void GoogleLatitude::set(double la, double lo, double ac) {
latitude = la;
longitude = lo;
accuracy = ac;
qDebug() << "GoogleLatitude: set la = " << la << " lo = " << lo << " ac = " << ac;
void GoogleLatitude::set(double la, double lo, double ac) {
latitude = la;
longitude = lo;
accuracy = ac;
qDebug() << "GoogleLatitude: set la = " << la << " lo = " << lo << " ac = " << ac;
- qDebug() << "GoogleLatitude: set lastupdate = " << lastupdate << " current = " << QDateTime::currentMSecsSinceEpoch();
+ qDebug() << "GoogleLatitude: set lastupdate = " << lastupdate << " current = " << QDateTime::currentDateTime().toUTC().toTime_t();
if (login_error) return;
if (la*lo == 0) return;
if (login_error) return;
if (la*lo == 0) return;
- if ( QDateTime::currentMSecsSinceEpoch() < lastupdate + 120*1000 ) return;
+ if ( QDateTime::currentDateTime().toUTC().toTime_t() < lastupdate + interval ) return;
worker->get(QNetworkRequest(urllogin));
}
worker->get(QNetworkRequest(urllogin));
}
@@
-71,8
+82,8
@@
void GoogleLatitude::finishedreply(QNetworkReply *r) {
login_error = true;
emit ERROR();
} else {
login_error = true;
emit ERROR();
} else {
- lastupdate = QDateTime::currentMSecsSinceEpoch();
- qDebug() << "GoogleLatitude: update ok " << " lastupdate = " << lastupdate;
+ lastupdate = QDateTime::currentDateTime().toUTC().toTime_t();
+ qDebug() << "GoogleLatitude: update ok " << "lastupdate = " << lastupdate;
emit OK();
}
} else {
emit OK();
}
} else {