summaryrefslogtreecommitdiffstats
path: root/app/Radio.qml
diff options
context:
space:
mode:
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