diff --git a/MediaButton.qml b/MediaButton.qml index bf34fcd..bd9b649 100644 --- a/MediaButton.qml +++ b/MediaButton.qml @@ -1,20 +1,18 @@ import QtQuick 2.0 import QtQuick.Controls 2.15 -Rectangle { +Item { id: container - x: 141 - y: 367 + x: 64 + y: 64 property bool isClicked : false - color: isClicked ? "#a98415" : "#f9c620" - Image { id: buttonIcon width: 64 anchors.centerIn: parent fillMode: Image.PreserveAspectFit - source: isClicked ? "Resources/pause-button.svg" : "Resources/play-button.svg" + source: isClicked ? "Resources/buuf-pause.png" : "Resources/buuf-play.png" } } diff --git a/MenuToolbar.qml b/MenuToolbar.qml new file mode 100644 index 0000000..f086e43 --- /dev/null +++ b/MenuToolbar.qml @@ -0,0 +1,87 @@ +import QtQuick 2.0 +import QtQuick.Window 2.12 + +Item { + Rectangle { + id: menu + width: mainWindow.width + height: 32 + + Image { + source: "Resources/menu-background.png" + fillMode: Image.Tile + anchors.fill: parent + + } + + + MouseArea { + anchors.fill: parent; + property variant clickPos: "1,1" + + onPressed: { + clickPos = Qt.point(mouse.x,mouse.y) + } + + onPositionChanged: { + 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 + if (new_y <= 0) + mainWindow.visibility = Window.Maximized + else + { + if (mainWindow.visibility === Window.Maximized) + mainWindow.visibility = Window.Windowed + mainWindow.x = new_x + mainWindow.y = new_y + } + } + + MenuButton { + id: buttonExit + caption: "X" + onClicked: Qt.quit(); + + } + + MenuButton { + id: buttonMinimize + anchors.left: buttonExit.right + caption: "_" + onClicked: mainWindow.hide() + + } + + Text { + id: appTitle + anchors.left: buttonMinimize.right + text: qsTr("TangraPlay") + font.family: mainfont.name + font.pixelSize: 20 + font.bold: true + color: "#f9c620" + } + +// Image { +// id: buttonLive +// source: "Resources/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 +// } +// } +// } + } + } +} + diff --git a/PgLive.qml b/PgLive.qml new file mode 100644 index 0000000..a9171a5 --- /dev/null +++ b/PgLive.qml @@ -0,0 +1,91 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import Qt.labs.platform 1.1 +import QtMultimedia 5.15 + +Item { + + + Image { + id: logo + x: 190 + y: 51 + visible: true + width: 260 + height: 175 + fillMode: Image.PreserveAspectFit + source: "Resources/logo.png" + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onPressed: { + Qt.openUrlExternally("http://radiotangra.com") + } + } + } + + MediaButton { + id: playPause + x: 35 + y: 291 + width: 64 + height: 64 + MouseArea { + anchors.fill: parent + onClicked: { + mediaControl(); + playPause.isClicked = !playPause.isClicked; + } + } + } + + Text { + id: aboutLink + x: 509 + y: 455 + text: qsTr("Относно програмата") + font.pixelSize: 12 + font.family: mainfont.name + color: "#f9c620" + MouseArea { + anchors.fill: parent + onClicked: aboutDialog.open() + } + } + + Image { + id: playbtnframe + x: 0 + y: 259 + width: 629 + height: 127 + source: "Resources/playbtn-frame.png" + fillMode: Image.PreserveAspectFit + + Text { + id: text1 + x: 156 + y: 17 + text: qsTr("Предаване в ефир:") + color: "#f9c620" + font.family: mainfont.name + font.pixelSize: 15 + } + + Text { + id: text2 + x: 156 + y: 60 + text: qsTr("В момента звучи:") + color: "#f9c620" + font.family: mainfont.name + font.pixelSize: 15 + } + } +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/ diff --git a/PgNews.qml b/PgNews.qml new file mode 100644 index 0000000..4e74cf8 --- /dev/null +++ b/PgNews.qml @@ -0,0 +1,38 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import Qt.labs.platform 1.1 +import QtMultimedia 5.15 + +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 + } + } + + + +} diff --git a/Resources/buuf-pause.png b/Resources/buuf-pause.png new file mode 100644 index 0000000..0a1ea86 Binary files /dev/null and b/Resources/buuf-pause.png differ diff --git a/Resources/buuf-play.png b/Resources/buuf-play.png new file mode 100755 index 0000000..6fa868e Binary files /dev/null and b/Resources/buuf-play.png differ diff --git a/Resources/live.png b/Resources/live.png new file mode 100755 index 0000000..ac0d09c Binary files /dev/null and b/Resources/live.png differ diff --git a/Resources/news-icon.png b/Resources/news-icon.png new file mode 100755 index 0000000..5b2aed0 Binary files /dev/null and b/Resources/news-icon.png differ diff --git a/Resources/news.png b/Resources/news.png new file mode 100755 index 0000000..5b2aed0 Binary files /dev/null and b/Resources/news.png differ diff --git a/Resources/playbtn-frame.png b/Resources/playbtn-frame.png new file mode 100644 index 0000000..3d4bf75 Binary files /dev/null and b/Resources/playbtn-frame.png differ diff --git a/Resources/podcast.png b/Resources/podcast.png new file mode 100755 index 0000000..15782ba Binary files /dev/null and b/Resources/podcast.png differ diff --git a/fetchshowid.cpp b/fetchshowid.cpp index 93b440e..9eaaf28 100644 --- a/fetchshowid.cpp +++ b/fetchshowid.cpp @@ -1,15 +1,15 @@ #include "fetchshowid.h" -#include -#include -#include -#include FetchShowID::FetchShowID() { + n_manager = new QNetworkAccessManager; + + connect(n_manager, SIGNAL(finished(QNetworkReply*)), + this, SLOT(replyFinished(QNetworkReply*))); } -//int FetchShowID::Fetch() { -// QNetworkAccessManager *manager = new QNetworkAccessManager(this); -//} +void FetchShowID::Fetch() { + n_manager->get(QNetworkRequest(QUrl("http://app.radiotangra.com/TMR_monitor_songs"))); +} diff --git a/fetchshowid.h b/fetchshowid.h index 34987bc..d71a18f 100644 --- a/fetchshowid.h +++ b/fetchshowid.h @@ -1,12 +1,20 @@ #ifndef FETCHSHOWID_H #define FETCHSHOWID_H +#include +#include +#include +#include +#include -class FetchShowID +class FetchShowID : public QObject { public: FetchShowID(); -// int Fetch(); + void Fetch(); + +private: + QNetworkAccessManager* n_manager; }; #endif // FETCHSHOWID_H diff --git a/main.qml b/main.qml index 5998a8d..5b2f0b3 100644 --- a/main.qml +++ b/main.qml @@ -8,7 +8,9 @@ Window { id: mainWindow visible: true width: 640 + maximumWidth: 640 height: 480 + maximumHeight: 480 flags: Qt.FramelessWindowHint FontLoader { id: mainfont; source: "Resources/KellySlab-Regular.ttf" } @@ -65,160 +67,25 @@ Window { fillMode: Image.Tile source: "Resources/dark_leather.png" - Rectangle { - id: menu - width: mainWindow.width - height: 32 + MenuToolbar {} - Image { - source: "Resources/menu-background.png" - fillMode: Image.Tile - anchors.fill: parent - - } - - - MouseArea { - anchors.fill: parent; - property variant clickPos: "1,1" - - onPressed: { - clickPos = Qt.point(mouse.x,mouse.y) - } - - onPositionChanged: { - 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 - if (new_y <= 0) - mainWindow.visibility = Window.Maximized - else - { - if (mainWindow.visibility === Window.Maximized) - mainWindow.visibility = Window.Windowed - mainWindow.x = new_x - mainWindow.y = new_y - } - } - - MenuButton { - id: buttonExit - caption: "X" - onClicked: Qt.quit() - - } - - MenuButton { - id: buttonMinimize - anchors.left: buttonExit.right - caption: "_" - onClicked: mainWindow.hide() - - } - - Text { - id: appTitle - anchors.left: buttonMinimize.right - text: qsTr("TangraPlay") - font.family: mainfont.name - font.pixelSize: 20 - font.bold: true - color: "#f9c620" - } - } + PgLive { + id: pgLive1 } - - Image { - id: logo - x: 190 - y: 51 - visible: true - width: 260 - height: 175 - fillMode: Image.PreserveAspectFit - source: "Resources/logo.png" - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onPressed: { - Qt.openUrlExternally("http://radiotangra.com") - } - } - } - - - -// Text { -// id: element -// x: 17 -// y: 68 -// text: qsTr("Качество:") -// font.bold: true -// color: "#f9c620" -// styleColor: "#f9c620" -// horizontalAlignment: Text.AlignHCenter -// font.pixelSize: 20 +// PgNews { +// id: pgNews1 +// visible: false // } -// Rectangle { -// id: buttonHighQuality -// color: "#f9c620" -// x: 17 -// y: 102 -// width: 100 -// height: 34 -// Text { -// anchors.centerIn: parent -// id: element1 -// text: qsTr("ВИСОКО") -// color: "#000000" -// font.pixelSize: 20 -// horizontalAlignment: Text.AlignHCenter -// font.bold: true +// Item { +// Component { +// id: myComp // } -// } -// Rectangle { -// id: buttonLowQuality -// color: "transparent" -// x: 24 -// y: 146 -// width: 100 -// height: 34 -// Text { -// text: qsTr("НИСКО") -// color: "#f9c620" -// horizontalAlignment: Text.AlignHCenter -// font.pixelSize: 20 -// font.bold: true -// } -// } +// Loader { id: contentLoader } - MediaButton { - id: playPause - width: 359 - height: 85 - MouseArea { - anchors.fill: parent - onClicked: { - mediaControl(); - playPause.isClicked = !playPause.isClicked; - } - } - } +// } - Text { - id: aboutLink - x: 509 - y: 455 - text: qsTr("Относно програмата") - font.pixelSize: 12 - font.family: mainfont.name - color: "#f9c620" - MouseArea { - anchors.fill: parent - onClicked: aboutDialog.open() - } - } } } + diff --git a/qml.qrc b/qml.qrc index c82a25b..95e5d50 100644 --- a/qml.qrc +++ b/qml.qrc @@ -14,5 +14,15 @@ Resources/blago.png Resources/tangra.ico Resources/KellySlab-Regular.ttf + PgLive.qml + MenuToolbar.qml + PgNews.qml + 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