mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Merge commit '79303414787998cc6b537ed6eb79a8b4df7eb891' into dev
This commit is contained in:
commit
9b99e7b5ce
19
.gitlab-ci.yml
Normal file
19
.gitlab-ci.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
stages:
|
||||||
|
- build
|
||||||
|
|
||||||
|
build:windows:
|
||||||
|
stage: build
|
||||||
|
tags:
|
||||||
|
- vs2017
|
||||||
|
- windows
|
||||||
|
before_script:
|
||||||
|
- git clean -xdf
|
||||||
|
- git submodule sync --recursive
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
script:
|
||||||
|
- call scripts/build.bat
|
||||||
|
- call scripts/package.bat
|
||||||
|
artifacts:
|
||||||
|
expire_in: '2 hrs'
|
||||||
|
paths:
|
||||||
|
- PACKAGE/
|
@ -1,5 +1,5 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
QT += qml quick widgets quickcontrols2 core
|
QT += qml quick widgets quickcontrols2 core webengine
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
CONFIG += qtquickcompiler
|
CONFIG += qtquickcompiler
|
||||||
#DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
|
#DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
|
||||||
@ -73,7 +73,6 @@ installOut.path = $${OUT_PWD}/
|
|||||||
|
|
||||||
install_it.files += assets/templates/config.json \
|
install_it.files += assets/templates/config.json \
|
||||||
assets/icons/favicon.ico \
|
assets/icons/favicon.ico \
|
||||||
settings.json \
|
|
||||||
steam_appid.txt \
|
steam_appid.txt \
|
||||||
ThirdParty/ffmpeg/Windows/avcodec-58.dll \
|
ThirdParty/ffmpeg/Windows/avcodec-58.dll \
|
||||||
ThirdParty/ffmpeg/Windows/avdevice-58.dll \
|
ThirdParty/ffmpeg/Windows/avdevice-58.dll \
|
||||||
@ -116,6 +115,8 @@ release {
|
|||||||
win32 {
|
win32 {
|
||||||
win32: LIBS += -L$$PWD/ThirdParty/Steam/redistributable_bin/win64/ -lsteam_api64
|
win32: LIBS += -L$$PWD/ThirdParty/Steam/redistributable_bin/win64/ -lsteam_api64
|
||||||
DEPENDPATH += $$PWD/ThirdParty/Steam/redistributable_bin/win64
|
DEPENDPATH += $$PWD/ThirdParty/Steam/redistributable_bin/win64
|
||||||
|
|
||||||
|
install_it.files += ThirdParty\steam\redistributable_bin\win64\steam_api64.dll
|
||||||
}
|
}
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
@ -126,6 +127,8 @@ unix {
|
|||||||
DEPENDPATH += $$PWD/ThirdParty/steam/lib/linux64s
|
DEPENDPATH += $$PWD/ThirdParty/steam/lib/linux64s
|
||||||
|
|
||||||
LIBS += -L$$PWD/ThirdParty/steam/lib/linux64/ -lsdkencryptedappticket
|
LIBS += -L$$PWD/ThirdParty/steam/lib/linux64/ -lsdkencryptedappticket
|
||||||
|
|
||||||
|
install_it.files += ThirdParty\steam\redistributable_bin\linux64\libsteam_api.so
|
||||||
}
|
}
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
|
@ -45,10 +45,10 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
|
|
||||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QGuiApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
|
|
||||||
|
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
|
||||||
|
|
||||||
|
|
||||||
QTranslator trsl;
|
QTranslator trsl;
|
||||||
|
@ -78,6 +78,7 @@ Item {
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: wrapperSteps
|
id: wrapperSteps
|
||||||
|
z:10
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
@ -398,11 +399,13 @@ Item {
|
|||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: wrapperSteps
|
target: wrapperSteps
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
z:0
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: wrapperError
|
target: wrapperError
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
transitions: [
|
transitions: [
|
||||||
|
@ -1,16 +1,66 @@
|
|||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
|
import QtQuick.Controls.Material 2.3
|
||||||
|
import net.aimber.create 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: screenPlayCreate
|
||||||
|
onCreateWallpaperStateChanged: {
|
||||||
|
print(state)
|
||||||
|
if (state === Create.State.ConvertingVideoFinished) {
|
||||||
|
root.state = "finished"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: rectangle1
|
id: wrapperProgressbar
|
||||||
color: "#eeeeee"
|
height: parent.height * .5
|
||||||
width: parent.width * .5
|
z:1
|
||||||
radius: 3
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
right: parent.right
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: txtProgress
|
||||||
|
text: Math.floor(screenPlayCreate.progress) + "%"
|
||||||
|
font.pixelSize: 42
|
||||||
|
color: "#626262"
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
bottom: progressBar.top
|
||||||
|
bottomMargin: 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressBar {
|
||||||
|
id: progressBar
|
||||||
|
value: screenPlayCreate.progress
|
||||||
|
from: 0
|
||||||
|
to: 100
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
bottom: parent.bottom
|
||||||
|
bottomMargin: 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: wrapperFFMPEGOutput
|
||||||
|
color: "#eeeeee"
|
||||||
|
radius: 3
|
||||||
|
z:1
|
||||||
|
anchors {
|
||||||
|
top: wrapperProgressbar.bottom
|
||||||
|
topMargin: 30
|
||||||
|
right: parent.right
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
@ -18,6 +68,7 @@ Item {
|
|||||||
Flickable {
|
Flickable {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
focus: true
|
||||||
|
clip: true
|
||||||
contentHeight: txtFFMPEG.paintedHeight
|
contentHeight: txtFFMPEG.paintedHeight
|
||||||
ScrollBar.vertical: ScrollBar {
|
ScrollBar.vertical: ScrollBar {
|
||||||
snapMode: ScrollBar.SnapOnRelease
|
snapMode: ScrollBar.SnapOnRelease
|
||||||
@ -33,26 +84,79 @@ Item {
|
|||||||
}
|
}
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
color: "#626262"
|
color: "#626262"
|
||||||
|
text: "asasas"
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
height: txtFFMPEG.paintedHeight
|
height: txtFFMPEG.paintedHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: wrapperFinished
|
||||||
|
z:0
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: txtDone
|
||||||
|
text: qsTr("Video creation successful!")
|
||||||
|
font.pixelSize: 42
|
||||||
|
color: Material.color(Material.Green)
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
top: parent.top
|
||||||
|
topMargin: 30
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: screenPlayCreate
|
target: screenPlayCreate
|
||||||
onProcessOutput: {
|
onProcessOutput: {
|
||||||
txtFFMPEG.text = text
|
txtFFMPEG.text += text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
states: [
|
||||||
Rectangle {
|
State {
|
||||||
id: rectangle
|
name: "finished"
|
||||||
width: parent.width * .5
|
PropertyChanges {
|
||||||
anchors {
|
target: wrapperProgressbar
|
||||||
top: parent.top
|
opacity:0
|
||||||
bottom: parent.bottom
|
}
|
||||||
right: parent.right
|
PropertyChanges {
|
||||||
|
target: wrapperFFMPEGOutput
|
||||||
|
opacity:0
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: wrapperFinished
|
||||||
|
opacity:1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: "0"
|
||||||
|
to: "finished"
|
||||||
|
PropertyAnimation {
|
||||||
|
target: wrapperFFMPEGOutput
|
||||||
|
duration: 200
|
||||||
|
property: "opacity"
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
PropertyAnimation {
|
||||||
|
target: wrapperProgressbar
|
||||||
|
duration: 200
|
||||||
|
property: "opacity"
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
PropertyAnimation {
|
||||||
|
target: wrapperFinished
|
||||||
|
duration: 200
|
||||||
|
property: "opacity"
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ Item {
|
|||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
anchors{
|
anchors{
|
||||||
top:parent.top
|
top:parent.top
|
||||||
topMargin: 3
|
topMargin: 0
|
||||||
left:parent.left
|
left:parent.left
|
||||||
leftMargin: 30
|
leftMargin: 30
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ Item {
|
|||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: txtHeadline
|
target: txtHeadline
|
||||||
anchors.topMargin: 3
|
anchors.topMargin: 0
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,14 +195,6 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
|
|||||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideo);
|
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideo);
|
||||||
|
|
||||||
proConvertPreviewMP4.data()->start();
|
proConvertPreviewMP4.data()->start();
|
||||||
|
|
||||||
QScopedPointer<QTimer> processOutputTimer(new QTimer());
|
|
||||||
|
|
||||||
// connect(processOutputTimer.data(), &QTimer::timeout, [&]() {
|
|
||||||
// qDebug() << "### " << proConvertPreviewMP4.data()->readAll();
|
|
||||||
// this->processOutput(proConvertPreviewMP4.data()->readAll());
|
|
||||||
// });
|
|
||||||
processOutputTimer.data()->start(100);
|
|
||||||
proConvertPreviewMP4.data()->waitForFinished(-1);
|
proConvertPreviewMP4.data()->waitForFinished(-1);
|
||||||
if (proConvertPreviewMP4.data()->exitStatus() == QProcess::NormalExit) {
|
if (proConvertPreviewMP4.data()->exitStatus() == QProcess::NormalExit) {
|
||||||
qDebug() << "normal exit";
|
qDebug() << "normal exit";
|
||||||
@ -211,19 +203,17 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
|
|||||||
}
|
}
|
||||||
QString tmpErr = proConvertPreviewMP4.data()->readAllStandardError();
|
QString tmpErr = proConvertPreviewMP4.data()->readAllStandardError();
|
||||||
if (!tmpErr.isEmpty()) {
|
if (!tmpErr.isEmpty()) {
|
||||||
qDebug() << tmpErr;
|
QFile previewVideo(createWallpaperData.exportPath + "/preview.mp4");
|
||||||
qDebug() << proConvertPreviewMP4.data()->readAllStandardOutput();
|
if (!previewVideo.exists() && !(previewVideo.size() > 0)) {
|
||||||
qDebug() << proConvertPreviewMP4.data()->readAll();
|
emit processOutput(tmpErr);
|
||||||
emit processOutput(tmpErr);
|
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideoError);
|
||||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideoError);
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
// qDebug() << proConvertPreviewMP4.data()->program() << proConvertPreviewMP4.data()->arguments();
|
|
||||||
// qDebug() << "Done converting video to preview" << proConvertPreviewMP4.data()->readAll() << "\n"
|
|
||||||
// << proConvertPreviewMP4.data()->readAllStandardError();
|
|
||||||
this->processOutput(proConvertPreviewMP4.data()->readAll());
|
this->processOutput(proConvertPreviewMP4.data()->readAll());
|
||||||
proConvertPreviewMP4.data()->close();
|
proConvertPreviewMP4.data()->close();
|
||||||
processOutputTimer.data()->stop();
|
|
||||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideoFinished);
|
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideoFinished);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -250,14 +240,15 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
|
|||||||
#endif
|
#endif
|
||||||
proConvertGif.data()->start();
|
proConvertGif.data()->start();
|
||||||
proConvertGif.data()->waitForFinished(-1);
|
proConvertGif.data()->waitForFinished(-1);
|
||||||
if (!proConvertGif.data()->readAllStandardError().isEmpty()) {
|
QString tmpErrGif = proConvertGif.data()->readAllStandardError();
|
||||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewGifError);
|
if (!tmpErrGif.isEmpty()) {
|
||||||
return false;
|
QFile previewGif(createWallpaperData.exportPath + "/preview.gif");
|
||||||
|
if (!previewGif.exists() && !(previewGif.size() > 0)) {
|
||||||
|
emit createWallpaperStateChanged(Create::State::ConvertingPreviewGifError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// qDebug() << proConvertGif.data()->program() << proConvertGif.data()->arguments();
|
|
||||||
// qDebug() << "Done converting video to preview" << proConvertGif.data()->readAll() << "\n"
|
|
||||||
// << proConvertGif.data()->readAllStandardError();
|
|
||||||
this->processOutput(proConvertPreviewMP4.data()->readAll());
|
this->processOutput(proConvertPreviewMP4.data()->readAll());
|
||||||
proConvertGif.data()->close();
|
proConvertGif.data()->close();
|
||||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewGifFinished);
|
emit createWallpaperStateChanged(Create::State::ConvertingPreviewGifFinished);
|
||||||
@ -267,6 +258,74 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
|
|||||||
|
|
||||||
bool Create::createWallpaperVideo(CreateWallpaperData& createWallpaperData)
|
bool Create::createWallpaperVideo(CreateWallpaperData& createWallpaperData)
|
||||||
{
|
{
|
||||||
|
emit createWallpaperStateChanged(Create::State::ConvertingVideo);
|
||||||
|
|
||||||
|
QStringList args;
|
||||||
|
args.append("-hide_banner");
|
||||||
|
args.append("-y");
|
||||||
|
args.append("-stats");
|
||||||
|
args.append("-i");
|
||||||
|
args.append(createWallpaperData.videoPath);
|
||||||
|
args.append("-c:v");
|
||||||
|
args.append("libvpx-vp9");
|
||||||
|
args.append("-crf");
|
||||||
|
args.append("30");
|
||||||
|
args.append("-threads");
|
||||||
|
args.append("16");
|
||||||
|
args.append("-slices");
|
||||||
|
args.append("16");
|
||||||
|
args.append("-cpu-used");
|
||||||
|
args.append("4");
|
||||||
|
args.append("-pix_fmt");
|
||||||
|
args.append("yuv420p");
|
||||||
|
args.append("-b:v");
|
||||||
|
args.append("0");
|
||||||
|
args.append(createWallpaperData.exportPath + "/video.webm");
|
||||||
|
|
||||||
|
QScopedPointer<QProcess> proConvertVideo(new QProcess());
|
||||||
|
proConvertVideo.data()->setArguments(args);
|
||||||
|
proConvertVideo.data()->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
proConvertVideo.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg.exe");
|
||||||
|
qDebug() << "Start converting video";
|
||||||
|
|
||||||
|
connect(proConvertVideo.data(), &QProcess::readyReadStandardOutput, this, [&]() {
|
||||||
|
QString tmpOut = proConvertVideo.data()->readAllStandardOutput();
|
||||||
|
auto tmpList = tmpOut.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
||||||
|
if (tmpList.length() > 2) {
|
||||||
|
bool ok = false;
|
||||||
|
float currentFrame = QString(tmpList.at(1)).toFloat(&ok);
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float progress = currentFrame / createWallpaperData.length;
|
||||||
|
|
||||||
|
this->setProgress(progress);
|
||||||
|
}
|
||||||
|
this->processOutput(tmpOut);
|
||||||
|
});
|
||||||
|
|
||||||
|
// For some reason we only get output if we use execute instead of start....?!
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
//proConvertVideo.data()->execute(QApplication::applicationDirPath() + "/ffmpeg.exe", args);
|
||||||
|
#endif
|
||||||
|
proConvertVideo.data()->start(QIODevice::ReadOnly);
|
||||||
|
proConvertVideo.data()->waitForFinished(-1);
|
||||||
|
QString out = proConvertVideo.data()->readAllStandardOutput();
|
||||||
|
|
||||||
|
this->processOutput(out);
|
||||||
|
QString tmpErrVideo = proConvertVideo.data()->readAllStandardError();
|
||||||
|
if (!tmpErrVideo.isEmpty()) {
|
||||||
|
QFile video(createWallpaperData.exportPath + "/video.webm");
|
||||||
|
if (!video.exists() && !(video.size() > 0)) {
|
||||||
|
emit createWallpaperStateChanged(Create::State::ConvertingVideoError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proConvertVideo.data()->close();
|
||||||
|
emit createWallpaperStateChanged(Create::State::ConvertingVideoFinished);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ public:
|
|||||||
explicit Create(Settings* st, QMLUtilities* util, QObject* parent = nullptr);
|
explicit Create(Settings* st, QMLUtilities* util, QObject* parent = nullptr);
|
||||||
|
|
||||||
Q_PROPERTY(QString workingDir READ workingDir WRITE setWorkingDir NOTIFY workingDirChanged)
|
Q_PROPERTY(QString workingDir READ workingDir WRITE setWorkingDir NOTIFY workingDirChanged)
|
||||||
|
Q_PROPERTY(float progress READ progress WRITE setProgress NOTIFY progressChanged)
|
||||||
|
|
||||||
Create() {}
|
Create() {}
|
||||||
~Create() {}
|
~Create() {}
|
||||||
@ -55,6 +56,9 @@ public:
|
|||||||
ConvertingPreviewGif,
|
ConvertingPreviewGif,
|
||||||
ConvertingPreviewGifFinished,
|
ConvertingPreviewGifFinished,
|
||||||
ConvertingPreviewGifError,
|
ConvertingPreviewGifError,
|
||||||
|
ConvertingVideo,
|
||||||
|
ConvertingVideoFinished,
|
||||||
|
ConvertingVideoError,
|
||||||
Finished,
|
Finished,
|
||||||
ErrorUnknown,
|
ErrorUnknown,
|
||||||
};
|
};
|
||||||
@ -66,11 +70,18 @@ public:
|
|||||||
return m_workingDir;
|
return m_workingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float progress() const
|
||||||
|
{
|
||||||
|
return m_progress;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void createWallpaperStateChanged(Create::State state);
|
void createWallpaperStateChanged(Create::State state);
|
||||||
void processOutput(QString text);
|
void processOutput(QString text);
|
||||||
void workingDirChanged(QString workingDir);
|
void workingDirChanged(QString workingDir);
|
||||||
|
|
||||||
|
void progressChanged(float progress);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void copyProject(QString relativeProjectPath, QString toPath);
|
void copyProject(QString relativeProjectPath, QString toPath);
|
||||||
bool copyRecursively(const QString& srcFilePath, const QString& tgtFilePath);
|
bool copyRecursively(const QString& srcFilePath, const QString& tgtFilePath);
|
||||||
@ -92,9 +103,20 @@ public slots:
|
|||||||
emit workingDirChanged(m_workingDir);
|
emit workingDirChanged(m_workingDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setProgress(float progress)
|
||||||
|
{
|
||||||
|
if (qFuzzyCompare(m_progress, progress))
|
||||||
|
return;
|
||||||
|
|
||||||
|
qDebug() << progress;
|
||||||
|
m_progress = progress;
|
||||||
|
emit progressChanged(m_progress);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Settings* m_settings;
|
Settings* m_settings;
|
||||||
QMLUtilities* m_utils;
|
QMLUtilities* m_utils;
|
||||||
|
|
||||||
QString m_workingDir;
|
QString m_workingDir;
|
||||||
|
float m_progress = 0.0f;
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, SDKConnector* sdkc, AppId_t steamID, QGuiApplication* app, QObject* parent)
|
Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, SDKConnector* sdkc, AppId_t steamID, QGuiApplication* app, QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -12,7 +13,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
|||||||
m_qGuiApplication = app;
|
m_qGuiApplication = app;
|
||||||
|
|
||||||
QFile configTmp;
|
QFile configTmp;
|
||||||
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
QString appConfigLocation = QGuiApplication::applicationDirPath();
|
||||||
m_localSettingsPath = QUrl(appConfigLocation);
|
m_localSettingsPath = QUrl(appConfigLocation);
|
||||||
if (!QDir(appConfigLocation).exists()) {
|
if (!QDir(appConfigLocation).exists()) {
|
||||||
if (!QDir().mkdir(appConfigLocation)) {
|
if (!QDir().mkdir(appConfigLocation)) {
|
||||||
@ -30,7 +31,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
QJsonDocument configJsonDocument;
|
QJsonDocument configJsonDocument;
|
||||||
QJsonParseError parseError{};
|
QJsonParseError parseError {};
|
||||||
QJsonObject configObj;
|
QJsonObject configObj;
|
||||||
|
|
||||||
configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
|
configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
@ -150,7 +151,7 @@ void Settings::writeSingleSettingConfig(QString name, QVariant value)
|
|||||||
{
|
{
|
||||||
|
|
||||||
QJsonDocument configJsonDocument;
|
QJsonDocument configJsonDocument;
|
||||||
QJsonParseError parseError{};
|
QJsonParseError parseError {};
|
||||||
QJsonObject configObj;
|
QJsonObject configObj;
|
||||||
QFile configTmp;
|
QFile configTmp;
|
||||||
|
|
||||||
@ -263,7 +264,7 @@ void Settings::setPlayAll(bool isPlaying)
|
|||||||
void Settings::createDefaultConfig()
|
void Settings::createDefaultConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
QFile file(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/settings.json");
|
QFile file(QGuiApplication::applicationDirPath() + "/settings.json");
|
||||||
QFile defaultSettings(":/settings.json");
|
QFile defaultSettings(":/settings.json");
|
||||||
|
|
||||||
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
@ -232,6 +232,7 @@ public slots:
|
|||||||
writeSingleSettingConfig("absoluteStoragePath", cleanedPath);
|
writeSingleSettingConfig("absoluteStoragePath", cleanedPath);
|
||||||
|
|
||||||
m_ilm->setabsoluteStoragePath(cleanedPath.toString());
|
m_ilm->setabsoluteStoragePath(cleanedPath.toString());
|
||||||
|
m_localStoragePath = cleanedPath.toString();
|
||||||
emit localStoragePathChanged(cleanedPath.toString());
|
emit localStoragePathChanged(cleanedPath.toString());
|
||||||
m_ilm->reset();
|
m_ilm->reset();
|
||||||
m_ilm->loadScreens();
|
m_ilm->loadScreens();
|
||||||
|
@ -9,11 +9,15 @@ uri = net.aimber.sysinfo
|
|||||||
# Input
|
# Input
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
screenplaysysinfo_plugin.cpp \
|
screenplaysysinfo_plugin.cpp \
|
||||||
sysinfo.cpp
|
sysinfo.cpp \
|
||||||
|
cpu.cpp \
|
||||||
|
ram.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
screenplaysysinfo_plugin.h \
|
screenplaysysinfo_plugin.h \
|
||||||
sysinfo.h
|
sysinfo.h \
|
||||||
|
cpu.h \
|
||||||
|
ram.h
|
||||||
|
|
||||||
DISTFILES = qmldir
|
DISTFILES = qmldir
|
||||||
|
|
||||||
|
36
ScreenPlaySysInfo/cpu.cpp
Normal file
36
ScreenPlaySysInfo/cpu.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "cpu.h"
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
|
||||||
|
#define STATUS_SUCCESS 0
|
||||||
|
#define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
|
||||||
|
|
||||||
|
CPU::CPU(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
// signal obj, signal function pointer, slot obj, slot function pointer
|
||||||
|
connect(&m_updateTimer,&QTimer::timeout,this,&CPU::update);
|
||||||
|
m_updateTimer.start(m_tickRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CPU::update()
|
||||||
|
{
|
||||||
|
// long status = 0;
|
||||||
|
// unsigned long bufSize = c_BufferSize;
|
||||||
|
// byte* buf = (bufSize > 0) ? new BYTE[bufSize] : nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// status = c_NtQuerySystemInformation(SystemProcessorPerformanceInformation, buf, bufSize, &size);
|
||||||
|
|
||||||
|
// switch (status) {
|
||||||
|
// case STATUS_INFO_LENGTH_MISMATCH:
|
||||||
|
// qWarning() << "Warning: Status info length mismatch!";
|
||||||
|
// break;
|
||||||
|
// case STATUS_SUCCESS:
|
||||||
|
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
}
|
78
ScreenPlaySysInfo/cpu.h
Normal file
78
ScreenPlaySysInfo/cpu.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <qt_windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// https://github.com/rainmeter/rainmeter/blob/master/Library/MeasureCPU.cpp
|
||||||
|
|
||||||
|
typedef LONG(WINAPI* FPNTQSI)(UINT, PVOID, ULONG, PULONG);
|
||||||
|
|
||||||
|
class CPU : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(float usage READ usage NOTIFY usageChanged)
|
||||||
|
Q_PROPERTY(int tickRate READ tickRate WRITE setTickRate NOTIFY tickRateChanged)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CPU(QObject* parent = nullptr);
|
||||||
|
|
||||||
|
|
||||||
|
float usage() const
|
||||||
|
{
|
||||||
|
return m_usage;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tickRate() const
|
||||||
|
{
|
||||||
|
return m_tickRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void usageChanged(float usage);
|
||||||
|
|
||||||
|
void tickRateChanged(int tickRate);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void update();
|
||||||
|
|
||||||
|
void setUsage(float usage)
|
||||||
|
{
|
||||||
|
qWarning("Floating point comparison needs context sanity check");
|
||||||
|
if (qFuzzyCompare(m_usage, usage))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_usage = usage;
|
||||||
|
emit usageChanged(m_usage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTickRate(int tickRate)
|
||||||
|
{
|
||||||
|
if (m_tickRate == tickRate)
|
||||||
|
return;
|
||||||
|
|
||||||
|
qDebug() << "hat sich was geändert";
|
||||||
|
|
||||||
|
m_tickRate = tickRate;
|
||||||
|
emit tickRateChanged(m_tickRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
float m_usage = 42.0f;
|
||||||
|
|
||||||
|
int m_Processor;
|
||||||
|
|
||||||
|
double m_OldTime[2];
|
||||||
|
|
||||||
|
static FPNTQSI c_NtQuerySystemInformation;
|
||||||
|
|
||||||
|
static int c_NumOfProcessors;
|
||||||
|
static ULONG c_BufferSize;
|
||||||
|
int m_tickRate = 500;
|
||||||
|
QTimer m_updateTimer;
|
||||||
|
};
|
8
ScreenPlaySysInfo/ram.cpp
Normal file
8
ScreenPlaySysInfo/ram.cpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include "ram.h"
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
#include <qmetatype.h>
|
||||||
|
RAM::RAM(QObject* parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
39
ScreenPlaySysInfo/ram.h
Normal file
39
ScreenPlaySysInfo/ram.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
class RAM : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(float usage READ usage NOTIFY usageChanged)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit RAM(QObject* parent = nullptr);
|
||||||
|
|
||||||
|
float usage() const
|
||||||
|
{
|
||||||
|
return m_usage;
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void usageChanged(float usage);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void exe(){
|
||||||
|
qDebug() << "aa";
|
||||||
|
}
|
||||||
|
void setUsage(float usage)
|
||||||
|
{
|
||||||
|
qWarning("Floating point comparison needs context sanity check");
|
||||||
|
if (qFuzzyCompare(m_usage, usage))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_usage = usage;
|
||||||
|
emit usageChanged(m_usage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
float m_usage = 42.0f;
|
||||||
|
};
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
#include "screenplaysysinfo_plugin.h"
|
#include "screenplaysysinfo_plugin.h"
|
||||||
#include "sysinfo.h"
|
#include "sysinfo.h"
|
||||||
|
#include <qmetatype.h>
|
||||||
#include <qqml.h>
|
#include <qqml.h>
|
||||||
|
|
||||||
QObject *ScreenPlaySysInfoSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
|
QObject* ScreenPlaySysInfoSingleton(QQmlEngine* engine, QJSEngine* scriptEngine)
|
||||||
{
|
{
|
||||||
Q_UNUSED(engine)
|
Q_UNUSED(engine)
|
||||||
Q_UNUSED(scriptEngine)
|
Q_UNUSED(scriptEngine)
|
||||||
@ -11,9 +11,9 @@ QObject *ScreenPlaySysInfoSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
|
|||||||
return new SysInfo();
|
return new SysInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenPlaySysInfoPlugin::registerTypes(const char *uri)
|
void ScreenPlaySysInfoPlugin::registerTypes(const char* uri)
|
||||||
{
|
{
|
||||||
// @uri net.aimber.sysinfo
|
// @uri net.aimber.sysinfo
|
||||||
qmlRegisterSingletonType<SysInfo>(uri, 1, 0, "SysInfo",ScreenPlaySysInfoSingleton);
|
qmlRegisterSingletonType<SysInfo>(uri, 1, 0, "SysInfo", ScreenPlaySysInfoSingleton);
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
SysInfo::SysInfo(QQuickItem *parent):
|
SysInfo::SysInfo(QQuickItem *parent):
|
||||||
QQuickItem(parent)
|
QQuickItem(parent)
|
||||||
{
|
{
|
||||||
// By default, QQuickItem does not draw anything. If you subclass
|
// FIXME Elias 2018 QQmlEngine cannot handle smartpointers yet....
|
||||||
// QQuickItem to create a visual item, you will need to uncomment the
|
m_ram = new RAM();
|
||||||
// following line and re-implement updatePaintNode()
|
m_cpu = new CPU();
|
||||||
|
|
||||||
// setFlag(ItemHasContents, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SysInfo::~SysInfo()
|
SysInfo::~SysInfo()
|
||||||
{
|
{
|
||||||
|
delete m_cpu;
|
||||||
|
delete m_ram;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,39 @@
|
|||||||
#ifndef SYSINFO_H
|
#pragma once
|
||||||
#define SYSINFO_H
|
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "ram.h"
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class SysInfo : public QQuickItem
|
class SysInfo : public QQuickItem {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY(SysInfo)
|
Q_DISABLE_COPY(SysInfo)
|
||||||
|
|
||||||
public:
|
Q_PROPERTY(RAM* ram READ ram NOTIFY ramChanged)
|
||||||
SysInfo(QQuickItem *parent = nullptr);
|
Q_PROPERTY(CPU* cpu READ cpu NOTIFY cpuChanged)
|
||||||
~SysInfo();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SYSINFO_H
|
public:
|
||||||
|
SysInfo(QQuickItem* parent = nullptr);
|
||||||
|
~SysInfo();
|
||||||
|
|
||||||
|
RAM* ram() const
|
||||||
|
{
|
||||||
|
return m_ram;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPU* cpu() const
|
||||||
|
{
|
||||||
|
return m_cpu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ramChanged(RAM* ram);
|
||||||
|
void cpuChanged(CPU* cpu);
|
||||||
|
|
||||||
|
private:
|
||||||
|
RAM* m_ram;
|
||||||
|
CPU* m_cpu;
|
||||||
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>main.qml</file>
|
<file>main.qml</file>
|
||||||
|
<file>assets/image/noisy-texture-3.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
QT += quick
|
QT += quick qml quickcontrols2 core charts widgets gui
|
||||||
CONFIG += c++11
|
CONFIG += c++17
|
||||||
CONFIG += qtquickcompiler
|
CONFIG += qtquickcompiler
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any feature of Qt which as been marked deprecated (the exact warnings
|
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||||
|
BIN
ScreenPlayWidget/assets/image/noisy-texture-3.png
Normal file
BIN
ScreenPlayWidget/assets/image/noisy-texture-3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
@ -1,14 +1,42 @@
|
|||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import net.aimber.screenplaysdk 1.0
|
import net.aimber.screenplaysdk 1.0
|
||||||
import QtQuick.Window 2.3
|
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
Window {
|
Item {
|
||||||
id: mainWindow
|
id: mainWindow
|
||||||
visible: true
|
visible: true
|
||||||
width: 250
|
anchors.fill: parent
|
||||||
height: 250
|
|
||||||
flags: Qt.SplashScreen | Qt.ToolTip | Qt.SplashScreen
|
Rectangle {
|
||||||
|
id:bgColor
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "white"
|
||||||
|
//color: "#1A1F22"
|
||||||
|
opacity: .15
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: bg
|
||||||
|
source: "qrc:/assets/image/noisy-texture-3.png"
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: .05
|
||||||
|
fillMode: Image.Tile
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
onPressed: {
|
||||||
|
backend.setClickPos(Qt.point(mouse.x, mouse.y))
|
||||||
|
}
|
||||||
|
|
||||||
|
onPositionChanged: {
|
||||||
|
backend.setPos(mouse.x, mouse.y)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ScreenPlaySDK {
|
ScreenPlaySDK {
|
||||||
id: spSDK
|
id: spSDK
|
||||||
@ -53,48 +81,4 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections{
|
|
||||||
target: loader.item
|
|
||||||
ignoreUnknownSignals: true
|
|
||||||
onSizeChanged:{
|
|
||||||
print(size)
|
|
||||||
mainWindow.width = size.width
|
|
||||||
mainWindow.height = size.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
property point clickPos: "1,1"
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
||||||
z:99
|
|
||||||
|
|
||||||
onPressed: {
|
|
||||||
clickPos = Qt.point(mouse.x, mouse.y)
|
|
||||||
}
|
|
||||||
|
|
||||||
onPositionChanged: {
|
|
||||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
|
||||||
var new_x = mainWindow.x + delta.x
|
|
||||||
var new_y = mainWindow.y + delta.y
|
|
||||||
mainWindow.x = new_x
|
|
||||||
mainWindow.y = new_y
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
if (mouse.button === Qt.RightButton) {
|
|
||||||
contextMenu.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
|
||||||
id: contextMenu
|
|
||||||
MenuItem {
|
|
||||||
text: qsTr("Close")
|
|
||||||
onClicked: {
|
|
||||||
Qt.quit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,15 @@
|
|||||||
SPWidgetmainwindow::SPWidgetmainwindow(QString projectPath, QString appid, QScreen* parent)
|
SPWidgetmainwindow::SPWidgetmainwindow(QString projectPath, QString appid, QScreen* parent)
|
||||||
: QWindow(parent)
|
: QWindow(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_appID = appid;
|
m_appID = appid;
|
||||||
|
|
||||||
|
m_hwnd = (HWND)this->winId();
|
||||||
|
Qt::WindowFlags flags = this->flags();
|
||||||
|
this->setWidth(500);
|
||||||
|
this->setHeight(300);
|
||||||
|
this->setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::BypassWindowManagerHint | Qt::SplashScreen);
|
||||||
|
|
||||||
QFile configTmp;
|
QFile configTmp;
|
||||||
QJsonDocument configJsonDocument;
|
QJsonDocument configJsonDocument;
|
||||||
QJsonParseError parseError;
|
QJsonParseError parseError;
|
||||||
@ -20,11 +27,80 @@ SPWidgetmainwindow::SPWidgetmainwindow(QString projectPath, QString appid, QScre
|
|||||||
m_project = configJsonDocument.object();
|
m_project = configJsonDocument.object();
|
||||||
QString fullPath = projectPath + "/" + m_project.value("file").toString();
|
QString fullPath = projectPath + "/" + m_project.value("file").toString();
|
||||||
|
|
||||||
m_quickRenderer = QSharedPointer<QQmlApplicationEngine>(new QQmlApplicationEngine());
|
m_quickRenderer = QSharedPointer<QQuickView>(new QQuickView(this));
|
||||||
m_quickRenderer.data()->rootContext()->setContextProperty("backend", this);
|
m_quickRenderer.data()->rootContext()->setContextProperty("backend", this);
|
||||||
m_quickRenderer.data()->load(QUrl("qrc:/main.qml"));
|
m_quickRenderer.data()->setColor(Qt::transparent);
|
||||||
|
m_quickRenderer.data()->setWidth(this->width());
|
||||||
|
m_quickRenderer.data()->setHeight(this->height());
|
||||||
|
m_quickRenderer.data()->setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
|
||||||
|
|
||||||
|
m_quickRenderer.data()->setSource(QUrl("qrc:/main.qml"));
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
SetWindowBlur(m_hwnd);
|
||||||
|
#endif
|
||||||
|
show();
|
||||||
|
m_quickRenderer.data()->show();
|
||||||
|
|
||||||
emit setWidgetSource(fullPath);
|
emit setWidgetSource(fullPath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SPWidgetmainwindow::setSize(QSize size)
|
||||||
|
{
|
||||||
|
this->setWidth(size.width());
|
||||||
|
this->setHeight(size.height());
|
||||||
|
m_quickRenderer.data()->setWidth(size.width());
|
||||||
|
m_quickRenderer.data()->setHeight(size.height());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPWidgetmainwindow::setPos(int xPos, int yPos)
|
||||||
|
{
|
||||||
|
|
||||||
|
QPoint delta((xPos - m_clickPos.x()), (yPos - m_clickPos.y()));
|
||||||
|
int new_x = x() + delta.x();
|
||||||
|
int new_y = y() + delta.y();
|
||||||
|
|
||||||
|
setPosition(QPoint(new_x, new_y));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPWidgetmainwindow::setClickPos(const QPoint &clickPos)
|
||||||
|
{
|
||||||
|
m_clickPos = clickPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPWidgetmainwindow::SetWindowBlur(HWND hWnd)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
|
||||||
|
const HINSTANCE hModule = LoadLibrary(TEXT("user32.dll"));
|
||||||
|
if (hModule) {
|
||||||
|
struct ACCENTPOLICY {
|
||||||
|
int nAccentState;
|
||||||
|
int nFlags;
|
||||||
|
int nColor;
|
||||||
|
int nAnimationId;
|
||||||
|
};
|
||||||
|
struct WINCOMPATTRDATA {
|
||||||
|
int nAttribute;
|
||||||
|
PVOID pData;
|
||||||
|
ULONG ulDataSize;
|
||||||
|
};
|
||||||
|
enum class Accent {
|
||||||
|
DISABLED = 0,
|
||||||
|
GRADIENT = 1,
|
||||||
|
TRANSPARENTGRADIENT = 2,
|
||||||
|
BLURBEHIND = 3,
|
||||||
|
ACRYLIC = 4,
|
||||||
|
INVALID = 5
|
||||||
|
};
|
||||||
|
typedef BOOL(WINAPI * pSetWindowCompositionAttribute)(HWND, WINCOMPATTRDATA*);
|
||||||
|
const pSetWindowCompositionAttribute SetWindowCompositionAttribute = (pSetWindowCompositionAttribute)GetProcAddress(hModule, "SetWindowCompositionAttribute");
|
||||||
|
if (SetWindowCompositionAttribute) {
|
||||||
|
ACCENTPOLICY policy = { (int)Accent::BLURBEHIND, 0, 0, 0 }; // ACCENT_ENABLE_BLURBEHIND=3...
|
||||||
|
WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) }; // WCA_ACCENT_POLICY=19
|
||||||
|
SetWindowCompositionAttribute(hWnd, &data);
|
||||||
|
}
|
||||||
|
FreeLibrary(hModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -6,12 +6,15 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonParseError>
|
#include <QJsonParseError>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QQuickView>
|
#include <QtQuick/QQuickView>
|
||||||
|
#include <QtQuick/QQuickWindow>
|
||||||
|
#include <QQuickWindow>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QQmlApplicationEngine>
|
#include <qt_windows.h>
|
||||||
|
|
||||||
class SPWidgetmainwindow : public QWindow {
|
class SPWidgetmainwindow : public QWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -45,6 +48,7 @@ signals:
|
|||||||
void setWidgetSource(QString source);
|
void setWidgetSource(QString source);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void setSize(QSize size);
|
||||||
void setAppID(QString appID)
|
void setAppID(QString appID)
|
||||||
{
|
{
|
||||||
if (m_appID == appID)
|
if (m_appID == appID)
|
||||||
@ -70,11 +74,17 @@ public slots:
|
|||||||
emit projectConfigChanged(m_projectConfig);
|
emit projectConfigChanged(m_projectConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPos(int xPos, int yPos);
|
||||||
|
void setClickPos(const QPoint& clickPos);
|
||||||
|
void SetWindowBlur(HWND hWnd);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_appID;
|
QString m_appID;
|
||||||
QString m_type = "qmlWidget";
|
QString m_type = "qmlWidget";
|
||||||
QString m_projectConfig;
|
QString m_projectConfig;
|
||||||
QJsonObject m_project;
|
QJsonObject m_project;
|
||||||
|
HWND m_hwnd;
|
||||||
|
QPoint m_clickPos = { 0, 0 };
|
||||||
|
|
||||||
QSharedPointer<QQmlApplicationEngine> m_quickRenderer = nullptr;
|
QSharedPointer<QQuickView> m_quickRenderer;
|
||||||
};
|
};
|
||||||
|
18
scripts/build.bat
Normal file
18
scripts/build.bat
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
setlocal EnableExtensions
|
||||||
|
|
||||||
|
set PATH=%PATH%;C:\Qt\Tools\QtCreator\bin
|
||||||
|
set PATH=%PATH%;C:\Qt\5.11.2\msvc2017_64\bin
|
||||||
|
set root=%cd%
|
||||||
|
|
||||||
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
|
||||||
|
|
||||||
|
mkdir BUILD
|
||||||
|
cd BUILD
|
||||||
|
|
||||||
|
echo "Begin build of ScreenPlay "
|
||||||
|
qmake.exe ../ScreenPlay.pro -spec win32-msvc "CONFIG+=release"
|
||||||
|
jom.exe qmake_all
|
||||||
|
jom.exe -j8
|
||||||
|
jom.exe install
|
||||||
|
echo "Build ScreenPlay finished!"
|
||||||
|
|
40
scripts/package.bat
Normal file
40
scripts/package.bat
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
setlocal EnableExtensions
|
||||||
|
|
||||||
|
set PATH=%PATH%;C:\Qt\Tools\QtCreator\bin
|
||||||
|
set PATH=%PATH%;C:\Qt\5.11.2\msvc2017_64\bin
|
||||||
|
set root=%cd%
|
||||||
|
|
||||||
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
|
||||||
|
|
||||||
|
echo "Begin packaging"
|
||||||
|
|
||||||
|
mkdir PACKAGE
|
||||||
|
cd BUILD
|
||||||
|
|
||||||
|
echo "Copy ScreenPlay"
|
||||||
|
xcopy /s /y ScreenPlay\release ..\PACKAGE
|
||||||
|
echo "Copy ScreenPlaySDK"
|
||||||
|
xcopy /s /y ScreenPlaySDK\release ..\PACKAGE
|
||||||
|
echo "Copy ScreenPlayWidget"
|
||||||
|
xcopy /s /y ScreenPlayWidget\release ..\PACKAGE
|
||||||
|
echo "Copy ScreenPlayWindow"
|
||||||
|
xcopy /s /y ScreenPlayWindow\release ..\PACKAGE
|
||||||
|
echo "Copy ScreenPlayWorkshop"
|
||||||
|
xcopy /s /y ScreenPlayWorkshop\release ..\PACKAGE
|
||||||
|
|
||||||
|
xcopy C:\Qt\Tools\QtCreator\bin\libeay32.dll ..\PACKAGE
|
||||||
|
xcopy C:\Qt\Tools\QtCreator\bin\ssleay32.dll ..\PACKAGE
|
||||||
|
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
windeployqt.exe --release --qmldir ScreenPlay/qml PACKAGE/ScreenPlay.exe
|
||||||
|
|
||||||
|
cd PACKAGE
|
||||||
|
|
||||||
|
del /f *.cpp
|
||||||
|
del /f *.moc
|
||||||
|
del /f *.h
|
||||||
|
del /f *.obj
|
||||||
|
del /f *.res
|
||||||
|
|
Loading…
Reference in New Issue
Block a user