mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-26 04:33:06 +01:00
Make all wizards consitent
Use same parameters and functions to copy files and create folder
This commit is contained in:
parent
6d65791976
commit
6939ee2b92
@ -23,8 +23,10 @@ WizardPage {
|
||||
|
||||
function create() {
|
||||
ScreenPlay.wizards.createHTMLWallpaper(tfTitle.text,
|
||||
cbLicense.name,
|
||||
cbLicense.licenseFile,
|
||||
previewSelector.imageSource,
|
||||
cbLicense.currentText,
|
||||
tfCreatedBy.text,
|
||||
tagSelector.getTags())
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,10 @@ WizardPage {
|
||||
|
||||
function create() {
|
||||
ScreenPlay.wizards.createHTMLWidget(tfTitle.text,
|
||||
cbLicense.name,
|
||||
cbLicense.licenseFile,
|
||||
previewSelector.imageSource,
|
||||
tfCreatedBy.text,
|
||||
cbLicense.currentText,
|
||||
tagSelector.getTags())
|
||||
}
|
||||
|
||||
@ -57,7 +58,7 @@ WizardPage {
|
||||
}
|
||||
|
||||
Common.ImageSelector {
|
||||
id: imageSelector
|
||||
id: previewSelector
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
@ -77,13 +78,7 @@ WizardPage {
|
||||
Layout.fillWidth: true
|
||||
required: true
|
||||
placeholderText: qsTr("Widget name")
|
||||
onTextChanged: {
|
||||
if (text.length >= 3) {
|
||||
btnSave.enabled = true
|
||||
} else {
|
||||
btnSave.enabled = false
|
||||
}
|
||||
}
|
||||
onTextChanged: root.ready = text.length >= 1
|
||||
}
|
||||
Common.TextField {
|
||||
id: tfCreatedBy
|
||||
|
@ -22,9 +22,12 @@ WizardPage {
|
||||
}
|
||||
|
||||
function create() {
|
||||
ScreenPlay.wizards.createQMLWallpaper(
|
||||
tfTitle.text, previewSelector.imageSource,
|
||||
cbLicense.currentText, tagSelector.getTags())
|
||||
ScreenPlay.wizards.createQMLWallpaper(tfTitle.text,
|
||||
cbLicense.name,
|
||||
cbLicense.licenseFile,
|
||||
previewSelector.imageSource,
|
||||
tfCreatedBy.text,
|
||||
tagSelector.getTags())
|
||||
}
|
||||
|
||||
Common.Headline {
|
||||
|
@ -13,10 +13,10 @@ WizardPage {
|
||||
sourceComponent: ColumnLayout {
|
||||
|
||||
function create() {
|
||||
ScreenPlay.wizards.createQMLWidget(tfTitle.text,
|
||||
ScreenPlay.wizards.createQMLWidget(tfTitle.text, cbLicense.name,
|
||||
cbLicense.licenseFile,
|
||||
previewSelector.imageSource,
|
||||
tfCreatedBy.text,
|
||||
cbLicense.currentText,
|
||||
tagSelector.getTags())
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ WizardPage {
|
||||
}
|
||||
|
||||
Common.ImageSelector {
|
||||
id: imageSelector
|
||||
id: previewSelector
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
@ -77,13 +77,7 @@ WizardPage {
|
||||
Layout.fillWidth: true
|
||||
required: true
|
||||
placeholderText: qsTr("Widget name")
|
||||
onTextChanged: {
|
||||
if (text.length >= 3) {
|
||||
btnSave.enabled = true
|
||||
} else {
|
||||
btnSave.enabled = false
|
||||
}
|
||||
}
|
||||
onTextChanged: root.ready = text.length >= 1
|
||||
}
|
||||
Common.TextField {
|
||||
id: tfCreatedBy
|
||||
|
@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +1,5 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.14
|
||||
|
||||
Item {
|
||||
|
||||
id: root
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.14
|
||||
|
||||
Item {
|
||||
|
||||
id: root
|
||||
}
|
||||
|
@ -24,214 +24,10 @@ Wizards::Wizards(const std::shared_ptr<GlobalVariables>& globalVariables, QObjec
|
||||
*/
|
||||
void Wizards::createQMLWidget(
|
||||
const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& previewThumbnail,
|
||||
const QString& createdBy,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
QUrl localStoragePathUrl { m_globalVariables->localStoragePath() };
|
||||
QDir dir;
|
||||
dir.cd(localStoragePathUrl.toLocalFile());
|
||||
// Create a temp dir so we can later alter it to the workshop id
|
||||
auto folderName = QString("_tmp_" + QTime::currentTime().toString()).replace(":", "");
|
||||
QString workingPath = dir.path() + "/" + folderName;
|
||||
|
||||
if (!dir.mkdir(folderName)) {
|
||||
qDebug() << "Could create folder: " << folderName;
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", license);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("type", "qmlWidget");
|
||||
obj.insert("file", "main.qml");
|
||||
|
||||
QFile fileMainQML(workingPath + "/main.qml");
|
||||
if (!fileMainQML.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Could not open /main.qml";
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream outMainQML(&fileMainQML);
|
||||
outMainQML.setCodec("UTF-8");
|
||||
outMainQML << "import QtQuick 2.14 \n\n Item {\n id:root \n}";
|
||||
fileMainQML.close();
|
||||
|
||||
QFile file(workingPath + "/project.json");
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Could not open /project.json";
|
||||
return;
|
||||
}
|
||||
|
||||
QUrl previewThumbnailUrl { previewThumbnail };
|
||||
QFileInfo previewImageFile(previewThumbnailUrl.toLocalFile());
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
obj.insert("previewThumbnail", previewImageFile.fileName());
|
||||
obj.insert("preview", previewImageFile.fileName());
|
||||
if (!QFile::copy(previewThumbnailUrl.toLocalFile(), workingPath + "/" + previewImageFile.fileName())) {
|
||||
qDebug() << "Could not copy" << previewThumbnailUrl.toLocalFile() << " to " << workingPath + "/" + previewImageFile.fileName();
|
||||
emit widgetCreationFinished(WizardResult::CopyError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QTextStream out(&file);
|
||||
out.setCodec("UTF-8");
|
||||
QJsonDocument doc(obj);
|
||||
out << doc.toJson();
|
||||
file.close();
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Creates a new widget.
|
||||
*/
|
||||
void Wizards::createHTMLWidget(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& createdBy,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
QUrl localStoragePathUrl { m_globalVariables->localStoragePath() };
|
||||
QDir dir;
|
||||
dir.cd(localStoragePathUrl.toLocalFile());
|
||||
// Create a temp dir so we can later alter it to the workshop id
|
||||
auto folderName = QString("_tmp_" + QTime::currentTime().toString()).replace(":", "");
|
||||
QString workingPath = dir.path() + "/" + folderName;
|
||||
|
||||
if (!dir.mkdir(folderName)) {
|
||||
qDebug() << "Could create folder: " << folderName;
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", license);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("type", "htmlWidget");
|
||||
obj.insert("file", "index.html");
|
||||
|
||||
QFile fileMainHTML(workingPath + "/index.html");
|
||||
if (!fileMainHTML.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Could not open /index.html";
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream outMainHTML(&fileMainHTML);
|
||||
outMainHTML.setCodec("UTF-8");
|
||||
outMainHTML << "<html>\n<head></head>\n<body></body>\n</html>";
|
||||
fileMainHTML.close();
|
||||
|
||||
QFile file(workingPath + "/project.json");
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Could not open /project.json";
|
||||
return;
|
||||
}
|
||||
|
||||
QUrl previewThumbnailUrl { previewThumbnail };
|
||||
QFileInfo previewImageFile(previewThumbnailUrl.toLocalFile());
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
obj.insert("previewThumbnail", previewImageFile.fileName());
|
||||
obj.insert("preview", previewImageFile.fileName());
|
||||
if (!QFile::copy(previewThumbnailUrl.toLocalFile(), workingPath + "/" + previewImageFile.fileName())) {
|
||||
qDebug() << "Could not copy" << previewThumbnailUrl.toLocalFile() << " to " << workingPath + "/" + previewImageFile.fileName();
|
||||
emit widgetCreationFinished(WizardResult::CopyError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QTextStream out(&file);
|
||||
out.setCodec("UTF-8");
|
||||
QJsonDocument doc(obj);
|
||||
out << doc.toJson();
|
||||
file.close();
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Creates a HTML wallpaper.
|
||||
*/
|
||||
void Wizards::createHTMLWallpaper(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
QUrl localStoragePathUrl { m_globalVariables->localStoragePath() };
|
||||
QDir dir;
|
||||
dir.cd(localStoragePathUrl.toLocalFile());
|
||||
// Create a temp dir so we can later alter it to the workshop id
|
||||
auto folderName = QString("_tmp_" + QTime::currentTime().toString()).replace(":", "");
|
||||
QString workingPath = dir.path() + "/" + folderName;
|
||||
|
||||
if (!dir.mkdir(folderName)) {
|
||||
qDebug() << "Could create folder: " << folderName;
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", license);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("type", "htmlWallpaper");
|
||||
obj.insert("file", "index.html");
|
||||
|
||||
QFile fileMainHTML(workingPath + "/index.html");
|
||||
if (!fileMainHTML.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "Could not open /index.html";
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream outMainHTML(&fileMainHTML);
|
||||
outMainHTML.setCodec("UTF-8");
|
||||
outMainHTML << "<html>\n<head></head>\n"
|
||||
"<h1>This is an empty html Wallpaper!</h1>"
|
||||
"<body></body>\n</html>";
|
||||
fileMainHTML.close();
|
||||
|
||||
QUrl previewThumbnailUrl { previewThumbnail };
|
||||
QFileInfo previewImageFile(previewThumbnailUrl.toLocalFile());
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
obj.insert("previewThumbnail", previewImageFile.fileName());
|
||||
obj.insert("preview", previewImageFile.fileName());
|
||||
if (!QFile::copy(previewThumbnailUrl.toLocalFile(), workingPath + "/" + previewImageFile.fileName())) {
|
||||
qDebug() << "Could not copy" << previewThumbnailUrl.toLocalFile() << " to " << workingPath + "/" + previewImageFile.fileName();
|
||||
emit widgetCreationFinished(WizardResult::CopyPreviewThumbnailError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Util::writeSettings(obj, dir.path() + "/project.json")) {
|
||||
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
*/
|
||||
void Wizards::createQMLWallpaper(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
@ -245,9 +41,197 @@ void Wizards::createQMLWallpaper(
|
||||
const QString workingPath = Util::toLocal(m_globalVariables->localStoragePath().toString() + "/" + folderName.value());
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", license);
|
||||
obj.insert("license", licenseName);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("type", "qmlWidget");
|
||||
obj.insert("file", "main.qml");
|
||||
|
||||
if (!Util::writeFileFromQrc(":/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
qWarning() << "Could not write " << licenseFile;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/Create/WizardsFiles/QMLWidgetMain.qml", workingPath + "main.qml")) {
|
||||
qWarning() << "Could not write main.qml";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
QUrl previewThumbnailUrl { previewThumbnail };
|
||||
QFileInfo previewImageFile(previewThumbnailUrl.toLocalFile());
|
||||
obj.insert("previewThumbnail", previewImageFile.fileName());
|
||||
obj.insert("preview", previewImageFile.fileName());
|
||||
if (!QFile::copy(previewThumbnailUrl.toLocalFile(), workingPath + "/" + previewImageFile.fileName())) {
|
||||
qWarning() << "Could not copy" << previewThumbnailUrl.toLocalFile() << " to " << workingPath + "/" + previewImageFile.fileName();
|
||||
emit widgetCreationFinished(WizardResult::CopyError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Util::writeSettings(obj, workingPath + "/project.json")) {
|
||||
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Creates a new widget.
|
||||
*/
|
||||
void Wizards::createHTMLWidget(
|
||||
const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& previewThumbnail,
|
||||
const QString& createdBy,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
std::optional<QString> folderName = createTemporaryFolder();
|
||||
|
||||
if (!folderName.has_value()) {
|
||||
emit widgetCreationFinished(WizardResult::CreateProjectFolderError);
|
||||
return;
|
||||
}
|
||||
|
||||
const QString workingPath = Util::toLocal(m_globalVariables->localStoragePath().toString() + "/" + folderName.value());
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", licenseName);
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("type", "htmlWidget");
|
||||
obj.insert("file", "index.html");
|
||||
|
||||
if (!Util::writeFileFromQrc(":/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
qWarning() << "Could not write " << licenseFile;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/Create/WizardsFiles/HTMLWidgetMain.html", workingPath + "/index.html")) {
|
||||
qWarning() << "Could not write HTMLWidgetMain.html";
|
||||
return;
|
||||
}
|
||||
|
||||
QUrl previewThumbnailUrl { previewThumbnail };
|
||||
QFileInfo previewImageFile(previewThumbnailUrl.toLocalFile());
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
obj.insert("previewThumbnail", previewImageFile.fileName());
|
||||
obj.insert("preview", previewImageFile.fileName());
|
||||
if (!QFile::copy(previewThumbnailUrl.toLocalFile(), workingPath + "/" + previewImageFile.fileName())) {
|
||||
qWarning() << "Could not copy" << previewThumbnailUrl.toLocalFile() << " to " << workingPath + "/" + previewImageFile.fileName();
|
||||
emit widgetCreationFinished(WizardResult::CopyError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QFile file(workingPath + "/project.json");
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qWarning() << "Could not open /project.json";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Util::writeSettings(obj, workingPath + "/project.json")) {
|
||||
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Creates a HTML wallpaper.
|
||||
*/
|
||||
void Wizards::createHTMLWallpaper(
|
||||
const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& createdBy,
|
||||
const QString& previewThumbnail,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
std::optional<QString> folderName = createTemporaryFolder();
|
||||
|
||||
if (!folderName.has_value()) {
|
||||
emit widgetCreationFinished(WizardResult::CreateProjectFolderError);
|
||||
return;
|
||||
}
|
||||
|
||||
const QString workingPath = Util::toLocal(m_globalVariables->localStoragePath().toString() + "/" + folderName.value());
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", licenseName);
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("type", "htmlWallpaper");
|
||||
obj.insert("file", "index.html");
|
||||
|
||||
if (!Util::writeFileFromQrc(":/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
qWarning() << "Could not write " << licenseFile;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/Create/WizardsFiles/HTMLWallpaperMain.html", workingPath + "/index.html")) {
|
||||
qWarning() << "Could not write HTMLWallpaperMain.html";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
QUrl previewThumbnailUrl { previewThumbnail };
|
||||
QFileInfo previewImageFile(previewThumbnailUrl.toLocalFile());
|
||||
obj.insert("previewThumbnail", previewImageFile.fileName());
|
||||
obj.insert("preview", previewImageFile.fileName());
|
||||
if (!QFile::copy(previewThumbnailUrl.toLocalFile(), workingPath + "/" + previewImageFile.fileName())) {
|
||||
qWarning() << "Could not copy" << previewThumbnailUrl.toLocalFile() << " to " << workingPath + "/" + previewImageFile.fileName();
|
||||
emit widgetCreationFinished(WizardResult::CopyPreviewThumbnailError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Util::writeSettings(obj, workingPath + "/project.json")) {
|
||||
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief .
|
||||
*/
|
||||
void Wizards::createQMLWallpaper(
|
||||
const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& createdBy,
|
||||
const QString& previewThumbnail,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
std::optional<QString> folderName = createTemporaryFolder();
|
||||
|
||||
if (!folderName.has_value()) {
|
||||
emit widgetCreationFinished(WizardResult::CreateProjectFolderError);
|
||||
return;
|
||||
}
|
||||
|
||||
const QString workingPath = Util::toLocal(m_globalVariables->localStoragePath().toString() + "/" + folderName.value());
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", licenseName);
|
||||
obj.insert("title", title);
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("type", "qmlWallpaper");
|
||||
obj.insert("file", "main.qml");
|
||||
|
||||
@ -259,13 +243,18 @@ void Wizards::createQMLWallpaper(
|
||||
}
|
||||
}
|
||||
|
||||
if (!Util::writeFileFromQrc(":/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
qWarning() << "Could not write " << licenseFile;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Util::writeSettings(obj, workingPath + "/project.json")) {
|
||||
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Util::writeFile("import QtQuick 2.14 \n\nItem {\n id:root \n}", workingPath + "/main.qml")) {
|
||||
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
|
||||
if (!Util::writeFileFromQrc(":/qml/Create/WizardsFiles/QMLWallpaperMain.qml", workingPath + "/main.qml")) {
|
||||
qWarning() << "Could not write main.qml";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -327,7 +316,6 @@ void Wizards::createGifWallpaper(
|
||||
void Wizards::createWebsiteWallpaper(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QUrl& url,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
@ -342,11 +330,10 @@ void Wizards::createWebsiteWallpaper(
|
||||
const QString workingPath = Util::toLocal(m_globalVariables->localStoragePath().toString() + "/" + folderName.value());
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", license);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("type", "qmlWallpaper");
|
||||
obj.insert("file", "main.qml");
|
||||
obj.insert("type", "websiteWallpaper");
|
||||
obj.insert("source", url.toString());
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
QUrl previewThumbnailUrl { previewThumbnail };
|
||||
@ -361,11 +348,6 @@ void Wizards::createWebsiteWallpaper(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Util::writeFile("import QtQuick 2.14 \n\nItem {\n id:root \n}", workingPath + "/main.qml")) {
|
||||
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
|
@ -84,28 +84,32 @@ public:
|
||||
public slots:
|
||||
void createQMLWidget(
|
||||
const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& previewThumbnail,
|
||||
const QString& createdBy,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags);
|
||||
|
||||
void createHTMLWidget(
|
||||
const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& previewThumbnail,
|
||||
const QString& createdBy,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags);
|
||||
|
||||
void createHTMLWallpaper(
|
||||
const QString& title,
|
||||
void createHTMLWallpaper(const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& createdBy,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags);
|
||||
|
||||
void createQMLWallpaper(
|
||||
const QString& title,
|
||||
void createQMLWallpaper(const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& createdBy,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags);
|
||||
|
||||
void createGifWallpaper(
|
||||
@ -119,7 +123,6 @@ public slots:
|
||||
void createWebsiteWallpaper(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QUrl& url,
|
||||
const QVector<QString>& tags);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user