Δημοσιεύτηκε: 26 Νοέμ 2023, 18:45
από malos
Ξέρει κανείς γιατί αυτός ο κώδικας

Κώδικας: Επιλογή όλων

import QtQuick 2.3
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.0 as QtControls
import QtQuick.Controls 2.0
import QtMultimedia 5.8
import org.kde.plasma.core 2.0 as PlasmaCore


PlasmaCore.IconItem {
id: root

property string url: plasmoid.configuration.url
property bool autoPlay: plasmoid.configuration.autoPlay

readonly property bool inPanel: (plasmoid.location === PlasmaCore.Types.TopEdge
|| plasmoid.location === PlasmaCore.Types.RightEdge
|| plasmoid.location === PlasmaCore.Types.BottomEdge
|| plasmoid.location === PlasmaCore.Types.LeftEdge)

Layout.maximumWidth: inPanel ? units.iconSizeHints.panel : -1
Layout.maximumHeight: inPanel ? units.iconSizeHints.panel : -1

Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
Plasmoid.onActivated: startStop()

Rectangle {
id: rootButton
width: 161
height: 100
color: "transparent"

onComponentCompleted: {
QtControls.Button {
id: playButton
text: isPlaying() ? "Stop" : "Play"
anchors.centerIn: rootButton
onClicked: startStop()
}
}
}


Text {
text: "Επιλέξτε σταθμό"
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: 5
}

ListModel {
id: stationList
ListElement { station: "Rock FM" }
ListElement { station: "Ant1 Radio" }
// Προσθέστε άλλους σταθμούς αν χρειαστεί
}

ListView {
id: stationView
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 5
model: stationList

onCurrentItemChanged: {
root.url = stationList.get(currentItem).station
}
}
}

MediaPlayer {
id: playMusic
autoPlay: root.autoPlay
source: root.url

onStatusChanged: {
if (playMusic.metaData.title !== undefined) {
toolTip.subText = playMusic.metaData.title
}
}
}

MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: startStop()
}

ToolTip {
id: toolTip
visible: mouseArea.containsMouse

Text {
text: i18n("Simple Radio Player")
font.bold: true
color: "white"
}

Text {
text: (playMusic.metaData.title === undefined) ? i18n("Unknown") : playMusic.metaData.title
color: "white"
}
}

function startStop() {
if (isPlaying())
playMusic.stop()
else {
playMusic.source = root.url
playMusic.play()
}

root.source = getIcon()
}

function getIcon() {
return isPlaying() ? "media-playback-stop" : "media-playback-start"
}

function isPlaying() {
return playMusic.playbackState === MediaPlayer.PlayingState
}
}




έβγαλε αυτό το λάθος;

~/.local/share/plasma/plasmoids/org.netts.srp/contents/ui/main.qml:34:31: Expected token `,'

Και πως διορθώνεται;