1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00
This commit is contained in:
kelteseth 2018-10-14 17:22:28 +02:00
parent ba4e9d2607
commit 7c7b614d2a
2 changed files with 31 additions and 13 deletions

View File

@ -49,26 +49,24 @@ bool Create::copyRecursively(const QString& srcFilePath, const QString& tgtFileP
void Create::createWallpaperStart(QString videoPath)
{
videoPath.remove("file:///");
QtConcurrent::run([=]() {
QDir dir;
dir.cd(m_settings->localStoragePath().toString());
dir.cd(this->m_settings->localStoragePath().toString());
CreateWallpaperData createWallpaperData;
createWallpaperData.videoPath = videoPath;
// Create a temp dir so we can later alter it to the workshop id
createWallpaperData.exportPath = QString(dir.path() + "/" + "_tmp_" + QTime::currentTime().toString()).replace(":", "");
auto folderName = QString( "_tmp_" + QTime::currentTime().toString()).replace(":", "");
if (dir.mkdir(createWallpaperData.exportPath)) {
// TODO
} else {
if (!dir.mkdir(folderName))
return;
}
createWallpaperData.exportPath = dir.path() + "/" + folderName;
m_workingDir = createWallpaperData.exportPath;
// If we return early/false this means the creation
// process did not work
@ -205,10 +203,10 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideoFinished);
/*
*
* Create gif
*
*/
*
* Create gif
*
*/
emit createWallpaperStateChanged(Create::State::ConvertingPreviewGif);
args.clear();
@ -239,7 +237,7 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
bool Create::createWallpaperVideo(CreateWallpaperData& createWallpaperData)
{
return true;
return true;
}
bool Create::createWallpaperProjectFile(CreateWallpaperData& createWallpaperData)

View File

@ -34,6 +34,9 @@ class Create : public QObject {
Q_OBJECT
public:
explicit Create(Settings* st, QMLUtilities* util, QObject* parent = nullptr);
Q_PROPERTY(QString workingDir READ workingDir WRITE setWorkingDir NOTIFY workingDirChanged)
Create() {}
~Create() {}
@ -58,11 +61,18 @@ public:
Q_ENUM(State)
QString workingDir() const
{
return m_workingDir;
}
signals:
void createWallpaperStateChanged(Create::State state);
void processOutput(QString text);
void workingDirChanged(QString workingDir);
public slots:
void copyProject(QString relativeProjectPath, QString toPath);
bool copyRecursively(const QString& srcFilePath, const QString& tgtFilePath);
@ -75,8 +85,18 @@ public slots:
bool createWallpaperVideo(CreateWallpaperData& createWallpaperData);
bool createWallpaperProjectFile(CreateWallpaperData& createWallpaperData);
void setWorkingDir(QString workingDir)
{
if (m_workingDir == workingDir)
return;
m_workingDir = workingDir;
emit workingDirChanged(m_workingDir);
}
private:
Settings* m_settings;
QMLUtilities* m_utils;
QString m_workingDir;
};