mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-03 00:59:47 +02:00
Add create of empty widgets
This commit is contained in:
parent
a5af50b31c
commit
3b4494c485
9
.gitmodules
vendored
9
.gitmodules
vendored
@ -1,6 +1,3 @@
|
||||
[submodule "QtAV"]
|
||||
path = ScreenPlay/ThirdParty/QtAV
|
||||
url = https://github.com/wang-bin/QtAV.git
|
||||
[submodule "stomt-qt-sdk"]
|
||||
path = ScreenPlay/ThirdParty/stomt-qt-sdk
|
||||
url = https://github.com/Aimber/stomt-qt-sdk.git
|
||||
[submodule "ScreenPlay/examples"]
|
||||
path = ScreenPlay/examples
|
||||
url = https://github.com/Aimber/ScreenPlay-examples.git
|
||||
|
@ -21,7 +21,8 @@ SOURCES += main.cpp \
|
||||
src/projectsettingslistmodel.cpp \
|
||||
src/startuperror.cpp \
|
||||
src/screenplay.cpp \
|
||||
src/qmlutilities.cpp
|
||||
src/qmlutilities.cpp \
|
||||
src/create.cpp
|
||||
|
||||
RESOURCES += \
|
||||
Resources.qrc \
|
||||
@ -44,7 +45,8 @@ HEADERS += \
|
||||
src/projectsettingslistmodel.h \
|
||||
src/startuperror.h \
|
||||
src/screenplay.h \
|
||||
src/qmlutilities.h
|
||||
src/qmlutilities.h \
|
||||
src/create.h
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/ThirdParty/ \
|
||||
|
1
ScreenPlay/examples
Submodule
1
ScreenPlay/examples
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 66091ad14daa9122d0357fc7a98f29139f526fc6
|
@ -264,7 +264,7 @@ Rectangle {
|
||||
spacing: 20
|
||||
Button {
|
||||
text: qsTr("QML Quickstart Guide")
|
||||
Material.background: Material.Blue
|
||||
Material.background: Material.Orange
|
||||
Material.foreground: "white"
|
||||
icon.source: "qrc:/assets/icons/icon_info.svg"
|
||||
icon.color:"white"
|
||||
@ -280,25 +280,29 @@ Rectangle {
|
||||
icon.color:"white"
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
|
||||
onClicked: Qt.openUrlExternally("https://qmlbook.github.io/index.html")
|
||||
}
|
||||
// Button {
|
||||
// text: qsTr("Lore Ipsum")
|
||||
// Material.background: Material.Orange
|
||||
// Material.foreground: "white"
|
||||
// icon.source: "qrc:/assets/icons/icon_plus.svg"
|
||||
// icon.color:"white"
|
||||
// icon.width: 16
|
||||
// icon.height: 16
|
||||
// }
|
||||
Button {
|
||||
text: qsTr("Community")
|
||||
Material.background: Material.Orange
|
||||
text: qsTr("Forums")
|
||||
Material.background: Material.Blue
|
||||
Material.foreground: "white"
|
||||
icon.source: "qrc:/assets/icons/icon_people.svg"
|
||||
icon.color:"white"
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
onClicked: Qt.openUrlExternally("http://forum.screen-play.rocks:4567/")
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Workshop")
|
||||
Material.background: Material.Red
|
||||
Material.foreground: "white"
|
||||
|
||||
icon.source: "qrc:/assets/icons/icon_steam.svg"
|
||||
icon.color: "white"
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
onClicked: Qt.openUrlExternally(
|
||||
"steam://url/SteamWorkshopPage/672870")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import QtQuick 2.9
|
||||
import QtGraphicalEffects 1.0
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
Item {
|
||||
state: "out"
|
||||
@ -27,8 +28,15 @@ Item {
|
||||
anchors.topMargin: 20
|
||||
imgSource: "qrc:/assets/icons/icon_emptyWidget.svg"
|
||||
onClicked: {
|
||||
|
||||
folderDialog.open()
|
||||
}
|
||||
FolderDialog {
|
||||
id: folderDialog
|
||||
onAccepted: {
|
||||
screenPlayCreate.copyProject("/examples/scenes/empty", folderDialog.currentFolder)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Text {
|
||||
id: txtExamples
|
||||
@ -77,6 +85,7 @@ Item {
|
||||
buttonActive: true
|
||||
onClicked: {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ Item {
|
||||
enabled: buttonActive
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
|
||||
btnEmpty.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
44
ScreenPlay/src/create.cpp
Normal file
44
ScreenPlay/src/create.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include "create.h"
|
||||
|
||||
|
||||
Create::Create(Settings *st, QMLUtilities *util, QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_settings = st;
|
||||
m_utils = util;
|
||||
}
|
||||
|
||||
void Create::copyProject(QString relativeProjectPath, QString toPath)
|
||||
{
|
||||
if(toPath.contains("file:///")){
|
||||
toPath.remove("file:///");
|
||||
}
|
||||
QString srcFilePath = m_settings->getScreenPlayBasePath().toString() + relativeProjectPath ;
|
||||
|
||||
// Todo: UI Error handling
|
||||
if(copyRecursively(srcFilePath, toPath)){
|
||||
emit m_utils->openFolderInExplorer(toPath);
|
||||
}
|
||||
}
|
||||
|
||||
bool Create::copyRecursively(const QString &srcFilePath, const QString &tgtFilePath)
|
||||
{
|
||||
QFileInfo srcFileInfo(srcFilePath);
|
||||
if (srcFileInfo.isDir()) {
|
||||
QDir targetDir(tgtFilePath);
|
||||
targetDir.cdUp();
|
||||
QDir sourceDir(srcFilePath);
|
||||
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
|
||||
foreach (const QString &fileName, fileNames) {
|
||||
const QString newSrcFilePath
|
||||
= srcFilePath + QLatin1Char('/') + fileName;
|
||||
const QString newTgtFilePath
|
||||
= tgtFilePath + QLatin1Char('/') + fileName;
|
||||
if (!copyRecursively(newSrcFilePath, newTgtFilePath))
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!QFile::copy(srcFilePath, tgtFilePath))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
28
ScreenPlay/src/create.h
Normal file
28
ScreenPlay/src/create.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
|
||||
#include "qmlutilities.h"
|
||||
#include "settings.h"
|
||||
|
||||
class Create : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Create(Settings* st, QMLUtilities* util,QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void copyProject(QString relativeProjectPath, QString toPath);
|
||||
bool copyRecursively(const QString &srcFilePath, const QString &tgtFilePath);
|
||||
|
||||
private:
|
||||
Settings* m_settings;
|
||||
QMLUtilities* m_utils;
|
||||
};
|
@ -222,6 +222,16 @@ void Settings::createDefaultConfig()
|
||||
defaultSettings.close();
|
||||
}
|
||||
|
||||
QUrl Settings::getScreenPlayBasePath() const
|
||||
{
|
||||
return m_screenPlayBasePath;
|
||||
}
|
||||
|
||||
void Settings::setScreenPlayBasePath(QUrl screenPlayBasePath)
|
||||
{
|
||||
m_screenPlayBasePath = screenPlayBasePath;
|
||||
}
|
||||
|
||||
QUrl Settings::getScreenPlayWindowPath() const
|
||||
{
|
||||
return m_screenPlayWindowPath;
|
||||
|
@ -118,6 +118,9 @@ public:
|
||||
return m_offlineMode;
|
||||
}
|
||||
|
||||
QUrl getScreenPlayBasePath() const;
|
||||
void setScreenPlayBasePath(QUrl screenPlayBasePath);
|
||||
|
||||
signals:
|
||||
void autostartChanged(bool autostart);
|
||||
void highPriorityStartChanged(bool highPriorityStart);
|
||||
@ -296,6 +299,7 @@ private:
|
||||
QUrl m_localStoragePath;
|
||||
QUrl m_localSettingsPath;
|
||||
QUrl m_screenPlayWindowPath;
|
||||
QUrl m_screenPlayBasePath;
|
||||
|
||||
bool m_hasWorkshopBannerSeen = false;
|
||||
bool m_pauseWallpaperWhenIngame = true;
|
||||
|
Loading…
Reference in New Issue
Block a user