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)
|
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)
|
qt_standard_project_setup(REQUIRES 6.8)
|
||||||
|
|
||||||
@@ -12,11 +12,21 @@ qt_add_executable(appqyouradio
|
|||||||
main.cpp
|
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
|
qt_add_qml_module(appqyouradio
|
||||||
URI qyouradio
|
URI qyouradio
|
||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
QML_FILES
|
QML_FILES
|
||||||
Main.qml
|
Main.qml
|
||||||
|
Player.qml
|
||||||
ViewPlayer.qml
|
ViewPlayer.qml
|
||||||
ViewSettings.qml
|
ViewSettings.qml
|
||||||
)
|
)
|
||||||
@@ -33,7 +43,7 @@ set_target_properties(appqyouradio PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(appqyouradio
|
target_link_libraries(appqyouradio
|
||||||
PRIVATE Qt6::Quick
|
PRIVATE Qt6::Quick Qt6::Multimedia
|
||||||
)
|
)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|||||||
35
Main.qml
35
Main.qml
@@ -8,7 +8,7 @@ import QYRComponents 1.0
|
|||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
width: 1280
|
width: 1280
|
||||||
height: 800
|
height: 800
|
||||||
title: qsTr("Hello World")
|
title: qsTr("QYouRadio")
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -21,12 +21,12 @@ ApplicationWindow {
|
|||||||
TabButton {
|
TabButton {
|
||||||
text: qsTr("Autoradio")
|
text: qsTr("Autoradio")
|
||||||
}
|
}
|
||||||
TabButton {
|
// TabButton {
|
||||||
text: qsTr("Live Mix")
|
// text: qsTr("Live Mix")
|
||||||
}
|
// }
|
||||||
TabButton {
|
// TabButton {
|
||||||
text: qsTr("Deep Bass")
|
// text: qsTr("Deep Bass")
|
||||||
}
|
// }
|
||||||
TabButton {
|
TabButton {
|
||||||
text: qsTr("Settings")
|
text: qsTr("Settings")
|
||||||
}
|
}
|
||||||
@@ -40,15 +40,24 @@ ApplicationWindow {
|
|||||||
currentIndex: tabbar.currentIndex
|
currentIndex: tabbar.currentIndex
|
||||||
ViewPlayer {
|
ViewPlayer {
|
||||||
title: qsTr("Autoradio")
|
title: qsTr("Autoradio")
|
||||||
|
streamURL: "https://youradio.nonamesoft.xyz/api/autoradio"
|
||||||
}
|
}
|
||||||
ViewPlayer {
|
// ViewPlayer {
|
||||||
title: qsTr("Live Radio")
|
// title: qsTr("Live Radio")
|
||||||
}
|
// streamURL: "https://youradio.nonamesoft.xyz/api/live"
|
||||||
ViewPlayer {
|
// }
|
||||||
title: qsTr("Deep Bass")
|
// ViewPlayer {
|
||||||
}
|
// title: qsTr("Deep Bass")
|
||||||
|
// streamURL: "https://youradio.nonamesoft.xyz/api/deepbass"
|
||||||
|
// }
|
||||||
ViewSettings {
|
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 {
|
Button {
|
||||||
Layout.rightMargin: 5
|
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 {
|
Slider {
|
||||||
@@ -78,9 +86,4 @@ ColumnLayout {
|
|||||||
Item {
|
Item {
|
||||||
Layout.fillHeight: true
|
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 {
|
StackLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
currentIndex: settingsCategory.currentIndex
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
3
main.cpp
3
main.cpp
@@ -1,3 +1,4 @@
|
|||||||
|
#include <QIcon>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
|
|
||||||
@@ -12,5 +13,7 @@ int main(int argc, char *argv[])
|
|||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
engine.loadFromModule("qyouradio", "Main");
|
engine.loadFromModule("qyouradio", "Main");
|
||||||
|
|
||||||
|
app.setWindowIcon(QIcon(":/resources/logo.png"));
|
||||||
|
|
||||||
return app.exec();
|
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