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.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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -35,5 +35,8 @@ Slider {
|
||||
height: 20
|
||||
radius: 10
|
||||
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
|
||||
|
||||
TabButton {
|
||||
leftPadding: 5
|
||||
rightPadding: 5
|
||||
property bool outlined: false
|
||||
implicitHeight: 36
|
||||
|
||||
contentItem: Text {
|
||||
@@ -19,7 +18,9 @@ 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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -4,9 +4,13 @@ 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
|
||||
@@ -58,11 +62,11 @@ RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
orientation: Qt.Vertical
|
||||
interactive: false
|
||||
interactive: true
|
||||
currentIndex: tabbar.currentIndex
|
||||
|
||||
Loader {
|
||||
active: tabbar.currentIndex == 0
|
||||
// active: tabbar.currentIndex == 0
|
||||
asynchronous: true
|
||||
visible: status == Loader.Ready
|
||||
sourceComponent: ColumnLayout {
|
||||
@@ -75,7 +79,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: tabbar.currentIndex == 1
|
||||
// active: tabbar.currentIndex == 1
|
||||
asynchronous: true
|
||||
visible: status == Loader.Ready
|
||||
sourceComponent: ColumnLayout {
|
||||
@@ -88,7 +92,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: tabbar.currentIndex == 2
|
||||
// active: tabbar.currentIndex == 2
|
||||
asynchronous: true
|
||||
visible: status == Loader.Ready
|
||||
sourceComponent: ColumnLayout {
|
||||
@@ -101,7 +105,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: tabbar.currentIndex == 3
|
||||
// active: tabbar.currentIndex == 3
|
||||
asynchronous: true
|
||||
visible: status == Loader.Ready
|
||||
sourceComponent: ColumnLayout {
|
||||
@@ -172,4 +176,5 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user