mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-15 06:52:34 +02:00
Fix gif wallpaper creation
This commit is contained in:
parent
cf40637d46
commit
a414a8ebeb
@ -32,42 +32,42 @@ ColumnLayout {
|
||||
name: "Create Commons - Attribution-ShareAlike 4.0"
|
||||
description: qsTr("Share — copy and redistribute the material in any medium or format. Adapt — remix, transform, and build upon the material for any purpose, even commercially.")
|
||||
tldrlegal: "https://tldrlegal.com/license/creative-commons-attribution-sharealike-4.0-international-(cc-by-sa-4.0)"
|
||||
licenseFile: ":/assets/wizards/License_CC_Attribution-ShareAlike_4.0.txt"
|
||||
licenseFile: "License_CC_Attribution-ShareAlike_4.0.txt"
|
||||
}
|
||||
ListElement {
|
||||
name: "Create Commons - Attribution 4.0"
|
||||
description: qsTr("You grant other to remix your work and change the license to their linking.")
|
||||
tldrlegal: "https://tldrlegal.com/license/creative-commons-attribution-4.0-international-(cc-by-4)"
|
||||
licenseFile: ":/assets/wizards/License_CC_Attribution_4.0.txt"
|
||||
licenseFile: "License_CC_Attribution_4.0.txt"
|
||||
}
|
||||
ListElement {
|
||||
name: "Create Commons - Attribution-NonCommercial-ShareAlike 4.0"
|
||||
description: qsTr("Share — copy and redistribute the material in any medium or format. Adapt — remix, transform, and build upon the material. You are not allowed to use it commercially! ")
|
||||
tldrlegal: "https://tldrlegal.com/license/creative-commons-attribution-noncommercial-sharealike-4.0-international-(cc-by-nc-sa-4.0)"
|
||||
licenseFile: ":/assets/wizards/License_CC_Attribution-NonCommercial-ShareAlike_4.0.txt"
|
||||
licenseFile: "License_CC_Attribution-NonCommercial-ShareAlike_4.0.txt"
|
||||
}
|
||||
ListElement {
|
||||
name: "Create Commons - CC0 1.0 Universal Public Domain"
|
||||
description: qsTr("You allow everyone do do anything with your work.")
|
||||
tldrlegal: "https://tldrlegal.com/license/creative-commons-cc0-1.0-universal"
|
||||
licenseFile: ":/assets/wizards/License_CC0_1.0.txt"
|
||||
licenseFile: "License_CC0_1.0.txt"
|
||||
}
|
||||
ListElement {
|
||||
name: "Open Source - Apache License 2.0"
|
||||
description: qsTr("You grant other to remix your work and change the license to their linking.")
|
||||
tldrlegal: "https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)"
|
||||
licenseFile: ":/assets/wizards/License_Apache_2.0.txt"
|
||||
licenseFile: "License_Apache_2.0.txt"
|
||||
}
|
||||
ListElement {
|
||||
name: "Open Source - General Public License 3.0"
|
||||
description: qsTr("You grant other to remix your work but it must remain under the GPLv3. We recommend this license for all code wallpaper!")
|
||||
tldrlegal: "https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)"
|
||||
licenseFile: ":/assets/wizards/License_GPL_3.0.txt"
|
||||
licenseFile: "License_GPL_3.0.txt"
|
||||
}
|
||||
ListElement {
|
||||
name: "All rights reserved"
|
||||
description: qsTr("You do not share any rights and nobody is allowed to use remix it (Not recommended). Can also used to credit work others.")
|
||||
tldrlegal: ":/assets/wizards/License_All_Rights_Reserved_1.0.txt"
|
||||
tldrlegal: "License_All_Rights_Reserved_1.0.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls.Material 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
import ScreenPlay 1.0
|
||||
|
||||
import "../../Common" as Common
|
||||
@ -12,9 +13,10 @@ WizardPage {
|
||||
sourceComponent: ColumnLayout {
|
||||
|
||||
function create() {
|
||||
ScreenPlay.wizards.createGifWallpaper(tfTitle.text,
|
||||
cbLicense.currentText,
|
||||
ScreenPlay.wizards.createGifWallpaper(tfTitle.text, cbLicense.name,
|
||||
cbLicense.licenseFile,
|
||||
tfCreatedBy.text,
|
||||
fileSelector.file,
|
||||
tagSelector.getTags())
|
||||
}
|
||||
|
||||
@ -95,7 +97,7 @@ WizardPage {
|
||||
}
|
||||
|
||||
Common.TextField {
|
||||
id: tfLicense
|
||||
id: tfCreatedBy
|
||||
Layout.fillWidth: true
|
||||
placeholderText: qsTr("Created By")
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ Item {
|
||||
case InstalledType.QMLWallpaper:
|
||||
case InstalledType.HTMLWallpaper:
|
||||
case InstalledType.GodotWallpaper:
|
||||
case InstalledType.GifWallpaper:
|
||||
case InstalledType.WebsiteWallpaper:
|
||||
icnType.source = "qrc:/assets/icons/icon_widgets.svg"
|
||||
return
|
||||
case InstalledType.QMLWidget:
|
||||
|
@ -22,7 +22,12 @@ Wizards::Wizards(const std::shared_ptr<GlobalVariables>& globalVariables, QObjec
|
||||
/*!
|
||||
\brief Creates a new widget.
|
||||
*/
|
||||
void Wizards::createQMLWidget(const QString& title, const QString& previewThumbnail, const QString& createdBy, const QString& license, const QVector<QString>& tags)
|
||||
void Wizards::createQMLWidget(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& createdBy,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
QUrl localStoragePathUrl { m_globalVariables->localStoragePath() };
|
||||
@ -88,7 +93,12 @@ void Wizards::createQMLWidget(const QString& title, const QString& previewThumbn
|
||||
/*!
|
||||
\brief Creates a new widget.
|
||||
*/
|
||||
void Wizards::createHTMLWidget(const QString& title, const QString& previewThumbnail, const QString& createdBy, const QString& license, const QVector<QString>& tags)
|
||||
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() };
|
||||
@ -154,7 +164,8 @@ void Wizards::createHTMLWidget(const QString& title, const QString& previewThumb
|
||||
/*!
|
||||
\brief Creates a HTML wallpaper.
|
||||
*/
|
||||
void Wizards::createHTMLWallpaper(const QString& title,
|
||||
void Wizards::createHTMLWallpaper(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags)
|
||||
@ -217,7 +228,11 @@ void Wizards::createHTMLWallpaper(const QString& title,
|
||||
/*!
|
||||
\brief .
|
||||
*/
|
||||
void Wizards::createQMLWallpaper(const QString& title, const QString& previewThumbnail, const QString& license, const QVector<QString>& tags)
|
||||
void Wizards::createQMLWallpaper(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
std::optional<QString> folderName = createTemporaryFolder();
|
||||
@ -258,7 +273,13 @@ void Wizards::createQMLWallpaper(const QString& title, const QString& previewThu
|
||||
});
|
||||
}
|
||||
|
||||
void Wizards::createGifWallpaper(const QString& title, const QString& license, const QString& creator, const QString& file, const QVector<QString>& tags)
|
||||
void Wizards::createGifWallpaper(
|
||||
const QString& title,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& creator,
|
||||
const QString& file,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
std::optional<QString> folderName = createTemporaryFolder();
|
||||
@ -269,17 +290,19 @@ void Wizards::createGifWallpaper(const QString& title, const QString& license, c
|
||||
}
|
||||
|
||||
const QString workingPath = Util::toLocal(m_globalVariables->localStoragePath().toString() + "/" + folderName.value());
|
||||
const QString gifFileName = QFileInfo(Util::toLocal(file)).fileName();
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("license", license);
|
||||
obj.insert("license", licenseName);
|
||||
obj.insert("creator", creator);
|
||||
obj.insert("title", title);
|
||||
obj.insert("file", gifFileName);
|
||||
obj.insert("previewGIF", gifFileName);
|
||||
obj.insert("tags", Util::fillArray(tags));
|
||||
obj.insert("type", "gifWallpaper");
|
||||
obj.insert("file", "main.qml");
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/Create/WizardsFiles/GifWallpaperMain.qml", workingPath + "/main.qml")) {
|
||||
qDebug() << "Could not write GifWallpaperMain.qml";
|
||||
if (!Util::writeFileFromQrc(":/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
qWarning() << "Could not write " << licenseFile;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -288,6 +311,12 @@ void Wizards::createGifWallpaper(const QString& title, const QString& license, c
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QFile::copy(Util::toLocal(file), workingPath + "/" + gifFileName)) {
|
||||
qWarning() << "Could not copy gif " << file << " to: " << workingPath + "/" + gifFileName;
|
||||
emit widgetCreationFinished(WizardResult::CopyFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
emit widgetCreationFinished(WizardResult::Ok, workingPath);
|
||||
});
|
||||
}
|
||||
@ -295,7 +324,12 @@ void Wizards::createGifWallpaper(const QString& title, const QString& license, c
|
||||
/*!
|
||||
\brief .
|
||||
*/
|
||||
void Wizards::createWebsiteWallpaper(const QString& title, const QString& previewThumbnail, const QString& license, const QUrl& url, const QVector<QString>& tags)
|
||||
void Wizards::createWebsiteWallpaper(
|
||||
const QString& title,
|
||||
const QString& previewThumbnail,
|
||||
const QString& license,
|
||||
const QUrl& url,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
std::optional<QString> folderName = createTemporaryFolder();
|
||||
|
@ -77,6 +77,7 @@ public:
|
||||
WriteProjectFileError,
|
||||
CreateProjectFolderError,
|
||||
CopyPreviewThumbnailError,
|
||||
CopyFileError,
|
||||
};
|
||||
Q_ENUM(WizardResult)
|
||||
|
||||
@ -109,7 +110,8 @@ public slots:
|
||||
|
||||
void createGifWallpaper(
|
||||
const QString& title,
|
||||
const QString& license,
|
||||
const QString& licenseName,
|
||||
const QString& licenseFile,
|
||||
const QString& creator,
|
||||
const QString& file,
|
||||
const QVector<QString>& tags);
|
||||
|
Loading…
Reference in New Issue
Block a user