Revert "Enable QML Type Compiler", implement YouAds component

This commit is contained in:
Dark Steveneq
2025-10-12 15:52:26 +02:00
parent ef675152c3
commit 5811933326
4 changed files with 43 additions and 11 deletions

View File

@@ -15,7 +15,6 @@ qt_add_executable(appqyouradio
qt_add_qml_module(appqyouradio
URI qyouradio
VERSION 1.0
ENABLE_TYPE_COMPILER
QML_FILES
Main.qml
ViewPlayer.qml

View File

@@ -6,7 +6,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
find_package(Qt6 6.2 COMPONENTS Quick WebView REQUIRED)
set_source_files_properties(Colors.qml
PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
@@ -15,15 +15,16 @@ qt_add_library(QYRComponents STATIC)
qt_add_qml_module(QYRComponents
URI QYRComponents
VERSION 1.0
ENABLE_TYPE_COMPILER
RESOURCE_PREFIX /qt/qml
QML_FILES Button.qml
QML_FILES Colors.qml
QML_FILES ApplicationWindow.qml
QML_FILES CheckBox.qml
QML_FILES Slider.qml
QML_FILES Label.qml
QML_FILES TabButton.qml
QML_FILES
Button.qml
Colors.qml
ApplicationWindow.qml
CheckBox.qml
Slider.qml
Label.qml
TabButton.qml
YouAds.qml
# SOURCES qyrcomponents.cpp qyrcomponents.h
)
@@ -34,7 +35,7 @@ set_target_properties(QYRComponents PROPERTIES
target_compile_definitions(QYRComponents
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(QYRComponents
PRIVATE Qt6::Quick)
PRIVATE Qt6::Quick Qt6::WebView)
target_include_directories(QYRComponents PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

27
QYRComponents/YouAds.qml Normal file
View File

@@ -0,0 +1,27 @@
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
}
Timer {
interval: 30 * 60 * 60
running: true
repeat: true
onTriggered: function() {
parent.reload()
}
}
}

View File

@@ -78,4 +78,9 @@ ColumnLayout {
Item {
Layout.fillHeight: true
}
YouAds {
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
}
}