Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions exporter/assets/images/export-success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions exporter/assets/images/export-waiting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
287 changes: 287 additions & 0 deletions exporter/assets/qml/CompositionListView.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
import QtQuick
import QtQuick.Controls
import Qt.labs.platform as Platform

ListView {
id: compositionTableView

property var parentWindow: null

clip: true
boundsBehavior: Flickable.StopAtBounds

ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
anchors.right: parent.right
anchors.rightMargin: 2

background: Rectangle {
color: "#00000000"
}

contentItem: Rectangle {
implicitWidth: 9
implicitHeight: 100
color: "#00000000"

Rectangle {
anchors.fill: parent
radius: 2
anchors.right: parent.right
anchors.rightMargin: 2
color: "#AA4B4B5A"
visible: compositionTableView.ScrollBar.vertical.size < 1.0
}
}
}

ScrollBar.horizontal: ScrollBar {
policy: ScrollBar.AsNeeded
anchors.bottom: parent.bottom
anchors.bottomMargin: 2

background: Rectangle {
color: "#00000000"
}

contentItem: Rectangle {
implicitWidth: 100
implicitHeight: 9
color: "#00000000"

Rectangle {
anchors.fill: parent
radius: 2
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
color: "#AA4B4B5A"
visible: compositionTableView.ScrollBar.horizontal.size < 1.0
}
}
}

delegate: Item {
required property var row

required property var index

required property string name

required property string savePath

required property bool isFolder

required property bool isSelected

required property bool isUnfold

required property int level

height: 35
implicitWidth: ListView.view.width

Rectangle {
anchors.fill: parent
color: (row % 2 === 0) ? "#22222B" : "#27272F"

Row {
anchors.fill: parent
spacing: 20
leftPadding: 20

Image {
id: selectedColumn
width: 20
height: 20
anchors.verticalCenter: parent.verticalCenter
visible: true
source: isFolder ? "" : (isSelected ? "qrc:/images/checkbox-on.png" : "qrc:/images/checkbox-off.png")

MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
Qt.callLater(function () {
model.setIsSelected(row, !isSelected);
});
}
}
}

Rectangle {
width: parent.width - parent.leftPadding - selectedColumn.width - savePathColumn.width - settingColumn.width - previewColumn.width - 4 * parent.spacing
height: parent.height
color: "transparent"

Image {
id: unfoldIcon
width: 8
height: 8
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: level * 20 - (isFolder ? 8 : 0)
visible: isFolder
source: isUnfold ? "qrc:/images/folder-unfold.png" : "qrc:/images/folder-fold.png"
}

Image {
id: icon
width: 20
height: 20
anchors.verticalCenter: parent.verticalCenter
anchors.left: unfoldIcon.right
anchors.leftMargin: isFolder ? 8 : 0
source: isFolder ? "qrc:/images/folder.png" : "qrc:/images/bmp.png"
}

Text {
id: nameText
text: name
font.pixelSize: 14
font.family: "PingFang SC"
elide: Text.ElideRight
anchors.left: icon.right
anchors.leftMargin: 8
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
color: "#FFFFFF"
}

MouseArea {
visible: isFolder
height: parent.height
anchors.left: parent.left
anchors.right: nameText.right
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: {
model.setIsUnfold(row, !isUnfold);
}
}
}

Rectangle {
id: savePathColumn
width: 300
height: parent.height
color: "transparent"

Text {
text: savePath
width: parent.width
font.pixelSize: 13
font.family: "PingFang SC"
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
color: "#8E96B3"

MouseArea {
enabled: !isFolder
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: {
openFolderDialog.row = row;
openFolderDialog.folder = pathToFileUrl(savePath);
openFolderDialog.open();
}
}
}
}

Rectangle {
id: settingColumn

property var subWindow: null

width: 72
anchors.top: parent.top
anchors.bottom: parent.bottom
color: "transparent"

Image {
width: 20
height: 20
anchors.centerIn: parent
visible: !isFolder
source: "qrc:/images/setting.png"

MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor

onClicked: {}
}
}
}

