2025-05-29 14:04:05 +08:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
|
import QtQuick.Window 2.15
|
|
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
import QtMultimedia 5.15
|
2025-09-15 09:46:04 +08:00
|
|
|
|
import HuskarUI.Basic 1.0
|
2025-05-29 14:04:05 +08:00
|
|
|
|
import QmlTool 1.0
|
|
|
|
|
|
import FileTransfer 1.0
|
|
|
|
|
|
import "../MyGlobals" 1.0
|
|
|
|
|
|
import "../Component" 1.0
|
|
|
|
|
|
|
2025-09-15 09:46:04 +08:00
|
|
|
|
HusWindow {
|
2025-05-29 14:04:05 +08:00
|
|
|
|
id:plugininfo_goods
|
|
|
|
|
|
width: 890
|
|
|
|
|
|
height: 630
|
|
|
|
|
|
visible: true
|
|
|
|
|
|
title: qsTr("插件详情页")
|
|
|
|
|
|
captionBar.topButtonVisible: true
|
|
|
|
|
|
captionBar.winIconDelegate: Image {
|
|
|
|
|
|
id: name
|
|
|
|
|
|
width: 20
|
|
|
|
|
|
height: 20
|
|
|
|
|
|
source: "qrc:/image/logo.png"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//原始数据
|
|
|
|
|
|
property var p_basedata: null
|
|
|
|
|
|
//插件名
|
|
|
|
|
|
property string p_name : "未定名插件"
|
|
|
|
|
|
//作者名
|
|
|
|
|
|
property string p_author : "未定名作者"
|
|
|
|
|
|
//版本号
|
|
|
|
|
|
property string p_version: "0.0.1"
|
|
|
|
|
|
//描述
|
|
|
|
|
|
property string p_description: "暂无描述"
|
|
|
|
|
|
//售价
|
|
|
|
|
|
property int p_price: 0
|
|
|
|
|
|
//插件文件数组
|
|
|
|
|
|
property var p_filelist : []
|
|
|
|
|
|
//是否是凌众插件
|
|
|
|
|
|
property bool p_isrindro : false
|
|
|
|
|
|
//图像
|
|
|
|
|
|
property string p_image:"qrc:/image/logo2.png"
|
|
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
|
|
sequences: ["Esc"]
|
|
|
|
|
|
onActivated: close()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function init(index){
|
|
|
|
|
|
//全局数据插件列表存在
|
|
|
|
|
|
if(!GlobalVars.serverPluginList)return;
|
|
|
|
|
|
var Data = GlobalVars.serverPluginList[index]
|
|
|
|
|
|
p_basedata = Data;
|
|
|
|
|
|
p_name = Data.ProjectName
|
|
|
|
|
|
p_author = Data.ProjectAuthor
|
|
|
|
|
|
p_version = Data.ProjectVersion
|
|
|
|
|
|
p_description = Data.ProjectDescribe
|
|
|
|
|
|
//如果有插件文件数组
|
|
|
|
|
|
if(Data.ProjectFiles)p_filelist = Data.ProjectFiles
|
|
|
|
|
|
//如果有插件的详细描述
|
|
|
|
|
|
if(Data.ProjectDetails)details.model = Data.ProjectDetails
|
|
|
|
|
|
//如果有售价才设置售价
|
|
|
|
|
|
if(Data.ProjectPrice)p_price = Data.ProjectPrice
|
|
|
|
|
|
else p_price = 0
|
|
|
|
|
|
//如果是凌众的插件
|
|
|
|
|
|
if(Data.isrindro)p_isrindro = true
|
|
|
|
|
|
else p_isrindro = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function buildQuest(filename){
|
|
|
|
|
|
var downloadurl = GlobalVars.server_url + "/dps/download/" + p_name + ":";
|
|
|
|
|
|
var updir = (filename.indexOf(".json") === -1 ? ("OfficialProject/" + p_basedata.ProjectName + "/") : "OfficialConfig/");
|
|
|
|
|
|
GlobalVars.downlad_quest_window.addQuest(p_basedata.ProjectName + ":" + filename,[
|
|
|
|
|
|
function(quest){
|
|
|
|
|
|
//下载
|
|
|
|
|
|
quest.status = 1;
|
|
|
|
|
|
FileTransfer.postDownload(downloadurl + filename, "download/" + filename,{key:p_basedata.ProjectName + ":" + filename},"quest");
|
|
|
|
|
|
},
|
|
|
|
|
|
function(quest){
|
|
|
|
|
|
if(GlobalVars.accServerList){
|
|
|
|
|
|
var server = GlobalVars.accServerList[GlobalVars.selectServer].serverIp
|
|
|
|
|
|
//上传
|
|
|
|
|
|
quest.status = 1;
|
|
|
|
|
|
FileTransfer.postUpload("http://" + server + ":65170/api/uploadfiles", "download/" + filename, "/dp_s/" + updir,"quest");
|
|
|
|
|
|
}
|
|
|
|
|
|
else{
|
|
|
|
|
|
quest.instruction = true
|
|
|
|
|
|
}
|
|
|
|
|
|
},function(quest){
|
|
|
|
|
|
GlobalVars.msg_control.success("文件 :" + p_basedata.ProjectName + ":" + filename + " 已下载并上传至服务器!");
|
|
|
|
|
|
quest.instruction = true
|
|
|
|
|
|
}]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function buyPlugin(){
|
|
|
|
|
|
//如果不是凌众插件
|
|
|
|
|
|
if(!p_isrindro){
|
|
|
|
|
|
|
|
|
|
|
|
buildQuest("Proj.ifo");
|
|
|
|
|
|
|
|
|
|
|
|
//项目配置文件
|
|
|
|
|
|
if(p_basedata && p_basedata.ProjectConfig.length > 0){
|
|
|
|
|
|
buildQuest(p_basedata.ProjectConfig);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//项目逻辑文件
|
|
|
|
|
|
for (var i = 0; i < p_filelist.length; i++) {
|
|
|
|
|
|
buildQuest(p_filelist[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle{
|
|
|
|
|
|
id:title
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
anchors.rightMargin: 15
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
|
anchors.topMargin: 45
|
|
|
|
|
|
height:78 + headerdiv.height + description.height
|
|
|
|
|
|
radius:8
|
2025-09-15 09:46:04 +08:00
|
|
|
|
border.color: HusTheme.isDark ? "#23272e" : "#f0f4f7"
|
2025-05-29 14:04:05 +08:00
|
|
|
|
border.width: 2
|
|
|
|
|
|
color:"transparent"
|
|
|
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
|
id: logo
|
|
|
|
|
|
source: "qrc:/image/logo.png"
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
|
anchors.topMargin: 15
|
|
|
|
|
|
width: 48
|
|
|
|
|
|
height: 48
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-15 09:46:04 +08:00
|
|
|
|
HusDivider {
|
2025-05-29 14:04:05 +08:00
|
|
|
|
id:headerdiv
|
|
|
|
|
|
anchors.top: logo.bottom
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
anchors.leftMargin: 1
|
|
|
|
|
|
width: parent.width - 1
|
|
|
|
|
|
height: 30
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
|
id:description
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
anchors.rightMargin: 10
|
|
|
|
|
|
anchors.top: headerdiv.bottom
|
|
|
|
|
|
text: p_description
|
|
|
|
|
|
|
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
|
font {
|
|
|
|
|
|
pixelSize: 14
|
2025-09-15 09:46:04 +08:00
|
|
|
|
family: HusTheme.Primary.fontPrimaryFamily
|
2025-05-29 14:04:05 +08:00
|
|
|
|
}
|
2025-09-15 09:46:04 +08:00
|
|
|
|
color: HusTheme.Primary.colorTextBase
|
2025-05-29 14:04:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
|
id:pluginname
|
|
|
|
|
|
anchors.left: logo.right
|
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
|
anchors.topMargin: 14
|
|
|
|
|
|
text: p_name
|
|
|
|
|
|
font {
|
|
|
|
|
|
pixelSize: 20
|
2025-09-15 09:46:04 +08:00
|
|
|
|
family: HusTheme.Primary.fontPrimaryFamily
|
2025-05-29 14:04:05 +08:00
|
|
|
|
}
|
2025-09-15 09:46:04 +08:00
|
|
|
|
color: HusTheme.Primary.colorTextBase
|
2025-05-29 14:04:05 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
|
anchors.left: logo.right
|
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
|
anchors.top: pluginname.bottom
|
|
|
|
|
|
anchors.topMargin: 2
|
|
|
|
|
|
text: "作者: " + p_author
|
|
|
|
|
|
font {
|
|
|
|
|
|
pixelSize: 14
|
2025-09-15 09:46:04 +08:00
|
|
|
|
family: HusTheme.Primary.fontPrimaryFamily
|
2025-05-29 14:04:05 +08:00
|
|
|
|
}
|
2025-09-15 09:46:04 +08:00
|
|
|
|
color: HusTheme.Primary.colorTextBase
|
2025-05-29 14:04:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 09:46:04 +08:00
|
|
|
|
HusTag {
|
2025-05-29 14:04:05 +08:00
|
|
|
|
id:version_tag
|
|
|
|
|
|
anchors.left: pluginname.right
|
|
|
|
|
|
anchors.leftMargin: 15
|
|
|
|
|
|
anchors.top: pluginname.top
|
|
|
|
|
|
anchors.topMargin: 2
|
|
|
|
|
|
text:"Ver:" + p_version
|
|
|
|
|
|
presetColor:"green"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 09:46:04 +08:00
|
|
|
|
HusTag {
|
2025-05-29 14:04:05 +08:00
|
|
|
|
id:price_tag
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
|
anchors.topMargin: 15
|
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
anchors.rightMargin: 10
|
|
|
|
|
|
text:"所需贡献点:" + p_price
|
|
|
|
|
|
presetColor:"green"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 09:46:04 +08:00
|
|
|
|
HusButton {
|
2025-05-29 14:04:05 +08:00
|
|
|
|
id:buy_button
|
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
anchors.rightMargin: 10
|
|
|
|
|
|
anchors.top: price_tag.bottom
|
|
|
|
|
|
anchors.topMargin: 2
|
|
|
|
|
|
height: 26
|
|
|
|
|
|
text: "购买"
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
|
//我这里临时先写免费服务端插件的安装
|
|
|
|
|
|
buyPlugin();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle{
|
|
|
|
|
|
id:content
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
anchors.rightMargin: 15
|
|
|
|
|
|
anchors.top: title.bottom
|
|
|
|
|
|
anchors.topMargin: 10
|
|
|
|
|
|
anchors.bottom:parent.bottom
|
|
|
|
|
|
anchors.bottomMargin: 10
|
|
|
|
|
|
radius:8
|
2025-09-15 09:46:04 +08:00
|
|
|
|
border.color: HusTheme.isDark ? "#23272e" : "#f0f4f7"
|
2025-05-29 14:04:05 +08:00
|
|
|
|
border.width: 2
|
|
|
|
|
|
color:"transparent"
|
|
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
anchors.margins: 10
|
|
|
|
|
|
Column {
|
|
|
|
|
|
id: contentColumn
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
|
|
id:details
|
|
|
|
|
|
delegate: Column { // 直接使用 Column 作为根元素
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
|
|
switch(modelData.type) {
|
|
|
|
|
|
case "str": return textComponent;
|
|
|
|
|
|
case "img": return imageComponent;
|
|
|
|
|
|
case "mov": return videoComponent;
|
|
|
|
|
|
default: return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 动态绑定组件属性
|
|
|
|
|
|
property var itemData: modelData
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 定义组件映射
|
|
|
|
|
|
Component {
|
|
|
|
|
|
id: textComponent;
|
|
|
|
|
|
Text {
|
|
|
|
|
|
width: parent.width - 20
|
|
|
|
|
|
text: itemData.content
|
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
|
font {
|
|
|
|
|
|
pixelSize: 14
|
2025-09-15 09:46:04 +08:00
|
|
|
|
family: HusTheme.Primary.fontPrimaryFamily
|
2025-05-29 14:04:05 +08:00
|
|
|
|
}
|
2025-09-15 09:46:04 +08:00
|
|
|
|
color: HusTheme.Primary.colorTextBase
|
2025-05-29 14:04:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
|
id: imageComponent;
|
|
|
|
|
|
Image {
|
|
|
|
|
|
source: itemData.content
|
|
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
|
|
asynchronous: true
|
|
|
|
|
|
cache: true
|
|
|
|
|
|
// 动态计算宽度
|
|
|
|
|
|
width: Math.min(implicitWidth, parent.width)
|
|
|
|
|
|
// 让图像靠左边显示
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
// 确保父级有明确宽度传递
|
|
|
|
|
|
property real maxWidth: parent ? parent.width : 0
|
|
|
|
|
|
// 异步加载完成后更新尺寸
|
|
|
|
|
|
onStatusChanged: {
|
|
|
|
|
|
if (status === Image.Ready) {
|
|
|
|
|
|
width = Math.min(implicitWidth, maxWidth)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
|
id: videoComponent
|
|
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
|
id: videoContainer
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
height: 400
|
|
|
|
|
|
|
|
|
|
|
|
// 视频播放器
|
|
|
|
|
|
Video {
|
|
|
|
|
|
id: videoPlayer
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
anchors.bottomMargin: 15
|
|
|
|
|
|
source: itemData.content
|
|
|
|
|
|
loops: MediaPlayer.Infinite
|
|
|
|
|
|
autoPlay: false
|
|
|
|
|
|
|
|
|
|
|
|
// 错误处理
|
|
|
|
|
|
onErrorChanged: {
|
|
|
|
|
|
if (error !== MediaPlayer.NoError) {
|
|
|
|
|
|
GlobalVars.msg_control.error("播放错误:", errorString);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 播放控制按钮(可选)
|
|
|
|
|
|
Row {
|
|
|
|
|
|
anchors.top: videoPlayer.bottom
|
|
|
|
|
|
anchors.topMargin: 4
|
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
2025-09-15 09:46:04 +08:00
|
|
|
|
HusButton {
|
2025-05-29 14:04:05 +08:00
|
|
|
|
text: videoPlayer.playbackState === MediaPlayer.PlayingState ? "暂停" : "播放"
|
|
|
|
|
|
onClicked: videoPlayer.playbackState === MediaPlayer.PlayingState ? videoPlayer.pause() : videoPlayer.play()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 09:46:04 +08:00
|
|
|
|
HusButton {
|
2025-05-29 14:04:05 +08:00
|
|
|
|
text: "静音"
|
|
|
|
|
|
onClicked: videoPlayer.muted = !videoPlayer.muted
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DelButton {
|
|
|
|
|
|
text: "Open XLSX File"
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
|
var filePath = "./基础配置.xlsx"; // 请替换为实际的文件路径
|
|
|
|
|
|
QmlTool.openFile(filePath);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
}
|