Merge lp:~paolorotolo/ubuntu-clock-app/fix-for-1200410 into lp:ubuntu-clock-app/saucy

Proposed by Paolo Rotolo
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 183
Merged at revision: 182
Proposed branch: lp:~paolorotolo/ubuntu-clock-app/fix-for-1200410
Merge into: lp:ubuntu-clock-app/saucy
Diff against target: 58 lines (+29/-18)
1 file modified
clock/WorldClock.qml (+29/-18)
To merge this branch: bzr merge lp:~paolorotolo/ubuntu-clock-app/fix-for-1200410
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nekhelesh Ramananthan Approve
Review via email: mp+183908@code.launchpad.net

Commit message

Added a small pause before searching cities online (LP: #1200410).

Description of the change

Clock: added a small pause before searching cities online.
Please see: https://bugs.launchpad.net/ubuntu-clock-app/+bug/1200410

To post a comment you must log in.
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Nice works as expected. Can you perhaps try some range of interval values between 1000-1500. On the phone, I expect the user to type slower, and hence the interval can slightly be increased.

181. By Paolo Rotolo

* Setted timer interval to 1300;
* Added search_timer.restart to restart the timer for each letter;
* Added comment in the code to explain the function of the timer.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Looking at the docs here at http://harmattan-dev.nokia.com/docs/library/html/qt4/qml-timer.html#restart-method, it seems that restart() alone will do the job. If the timer has not started, restart will start it. If the timer is running, it will stop, reset and then start the timer. Hence I think you can remove the start().

Also can you reduce the interval to 1100. 1300 seems to be a bit slow. Again this is a sensitive variable. Hence we can fine tune it at a later stage as well.

A small nitpick, can you align the comment code to the Timer {} and not the row.

review: Needs Fixing
182. By Paolo Rotolo

Reduced timer interval to 1100, fixed comment position.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

You missed the restart() part I mentioned earlier.

"Looking at the docs here at http://harmattan-dev.nokia.com/docs/library/html/qt4/qml-timer.html#restart-method, it seems that restart() alone will do the job. If the timer has not started, restart will start it. If the timer is running, it will stop, reset and then start the timer. Hence I think you can remove the start()."

review: Needs Fixing
183. By Paolo Rotolo

Removed search_timer.start.

Revision history for this message
Paolo Rotolo (paolorotolo) wrote :

Thanks nik. I don't know why but yesterday I totally forgot it...

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Thanks Paolo. I am at work atm, so I will try to merge this in at the end of the day after testing it again on my machine to confirm it one final time.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

lgtm!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clock/WorldClock.qml'
2--- clock/WorldClock.qml 2013-07-23 17:57:17 +0000
3+++ clock/WorldClock.qml 2013-09-05 07:31:21 +0000
4@@ -72,25 +72,36 @@
5 height: childrenRect.height;
6
7 TextField {
8- id: searchLabel
9-
10- hasClearButton: true
11- placeholderText: i18n.tr("Search");
12- primaryItem: Image {
13- height: parent.height/1.4
14- width: parent.height/1.45
15- source: Qt.resolvedUrl("../images/search_icon.png")
16- }
17-
18- onTextChanged: {
19- if (searchLabel.text != "") {
20- search_string = searchLabel.text;
21- searchCityModel.source = searchCityUrl(search_string);
22- } else {
23- searchCityModel.source = localCityUrl()
24+ id: searchLabel
25+
26+ hasClearButton: true
27+ placeholderText: i18n.tr("Search");
28+ primaryItem: Image {
29+ height: parent.height/1.4
30+ width: parent.height/1.45
31+ source: Qt.resolvedUrl("../images/search_icon.png")
32+ }
33+
34+ // Provide a small pause before going online to search
35+ Timer {
36+ id: search_timer
37+
38+ interval: 1100
39+ repeat: false
40+ onTriggered: {
41+ if (searchLabel.text != "") {
42+ search_string = searchLabel.text;
43+ searchCityModel.source = searchCityUrl(search_string);
44+ } else {
45+ searchCityModel.source = localCityUrl()
46+ }
47+ }
48+ }
49+
50+ onTextChanged: {
51+ search_timer.restart()
52+ }
53 }
54- }
55- }
56
57 Button {
58 id: searchButton;

Subscribers

People subscribed via source and target branches