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/SearchStationsPage.qml \
qml/pages/SecondPage.qml \ qml/pages/SecondPage.qml \
qml/pages/SettingsPage.qml \ qml/pages/SettingsPage.qml \
qml/pages/SettingsPage__.qml \
qml/pages/TagListPage.qml \ qml/pages/TagListPage.qml \
rpm/harbour-allradio.spec \ rpm/harbour-allradio.spec \
translations/*.ts \ translations/*.ts \

View File

@ -9,7 +9,7 @@ import "helpers"
ApplicationWindow ApplicationWindow
{ {
id: allRadio 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 _language: Qt.locale().name.slice(0,2)
property string _country: Qt.locale().name.slice(-2) property string _country: Qt.locale().name.slice(-2)
property int sleepTime: 0 property int sleepTime: 0

View File

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

View File

@ -6,7 +6,6 @@ import QtGraphicalEffects 1.0
Column { Column {
id: column id: column
spacing: Theme.paddingMedium spacing: Theme.paddingMedium
//property alias busy: busyIndicator.running
anchors.centerIn: parent anchors.centerIn: parent
Image { Image {
@ -21,27 +20,32 @@ Column {
source: parent source: parent
color: Theme.highlightColor color: Theme.highlightColor
} }
// BusyIndicator {
// size: BusyIndicatorSize.Large
// anchors.centerIn: parent
// running: parent.visible
// }
} }
Label { BusyLabel {
text: radioBrowser.serversModel.count > 0 ? qsTr("Found")+": "+radioBrowser.serversModel.count + " "+qsTr("servers") : qsTr("Searching for servers...") text: radioBrowser.serversModel.count > 0 ? qsTr("Found")+": "+radioBrowser.serversModel.count + " "+qsTr("servers") : qsTr("Searching servers")
running: radioBrowser.serversModel.count < 1
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
Label { BusyLabel {
visible: radioBrowser.serversModel.count > 0 visible: radioBrowser.serversModel.count > 0
running: visible
text: qsTr("Connecting to:") text: qsTr("Connecting to:")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
Label { Label {
visible: radioBrowser.serversModel.count > 0
text: radioBrowser.server text: radioBrowser.server
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.highlightColor color: Theme.highlightColor
anchors.horizontalCenter: parent.horizontalCenter 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.fill: parent
anchors.bottomMargin: mediaPlayerPanel.visibleSize anchors.bottomMargin: mediaPlayerPanel.visibleSize
property int _appStart: Favorites.getSetting("appStart",0)
property bool stationOk: radioPlayer.stationOk property bool stationOk: radioPlayer.stationOk
property bool online: radioBrowser.online property bool online: radioBrowser.online
property bool _loading: radioBrowser.loading
property GetCountryStations getTrending1: GetCountryStations {id: getTrending1} property GetCountryStations getTrending1: GetCountryStations {id: getTrending1}
property GetCountryStations getTrending2: GetCountryStations {id: getTrending2} property GetCountryStations getTrending2: GetCountryStations {id: getTrending2}
property GetCountryStations getTrendingWorld: GetCountryStations {id: getTrendingWorld} property GetCountryStations getTrendingWorld: GetCountryStations {id: getTrendingWorld}
@ -28,6 +30,12 @@ Page {
onOnlineChanged: if (online) reloadDbData() onOnlineChanged: if (online) reloadDbData()
onStationOkChanged: if (stationOk) reloadDbData() onStationOkChanged: if (stationOk) reloadDbData()
on_LoadingChanged: {
if (!_loading) {
appAutoPlay()
console.log(" *** AUTOPLAY")
} else console.log(" *** INTE AUTOPLAY")
}
Splash { Splash {
id: splashItem 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() { function reloadDbData() {
Favorites.getTagsRecentClicked(playedTags,15) Favorites.getTagsRecentClicked(playedTags,15)
Favorites.getFavorites(favorites,"myclickcount",15) Favorites.getFavorites(favorites,"myclickcount",15)

View File

@ -1,56 +1,62 @@
import QtQuick 2.0 import QtQuick 2.0
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0 import QtQuick.LocalStorage 2.0
import QtGraphicalEffects 1.0
import "../helpers/db.js" as Favorites import "../helpers/db.js" as Favorites
Page { Dialog {
Flickable { id: settingsDialog
id: flick // property bool aComp
width:parent.width // property bool aMag
height: parent.height - Theme.paddingLarge * 3 // property int aR: anchorRadius
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge * 3
contentHeight: column1.height
Column{ Column {
id: column1 //id: col1
anchors.left: parent.left
anchors.right: parent.right
spacing: Theme.paddingMedium
DialogHeader {}
Label {
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
text: qsTr("App settings")
}
Separator {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.paddingMedium
color: Theme.highlightColor
}
ComboBox {
id: appStart
width: parent.width width: parent.width
spacing: Theme.paddingLarge label: "Auto play"
anchors.margins: Theme.paddingLarge
Image{ description: "What to do when AllRadio2 starts"
source: "../images/community.png" currentIndex: Favorites.getSetting("appStart",0)
height: Theme.itemSizeHuge menu: ContextMenu {
width: height MenuItem { text: "Off" }
fillMode: Image.PreserveAspectFit MenuItem { text: "Last played" }
anchors { MenuItem { text: "Random favorite" }
horizontalCenter: parent.horizontalCenter
}
}
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
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
} }
} }
} }
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 Name: harbour-allradio
Summary: AllRadio Summary: AllRadio
Version: 2.0.17 Version: 2.0.18
Release: 1 Release: 1
Group: Qt/Qt Group: Qt/Qt
License: GPL2 License: GPLv2
URL: https://gitea.nesnomis.nu/nesnomis/harbour-allradio/ URL: https://gitea.nesnomis.nu/nesnomis/harbour-allradio/
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
Requires: sailfishsilica-qt5 >= 0.10.9 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. AllRadio2 is a new version of AllRadio, an internet radio player.
%if "%{?vendor}" == "chum" %if "%{?vendor}" == "chum"
PackageName: AllRadio2
Type: desktop-application
PackagerName: Niels Simonsen (nesnomis)
Categories: Categories:
- Multimedia - Multimedia
Icon: https://gitea.nesnomis.nu/nesnomis/harbour-allradio/src/branch/master/icons/128x128/harbour-allradio.png 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_222316_001.png
- https://gitea.nesnomis.nu/nesnomis/harbour-allradio/wiki/raw/Screenshot_20250522_222349_001.png - https://gitea.nesnomis.nu/nesnomis/harbour-allradio/wiki/raw/Screenshot_20250522_222349_001.png
Url: Url:
Homepage: https://openrepos.net/content/nesnomis/allradio2 Homepage: http://gitea.nesnomis.nu/nesnomis/harbour-allradio
%endif %endif
%prep %prep

View File

@ -1134,15 +1134,7 @@
<context> <context>
<name>SettingsPage</name> <name>SettingsPage</name>
<message> <message>
<source>Working on more settings.....</source> <source>App 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>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -1191,7 +1183,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Searching for servers...</source> <source>Searching servers</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -1134,15 +1134,7 @@
<context> <context>
<name>SettingsPage</name> <name>SettingsPage</name>
<message> <message>
<source>Working on more settings.....</source> <source>App 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>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -1191,7 +1183,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Searching for servers...</source> <source>Searching servers</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>