From 3ebb0c952333caf715a9e2a6c23360db93e54f75 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Thu, 15 Feb 2018 18:35:50 -0500 Subject: UI improvements for scanning behavior Rework to only enable the scan buttons when the radio is playing, and a tweak to make sure the scan label reverts to the original non-scanning color when a scan is interrupted by the user selecting a frequency with the slider or tune buttons. Change-Id: I5c44234891aa82e13c28c75b703039575fa2428e Signed-off-by: Scott Murray --- app/Radio.qml | 43 ++++++++++++++++++++++++------------------- app/api/Binding.qml | 1 + 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/app/Radio.qml b/app/Radio.qml index 7b7797a..78bab94 100644 --- a/app/Radio.qml +++ b/app/Radio.qml @@ -181,33 +181,38 @@ ApplicationWindow { } ImageButton { + id: scanDownBtn offImage: './images/AGL_MediaPlayer_BackArrow.svg' - Timer { - running: parent.pressed - triggeredOnStart: true - interval: 100 - repeat: true - onTriggered: { - radio.scanDown() - scanLabel.color = '#59FF7F' + states: [ + State { + when: radio.state === radio.activeState + PropertyChanges { + target: scanDownBtn + onClicked: { + radio.scanDown() + scanLabel.color = '#59FF7F' + } + } } - } + ] } ImageButton { + id: scanUpBtn offImage: './images/AGL_MediaPlayer_ForwardArrow.svg' - Timer { - running: parent.pressed - triggeredOnStart: true - interval: 100 - repeat: true - onTriggered: { - radio.scanUp() - scanLabel.color = '#59FF7F' + states: [ + State { + when: radio.state === radio.activeState + PropertyChanges { + target: scanUpBtn + onClicked: { + radio.scanUp() + scanLabel.color = '#59FF7F' + } + } } - } + ] } - } } } diff --git a/app/api/Binding.qml b/app/api/Binding.qml index 7750452..ee83bb5 100644 --- a/app/api/Binding.qml +++ b/app/api/Binding.qml @@ -64,6 +64,7 @@ WebSocket { sendSocketMessage("scan_stop", 'None') scanningState = stoppedState sendSocketMessage("frequency", { value: frequency }) + root.stationFound() } else { // This update was from scanning, clear state scanningFreqUpdate = false -- cgit 1.2.3-korg