diff --git a/Main.qml b/Main.qml index d774b52..b2acaab 100755 --- a/Main.qml +++ b/Main.qml @@ -2,24 +2,15 @@ import QtQuick 6.8 import QtQuick.Controls 6.8 import QtQuick.Controls.Basic 6.8 import QtQuick.Layouts 6.8 -import QtQuick.Dialogs 6.10 import QYRComponents 1.0 ApplicationWindow { + id: root width: 1280 height: 800 title: qsTr("QYouRadio") - Dialog { - id: dialogSettings - // modality: Qt.WindowModal - popupType: Popup.Window - title: qsTr("Settings") - - ViewSettings {} - } - ColumnLayout { anchors.fill: parent anchors.margins: 10 @@ -64,7 +55,9 @@ ApplicationWindow { Button { text: "S" onClicked: function() { - dialogSettings.open() + var component = Qt.createComponent("ViewSettings.qml") + var window = component.createObject(root) + window.show() } } } diff --git a/QYRComponents/Button.qml b/QYRComponents/Button.qml index 7087fc8..cdef379 100755 --- a/QYRComponents/Button.qml +++ b/QYRComponents/Button.qml @@ -20,7 +20,7 @@ Button { background: Rectangle { color: parent.outlined ? "transparent" : (parent.hovered ? Colors.primaryAlt : Colors.primary) border.color: (parent.hovered ? "#555" : "#777") - border.width: parent.outlined ? 2 : 0 + border.width: (parent.outlined || parent.focuesd) ? 2 : 0 opacity: enabled ? 1 : 0.3 radius: 5 } diff --git a/QYRComponents/Slider.qml b/QYRComponents/Slider.qml index 2e8aa7f..a851135 100644 --- a/QYRComponents/Slider.qml +++ b/QYRComponents/Slider.qml @@ -35,5 +35,8 @@ Slider { height: 20 radius: 10 color: Colors.primary + + border.color: "#999" + border.width: parent.focused ? 3 : 0 } } diff --git a/QYRComponents/TabButton.qml b/QYRComponents/TabButton.qml index ecb0f02..7ce63a5 100644 --- a/QYRComponents/TabButton.qml +++ b/QYRComponents/TabButton.qml @@ -3,8 +3,7 @@ import QtQuick.Controls 6.8 import QtQuick.Controls.Basic 6.8 TabButton { - leftPadding: 5 - rightPadding: 5 + property bool outlined: false implicitHeight: 36 contentItem: Text { @@ -19,8 +18,10 @@ TabButton { } background: Rectangle { - color: checked ? (parent.hovered ? Colors.secondaryAlt : Colors.secondary) : (parent.hovered ? Colors.primaryAlt : Colors.primary) + color: parent.outlined ? "transparent" : (parent.hovered ? Colors.primaryAlt : Colors.primary) + border.color: (parent.hovered ? "#555" : "#777") + border.width: (parent.outlined || parent.focuesd) ? 2 : 0 opacity: enabled ? 1 : 0.3 radius: 5 } -} \ No newline at end of file +} diff --git a/QYRComponents/YouAds.qml b/QYRComponents/YouAds.qml index 9cb9be5..7f13608 100644 --- a/QYRComponents/YouAds.qml +++ b/QYRComponents/YouAds.qml @@ -1,27 +1,14 @@ import QtQuick 6.8 -import QtWebView 6.8 -WebView { - implicitWidth: 600 - implicitHeight: 150 - visible: false - url: "https://youads.nonamesoft.xyz/ads/site" - - settings.allowFileAccess: false - settings.javaScriptEnabled: false - settings.localContentCanAccessFileUrls: false - settings.localStorageEnabled: false - - onLoadingChanged: function(loadRequest) { - visible = loadRequest.status == WebView.LoadSucceededStatus - } +Item { + function fetchAd() {} Timer { interval: 30 * 60 * 60 running: true repeat: true onTriggered: function() { - parent.reload() + parent.fetchAd() } } } \ No newline at end of file diff --git a/QYRComponents/qyrcomponents.cpp b/QYRComponents/qyrcomponents.cpp deleted file mode 100755 index 1cfc684..0000000 --- a/QYRComponents/qyrcomponents.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "qyrcomponents.h" - -#include - -QYRComponents::QYRComponents(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ - // By default, QQuickItem does not draw anything. If you subclass - // QQuickItem to create a visual item, you will need to uncomment the - // following line and re-implement updatePaintNode() - - // setFlag(ItemHasContents, true); -} - -void QYRComponents::paint(QPainter *painter) -{ - QPen pen(QColorConstants::Red, 2); - QBrush brush(QColorConstants::Red); - - painter->setPen(pen); - painter->setBrush(brush); - painter->drawRect(0, 0, 100, 100); -} - -QYRComponents::~QYRComponents() -{ -} diff --git a/QYRComponents/qyrcomponents.h b/QYRComponents/qyrcomponents.h deleted file mode 100755 index bfebe28..0000000 --- a/QYRComponents/qyrcomponents.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef QYRCOMPONENTS_H -#define QYRCOMPONENTS_H - -#include - -class QYRComponents : public QQuickPaintedItem -{ - Q_OBJECT - QML_ELEMENT - Q_DISABLE_COPY(QYRComponents) -public: - explicit QYRComponents(QQuickItem *parent = nullptr); - void paint(QPainter *painter) override; - ~QYRComponents() override; -}; - -#endif // QYRCOMPONENTS_H diff --git a/ViewSettings.qml b/ViewSettings.qml index 9b803d2..3aaa416 100644 --- a/ViewSettings.qml +++ b/ViewSettings.qml @@ -4,170 +4,175 @@ import QtQuick.Controls.Basic 6.8 import QtQuick.Layouts 6.8 import QYRComponents 1.0 -RowLayout { - // Layout.leftMargin: parent.width * 2 - // Layout.rightMargin: parent.width * 2 +ApplicationWindow { + width: 840 + height: 560 + visible: true + title: qsTr("Settings") + RowLayout { + anchors.fill: parent - Container { - id: settingsCategory - Layout.fillWidth: false - Layout.fillHeight: true - Layout.rightMargin: 15 + Container { + id: settingsCategory + Layout.fillWidth: false + Layout.fillHeight: true + Layout.rightMargin: 15 - implicitWidth: 240 - clip: true + implicitWidth: 240 + clip: true - contentItem: ListView { - spacing: 7.5 - model: settingsCategory.contentModel - snapMode: ListView.SnapOneItem - orientation: ListView.Vertical - } + contentItem: ListView { + spacing: 7.5 + model: settingsCategory.contentModel + snapMode: ListView.SnapOneItem + orientation: ListView.Vertical + } - Button { - text: qsTr("Appearance") - width: 240 - outlined: true - onClicked: settingsCategory.currentIndex = 0 - } + Button { + text: qsTr("Appearance") + width: 240 + outlined: true + onClicked: settingsCategory.currentIndex = 0 + } - Button { - text: qsTr("Language") - width: 240 - outlined: true - onClicked: settingsCategory.currentIndex = 1 - } + Button { + text: qsTr("Language") + width: 240 + outlined: true + onClicked: settingsCategory.currentIndex = 1 + } - Button { - text: qsTr("Playback Settings") - width: 240 - outlined: true - onClicked: settingsCategory.currentIndex = 2 - } + Button { + text: qsTr("Playback Settings") + width: 240 + outlined: true + onClicked: settingsCategory.currentIndex = 2 + } - Button { - text: qsTr("About") - width: 240 - outlined: true - onClicked: settingsCategory.currentIndex = 3 - } - } - - SwipeView { - Layout.fillWidth: true - Layout.fillHeight: true - orientation: Qt.Vertical - interactive: false - currentIndex: tabbar.currentIndex - - Loader { - active: tabbar.currentIndex == 0 - asynchronous: true - visible: status == Loader.Ready - sourceComponent: ColumnLayout { - Label { - text: "Appearance" - heading: "h1" - font.bold: true - } + Button { + text: qsTr("About") + width: 240 + outlined: true + onClicked: settingsCategory.currentIndex = 3 } } - Loader { - active: tabbar.currentIndex == 1 - asynchronous: true - visible: status == Loader.Ready - sourceComponent: ColumnLayout { - Label { - text: "Language" - heading: "h1" - font.bold: true + SwipeView { + Layout.fillWidth: true + Layout.fillHeight: true + orientation: Qt.Vertical + interactive: true + currentIndex: tabbar.currentIndex + + Loader { + // active: tabbar.currentIndex == 0 + asynchronous: true + visible: status == Loader.Ready + sourceComponent: ColumnLayout { + Label { + text: "Appearance" + heading: "h1" + font.bold: true + } } } - } - Loader { - active: tabbar.currentIndex == 2 - asynchronous: true - visible: status == Loader.Ready - sourceComponent: ColumnLayout { - Label { - text: "Playback Settings" - heading: "h1" - font.bold: true + Loader { + // active: tabbar.currentIndex == 1 + asynchronous: true + visible: status == Loader.Ready + sourceComponent: ColumnLayout { + Label { + text: "Language" + heading: "h1" + font.bold: true + } } } - } - Loader { - active: tabbar.currentIndex == 3 - asynchronous: true - visible: status == Loader.Ready - sourceComponent: ColumnLayout { - Label { - text: "About" - heading: "h1" - font.bold: true + Loader { + // active: tabbar.currentIndex == 2 + asynchronous: true + visible: status == Loader.Ready + sourceComponent: ColumnLayout { + Label { + text: "Playback Settings" + heading: "h1" + font.bold: true + } } + } - Label { - text: "YouRadio" - heading: "h2" - font.bold: true - } + Loader { + // active: tabbar.currentIndex == 3 + asynchronous: true + visible: status == Loader.Ready + sourceComponent: ColumnLayout { + Label { + text: "About" + heading: "h1" + font.bold: true + } - Label { - text: "by Youpiter" - heading: "h3" - font.bold: true - } + Label { + text: "YouRadio" + heading: "h2" + font.bold: true + } - Label { - text: "Music source" - heading: "base" - font.bold: true - } + Label { + text: "by Youpiter" + heading: "h3" + font.bold: true + } - Label { - text: "QYouRadio" - heading: "h3" - font.bold: true - } - Label { - text: "by Ghostfox" - heading: "h3" - font.bold: true - } + Label { + text: "Music source" + heading: "base" + font.bold: true + } - Label { - text: "Client development" - heading: "base" - font.bold: true - } + Label { + text: "QYouRadio" + heading: "h3" + font.bold: true + } + Label { + text: "by Ghostfox" + heading: "h3" + font.bold: true + } - Label { - text: "Attribution" - heading: "h1" - font.bold: true - } + Label { + text: "Client development" + heading: "base" + font.bold: true + } - Label { - text: "Qt" - heading: "h2" - font.bold: true - } + Label { + text: "Attribution" + heading: "h1" + font.bold: true + } - Label { - text: "by Qt Group Inc." - heading: "h3" - font.bold: true - } + Label { + text: "Qt" + heading: "h2" + font.bold: true + } - Label { - text: "Open-Source library on which QYouRadio is built uppon, licensed under LGPL-3.0" - heading: "base" - font.bold: true + Label { + text: "by Qt Group Inc." + heading: "h3" + font.bold: true + } + + Label { + text: "Open-Source library on which QYouRadio is built uppon, licensed under LGPL-3.0" + heading: "base" + font.bold: true + } } } }