Merge lp:~unity-api-team/unity-scopes-shell/fix-location-caching-vivid into lp:unity-scopes-shell

Proposed by Pete Woods
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 186
Merged at revision: 186
Proposed branch: lp:~unity-api-team/unity-scopes-shell/fix-location-caching-vivid
Merge into: lp:unity-scopes-shell
Diff against target: 83 lines (+17/-14)
1 file modified
src/Unity/ubuntulocationservice.cpp (+17/-14)
To merge this branch: bzr merge lp:~unity-api-team/unity-scopes-shell/fix-location-caching-vivid
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+246981@code.launchpad.net

Commit message

Remove distance-based filtering and refresh GeoIP data every minute

Description of the change

Remove distance-based filtering and refresh GeoIP data every minute

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Unity/ubuntulocationservice.cpp'
2--- src/Unity/ubuntulocationservice.cpp 2014-11-18 17:08:43 +0000
3+++ src/Unity/ubuntulocationservice.cpp 2015-01-20 09:03:36 +0000
4@@ -51,6 +51,11 @@
5 */
6 static const int DEACTIVATE_INTERVAL = 5000;
7
8+ /**
9+ * Re-do the GeoIP call every 60 seconds
10+ */
11+ static const int GEOIP_INTERVAL = 60000;
12+
13 class DBusThread : public QThread
14 {
15
16@@ -92,7 +97,11 @@
17 m_deactivateTimer.setSingleShot(true);
18 m_deactivateTimer.setTimerType(Qt::VeryCoarseTimer);
19
20- m_geoIp->start();
21+ m_geoipTimer.moveToThread(thread());
22+ m_geoipTimer.setInterval(GEOIP_INTERVAL);
23+ m_geoipTimer.setTimerType(Qt::CoarseTimer);
24+
25+ QMetaObject::invokeMethod(m_geoIp.data(), "start", Qt::QueuedConnection);
26
27 try
28 {
29@@ -115,6 +124,9 @@
30
31 // Wire up the network request finished timer
32 connect(m_geoIp.data(), &GeoIp::finished, this, &Priv::requestFinished, Qt::QueuedConnection);
33+
34+ // Wire up the GeoIP repeat timer
35+ connect(&m_geoipTimer, &QTimer::timeout, m_geoIp.data(), &GeoIp::start, Qt::QueuedConnection);
36 }
37
38 ~Priv()
39@@ -166,6 +178,7 @@
40 {
41 m_session->updates().position_status =
42 culss::Interface::Updates::Status::enabled;
43+ m_geoipTimer.start();
44 }
45 else if (m_activationCount == 0
46 && m_session->updates().position_status
47@@ -173,6 +186,7 @@
48 {
49 m_session->updates().position_status =
50 culss::Interface::Updates::Status::disabled;
51+ m_geoipTimer.stop();
52 }
53 }
54 catch (exception& e)
55@@ -185,19 +199,6 @@
56 {
57 QMutexLocker lock(&m_lastLocationMutex);
58
59- if (m_locationUpdatedAtLeastOnce)
60- {
61- culu::Quantity<culu::Length> distance = cul::haversine_distance(
62- m_lastLocation, newPosition.value);
63- culu::Quantity<culu::Length> threshold(50.0 * culu::Meters);
64-
65- // Ignore the update if we haven't moved significantly
66- if (distance <= threshold)
67- {
68- return;
69- }
70- }
71-
72 m_locationUpdatedAtLeastOnce = true;
73 m_lastLocation = newPosition.value;
74 Q_EMIT locationChanged();
75@@ -243,6 +244,8 @@
76
77 int m_activationCount = 0;
78
79+ QTimer m_geoipTimer;
80+
81 QTimer m_deactivateTimer;
82
83 GeoIp::Ptr m_geoIp;

Subscribers

People subscribed via source and target branches

to all changes: