Move settings into a separate window, prepare YouAds component for a native rewrite
This commit is contained in:
15
Main.qml
15
Main.qml
@@ -2,24 +2,15 @@ import QtQuick 6.8
|
|||||||
import QtQuick.Controls 6.8
|
import QtQuick.Controls 6.8
|
||||||
import QtQuick.Controls.Basic 6.8
|
import QtQuick.Controls.Basic 6.8
|
||||||
import QtQuick.Layouts 6.8
|
import QtQuick.Layouts 6.8
|
||||||
import QtQuick.Dialogs 6.10
|
|
||||||
|
|
||||||
import QYRComponents 1.0
|
import QYRComponents 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
id: root
|
||||||
width: 1280
|
width: 1280
|
||||||
height: 800
|
height: 800
|
||||||
title: qsTr("QYouRadio")
|
title: qsTr("QYouRadio")
|
||||||
|
|
||||||
Dialog {
|
|
||||||
id: dialogSettings
|
|
||||||
// modality: Qt.WindowModal
|
|
||||||
popupType: Popup.Window
|
|
||||||
title: qsTr("Settings")
|
|
||||||
|
|
||||||
ViewSettings {}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 10
|
anchors.margins: 10
|
||||||
@@ -64,7 +55,9 @@ ApplicationWindow {
|
|||||||
Button {
|
Button {
|
||||||
text: "S"
|
text: "S"
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
dialogSettings.open()
|
var component = Qt.createComponent("ViewSettings.qml")
|
||||||
|
var window = component.createObject(root)
|
||||||
|
window.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Button {
|
|||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: parent.outlined ? "transparent" : (parent.hovered ? Colors.primaryAlt : Colors.primary)
|
color: parent.outlined ? "transparent" : (parent.hovered ? Colors.primaryAlt : Colors.primary)
|
||||||
border.color: (parent.hovered ? "#555" : "#777")
|
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
|
opacity: enabled ? 1 : 0.3
|
||||||
radius: 5
|
radius: 5
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,8 @@ Slider {
|
|||||||
height: 20
|
height: 20
|
||||||
radius: 10
|
radius: 10
|
||||||
color: Colors.primary
|
color: Colors.primary
|
||||||
|
|
||||||
|
border.color: "#999"
|
||||||
|
border.width: parent.focused ? 3 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import QtQuick.Controls 6.8
|
|||||||
import QtQuick.Controls.Basic 6.8
|
import QtQuick.Controls.Basic 6.8
|
||||||
|
|
||||||
TabButton {
|
TabButton {
|
||||||
leftPadding: 5
|
property bool outlined: false
|
||||||
rightPadding: 5
|
|
||||||
implicitHeight: 36
|
implicitHeight: 36
|
||||||
|
|
||||||
contentItem: Text {
|
contentItem: Text {
|
||||||
@@ -19,8 +18,10 @@ TabButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
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
|
opacity: enabled ? 1 : 0.3
|
||||||
radius: 5
|
radius: 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,14 @@
|
|||||||
import QtQuick 6.8
|
import QtQuick 6.8
|
||||||
import QtWebView 6.8
|
|
||||||
|
|
||||||
WebView {
|
Item {
|
||||||
implicitWidth: 600
|
function fetchAd() {}
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: 30 * 60 * 60
|
interval: 30 * 60 * 60
|
||||||
running: true
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: function() {
|
onTriggered: function() {
|
||||||
parent.reload()
|
parent.fetchAd()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#include "qyrcomponents.h"
|
|
||||||
|
|
||||||
#include <QPainter>
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef QYRCOMPONENTS_H
|
|
||||||
#define QYRCOMPONENTS_H
|
|
||||||
|
|
||||||
#include <QtQuick/QQuickPaintedItem>
|
|
||||||
|
|
||||||
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
|
|
||||||
279
ViewSettings.qml
279
ViewSettings.qml
@@ -4,170 +4,175 @@ import QtQuick.Controls.Basic 6.8
|
|||||||
import QtQuick.Layouts 6.8
|
import QtQuick.Layouts 6.8
|
||||||
import QYRComponents 1.0
|
import QYRComponents 1.0
|
||||||
|
|
||||||
RowLayout {
|
ApplicationWindow {
|
||||||
// Layout.leftMargin: parent.width * 2
|
width: 840
|
||||||
// Layout.rightMargin: parent.width * 2
|
height: 560
|
||||||
|
visible: true
|
||||||
|
title: qsTr("Settings")
|
||||||
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
Container {
|
Container {
|
||||||
id: settingsCategory
|
id: settingsCategory
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.rightMargin: 15
|
Layout.rightMargin: 15
|
||||||
|
|
||||||
implicitWidth: 240
|
implicitWidth: 240
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
contentItem: ListView {
|
contentItem: ListView {
|
||||||
spacing: 7.5
|
spacing: 7.5
|
||||||
model: settingsCategory.contentModel
|
model: settingsCategory.contentModel
|
||||||
snapMode: ListView.SnapOneItem
|
snapMode: ListView.SnapOneItem
|
||||||
orientation: ListView.Vertical
|
orientation: ListView.Vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Appearance")
|
text: qsTr("Appearance")
|
||||||
width: 240
|
width: 240
|
||||||
outlined: true
|
outlined: true
|
||||||
onClicked: settingsCategory.currentIndex = 0
|
onClicked: settingsCategory.currentIndex = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Language")
|
text: qsTr("Language")
|
||||||
width: 240
|
width: 240
|
||||||
outlined: true
|
outlined: true
|
||||||
onClicked: settingsCategory.currentIndex = 1
|
onClicked: settingsCategory.currentIndex = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Playback Settings")
|
text: qsTr("Playback Settings")
|
||||||
width: 240
|
width: 240
|
||||||
outlined: true
|
outlined: true
|
||||||
onClicked: settingsCategory.currentIndex = 2
|
onClicked: settingsCategory.currentIndex = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("About")
|
text: qsTr("About")
|
||||||
width: 240
|
width: 240
|
||||||
outlined: true
|
outlined: true
|
||||||
onClicked: settingsCategory.currentIndex = 3
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
SwipeView {
|
||||||
active: tabbar.currentIndex == 1
|
Layout.fillWidth: true
|
||||||
asynchronous: true
|
Layout.fillHeight: true
|
||||||
visible: status == Loader.Ready
|
orientation: Qt.Vertical
|
||||||
sourceComponent: ColumnLayout {
|
interactive: true
|
||||||
Label {
|
currentIndex: tabbar.currentIndex
|
||||||
text: "Language"
|
|
||||||
heading: "h1"
|
Loader {
|
||||||
font.bold: true
|
// active: tabbar.currentIndex == 0
|
||||||
|
asynchronous: true
|
||||||
|
visible: status == Loader.Ready
|
||||||
|
sourceComponent: ColumnLayout {
|
||||||
|
Label {
|
||||||
|
text: "Appearance"
|
||||||
|
heading: "h1"
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: tabbar.currentIndex == 2
|
// active: tabbar.currentIndex == 1
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
visible: status == Loader.Ready
|
visible: status == Loader.Ready
|
||||||
sourceComponent: ColumnLayout {
|
sourceComponent: ColumnLayout {
|
||||||
Label {
|
Label {
|
||||||
text: "Playback Settings"
|
text: "Language"
|
||||||
heading: "h1"
|
heading: "h1"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: tabbar.currentIndex == 3
|
// active: tabbar.currentIndex == 2
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
visible: status == Loader.Ready
|
visible: status == Loader.Ready
|
||||||
sourceComponent: ColumnLayout {
|
sourceComponent: ColumnLayout {
|
||||||
Label {
|
Label {
|
||||||
text: "About"
|
text: "Playback Settings"
|
||||||
heading: "h1"
|
heading: "h1"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Loader {
|
||||||
text: "YouRadio"
|
// active: tabbar.currentIndex == 3
|
||||||
heading: "h2"
|
asynchronous: true
|
||||||
font.bold: true
|
visible: status == Loader.Ready
|
||||||
}
|
sourceComponent: ColumnLayout {
|
||||||
|
Label {
|
||||||
|
text: "About"
|
||||||
|
heading: "h1"
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "by Youpiter"
|
text: "YouRadio"
|
||||||
heading: "h3"
|
heading: "h2"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Music source"
|
text: "by Youpiter"
|
||||||
heading: "base"
|
heading: "h3"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "QYouRadio"
|
text: "Music source"
|
||||||
heading: "h3"
|
heading: "base"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
Label {
|
|
||||||
text: "by Ghostfox"
|
|
||||||
heading: "h3"
|
|
||||||
font.bold: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Client development"
|
text: "QYouRadio"
|
||||||
heading: "base"
|
heading: "h3"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
Label {
|
||||||
|
text: "by Ghostfox"
|
||||||
|
heading: "h3"
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Attribution"
|
text: "Client development"
|
||||||
heading: "h1"
|
heading: "base"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Qt"
|
text: "Attribution"
|
||||||
heading: "h2"
|
heading: "h1"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "by Qt Group Inc."
|
text: "Qt"
|
||||||
heading: "h3"
|
heading: "h2"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Open-Source library on which QYouRadio is built uppon, licensed under LGPL-3.0"
|
text: "by Qt Group Inc."
|
||||||
heading: "base"
|
heading: "h3"
|
||||||
font.bold: true
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: "Open-Source library on which QYouRadio is built uppon, licensed under LGPL-3.0"
|
||||||
|
heading: "base"
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user