1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add QmlProject to qml wallpaper

This commit is contained in:
Elias Steurer 2023-01-05 14:36:56 +01:00
parent 04c86508ef
commit cc4cda5aa0
5 changed files with 41 additions and 2 deletions

View File

@ -218,6 +218,7 @@ set(RESOURCES
assets/startinfo/vscode.png
assets/wizards/example_html.png
assets/wizards/example_qml.png
assets/wizards/QmlProject.qmlproject
assets/wizards/License_All_Rights_Reserved_1.0.txt
assets/wizards/License_Apache_2.0.txt
assets/wizards/License_CC0_1.0.txt

View File

@ -0,0 +1,19 @@
import QmlProject 1.1
Project {
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "asset_imports" ]
}

View File

@ -1,12 +1,19 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Particles
import QtQuick.Controls.Material
Rectangle {
id: root
color: "#333333"
// This is the default testing size of the wallpaper
implicitWidth: 1366
implicitHeight: 768
Text {
id: name
text: qsTr("My Wallpaper 🚀")
text: qsTr("My ScreenPlay Wallpaper 🚀")
anchors.centerIn: parent
color: "white"
}

View File

@ -384,7 +384,12 @@ bool Util::writeFileFromQrc(const QString& qrcPath, const QString& absolutePath)
QFile qrc(qrcPath);
qrc.open(QIODevice::ReadOnly);
out << qrc.readAll();
QTextStream in(&qrc);
// Read line by line to avoid CLRF/LF issues
while (!in.atEnd()) {
out << in.readLine() << "\n";
}
qrc.close();
file.close();

View File

@ -268,6 +268,13 @@ void Wizards::createQMLWallpaper(
return;
}
const QString qmlproject = workingPath + "/" + title + ".qmlproject";
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/assets/wizards/" + QString("QmlProject.qmlproject"), qmlproject)) {
qWarning() << "Could not write " << qmlproject;
emit widgetCreationFinished(WizardResult::WriteLicenseFileError);
return;
}
if (!Util::writeSettings(obj, workingPath + "/project.json")) {
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
return;