Create icon files, begin writing playback system
This commit is contained in:
@@ -4,7 +4,7 @@ project(qyouradio VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Quick Multimedia)
|
||||
|
||||
qt_standard_project_setup(REQUIRES 6.8)
|
||||
|
||||
@@ -12,11 +12,21 @@ qt_add_executable(appqyouradio
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt_add_resources(appqyouradio "resources"
|
||||
PREFIX "/"
|
||||
FILES
|
||||
resources/logo.png
|
||||
)
|
||||
|
||||
set_source_files_properties(Player.qml
|
||||
PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
|
||||
|
||||
qt_add_qml_module(appqyouradio
|
||||
URI qyouradio
|
||||
VERSION 1.0
|
||||
QML_FILES
|
||||
Main.qml
|
||||
Player.qml
|
||||
ViewPlayer.qml
|
||||
ViewSettings.qml
|
||||
)
|
||||
@@ -33,7 +43,7 @@ set_target_properties(appqyouradio PROPERTIES
|
||||
)
|
||||
|
||||
target_link_libraries(appqyouradio
|
||||
PRIVATE Qt6::Quick
|
||||
PRIVATE Qt6::Quick Qt6::Multimedia
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
35
Main.qml
35
Main.qml
@@ -8,7 +8,7 @@ import QYRComponents 1.0
|
||||
ApplicationWindow {
|
||||
width: 1280
|
||||
height: 800
|
||||
title: qsTr("Hello World")
|
||||
title: qsTr("QYouRadio")
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@@ -21,12 +21,12 @@ ApplicationWindow {
|
||||
TabButton {
|
||||
text: qsTr("Autoradio")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Live Mix")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Deep Bass")
|
||||
}
|
||||
// TabButton {
|
||||
// text: qsTr("Live Mix")
|
||||
// }
|
||||
// TabButton {
|
||||
// text: qsTr("Deep Bass")
|
||||
// }
|
||||
TabButton {
|
||||
text: qsTr("Settings")
|
||||
}
|
||||
@@ -40,15 +40,24 @@ ApplicationWindow {
|
||||
currentIndex: tabbar.currentIndex
|
||||
ViewPlayer {
|
||||
title: qsTr("Autoradio")
|
||||
streamURL: "https://youradio.nonamesoft.xyz/api/autoradio"
|
||||
}
|
||||
ViewPlayer {
|
||||
title: qsTr("Live Radio")
|
||||
}
|
||||
ViewPlayer {
|
||||
title: qsTr("Deep Bass")
|
||||
}
|
||||
// ViewPlayer {
|
||||
// title: qsTr("Live Radio")
|
||||
// streamURL: "https://youradio.nonamesoft.xyz/api/live"
|
||||
// }
|
||||
// ViewPlayer {
|
||||
// title: qsTr("Deep Bass")
|
||||
// streamURL: "https://youradio.nonamesoft.xyz/api/deepbass"
|
||||
// }
|
||||
ViewSettings {
|
||||
}
|
||||
}
|
||||
|
||||
YouAds {
|
||||
Layout.fillWidth: false
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
visible: tabbar.currentIndex != 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
30
Player.qml
Normal file
30
Player.qml
Normal file
@@ -0,0 +1,30 @@
|
||||
import QtMultimedia 6.8
|
||||
|
||||
pragma Singleton
|
||||
|
||||
MediaPlayer {
|
||||
source: ""
|
||||
|
||||
function startPlaying(url) {
|
||||
if (player.playing) {
|
||||
return;
|
||||
}
|
||||
console.log("Starting playback from " + url);
|
||||
player.source = url;
|
||||
player.play();
|
||||
}
|
||||
|
||||
function stopPlaying() {
|
||||
console.log("Stopping playback...");
|
||||
player.source = "";
|
||||
player.stop();
|
||||
}
|
||||
|
||||
audioOutput: AudioOutput {
|
||||
volume: 0.4
|
||||
}
|
||||
|
||||
onErrorOccurred: function(error, errorString) {
|
||||
player.stopPlaying();
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,15 @@ ColumnLayout {
|
||||
|
||||
Button {
|
||||
Layout.rightMargin: 5
|
||||
text: "Play"
|
||||
text: Player.loading ? "Loading" : (Player.playing ? "Pause" : "Play")
|
||||
|
||||
onClicked: function() {
|
||||
if (Player.playing) {
|
||||
Player.stopPlaying();
|
||||
} else {
|
||||
Player.startPlaying(parent.parent.streamURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
@@ -78,9 +86,4 @@ ColumnLayout {
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
YouAds {
|
||||
Layout.fillWidth: false
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,17 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
width: 5
|
||||
color: Colors.text
|
||||
radius: 5
|
||||
}
|
||||
|
||||
StackLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
currentIndex: settingsCategory.currentIndex
|
||||
|
||||
}
|
||||
}
|
||||
3
main.cpp
3
main.cpp
@@ -1,3 +1,4 @@
|
||||
#include <QIcon>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
@@ -12,5 +13,7 @@ int main(int argc, char *argv[])
|
||||
Qt::QueuedConnection);
|
||||
engine.loadFromModule("qyouradio", "Main");
|
||||
|
||||
app.setWindowIcon(QIcon(":/resources/logo.png"));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
BIN
resources/logo.ico
Normal file
BIN
resources/logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
resources/logo.png
Normal file
BIN
resources/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Reference in New Issue
Block a user