Rectangle {
id: previewColumn
width: 72
anchors.top: parent.top
anchors.bottom: parent.bottom
color: "transparent"

Image {
width: 20
height: 20
anchors.centerIn: parent
visible: !isFolder
source: "qrc:/images/preview.png"

MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: {
compositionsModel.prepareForPreview(row);
let component = Qt.createComponent("qrc:/qml/ExportCompositionProgress.qml");
if (component.status === Component.Ready) {
let progressWindow = component.createObject(parentWindow, {});
if (progressWindow) {
progressWindow.closing.connect(function () {
Qt.callLater(function () {
if (progressWindow && !progressWindow.destroyed) {
progressWindow.destroy();
}
});
parentWindow.show();
});
progressWindow.show();
parentWindow.hide();
}
}
compositionsModel.previewComposition(row);
}
}
}
}
}
}
}

Platform.FolderDialog {
id: openFolderDialog

property int row: -1

visible: false
title: qsTr("Select Save Path")
onAccepted: {
compositionTableView.model.setSavePath(row, openFolderDialog.folder);
}
}

function pathToFileUrl(path) {
let url = path;
if (url.startsWith("file://")) {
return url;
}
if (Qt.platform.os === "windows") {
return "file:///" + url.replace(/\\/g, "/");
} else {
return "file://" + url;
}
}
}
103 changes: 103 additions & 0 deletions exporter/assets/qml/ExportCompositionProgress.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import QtQuick
import QtQuick.Controls.Universal

PAGWindow {
id: window

property int windowWidth: 400

property int windowHeight: 128

property string displayTitle: qsTr("PAG Export Progress")

property string displayTip: qsTr("Exporting PAG")

title: displayTitle
width: windowWidth
height: windowHeight
minimumWidth: windowWidth
minimumHeight: windowHeight
maximumWidth: windowWidth
maximumHeight: windowHeight
visible: true
isWindows: true
canResize: false
canMaxSize: false
maxBtnVisible: false
minBtnVisible: false
resizeHandleSize: 5
titleBarHeight: 32
windowBackgroundColor: "#14141E"
titlebarBackgroundColor: "#14141E"
titleFontSize: 14

Rectangle {
id: progressContainer
radius: 2
anchors.fill: parent
color: "transparent"

ProgressBar {
id: progressBar
anchors.top: parent.top
anchors.topMargin: 27
anchors.left: parent.left
anchors.leftMargin: 12
anchors.right: parent.right
anchors.rightMargin: 12
to: progressModel ? progressModel.totalProgress : 1.0
value: progressModel ? progressModel.currentProgress : 0.0
height: 8

background: Rectangle {
visible: progressBar.visualPosition < 1.0
color: "#2B2B33"
border.width: 0
radius: progressBar.height / 2
implicitWidth: progressBar.width
implicitHeight: progressBar.height
}

contentItem: Item {
Rectangle {
visible: progressBar.visualPosition !== 0
width: progressBar.visualPosition * progressBar.width
height: progressBar.height
radius: progressBar.height / 2
color: "#4082E4"
}
}
}

Text {
id: tipText
text: window.displayTip
font.pixelSize: 14
font.family: "PingFang SC"
font.bold: true
color: "#FFFFFF"
renderType: Text.NativeRendering
anchors.top: progressBar.bottom
anchors.topMargin: 16
anchors.horizontalCenter: parent.horizontalCenter
}
}

onClosing: function (closeEvent) {
closeEvent.accepted = true;
if (exportWindow !== null) {
exportWindow.onWindowClosing();
}
}

Connections {
target: progressModel || null
function onExportFinished() {
window.close();
}

function onExportFailed() {
window.close();
}
}
}
Loading
Loading