Added autoplay function (can be changed in settings)

This commit is contained in:
Niels 2025-06-08 12:21:38 +02:00
parent 158b40516a
commit 69be0689d6
10 changed files with 162 additions and 78 deletions

View File

@ -29,6 +29,7 @@ DISTFILES += qml/harbour-allradio.qml \
qml/pages/SearchStationsPage.qml \
qml/pages/SecondPage.qml \
qml/pages/SettingsPage.qml \
qml/pages/SettingsPage__.qml \
qml/pages/TagListPage.qml \
rpm/harbour-allradio.spec \
translations/*.ts \

View File

@ -9,7 +9,7 @@ import "helpers"
ApplicationWindow
{
id: allRadio
property string _version: "2.0.17"
property string _version: "2.0.18"
property string _language: Qt.locale().name.slice(0,2)
property string _country: Qt.locale().name.slice(-2)
property int sleepTime: 0

View File

@ -229,6 +229,7 @@ MediaPlayer {
isPaused = false
qdTimer.start()
if (_favorite) Favorites.setSetting("playlistIndex",playlistIndex)
//appStartPlay = false
}
function tryagain() {

View File

@ -6,7 +6,6 @@ import QtGraphicalEffects 1.0
Column {
id: column
spacing: Theme.paddingMedium
//property alias busy: busyIndicator.running
anchors.centerIn: parent
Image {
@ -21,27 +20,32 @@ Column {
source: parent
color: Theme.highlightColor
}
// BusyIndicator {
// size: BusyIndicatorSize.Large
// anchors.centerIn: parent
// running: parent.visible
// }
}
Label {
text: radioBrowser.serversModel.count > 0 ? qsTr("Found")+": "+radioBrowser.serversModel.count + " "+qsTr("servers") : qsTr("Searching for servers...")
BusyLabel {
text: radioBrowser.serversModel.count > 0 ? qsTr("Found")+": "+radioBrowser.serversModel.count + " "+qsTr("servers") : qsTr("Searching servers")
running: radioBrowser.serversModel.count < 1
anchors.horizontalCenter: parent.horizontalCenter
}
Label {
BusyLabel {
visible: radioBrowser.serversModel.count > 0
running: visible
text: qsTr("Connecting to:")
anchors.horizontalCenter: parent.horizontalCenter
}
Label {
visible: radioBrowser.serversModel.count > 0
text: radioBrowser.server
font.pixelSize: Theme.fontSizeSmall
color: Theme.highlightColor
anchors.horizontalCenter: parent.horizontalCenter
}
Button {
visible: radioBrowser.serversModel.count > 1
anchors.topMargin: Theme.paddingLarge
text: "Try another server"
onClicked: radioBrowser.getRandom()
anchors.horizontalCenter: parent.horizontalCenter
}
}

View File

@ -14,8 +14,10 @@ Page {
anchors.fill: parent
anchors.bottomMargin: mediaPlayerPanel.visibleSize
property int _appStart: Favorites.getSetting("appStart",0)
property bool stationOk: radioPlayer.stationOk
property bool online: radioBrowser.online
property bool _loading: radioBrowser.loading
property GetCountryStations getTrending1: GetCountryStations {id: getTrending1}
property GetCountryStations getTrending2: GetCountryStations {id: getTrending2}
property GetCountryStations getTrendingWorld: GetCountryStations {id: getTrendingWorld}
@ -28,6 +30,12 @@ Page {
onOnlineChanged: if (online) reloadDbData()
onStationOkChanged: if (stationOk) reloadDbData()
on_LoadingChanged: {
if (!_loading) {
appAutoPlay()
console.log(" *** AUTOPLAY")
} else console.log(" *** INTE AUTOPLAY")
}
Splash {
id: splashItem
@ -388,6 +396,24 @@ Page {
}
}
function appAutoPlay() {
console.log( "*** appStart: "+_appStart )
switch (_appStart) {
case 0:
break;
case 1:
radioPlayer.loadRecentPlay()
radioPlayer.playStream()
break;
case 2:
radioPlayer.loadRandomPlay()
radioPlayer.playStream()
break;
default:
break;
}
}
function reloadDbData() {
Favorites.getTagsRecentClicked(playedTags,15)
Favorites.getFavorites(favorites,"myclickcount",15)

View File

@ -1,56 +1,62 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import QtGraphicalEffects 1.0
import "../helpers/db.js" as Favorites
Page {
Flickable {
id: flick
width:parent.width
height: parent.height - Theme.paddingLarge * 3
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge * 3
contentHeight: column1.height
Dialog {
id: settingsDialog
// property bool aComp
// property bool aMag
// property int aR: anchorRadius
Column{
id: column1
width: parent.width
spacing: Theme.paddingLarge
Column {
//id: col1
anchors.left: parent.left
anchors.right: parent.right
spacing: Theme.paddingMedium
Image{
source: "../images/community.png"
height: Theme.itemSizeHuge
width: height
fillMode: Image.PreserveAspectFit
anchors {
horizontalCenter: parent.horizontalCenter
}
}
DialogHeader {}
Label {
width: parent.width-70
font.pixelSize: Theme.fontSizeSmall
text: qsTr("Working on more settings.....")
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignHCenter
height: 200
wrapMode: Text.WordWrap
}
Label {
width: parent.width-70
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: qsTr("WARNING! THis is for debugging or corrupt database. Only delete db if it is not working!!!")
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: qsTr("App settings")
}
Button {
text: qsTr("Delete DB")
onClicked: Favorites.dropTable()
anchors.horizontalCenter: parent.horizontalCenter
Separator {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
color: Theme.highlightColor
}
ComboBox {
id: appStart
width: parent.width
label: "Auto play"
anchors.margins: Theme.paddingLarge
description: "What to do when AllRadio2 starts"
currentIndex: Favorites.getSetting("appStart",0)
menu: ContextMenu {
MenuItem { text: "Off" }
MenuItem { text: "Last played" }
MenuItem { text: "Random favorite" }
}
}
}
onAccepted: {
//console.log(" *** APPSTART: "+appStart.currentIndex)
Favorites.setSetting("appStart",appStart.currentIndex)
/* activateNumbers.checked ? showCompasNumbers = 1 : showCompasNumbers = 0
var scron
keepSon.checked ? scron = 1 : scron = 0
keepScreenOn = keepSon.checked
settings.setSettingSetting(aComp,aMag,aR,showCompasNumbers,scron)
anchorRadius = aR */
}
}

