summaryrefslogtreecommitdiffstats
path: root/app/Radio.qml
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2017-05-22 18:05:21 -0400
committerScott Murray <scott.murray@konsulko.com>2017-05-23 18:53:26 -0400
commit9aebdfa77d57426fdaaab123d7c91c32a20e87be (patch)
tree68215fa3a0f70171bf0e05a2ce41ac2e924939ce /app/Radio.qml
parent9f227dc72607106641269560608b0297358adfa8 (diff)
Rework to add and use a binding for radio controldab_3.99.1dab/3.99.13.99.1
A radio binding has been added in the new binding directory, and the application has been reworked to use it. The binding uses a modified version of the rtl_fm code used in the qtmultimedia radio plugin that was previously used, and some new code has been added to output to PulseAudio using the asynchronous API to ensure compatibility with stream corking. The rtl_fm code has been enhanced to add seeking support, and the application has been tweaked to use it. Bug-AGL: SPEC-581 Change-Id: I011e98374accc2cad2b36c93ac800948ee51f2aa Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'app/Radio.qml')
-rw-r--r--app/Radio.qml65
1 files changed, 48 insertions, 17 deletions
diff --git a/app/Radio.qml b/app/Radio.qml
index 8bcd56e..f812af1 100644
--- a/app/Radio.qml
+++ b/app/Radio.qml
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Qt Company Ltd.
+ * Copyright (C) 2017 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,29 +18,23 @@
import QtQuick 2.6
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
-import QtMultimedia 5.5
import AGL.Demo.Controls 1.0
+import 'api' as API
ApplicationWindow {
id: root
- Radio {
+ API.Binding {
id: radio
+
property string title
+
onBandChanged: frequency = minimumFrequency
onStationFound: title = stationId
onFrequencyChanged: {
title = ''
slider.value = frequency
}
-
- function freq2str(freq) {
- if (freq > 5000000) {
- return '%1 MHz'.arg((freq / 1000000).toFixed(1))
- } else {
- return '%1 kHz'.arg((freq / 1000).toFixed(0))
- }
- }
}
ColumnLayout {
@@ -82,7 +77,7 @@ ApplicationWindow {
// offImage: './images/FM_Icons_FM.svg'
// onImage: './images/FM_Icons_AM.svg'
// onCheckedChanged: {
-// radio.band = checked ? Radio.AM : Radio.FM
+// radio.band = checked ? radio.amBand : radio.fmBand
// radio.frequency = radio.minimumFrequency
// }
// }
@@ -129,7 +124,11 @@ ApplicationWindow {
}
RowLayout {
Layout.fillHeight: true
- Item { Layout.fillWidth: true }
+
+ Label {
+ text: 'TUNE'
+ }
+
ImageButton {
offImage: './images/AGL_MediaPlayer_BackArrow.svg'
Timer {
@@ -140,13 +139,27 @@ ApplicationWindow {
onTriggered: radio.tuneDown()
}
}
+
+ ImageButton {
+ offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
+ Timer {
+ running: parent.pressed
+ triggeredOnStart: true
+ interval: 100
+ repeat: true
+ onTriggered: radio.tuneUp()
+ }
+ }
+
+ Item { Layout.fillWidth: true }
+
ImageButton {
id: play
offImage: './images/AGL_MediaPlayer_Player_Play.svg'
onClicked: radio.start()
states: [
State {
- when: radio.state === Radio.ActiveState
+ when: radio.state === radio.activeState
PropertyChanges {
target: play
offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
@@ -155,6 +168,25 @@ ApplicationWindow {
}
]
}
+
+ Item { Layout.fillWidth: true }
+
+ Label {
+ //Layout.fillWidth: true
+ text: 'SCAN'
+ }
+
+ ImageButton {
+ offImage: './images/AGL_MediaPlayer_BackArrow.svg'
+ Timer {
+ running: parent.pressed
+ triggeredOnStart: true
+ interval: 100
+ repeat: true
+ onTriggered: radio.scanDown()
+ }
+ }
+
ImageButton {
offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
Timer {
@@ -162,11 +194,10 @@ ApplicationWindow {
triggeredOnStart: true
interval: 100
repeat: true
- onTriggered: radio.tuneUp()
+ onTriggered: radio.scanUp()
}
}
- Item { Layout.fillWidth: true }
}
}
}
@@ -214,9 +245,9 @@ ApplicationWindow {
Image {
source: {
switch (model.modelData.band) {
- case Radio.FM:
+ case radio.fmBand:
return './images/FM_Icons_FM.svg'
- case Radio.AM:
+ case radio.amBand:
return './images/FM_Icons_AM.svg'
}
return null