From c6dc9ff631f429bfcd9bcde47f02d81bebaaff2b Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sat, 22 Apr 2023 20:40:39 +0300 Subject: [PATCH 01/12] Migrating to Qt6 Signed-off-by: Blagovest Petrov --- .../128-apps-org.petrovs_info.tangraplay.png | Bin .../16-apps-org.petrovs_info.tangraplay.png | Bin .../32-apps-org.petrovs_info.tangraplay.png | Bin .../48-apps-org.petrovs_info.tangraplay.png | Bin .../64-apps-org.petrovs_info.tangraplay.png | Bin {Resources => Assets}/KellySlab-Regular.ttf | Bin {Resources => Assets}/blago.png | Bin {Resources => Assets}/buuf-pause.png | Bin {Resources => Assets}/buuf-play.png | Bin {Resources => Assets}/dark_leather.png | Bin {Resources => Assets}/live.png | Bin {Resources => Assets}/logo.png | Bin {Resources => Assets}/menu-background.png | Bin {Resources => Assets}/menubtn-background.png | Bin {Resources => Assets}/news-icon.png | Bin {Resources => Assets}/news.png | Bin {Resources => Assets}/pause-button.svg | 0 {Resources => Assets}/play-button.svg | 0 {Resources => Assets}/playbtn-frame.png | Bin {Resources => Assets}/podcast.png | Bin {Resources => Assets}/stop-button.svg | 0 {Resources => Assets}/tangra.ico | Bin CMakeLists.txt | 111 +++++++++++------- Resources/CMakeLists.txt | 10 -- TangraPlay.pro | 38 ------ main.cpp | 2 +- qml.qrc | 28 ----- 27 files changed, 67 insertions(+), 122 deletions(-) rename {Resources => Assets}/128-apps-org.petrovs_info.tangraplay.png (100%) rename {Resources => Assets}/16-apps-org.petrovs_info.tangraplay.png (100%) rename {Resources => Assets}/32-apps-org.petrovs_info.tangraplay.png (100%) rename {Resources => Assets}/48-apps-org.petrovs_info.tangraplay.png (100%) rename {Resources => Assets}/64-apps-org.petrovs_info.tangraplay.png (100%) rename {Resources => Assets}/KellySlab-Regular.ttf (100%) rename {Resources => Assets}/blago.png (100%) rename {Resources => Assets}/buuf-pause.png (100%) rename {Resources => Assets}/buuf-play.png (100%) rename {Resources => Assets}/dark_leather.png (100%) rename {Resources => Assets}/live.png (100%) rename {Resources => Assets}/logo.png (100%) rename {Resources => Assets}/menu-background.png (100%) rename {Resources => Assets}/menubtn-background.png (100%) rename {Resources => Assets}/news-icon.png (100%) rename {Resources => Assets}/news.png (100%) rename {Resources => Assets}/pause-button.svg (100%) rename {Resources => Assets}/play-button.svg (100%) rename {Resources => Assets}/playbtn-frame.png (100%) rename {Resources => Assets}/podcast.png (100%) rename {Resources => Assets}/stop-button.svg (100%) rename {Resources => Assets}/tangra.ico (100%) delete mode 100644 Resources/CMakeLists.txt delete mode 100644 TangraPlay.pro delete mode 100644 qml.qrc diff --git a/Resources/128-apps-org.petrovs_info.tangraplay.png b/Assets/128-apps-org.petrovs_info.tangraplay.png similarity index 100% rename from Resources/128-apps-org.petrovs_info.tangraplay.png rename to Assets/128-apps-org.petrovs_info.tangraplay.png diff --git a/Resources/16-apps-org.petrovs_info.tangraplay.png b/Assets/16-apps-org.petrovs_info.tangraplay.png similarity index 100% rename from Resources/16-apps-org.petrovs_info.tangraplay.png rename to Assets/16-apps-org.petrovs_info.tangraplay.png diff --git a/Resources/32-apps-org.petrovs_info.tangraplay.png b/Assets/32-apps-org.petrovs_info.tangraplay.png similarity index 100% rename from Resources/32-apps-org.petrovs_info.tangraplay.png rename to Assets/32-apps-org.petrovs_info.tangraplay.png diff --git a/Resources/48-apps-org.petrovs_info.tangraplay.png b/Assets/48-apps-org.petrovs_info.tangraplay.png similarity index 100% rename from Resources/48-apps-org.petrovs_info.tangraplay.png rename to Assets/48-apps-org.petrovs_info.tangraplay.png diff --git a/Resources/64-apps-org.petrovs_info.tangraplay.png b/Assets/64-apps-org.petrovs_info.tangraplay.png similarity index 100% rename from Resources/64-apps-org.petrovs_info.tangraplay.png rename to Assets/64-apps-org.petrovs_info.tangraplay.png diff --git a/Resources/KellySlab-Regular.ttf b/Assets/KellySlab-Regular.ttf similarity index 100% rename from Resources/KellySlab-Regular.ttf rename to Assets/KellySlab-Regular.ttf diff --git a/Resources/blago.png b/Assets/blago.png similarity index 100% rename from Resources/blago.png rename to Assets/blago.png diff --git a/Resources/buuf-pause.png b/Assets/buuf-pause.png similarity index 100% rename from Resources/buuf-pause.png rename to Assets/buuf-pause.png diff --git a/Resources/buuf-play.png b/Assets/buuf-play.png similarity index 100% rename from Resources/buuf-play.png rename to Assets/buuf-play.png diff --git a/Resources/dark_leather.png b/Assets/dark_leather.png similarity index 100% rename from Resources/dark_leather.png rename to Assets/dark_leather.png diff --git a/Resources/live.png b/Assets/live.png similarity index 100% rename from Resources/live.png rename to Assets/live.png diff --git a/Resources/logo.png b/Assets/logo.png similarity index 100% rename from Resources/logo.png rename to Assets/logo.png diff --git a/Resources/menu-background.png b/Assets/menu-background.png similarity index 100% rename from Resources/menu-background.png rename to Assets/menu-background.png diff --git a/Resources/menubtn-background.png b/Assets/menubtn-background.png similarity index 100% rename from Resources/menubtn-background.png rename to Assets/menubtn-background.png diff --git a/Resources/news-icon.png b/Assets/news-icon.png similarity index 100% rename from Resources/news-icon.png rename to Assets/news-icon.png diff --git a/Resources/news.png b/Assets/news.png similarity index 100% rename from Resources/news.png rename to Assets/news.png diff --git a/Resources/pause-button.svg b/Assets/pause-button.svg similarity index 100% rename from Resources/pause-button.svg rename to Assets/pause-button.svg diff --git a/Resources/play-button.svg b/Assets/play-button.svg similarity index 100% rename from Resources/play-button.svg rename to Assets/play-button.svg diff --git a/Resources/playbtn-frame.png b/Assets/playbtn-frame.png similarity index 100% rename from Resources/playbtn-frame.png rename to Assets/playbtn-frame.png diff --git a/Resources/podcast.png b/Assets/podcast.png similarity index 100% rename from Resources/podcast.png rename to Assets/podcast.png diff --git a/Resources/stop-button.svg b/Assets/stop-button.svg similarity index 100% rename from Resources/stop-button.svg rename to Assets/stop-button.svg diff --git a/Resources/tangra.ico b/Assets/tangra.ico similarity index 100% rename from Resources/tangra.ico rename to Assets/tangra.ico diff --git a/CMakeLists.txt b/CMakeLists.txt index 7321797..79d1b29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,60 +1,81 @@ -project(tangraplay) +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +project(tangraplay VERSION 0.1 LANGUAGES CXX) -set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -set(QT_MIN_VERSION "5.10.0") -set(KF5_DEP_VERSION "5.40.0") +#set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_AUTOMOC ON) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -# We need some parts of the ECM CMake helpers. -find_package(ECM ${KF5_DEP_VERSION} QUIET REQUIRED NO_MODULE) +find_package(Qt6 6.2 REQUIRED COMPONENTS Quick Widgets Core QuickControls2 Widgets Gui Multimedia) -# We append to the module path so modules can be overridden from the command line. -list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) +set(QT_MIN_VERSION "5.10.0") +set(KF5_DEP_VERSION "5.40.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Quick QuickControls2 Multimedia Widgets Gui ) - include_directories(.) include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS}) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) -include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) -include(KDEInstallDirs) -include(KDECMakeSettings) - -include(ECMOptionalAddSubdirectory) -include(ECMAddAppIcon) -include(ECMInstallIcons) - - -add_subdirectory(Resources) -qt5_add_resources(RESOURCES qml.qrc) - -SET(SOURCES +list(APPEND QML_ASSETS + Assets/pause-button.svg + Assets/logo.png + Assets/play-button.svg + Assets/menu-background.png + Assets/dark_leather.png + Assets/menubtn-background.png + Assets/blago.png + Assets/tangra.ico + Assets/KellySlab-Regular.ttf + Assets/news-icon.png + Assets/buuf-pause.png + Assets/buuf-play.png + Assets/playbtn-frame.png + Assets/live.png + Assets/news.png + Assets/podcast.png +) + +qt_add_executable(apptangraplay main.cpp - ) - -add_executable(tangraplay - ${SOURCES} - ${RESOURCES} - ) - -qt5_use_modules(tangraplay Quick QuickControls2 Core Multimedia ) - -target_link_libraries(tangraplay - Qt5::Quick - Qt5::QuickControls2 - Qt5::Core - Qt5::Widgets - Qt5::Gui - Qt5::Multimedia ) - -install(TARGETS tangraplay DESTINATION ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) - -install(PROGRAMS org.petrovs_info.tangraplay.desktop DESTINATION ${KDE_INSTALL_APPDIR}) -install(FILES org.petrovs_info.tangraplay.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) + tangratray.h tangratray.cpp +) + +qt_add_qml_module(apptangraplay + URI tangraplay + VERSION 1.0 + QML_FILES ui/main.qml + ui/AboutProgram.qml + ui/AudioPlayer.qml + ui/MediaButton.qml + ui/MenuButton.qml + ui/MenuToolbar.qml + ui/PgLive.qml + ui/PgNews.qml + RESOURCES + ${QML_ASSETS} +) + +set_target_properties(apptangraplay PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER tangraplay.petrovs.info + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE +) + +target_link_libraries(apptangraplay PRIVATE + Qt6::Quick + Qt6::QuickControls2 + Qt6::Core + Qt6::Widgets + Qt6::Gui + Qt6::Multimedia ) + +install(TARGETS apptangraplay + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/Resources/CMakeLists.txt b/Resources/CMakeLists.txt deleted file mode 100644 index 73d7cfe..0000000 --- a/Resources/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ - -ecm_install_icons( - ICONS - 128-apps-org.petrovs_info.tangraplay.png - 64-apps-org.petrovs_info.tangraplay.png - 48-apps-org.petrovs_info.tangraplay.png - 32-apps-org.petrovs_info.tangraplay.png - 16-apps-org.petrovs_info.tangraplay.png - DESTINATION ${ICON_INSTALL_DIR} -) diff --git a/TangraPlay.pro b/TangraPlay.pro deleted file mode 100644 index 9ffdd16..0000000 --- a/TangraPlay.pro +++ /dev/null @@ -1,38 +0,0 @@ -QT += quick gui core widgets - -CONFIG += c++11 - -RC_ICONS = Resources/tangra.ico - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Refer to the documentation for the -# deprecated API to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - fetchshowid.cpp \ - main.cpp \ - tangratray.cpp - -RESOURCES += qml.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Additional import path used to resolve QML modules just for Qt Quick Designer -QML_DESIGNER_IMPORT_PATH = - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -HEADERS += \ - fetchshowid.h \ - tangratray.h diff --git a/main.cpp b/main.cpp index 18f83af..786ef5b 100644 --- a/main.cpp +++ b/main.cpp @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) QQmlContext *context = engine.rootContext(); context->setContextProperty("tangraTray", tangratray); - const QUrl url(QStringLiteral("qrc:/ui/main.qml")); + const QUrl url(u"qrc:/tangraplay/qml/main.qml"_qs); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) diff --git a/qml.qrc b/qml.qrc deleted file mode 100644 index ef25b9c..0000000 --- a/qml.qrc +++ /dev/null @@ -1,28 +0,0 @@ - - - ui/main.qml - ui/MenuToolbar.qml - ui/MenuButton.qml - ui/PgLive.qml - ui/PgNews.qml - ui/AboutProgram.qml - ui/AudioPlayer.qml - ui/MediaButton.qml - Resources/pause-button.svg - Resources/logo.png - Resources/play-button.svg - Resources/menu-background.png - Resources/dark_leather.png - Resources/menubtn-background.png - Resources/blago.png - Resources/tangra.ico - Resources/KellySlab-Regular.ttf - Resources/news-icon.png - Resources/buuf-pause.png - Resources/buuf-play.png - Resources/playbtn-frame.png - Resources/live.png - Resources/news.png - Resources/podcast.png - - From b0fddb43549b55fe7bc3e583fb75f098b7ac8540 Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sat, 22 Apr 2023 20:41:39 +0300 Subject: [PATCH 02/12] Gitignore Signed-off-by: Blagovest Petrov --- .gitignore | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/.gitignore b/.gitignore index 75c107b..7f4826b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,54 @@ +# C++ objects and libs +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.so.* +*.dll +*.dylib + +# Qt-es +object_script.*.Release +object_script.*.Debug +*_plugin_import.cpp +/.qmake.cache +/.qmake.stash *.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +moc_*.h +qrc_*.cpp +ui_*.h +*.qmlc +*.jsc +Makefile* +*build-* +*.qm +*.prl + +# Qt unit tests +target_wrapper.* + +# QtCreator +*.autosave + +# QtCreator Qml +*.qmlproject.user +*.qmlproject.user.* + +# QtCreator CMake +CMakeLists.txt.user* + +# QtCreator 4.8< compilation database +compile_commands.json + +# QtCreator local machine specific files for imported projects +*creator.user* + +*_qmlcache.qrc From ff618cc828db982d86f948a3b0caf97479ecf810 Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sat, 22 Apr 2023 21:49:39 +0300 Subject: [PATCH 03/12] First working version with Qt6 Signed-off-by: Blagovest Petrov --- CMakeLists.txt | 3 ++- main.cpp | 4 +++- ui/AboutProgram.qml | 13 +++++++------ ui/AudioPlayer.qml | 6 ++++-- ui/MediaButton.qml | 2 +- ui/MenuButton.qml | 2 +- ui/MenuToolbar.qml | 38 +++++++++++++++++++------------------- ui/PgLive.qml | 4 ++-- ui/main.qml | 14 ++++++++------ 9 files changed, 47 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79d1b29..fee4b9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,8 +46,9 @@ qt_add_executable(apptangraplay ) qt_add_qml_module(apptangraplay - URI tangraplay + URI TangraPlay VERSION 1.0 + RESOURCE_PREFIX /bpetrov.tangraplay/imports QML_FILES ui/main.qml ui/AboutProgram.qml ui/AudioPlayer.qml diff --git a/main.cpp b/main.cpp index 786ef5b..e29116d 100644 --- a/main.cpp +++ b/main.cpp @@ -10,11 +10,13 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QQmlApplicationEngine engine; + engine.addImportPath(":/bpetrov.tangraplay/imports"); + TangraTray * tangratray = new TangraTray(); QQmlContext *context = engine.rootContext(); context->setContextProperty("tangraTray", tangratray); - const QUrl url(u"qrc:/tangraplay/qml/main.qml"_qs); + const QUrl url(u"qrc:/bpetrov.tangraplay/imports/TangraPlay/ui/main.qml"_qs); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) diff --git a/ui/AboutProgram.qml b/ui/AboutProgram.qml index baf3f18..7b0a4d8 100644 --- a/ui/AboutProgram.qml +++ b/ui/AboutProgram.qml @@ -1,11 +1,12 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs Dialog { - id: aboutDialog - standardButtons: StandardButton.Ok + id: aboutDialo height: 500 width: 400 + title: "About" Image { id: image @@ -14,7 +15,7 @@ Dialog { width: 100 height: 100 fillMode: Image.PreserveAspectFit - source: "../Resources/blago.png" + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/blago.png" } Text { @@ -46,7 +47,7 @@ Dialog { y: 172 width: 354 height: 74 - text: qsTr("© 2020 Благовест Петров ( https://petrovs.info ) . Кодът е лиценциран под GNU GPL v3.0. \n Шрифтът е \"Kelly Slab\" и е взет от Google Fonts. Лицензиран е под OFL лиценз.") + text: qsTr("© 2023 Благовест Петров ( https://petrovs.info ) . Кодът е лиценциран под GNU GPL v3.0. \n Шрифтът е \"Kelly Slab\" и е взет от Google Fonts. Лицензиран е под OFL лиценз.") font.family: mainfont.name wrapMode: Text.WrapAtWordBoundaryOrAnywhere font.pixelSize: 12 diff --git a/ui/AudioPlayer.qml b/ui/AudioPlayer.qml index 273f1e4..e0a6e95 100644 --- a/ui/AudioPlayer.qml +++ b/ui/AudioPlayer.qml @@ -1,11 +1,13 @@ import QtQuick 2.0 -import QtMultimedia 5.15 +import QtMultimedia -Audio { +MediaPlayer { property variant quality: { "low" : "http://stream-bg-01.radiotangra.com/Tangra-middle.m3u", "high" : "http://stream-bg-01.radiotangra.com/Tangra-high.m3u" } + audioOutput: AudioOutput {} + source: "http://stream-bg-01.radiotangra.com:8000/Tangra-high" } diff --git a/ui/MediaButton.qml b/ui/MediaButton.qml index ebb439a..1d10510 100644 --- a/ui/MediaButton.qml +++ b/ui/MediaButton.qml @@ -12,7 +12,7 @@ Item { width: 64 anchors.centerIn: parent fillMode: Image.PreserveAspectFit - source: isClicked ? "../Resources/buuf-pause.png" : "../Resources/buuf-play.png" + source: isClicked ? "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-pause.png" : "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-play.png" } } diff --git a/ui/MenuButton.qml b/ui/MenuButton.qml index 05ac2d3..389e42a 100644 --- a/ui/MenuButton.qml +++ b/ui/MenuButton.qml @@ -10,7 +10,7 @@ Rectangle { Image { id: menuButtonBackground - source: "../Resources/menubtn-background.png" + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/menubtn-background.png" anchors.fill: parent } diff --git a/ui/MenuToolbar.qml b/ui/MenuToolbar.qml index 2b31fbe..b1bee40 100644 --- a/ui/MenuToolbar.qml +++ b/ui/MenuToolbar.qml @@ -8,7 +8,7 @@ Item { height: 32 Image { - source: "../Resources/menu-background.png" + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/menu-background.png" fillMode: Image.Tile anchors.fill: parent @@ -17,7 +17,7 @@ Item { MouseArea { anchors.fill: parent; - property variant clickPos: "1,1" + property string clickPos: "1,1" onPressed: { clickPos = Qt.point(mouse.x,mouse.y) @@ -63,24 +63,24 @@ Item { color: "#f9c620" } -// Image { -// id: buttonLive -// source: "Resources/live.png" -// anchors.left: appTitle.left -// anchors.leftMargin: 128 -// width: 32 -// height: 32 + Image { + id: buttonLive + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/live.png" + anchors.left: appTitle.left + anchors.leftMargin: 128 + width: 32 + height: 32 -// MouseArea { -// anchors.fill: parent -// hoverEnabled: true -// onClicked: { -// pgLive1.visible = false; -// pgnews1.visible = true; -//// contentLoader.sourceComponent = PgNews -// } -// } -// } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onClicked: { + pgLive1.visible = false; + pgnews1.visible = true; +// contentLoader.sourceComponent = PgNews + } + } + } } } } diff --git a/ui/PgLive.qml b/ui/PgLive.qml index 5049d4b..2c2a85c 100644 --- a/ui/PgLive.qml +++ b/ui/PgLive.qml @@ -14,7 +14,7 @@ Item { width: 260 height: 175 fillMode: Image.PreserveAspectFit - source: "../Resources/logo.png" + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/logo.png" MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor @@ -59,7 +59,7 @@ Item { y: 259 width: 629 height: 127 - source: "../Resources/playbtn-frame.png" + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/playbtn-frame.png" fillMode: Image.PreserveAspectFit Text { diff --git a/ui/main.qml b/ui/main.qml index a9dc314..0517286 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -2,6 +2,7 @@ import QtQuick 2.12 import QtQuick.Window 2.12 import Qt.labs.platform 1.1 import QtMultimedia 5.15 +//import TangraPlay Window { title: qsTr("Tangra Mega Rock") @@ -13,7 +14,8 @@ Window { maximumHeight: 480 flags: Qt.FramelessWindowHint - FontLoader { id: mainfont; source: "../Resources/KellySlab-Regular.ttf" } +// FontLoader { id: mainfont; source: "../Resources/KellySlab-Regular.ttf" } + FontLoader { id: mainfont; source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/KellySlab-Regular.ttf" } Connections { target: tangraTray @@ -34,15 +36,15 @@ Window { } AudioPlayer { - id: tangraplay + id: thePlayer } function mediaControl() { - if (tangraplay.playbackState != Audio.PlayingState) { - tangraplay.play(); + if (thePlayer.playbackState != thePlayer.PlayingState) { + thePlayer.play(); } else { - tangraplay.stop(); + thePlayer.stop(); } return 0; } @@ -52,7 +54,7 @@ Window { anchors.fill: parent visible: true fillMode: Image.Tile - source: "../Resources/dark_leather.png" + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/dark_leather.png" MenuToolbar {} From a153e5358466b481496923c5f6241f7d589a062a Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sun, 23 Apr 2023 00:21:49 +0300 Subject: [PATCH 04/12] Working RSS news Signed-off-by: Blagovest Petrov --- CMakeLists.txt | 1 + ui/AudioPlayer.qml | 6 ----- ui/MenuToolbar.qml | 28 +++++++++++++++++------ ui/PgNews.qml | 55 ++++++++++++++++++++++------------------------ ui/main.qml | 29 +++++++++++++++++------- 5 files changed, 69 insertions(+), 50 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fee4b9a..fa11680 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,7 @@ qt_add_qml_module(apptangraplay ui/MenuToolbar.qml ui/PgLive.qml ui/PgNews.qml + ui/NewsDelegate.qml RESOURCES ${QML_ASSETS} ) diff --git a/ui/AudioPlayer.qml b/ui/AudioPlayer.qml index e0a6e95..84b318f 100644 --- a/ui/AudioPlayer.qml +++ b/ui/AudioPlayer.qml @@ -2,12 +2,6 @@ import QtQuick 2.0 import QtMultimedia MediaPlayer { - property variant quality: { - "low" : "http://stream-bg-01.radiotangra.com/Tangra-middle.m3u", - "high" : "http://stream-bg-01.radiotangra.com/Tangra-high.m3u" - } - audioOutput: AudioOutput {} - source: "http://stream-bg-01.radiotangra.com:8000/Tangra-high" } diff --git a/ui/MenuToolbar.qml b/ui/MenuToolbar.qml index b1bee40..98bc0c6 100644 --- a/ui/MenuToolbar.qml +++ b/ui/MenuToolbar.qml @@ -17,13 +17,13 @@ Item { MouseArea { anchors.fill: parent; - property string clickPos: "1,1" + property variant clickPos: "1,1" - onPressed: { - clickPos = Qt.point(mouse.x,mouse.y) + onPressed: (mouse)=> { + clickPos = Qt.point(mouse.x, mouse.y) } - onPositionChanged: { + onPositionChanged: (mouse)=> { var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y) var new_x = mainWindow.x + delta.x var new_y = mainWindow.y + delta.y @@ -75,9 +75,23 @@ Item { anchors.fill: parent hoverEnabled: true onClicked: { - pgLive1.visible = false; - pgnews1.visible = true; -// contentLoader.sourceComponent = PgNews + mainStack.push(stackLive) + } + } + } + Image { + id: buttonNews + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/news.png" + anchors.left: buttonLive.left + anchors.leftMargin: 128 + width: 32 + height: 32 + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onClicked: { + mainStack.push(stackNews) } } } diff --git a/ui/PgNews.qml b/ui/PgNews.qml index 4e74cf8..379b584 100644 --- a/ui/PgNews.qml +++ b/ui/PgNews.qml @@ -1,38 +1,35 @@ -import QtQuick 2.12 -import QtQuick.Window 2.12 -import Qt.labs.platform 1.1 -import QtMultimedia 5.15 +import QtQuick +import QtQuick.Controls +import QtQml.XmlListModel Item { x: 190 y: 51 - Row { - id: row - x: 8 - y: 50 - width: 624 - height: 400 - spacing: 2 - - Text { - id: text1 - x: 61 - y: 50 - text: qsTr("Гледайте първо видео от новия албум на GOJIRA - той излиза на 3 април") - font.pixelSize: 12 - font.family: mainfont.name - } - Text { - id: text2 - x: 61 - y: 50 - text: qsTr("Историята на BLONDIE в предаването 'РОКЕНДРОЛ' на МОНИ ПАНЧЕВ от 16:00") - font.pixelSize: 12 - font.family: mainfont.name - } - } + XmlListModel { + id: newsModel + + source: "http://www.radiotangra.com/news/rss.html" + query: "/rss/channel/item" + + XmlListModelRole { name: "title"; elementName: "title"; attributeName: ""} + XmlListModelRole { name: "link"; elementName: "link"; attributeName: "" } + } + + ListView { + id: newsList + anchors.fill: parent + anchors.topMargin: 38 + anchors.leftMargin: 39 + anchors.rightMargin: 27 + anchors.bottomMargin: 17 + model: newsModel + delegate: NewsDelegate {} + ScrollBar.vertical: ScrollBar { + policy: ScrollBar.AlwaysOn + } + } } diff --git a/ui/main.qml b/ui/main.qml index 0517286..93d95fb 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -1,10 +1,10 @@ import QtQuick 2.12 -import QtQuick.Window 2.12 +import QtQuick.Controls +import QtQuick.Layouts import Qt.labs.platform 1.1 -import QtMultimedia 5.15 -//import TangraPlay +import QtMultimedia -Window { +ApplicationWindow { title: qsTr("Tangra Mega Rock") id: mainWindow visible: true @@ -14,9 +14,10 @@ Window { maximumHeight: 480 flags: Qt.FramelessWindowHint -// FontLoader { id: mainfont; source: "../Resources/KellySlab-Regular.ttf" } FontLoader { id: mainfont; source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/KellySlab-Regular.ttf" } + header: MenuToolbar {} + Connections { target: tangraTray @@ -56,11 +57,23 @@ Window { fillMode: Image.Tile source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/dark_leather.png" - MenuToolbar {} - PgLive { - id: pgLive1 + + StackView { + id: mainStack + initialItem: stackLive + anchors.fill: parent + } + + Component { + id: stackLive + PgLive { id: pgLive } + } + Component { + id: stackNews + PgNews { id: pgNews } } + // PgNews { // id: pgNews1 // visible: false From 21ddb1b773a7fe3f064e4fe7f5d473719ce2d871 Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sun, 23 Apr 2023 00:33:49 +0300 Subject: [PATCH 05/12] Added animation on logo hover Signed-off-by: Blagovest Petrov --- ui/PgLive.qml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/ui/PgLive.qml b/ui/PgLive.qml index 2c2a85c..7257e59 100644 --- a/ui/PgLive.qml +++ b/ui/PgLive.qml @@ -5,7 +5,6 @@ import QtMultimedia 5.15 Item { - Image { id: logo x: 190 @@ -15,12 +14,35 @@ Item { height: 175 fillMode: Image.PreserveAspectFit source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/logo.png" + + states: ["mouseFadeIn", "MouseFadeOut"] + state: "mouseFadeOut" + + transitions: [ + Transition { + from: "*" + to: "mouseFadeIn" + NumberAnimation { + target: logo + properties: "scale" + from: 0.95 + to: 1 + duration: 400 + easing.type: Easing.OutBounce + } + } + ] + MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor - onPressed: { + hoverEnabled: true + onPressed: { Qt.openUrlExternally("http://radiotangra.com") } + onContainsMouseChanged: { + logo.state = containsMouse ? "mouseFadeIn" : "mouseFadeOut" + } } } @@ -33,8 +55,8 @@ Item { MouseArea { anchors.fill: parent onClicked: { - mediaControl(); - playPause.isClicked = !playPause.isClicked; + mediaControl() + playPause.isClicked = !playPause.isClicked } } } @@ -89,3 +111,4 @@ Designer { D{i:0;autoSize:true;height:480;width:640} } ##^##*/ + From c1af3ad49fe5e08819823f70fc835d1315846ec7 Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sun, 23 Apr 2023 01:17:29 +0300 Subject: [PATCH 06/12] Fixed: Pause fuction of the button was broken Signed-off-by: Blagovest Petrov --- ui/MediaButton.qml | 104 +++++++++++++++++++++++++++++++++++++++++---- ui/PgLive.qml | 1 + ui/main.qml | 16 +------ 3 files changed, 97 insertions(+), 24 deletions(-) diff --git a/ui/MediaButton.qml b/ui/MediaButton.qml index 1d10510..c2cc6ac 100644 --- a/ui/MediaButton.qml +++ b/ui/MediaButton.qml @@ -1,18 +1,104 @@ import QtQuick 2.0 import QtQuick.Controls 2.15 -Item { - id: container +Image { + id: buttonIcon x: 64 y: 64 - property bool isClicked : false + property int animationDuration: 250 + fillMode: Image.PreserveAspectFit + source: isClicked ? "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-pause.png" : "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-play.png" + property bool isClicked: false - Image { - id: buttonIcon - width: 64 - anchors.centerIn: parent - fillMode: Image.PreserveAspectFit - source: isClicked ? "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-pause.png" : "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-play.png" + function runAnimation() { + glow.visible = true + animation1.start() + animation2.start() + } + + MouseArea { + anchors.fill: parent + onClicked: { + root.clicked() + stack.push(viewBeerSize) + } + + onPressed: { + glow.visible = true + animation1.start() + animation2.start() + } + } + + ///////// Click animation + Rectangle { + id: glow + visible: false + + width: 250 + height: 250 + color: "#00000000" + radius: 125 + scale: 1.05 + border.color: "#ffffff" + } + + PropertyAnimation { + target: glow + id: animation1 + duration: buttonIcon.animationDuration + loops: 1 + from: 1.05 + to: 1.2 + property: "scale" + } + + ParallelAnimation { + id: animation2 + SequentialAnimation { + PropertyAnimation { + target: glow + duration: buttonIcon.animationDuration + loops: 1 + from: 0.2 + to: 1.0 + property: "opacity" + } + PropertyAnimation { + target: glow + duration: buttonIcon.animationDuration + loops: 1 + from: 1.0 + to: 0.0 + property: "opacity" + } + + PropertyAction { + target: glow + property: "visible" + value: false + } + } + + SequentialAnimation { + PropertyAction { + target: glow + property: "border.width" + value: 20 + } + + PauseAnimation { + duration: 200 + } + PropertyAnimation { + target: glow + duration: buttonIcon.animationDuration + loops: 1 + from: 20 + to: 10 + property: "border.width" + } + } } } diff --git a/ui/PgLive.qml b/ui/PgLive.qml index 7257e59..43694d3 100644 --- a/ui/PgLive.qml +++ b/ui/PgLive.qml @@ -55,6 +55,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { + playPause.runAnimation() mediaControl() playPause.isClicked = !playPause.isClicked } diff --git a/ui/main.qml b/ui/main.qml index 93d95fb..af7f23a 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -41,7 +41,7 @@ ApplicationWindow { } function mediaControl() { - if (thePlayer.playbackState != thePlayer.PlayingState) { + if (thePlayer.playbackState != MediaPlayer.PlayingState) { thePlayer.play(); } else { @@ -74,20 +74,6 @@ ApplicationWindow { PgNews { id: pgNews } } -// PgNews { -// id: pgNews1 -// visible: false -// } - -// Item { -// Component { -// id: myComp -// } - -// Loader { id: contentLoader } - -// } - } } From 5cb56ad9ecc243f6d386640a2cf1a241fba1d9dc Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sun, 23 Apr 2023 01:20:44 +0300 Subject: [PATCH 07/12] Fixed Media Button Animation Signed-off-by: Blagovest Petrov --- ui/MediaButton.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/MediaButton.qml b/ui/MediaButton.qml index c2cc6ac..cb9f204 100644 --- a/ui/MediaButton.qml +++ b/ui/MediaButton.qml @@ -35,8 +35,8 @@ Image { id: glow visible: false - width: 250 - height: 250 + width: parent.width + height: parent.height color: "#00000000" radius: 125 scale: 1.05 From ea2294ccc453715bc9d295d3799840de3151355c Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sun, 23 Apr 2023 13:43:05 +0300 Subject: [PATCH 08/12] WIP: Play/Pause button doesn't keep it's state when the page is changed Signed-off-by: Blagovest Petrov --- CMakeLists.txt | 1 + fetchshowid.cpp | 15 --------------- fetchshowid.h | 20 -------------------- main.cpp | 1 + tangratray.cpp | 5 +++-- ui/AudioPlayer.qml | 1 + ui/CurrentShow.qml | 31 +++++++++++++++++++++++++++++++ ui/MediaButton.qml | 18 +++++++++++++++++- ui/PgLive.qml | 10 +++++++--- ui/main.qml | 12 +++++++++++- 10 files changed, 72 insertions(+), 42 deletions(-) delete mode 100644 fetchshowid.cpp delete mode 100644 fetchshowid.h create mode 100644 ui/CurrentShow.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index fa11680..d5d4977 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ qt_add_qml_module(apptangraplay ui/PgLive.qml ui/PgNews.qml ui/NewsDelegate.qml + ui/CurrentShow.qml RESOURCES ${QML_ASSETS} ) diff --git a/fetchshowid.cpp b/fetchshowid.cpp deleted file mode 100644 index 9eaaf28..0000000 --- a/fetchshowid.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "fetchshowid.h" - -FetchShowID::FetchShowID() -{ - n_manager = new QNetworkAccessManager; - - connect(n_manager, SIGNAL(finished(QNetworkReply*)), - this, SLOT(replyFinished(QNetworkReply*))); - -} - - -void FetchShowID::Fetch() { - n_manager->get(QNetworkRequest(QUrl("http://app.radiotangra.com/TMR_monitor_songs"))); -} diff --git a/fetchshowid.h b/fetchshowid.h deleted file mode 100644 index d71a18f..0000000 --- a/fetchshowid.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef FETCHSHOWID_H -#define FETCHSHOWID_H -#include -#include -#include -#include -#include - - -class FetchShowID : public QObject -{ -public: - FetchShowID(); - void Fetch(); - -private: - QNetworkAccessManager* n_manager; -}; - -#endif // FETCHSHOWID_H diff --git a/main.cpp b/main.cpp index e29116d..ebfd18b 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include #include #include "tangratray.h" +#include int main(int argc, char *argv[]) { diff --git a/tangratray.cpp b/tangratray.cpp index 52de6c3..ee7d4ab 100644 --- a/tangratray.cpp +++ b/tangratray.cpp @@ -16,7 +16,7 @@ TangraTray::TangraTray(QObject *parent) : QObject(parent) trayIcon = new QSystemTrayIcon(); trayIcon->setContextMenu(trayIconMenu); - setTrayIcon(":Resources/tangra.ico"); + setTrayIcon(":/bpetrov.tangraplay/imports/tangra.ico"); trayIcon->show(); @@ -37,8 +37,9 @@ void TangraTray::iconActivated(QSystemTrayIcon::ActivationReason reason) void TangraTray::setTrayIcon(QString image) { - QIcon icon = QIcon(image), tr("Icon"); + QIcon icon = QIcon(image); trayIcon->setIcon(icon); + trayIcon->show(); } void TangraTray::hideIconTray() diff --git a/ui/AudioPlayer.qml b/ui/AudioPlayer.qml index 84b318f..94b2496 100644 --- a/ui/AudioPlayer.qml +++ b/ui/AudioPlayer.qml @@ -4,4 +4,5 @@ import QtMultimedia MediaPlayer { audioOutput: AudioOutput {} source: "http://stream-bg-01.radiotangra.com:8000/Tangra-high" + } diff --git a/ui/CurrentShow.qml b/ui/CurrentShow.qml new file mode 100644 index 0000000..c0bc2fe --- /dev/null +++ b/ui/CurrentShow.qml @@ -0,0 +1,31 @@ +import QtQuick 2.0 + +Item { + property string theShow: "" + + function getShow(url) { + let request = new XMLHttpRequest() + + request.onreadystatechange = function () { + if (request.readyState === XMLHttpRequest.DONE) { +// let content = request.response.slice(0, request.response.indexOf("\n")); + let response = { + status : request.status, + headers : request.getAllResponseHeaders(), + content : request.response + }; + }; + theShow = request.responseText.toString().slice(0, request.response.indexOf("\n")); + } + + request.open("GET", "http://app.radiotangra.com/TMR_monitor_songs") + request.send() + } + + Timer { + interval: 30000 + running: true + repeat: true + onTriggered: getShow() + } +} diff --git a/ui/MediaButton.qml b/ui/MediaButton.qml index cb9f204..7daab6e 100644 --- a/ui/MediaButton.qml +++ b/ui/MediaButton.qml @@ -7,15 +7,31 @@ Image { y: 64 property int animationDuration: 250 fillMode: Image.PreserveAspectFit - source: isClicked ? "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-pause.png" : "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-play.png" + source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-play.png" property bool isClicked: false + function changeIconState() { + if ( thePlayer.playbackState === 1) { + buttonIcon.source = "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-pause.png" + } + else { + buttonIcon.source = "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-play.png" + } + } + function runAnimation() { glow.visible = true animation1.start() animation2.start() } + Connections { + target: mainStack + function activating() { + buttonIcon.changeIconState() + } + } + MouseArea { anchors.fill: parent onClicked: { diff --git a/ui/PgLive.qml b/ui/PgLive.qml index 43694d3..8217c31 100644 --- a/ui/PgLive.qml +++ b/ui/PgLive.qml @@ -5,6 +5,8 @@ import QtMultimedia 5.15 Item { +// property alias playPauseChangeState: playPause.changeIconState() + Image { id: logo x: 190 @@ -57,9 +59,11 @@ Item { onClicked: { playPause.runAnimation() mediaControl() - playPause.isClicked = !playPause.isClicked +// playPause.isClicked = !playPause.isClicked + playPause.changeIconState() } } + } Text { @@ -89,7 +93,7 @@ Item { id: text1 x: 156 y: 17 - text: qsTr("Предаване в ефир:") + text: qsTr("Предаване в ефир: ") + currentShow.theShow color: "#f9c620" font.family: mainfont.name font.pixelSize: 15 @@ -99,7 +103,7 @@ Item { id: text2 x: 156 y: 60 - text: qsTr("В момента звучи:") + text: qsTr("В момента звучи: Unknown") color: "#f9c620" font.family: mainfont.name font.pixelSize: 15 diff --git a/ui/main.qml b/ui/main.qml index af7f23a..0e23e7a 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -40,6 +40,13 @@ ApplicationWindow { id: thePlayer } + CurrentShow { + id: currentShow + Component.onCompleted: { + currentShow.getShow(); + } + } + function mediaControl() { if (thePlayer.playbackState != MediaPlayer.PlayingState) { thePlayer.play(); @@ -67,13 +74,16 @@ ApplicationWindow { Component { id: stackLive - PgLive { id: pgLive } + PgLive { + id: pgLive + } } Component { id: stackNews PgNews { id: pgNews } } + } } From d0ca23e6174efad6df673f61980f5dd7d043880b Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sun, 23 Apr 2023 13:44:50 +0300 Subject: [PATCH 09/12] Now Playing is broken in the website, so it's removed from the app Signed-off-by: Blagovest Petrov --- ui/PgLive.qml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/ui/PgLive.qml b/ui/PgLive.qml index 8217c31..682b7f4 100644 --- a/ui/PgLive.qml +++ b/ui/PgLive.qml @@ -89,21 +89,11 @@ Item { source: "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/playbtn-frame.png" fillMode: Image.PreserveAspectFit - Text { - id: text1 - x: 156 - y: 17 - text: qsTr("Предаване в ефир: ") + currentShow.theShow - color: "#f9c620" - font.family: mainfont.name - font.pixelSize: 15 - } - Text { id: text2 x: 156 y: 60 - text: qsTr("В момента звучи: Unknown") + text: qsTr("Предаване в ефир: ") + currentShow.theShow color: "#f9c620" font.family: mainfont.name font.pixelSize: 15 From 9cf8c8e3a829c1a0ceca2dabad31d236557fb00c Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sat, 6 May 2023 00:53:09 +0300 Subject: [PATCH 10/12] Added NewsDelegate for the news items; fixed syntax for compatibility with Qt 6.5 --- ui/NewsDelegate.qml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ui/NewsDelegate.qml diff --git a/ui/NewsDelegate.qml b/ui/NewsDelegate.qml new file mode 100644 index 0000000..86d4232 --- /dev/null +++ b/ui/NewsDelegate.qml @@ -0,0 +1,21 @@ +import QtQuick +import QtQuick.Controls + +Text { + height: 25 + width: newsList.width + id: titleText + textFormat: Text.RichText + text: " " + title + "" + wrapMode: Text.WordWrap + font.pixelSize: 12 + font.bold: true + onLinkActivated: openLink => Qt.openUrlExternally(link) + MouseArea { + id: mouseArea + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + acceptedButtons: Qt.NoButton + } +} From e70633e4cf2f243dfd34a8010c9621ba7f16462c Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sat, 6 May 2023 01:56:33 +0300 Subject: [PATCH 11/12] Fixed system try icon Signed-off-by: Blagovest Petrov --- CMakeLists.txt | 14 ++++---------- tangratray.cpp | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5d4977..06fb556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,20 +8,15 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(Qt6 6.2 REQUIRED COMPONENTS Quick Widgets Core QuickControls2 Widgets Gui Multimedia) +find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Widgets Core QuickControls2 Widgets Gui Multimedia) -set(QT_MIN_VERSION "5.10.0") -set(KF5_DEP_VERSION "5.40.0") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - -include_directories(.) -include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS}) +qt_standard_project_setup(REQUIRES 6.5) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) list(APPEND QML_ASSETS + Assets/tangra.ico Assets/pause-button.svg Assets/logo.png Assets/play-button.svg @@ -29,7 +24,6 @@ list(APPEND QML_ASSETS Assets/dark_leather.png Assets/menubtn-background.png Assets/blago.png - Assets/tangra.ico Assets/KellySlab-Regular.ttf Assets/news-icon.png Assets/buuf-pause.png @@ -64,7 +58,7 @@ qt_add_qml_module(apptangraplay ) set_target_properties(apptangraplay PROPERTIES - MACOSX_BUNDLE_GUI_IDENTIFIER tangraplay.petrovs.info + MACOSX_BUNDLE_GUI_IDENTIFIER tangraplay.blago.cloud MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE diff --git a/tangratray.cpp b/tangratray.cpp index ee7d4ab..fac0ccd 100644 --- a/tangratray.cpp +++ b/tangratray.cpp @@ -16,8 +16,8 @@ TangraTray::TangraTray(QObject *parent) : QObject(parent) trayIcon = new QSystemTrayIcon(); trayIcon->setContextMenu(trayIconMenu); - setTrayIcon(":/bpetrov.tangraplay/imports/tangra.ico"); - + trayIcon->setToolTip(QString("TagraPlay")); + setTrayIcon(":/bpetrov.tangraplay/imports/TangraPlay/Assets/tangra.ico"); trayIcon->show(); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), From b344128b3f96eccd7c80ff1e63b89566a7fdff49 Mon Sep 17 00:00:00 2001 From: Blagovest Petrov Date: Sat, 6 May 2023 03:12:54 +0300 Subject: [PATCH 12/12] Temporary forced multimedia backend to OS default due to https://bugreports.qt.io/browse/QTBUG-111910 Fixed Play/Pause button state when page is changed Signed-off-by: Blagovest Petrov --- CMakeLists.txt | 6 ++++++ ui/MediaButton.qml | 1 + ui/PgLive.qml | 5 +++++ ui/main.qml | 2 ++ 4 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06fb556..8d88fd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,12 @@ qt_standard_project_setup(REQUIRES 6.5) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) +if (WIN32) + set(QT_DEFAULT_MEDIA_BACKEND windows) +else() + set(QT_DEFAULT_MEDIA_BACKEND gstreamer) +endif() + list(APPEND QML_ASSETS Assets/tangra.ico Assets/pause-button.svg diff --git a/ui/MediaButton.qml b/ui/MediaButton.qml index 7daab6e..1d0836e 100644 --- a/ui/MediaButton.qml +++ b/ui/MediaButton.qml @@ -11,6 +11,7 @@ Image { property bool isClicked: false function changeIconState() { + if ( thePlayer.playbackState === 1) { buttonIcon.source = "qrc:/bpetrov.tangraplay/imports/TangraPlay/Assets/buuf-pause.png" } diff --git a/ui/PgLive.qml b/ui/PgLive.qml index 682b7f4..678e34c 100644 --- a/ui/PgLive.qml +++ b/ui/PgLive.qml @@ -54,6 +54,11 @@ Item { y: 291 width: 64 height: 64 + + Component.onCompleted: { + playPause.changeIconState() + } + MouseArea { anchors.fill: parent onClicked: { diff --git a/ui/main.qml b/ui/main.qml index 0e23e7a..0c8aa98 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -76,6 +76,8 @@ ApplicationWindow { id: stackLive PgLive { id: pgLive + + } } Component {