View File

@ -0,0 +1,59 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0
import QtGraphicalEffects 1.0
import "../helpers/db.js" as Favorites
Page {
PageHeader {
id: pheader
title: "Settings"
}
Flickable {
id: flick
width:parent.width
height: parent.height - Theme.paddingLarge * 3
anchors.fill: parent
anchors.leftMargin: Theme.paddingLarge
anchors.rightMargin: Theme.paddingLarge
anchors.topMargin: pheader.height + Theme.paddingLarge
//contentHeight: column1.height
TextSwitch {
id: activationSwitch
text: "Auto play"
description: "Play radio station on start"
onCheckedChanged: {
device.setStatus(checked ? DeviceState.Armed : DeviceState.Disarmed)
}
}
ComboBox {
width: parent.widht
label: "What to play"
menu: ContextMenu {
MenuItem { text: "Last played" }
MenuItem { text: "Random favorite" }
}
}
/* Label {
width: parent.width-70
font.pixelSize: Theme.fontSizeLarge
text: qsTr("WARNING! THis is for debugging or corrupt database. Only delete db if it is not working!!!")
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
}
Button {
text: qsTr("Delete DB")
onClicked: Favorites.dropTable()
anchors.horizontalCenter: parent.horizontalCenter
} */
}
}

View File

@ -1,10 +1,10 @@
Name: harbour-allradio
Summary: AllRadio
Version: 2.0.17
Version: 2.0.18
Release: 1
Group: Qt/Qt
License: GPL2
License: GPLv2
URL: https://gitea.nesnomis.nu/nesnomis/harbour-allradio/
Source0: %{name}-%{version}.tar.bz2
Requires: sailfishsilica-qt5 >= 0.10.9
@ -29,6 +29,9 @@ BuildRequires: pkgconfig(dbus-1)
AllRadio2 is a new version of AllRadio, an internet radio player.
%if "%{?vendor}" == "chum"
PackageName: AllRadio2
Type: desktop-application
PackagerName: Niels Simonsen (nesnomis)
Categories:
- Multimedia
Icon: https://gitea.nesnomis.nu/nesnomis/harbour-allradio/src/branch/master/icons/128x128/harbour-allradio.png
@ -39,7 +42,7 @@ Screenshots:
- https://gitea.nesnomis.nu/nesnomis/harbour-allradio/wiki/raw/Screenshot_20250522_222316_001.png
- https://gitea.nesnomis.nu/nesnomis/harbour-allradio/wiki/raw/Screenshot_20250522_222349_001.png
Url:
Homepage: https://openrepos.net/content/nesnomis/allradio2
Homepage: http://gitea.nesnomis.nu/nesnomis/harbour-allradio
%endif
%prep

View File

@ -1134,15 +1134,7 @@
<context>
<name>SettingsPage</name>
<message>
<source>Working on more settings.....</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING! THis is for debugging or corrupt database. Only delete db if it is not working!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete DB</source>
<source>App settings</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1191,7 +1183,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Searching for servers...</source>
<source>Searching servers</source>
<translation type="unfinished"></translation>
</message>
<message>

View File

@ -1134,15 +1134,7 @@
<context>
<name>SettingsPage</name>
<message>
<source>Working on more settings.....</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING! THis is for debugging or corrupt database. Only delete db if it is not working!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete DB</source>
<source>App settings</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1191,7 +1183,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Searching for servers...</source>
<source>Searching servers</source>
<translation type="unfinished"></translation>
</message>
<message>