1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-25 20:22:39 +01:00

Merge branch 'misc' into 'dev'

Misc

See merge request kelteseth/ScreenPlay!14
This commit is contained in:
Elias Steurer (Kelteseth) 2019-07-29 06:21:56 +00:00
commit 0b7676ab17
103 changed files with 1422 additions and 532 deletions

View File

@ -11,9 +11,10 @@ build:windows:
- git submodule sync --recursive
- git submodule update --init --recursive
script:
- call vcpkg-install-dependencies.bat
- call scripts/build.bat
- call scripts/package.bat
artifacts:
expire_in: '2 hrs'
expire_in: '3 weeks'
paths:
- PACKAGE/

View File

@ -26,7 +26,7 @@ Everyone can contribute with code, design, documentation or translation. Visit o
git clone --recursive https://gitlab.com/kelteseth/ScreenPlay.git
```
### Windows
1. [Download and install MSVC 2017 Community](https://visualstudio.microsoft.com/vs/community/)
1. [Download and install MSVC 2019 Community](https://visualstudio.microsoft.com/vs/community/)
2. [Download and install Win 10 SDK (debugging support. Not included via the MSVC installer)](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)
- Select debugging support during the installation (CDB)
3. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
@ -37,6 +37,9 @@ git clone --recursive https://gitlab.com/kelteseth/ScreenPlay.git
- Qt WebEngine
- Tools
- Qt Creator 4.x CDB Debugger Support
4. Start the vcpkg-install-dependencies.bat for the automatic dependencies management.
### Linux
1. Install dependencies for your distro:
``` bash
@ -65,4 +68,4 @@ sudo zypper install -t pattern devel_basis
- Select the following features to install:
- Qt 5.13.0
- Qt WebEngine
4. Change your default kit: QtCreator -> Options -> Kits -> Select your default kit (Desktop Qt 5.11.2) -> Change c and c++ Compiler to Apple Clang (x86_64)
4. Change your default kit: QtCreator -> Options -> Kits -> Select your default kit (Desktop Qt 5.13.0) -> Change c and c++ Compiler to Apple Clang (x86_64)

View File

@ -2,11 +2,11 @@ TEMPLATE = subdirs
SUBDIRS += \
ScreenPlay/ScreenPlay.pro \
ScreenPlaySDK/ScreenPlaySDK.pro \
ScreenPlayWindow/ScreenPlayWindow.pro \
ScreenPlayWallpaper/ScreenPlayWallpaper.pro \
ScreenPlayWidget/ScreenPlayWidget.pro \
ScreenPlay/ThirdParty/stomt-qt-sdk/sdk/stomt-qt-sdk.pro \
ScreenPlayWindow.depends = ScreenPlaySDK
ScreenPlayWallpaper.depends = ScreenPlaySDK
ScreenPlayWidget.depends = ScreenPlaySDK

View File

@ -123,5 +123,8 @@
<file>qml/Navigation/NavigationItem.qml</file>
<file>qml/Navigation/NavigationWallpaperConfiguration.qml</file>
<file>qml/Common/RippleEffect.qml</file>
<file>qml/Create/FFMPEGPopup.qml</file>
<file>assets/images/FFmpeg_Logo_new.svg</file>
<file>assets/icons/baseline-done-24px.svg</file>
</qresource>
</RCC>

View File

@ -31,6 +31,7 @@ SOURCES += main.cpp \
src/create.cpp
TRANSLATIONS = translations/ScreenPlay_en.ts \
translations/ScreenPlay_de.ts
@ -65,11 +66,33 @@ CONFIG(debug, debug|release) {
install_it.files += assets/templates/config.json \
assets/icons/favicon.ico
INCLUDEPATH += $$PWD/../Common/vcpkg/installed/x64-windows/include
DEPENDPATH += $$PWD/../Common/vcpkg/installed/x64-windows/include
win32 {
RC_ICONS += favicon.ico
LIBS += -L$$PWD/../Common/vcpkg/installed/x64-windows/lib/ -llibzippp
CONFIG(debug, debug|release) {
install_it.files += $$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/zip.dll \
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/zlibd1.dll \
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/libzippp.dll \
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/bz2d.dll \
} else {
install_it.files += $$PWD/../Common/vcpkg/installed/x64-windows/bin/zip.dll \
$$PWD/../Common/vcpkg/installed/x64-windows/bin/zlib1.dll \
$$PWD/../Common/vcpkg/installed/x64-windows/bin/libzippp.dll \
$$PWD/../Common/vcpkg/installed/x64-windows/bin/bz2.dll \
}
LIBS += -luser32
install_it.files += \
Common/vcpkg/packages/openssl-windows_x64-windows/bin/libeay32.dll \
Common/vcpkg/packages/openssl-windows_x64-windows/bin/ssleay32.dll \
$$PWD/ThirdParty/OpenSSL/libcrypto-1_1-x64.dll \
$$PWD/ThirdParty/OpenSSL/libssl-1_1-x64.dll \
}

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1d9286a9a225746890acf1325dbe24301536cbbe370c28467bb63918da07beb1
size 3407360

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7b8544110ad44015fef87135a02edce8aa5084f6468532574a89556767490bb
size 2278400

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c1917eb05675a807fe05cc89c0cab05911474dbc8883faa16cd1cb34086c3944
size 681472

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9d1943ac0ec73f1bf954fcaa631ec322a23ab2af7e65af5c31bf90e45cae48a7
size 361984

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:78a3199769a97d122d30722e52c789066be5eee5c817c3b332c8fc3a3d08c6a8
size 47339168

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d663cad0911bce9f287b1ebad8964ba3e4672b6107563c6a25995993daede1dd
size 1926324

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:65ca937e920731f51910f29fb8630d32b38df31a544f6dfee23dcb21e325ebc6
size 7763628

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29d7257882f656a5783cf64393eb717b78e7aceff053b437da6ab19ec44fd897
size 6585348

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:45500b2634e8f720ce2c824dc4066d7f23d403bf456f95f3e6cedc60a6687f4f
size 389200

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:51e735ec4a2ee1ff27a2f378ab1ca622c6e06dba3bb9422055b8ef66f3e35999
size 140948

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93d037bcc9bcdf01f0e10b14353563a14f95211cd53141a4fcf98ce5f0d0e98e
size 371664

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3b881a81789a6e67972bc050ef283390c480454423b715a110764992d922b8ae
size 817308

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a7110752e06808b95b6bb2c7b3d942db8c24c0f78d43f2aa791638c51fcc8846
size 47203328

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:582f18877acfca1268e7cf41e29f99404c320aa16080867737e15bf003f3c0d2
size 2429440

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9ab4e97a614ff35ac8cbf62627fa81305f30130813d6f60498175d3afea85d76
size 7006208

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c3218078110b6a25ee1fb2f3516b71c526481fff983798f72b37610d9cef03d
size 6114304

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5996ffbd137a0160bbd57e36f936f0a54c6c43e6ad7633aa53313fb62413cfb9
size 653824

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:456ca0e5c5171fa8f77fb5a4c3e7160476e40371e81700fe4ad41ebe6897e5a6
size 298496

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a4bcc94c8d74a86d54e1591d8265adb275234e7bcc5266e3f3c9edffec2bf64c
size 152576

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d0e1a4e8c533f1831f1be0ec74c167bce5d3c250fb505353baebce94c0e2d153
size 169472

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b58109994387057cb81e65698dd81b8548885cdd117026c605deec3053e541f4
size 126976

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a431dbf49e4e0011da8cb41fc675548cf232b41ac97a225c5d9d06026760eb5d
size 376832

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:98077b3c63449974711ba2573f643252ac50cbced212b4aa477ff75fa1d3e787
size 537600

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/></svg>

After

Width:  |  Height:  |  Size: 188 B

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="224.44334" height="60.186737" viewBox="0 0 224.44334 60.186738" version="1.1">
<defs>
<radialGradient id="a" gradientUnits="userSpaceOnUse" cy="442.72311" cx="-122.3936" gradientTransform="matrix(1,0,0,-1,134.4463,453.7334)" r="29.5804">
<stop stop-color="#fff" offset="0"/>
<stop stop-color="#007808" offset="1"/>
</radialGradient>
</defs>
<g>
<polygon points="0.511 12.364 0.511 5.078 5.402 6.763 5.402 13.541" fill="#0b4819"/>
<polygon points="4.455 42.317 4.455 15.226 9.13 16.215 9.13 41.393" fill="#0b4819"/>
<polygon points="27.321 5.066 15.306 18.846 15.306 24.71 33.126 4.617 61.351 2.432 19.834 45.706 25.361 45.997 55.516 15.154 55.516 44.305 52.166 47.454 60.662 47.913 60.662 55.981 34.012 53.917 47.597 40.738 47.597 34.243 28.175 53.465 4.919 51.667 42.222 11.55 36.083 11.882 9.13 41.393 9.13 16.215 11.683 13.201 5.402 13.541 5.402 6.763" fill="#105c80"/>
<polygon points="4.455 15.226 7.159 11.971 11.683 13.201 9.13 16.215" fill="#0b4819"/>
<polygon points="11.004 18.039 15.306 18.846 15.306 24.71 11.004 24.358" fill="#084010"/>
<polygon points="15.82 47.006 19.834 45.706 25.361 45.997 21.714 47.346" fill="#0c541e"/>
<polygon points="23.808 3.106 27.321 5.066 15.306 18.846 11.004 18.039" fill="#1a5c34"/>
<polygon points="11.004 24.358 30.022 2.58 33.126 4.617 15.306 24.71" fill="#0b4819"/>
<polygon points="33.195 10.432 36.083 11.882 9.13 41.393 4.455 42.317" fill="#1a5c34"/>
<polygon points="0 53.344 39.798 10.042 42.222 11.55 4.919 51.667" fill="#0b4819"/>
<polygon points="45.597 34.677 47.597 34.243 28.175 53.465 24.721 55.437" fill="#1a5c34"/>
<polygon points="45.597 41.737 45.597 34.677 47.597 34.243 47.597 40.738" fill="#0b4819"/>
<polygon points="30.973 55.965 45.597 41.737 47.597 40.738 34.012 53.917" fill="#0b4819"/>
<polygon points="54.168 45.648 50.538 49.059 52.166 47.454 55.516 44.305" fill="#13802d"/>
<polygon points="21.714 47.346 54.168 13.9 55.516 15.154 25.361 45.997" fill="#0b4819"/>
<polygon points="54.168 13.9 55.516 15.154 55.516 44.305 54.168 45.648" fill="#084010"/>
<polygon points="59.759 49.604 60.662 47.913 60.662 55.981 59.759 58.403" fill="#084010"/>
<polygon points="60.507 0 61.351 2.432 19.834 45.706 15.82 47.006" fill="#1a5c34"/>
<polygon points="23.808 3.106 11.004 18.039 11.004 24.358 30.022 2.58 60.507 0 15.82 47.006 21.714 47.346 54.168 13.9 54.168 45.648 50.538 49.059 59.759 49.604 59.759 58.403 30.973 55.965 45.597 41.737 45.597 34.677 24.721 55.437 0 53.344 39.798 10.042 33.195 10.432 4.455 42.317 4.455 15.226 7.159 11.971 0.511 12.364 0.511 5.078" fill="url(#a)"/>
</g>
<g transform="matrix(2.6160433,0,0,2.6160433,70,-145)">
<polygon points="2.907 66.777 6.825 66.777 6.825 69.229 2.907 69.229 2.907 74.687 0.797 74.687 0.797 74.688 0.797 61.504 8.218 61.504 8.218 63.965 2.907 63.965"/>
<polygon points="11.13 66.777 15.049 66.777 15.049 69.229 11.13 69.229 11.13 74.687 9.021 74.687 9.021 74.688 9.021 61.504 16.442 61.504 16.442 63.965 11.13 63.965"/>
<path d="m19.69 69.063v5.625h-2.461v-8.534l2.461-0.264v0.782c0.551-0.517 1.254-0.773 2.109-0.773 1.113 0 1.963 0.337 2.549 1.011 0.645-0.674 1.611-1.011 2.9-1.011 1.113 0 1.963 0.337 2.549 1.011 0.586 0.675 0.879 1.45 0.879 2.329v5.449h-2.461v-4.834c0-0.586-0.132-1.04-0.396-1.362-0.264-0.321-0.691-0.491-1.283-0.51-0.486 0.035-0.908 0.357-1.266 0.967-0.029 0.183-0.044 0.366-0.044 0.555v5.186h-2.461v-4.834c0-0.586-0.132-1.04-0.396-1.362-0.264-0.321-0.689-0.492-1.281-0.511-0.539 0.034-1.005 0.394-1.398 1.08z"/>
<path d="m31.913 78.379v-12.225l2.461-0.264v0.703c0.656-0.47 1.301-0.703 1.934-0.703 1.348 0 2.417 0.438 3.208 1.317 0.791 0.88 1.187 1.904 1.187 3.076s-0.396 2.197-1.187 3.076-1.86 1.318-3.208 1.318c-0.879-0.06-1.523-0.296-1.934-0.712v4.421l-2.461-0.007zm2.461-8.885v1.425c0.117 0.983 0.732 1.562 1.846 1.73 1.406-0.111 2.197-0.841 2.373-2.188-0.059-1.642-0.85-2.49-2.373-2.55-1.114 0.176-1.729 0.704-1.846 1.583z"/>
<path d="m41.094 70.293c0-1.289 0.41-2.345 1.23-3.164 0.82-0.82 1.875-1.23 3.164-1.23s2.314 0.41 3.076 1.23c0.762 0.819 1.143 1.875 1.143 3.164v0.879h-6.064c0.059 0.469 0.264 0.835 0.615 1.099s0.762 0.396 1.23 0.396c0.82 0 1.553-0.233 2.197-0.702l1.406 1.405c-0.645 0.879-1.846 1.318-3.604 1.318-1.289 0-2.344-0.41-3.164-1.23s-1.229-1.875-1.229-3.165zm5.625-1.977c-0.352-0.264-0.762-0.396-1.23-0.396s-0.879 0.132-1.23 0.396-0.527 0.63-0.527 1.099h3.516c-0.002-0.469-0.178-0.835-0.529-1.099z"/>
<path d="m59.037 66.163v7.822c0 1.23-0.366 2.259-1.099 3.085s-1.655 1.263-2.769 1.311l-0.527 0.053c-1.699-0.035-3.018-0.521-3.955-1.459l1.143-1.318c0.645 0.47 1.427 0.732 2.347 0.791 0.938 0 1.572-0.22 1.902-0.659 0.332-0.438 0.497-0.923 0.497-1.449v-0.439c-0.656 0.527-1.418 0.791-2.285 0.791-1.348 0-2.358-0.396-3.032-1.187s-1.011-1.86-1.011-3.208c0-1.289 0.366-2.345 1.099-3.164 0.733-0.82 1.772-1.23 3.12-1.23 0.996 0.06 1.699 0.325 2.109 0.8v-0.8l2.461 0.26zm-2.461 4.921v-1.424c-0.117-0.983-0.732-1.562-1.846-1.73-1.465 0.053-2.256 0.782-2.373 2.188 0.059 1.642 0.85 2.49 2.373 2.55 1.114-0.177 1.729-0.705 1.846-1.584z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -37,10 +37,10 @@ int main(int argc, char* argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setOrganizationName("Kelteseth");
QGuiApplication::setOrganizationName("ScreenPlay");
QGuiApplication::setOrganizationDomain("screen-play.app");
QGuiApplication::setApplicationName("ScreenPlay");
QGuiApplication::setApplicationVersion("0.2.0");
QGuiApplication::setApplicationVersion("0.3.0");
QGuiApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false);
@ -52,7 +52,6 @@ int main(int argc, char* argv[])
// Qt < 6.0 needs this init QtWebEngine
QtWebEngine::initialize();
QMLUtilities qmlUtil;
auto installedListModel = make_shared<InstalledListModel>();
auto installedListFilter = make_shared<InstalledListFilter>(installedListModel);
auto monitorListModel = make_shared<MonitorListModel>();
@ -72,6 +71,8 @@ int main(int argc, char* argv[])
settings->loadActiveProfiles();
QQmlApplicationEngine mainWindowEngine;
QMLUtilities qmlUtil { mainWindowEngine.networkAccessManager() };
mainWindowEngine.rootContext()->setContextProperty("screenPlay", &screenPlay);
mainWindowEngine.rootContext()->setContextProperty("screenPlayCreate", &create);
mainWindowEngine.rootContext()->setContextProperty("utility", &qmlUtil);

View File

@ -35,6 +35,7 @@ ApplicationWindow {
pageLoaderWorkshop.visible = false
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
sidebar.state = "inactive"
pageLoaderCreate.item.checkFFMPEG()
} else if (name === "Workshop") {
bg.state = "init"
pageLoader.visible = false
@ -114,6 +115,22 @@ ApplicationWindow {
id: sti
visible: true
iconSource: "qrc:/assets/icons/favicon.ico"
tooltip: qsTr("ScreenPlay - Double click to change you settings.")
onActivated:{
switch(reason){
case SystemTrayIcon.Unknown:
break;
case SystemTrayIcon.Context:
break;
case SystemTrayIcon.DoubleClick:
window.show()
break;
case SystemTrayIcon.Trigger:
break;
case SystemTrayIcon.MiddleClick:
break;
}
}
menu: Menu {
MenuItem {
@ -190,7 +207,6 @@ ApplicationWindow {
Loader {
id: pageLoaderCreate
visible: false
asynchronous: true
anchors {
top: nav.bottom
right: parent.right
@ -215,7 +231,6 @@ ApplicationWindow {
target: pageLoader.item
ignoreUnknownSignals: true
property bool ignoreWorkshopBanner: false
onSetSidebarActive: {
if (active) {
@ -225,39 +240,6 @@ ApplicationWindow {
}
}
onSetSidebaractiveItem: {
if ((type === "video")) {
if (sidebar.activeScreen == screenId
&& sidebar.state == "active") {
sidebar.state = "inactive"
} else {
sidebar.state = "active"
}
} else if (type === "widget") {
if (sidebar.activeScreen == screenId
&& sidebar.state == "activeWidget") {
sidebar.state = "inactive"
} else {
sidebar.state = "activeWidget"
}
} else if (type === "qmlScene") {
if (sidebar.activeScreen == screenId
&& sidebar.state == "activeScene") {
sidebar.state = "inactive"
} else {
sidebar.state = "activeScene"
}
} else if (type === "html") {
if (sidebar.activeScreen == screenId
&& sidebar.state == "activeScene") {
sidebar.state = "inactive"
} else {
sidebar.state = "activeScene"
}
}
sidebar.activeScreen = screenId
sidebar.type = type
}
onSetNavigationItem: {
if (pos === 0) {
nav.onPageChanged("Create")

View File

@ -1,5 +1,4 @@
import QtQuick 2.12
import QtGraphicalEffects 1.0
import QtQuick.Particles 2.0
@ -19,6 +18,11 @@ Item {
id: bgCommunity
anchors.fill: parent
}
Rectangle {
id: bgWorkshop
color: "#161C1D"
anchors.fill: parent
}
property var myDate: new Date()
@ -51,6 +55,10 @@ Item {
target: bgCommunity
opacity: 0
}
PropertyChanges {
target: bgWorkshop
opacity: 0
}
},
State {
name: "create"
@ -62,6 +70,10 @@ Item {
target: bgCommunity
opacity: 0
}
PropertyChanges {
target: bgWorkshop
opacity: 0
}
},
State {
name: "community"
@ -73,42 +85,46 @@ Item {
target: bgCommunity
opacity: 1
}
PropertyChanges {
target: bgWorkshop
opacity: 0
}
},
State {
name: "workshop"
PropertyChanges {
target: colorShaderCreate
shaderOpacity: 0
}
PropertyChanges {
target: bgCommunity
opacity: 0
}
PropertyChanges {
target: bgWorkshop
opacity: 1
}
}
]
transitions: [
Transition {
from: "init"
to: "create"
PropertyAnimation {
target: colorShaderCreate
property: "shaderOpacity"
duration: 400
easing.type: Easing.OutQuart
}
},
Transition {
from: "create"
from: "*"
to: "*"
PropertyAnimation {
targets: [bgCommunity, bgWorkshop]
property: "opacity"
duration: 400
easing.type: Easing.InOutQuart
}
PropertyAnimation {
target: colorShaderCreate
property: "shaderOpacity"
duration: 0
}
},
Transition {
from: "*"
to: "community"
PropertyAnimation {
target: bgCommunity
property: "opacity"
duration: 400
easing.type: Easing.InOutQuart
}
}
]
}

View File

@ -30,7 +30,7 @@ Item {
state: "nothingSelected"
property string imageSource
property alias placeHolderText: txtPlaceholder.text
onImageSourceChanged: {
if (imageSource === "") {
@ -98,6 +98,24 @@ Item {
}
}
Text {
id: txtPlaceholder
clip: true
font.pointSize: 12
font.family: "Roboto"
wrapMode: Text.WordWrap
color: Material.color(Material.Grey)
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
anchors {
top: parent.top
left: imgWrapper.right
right: btnClear.left
bottom: parent.bottom
margins: 10
}
}
Text {
id: txtName
clip: true
@ -147,7 +165,7 @@ Item {
id: fileDialog
title: "Please choose a file"
fileMode: FileDialog.OpenFile
nameFilters: []
nameFilters: ["Images (*.png *.jpg)"]
onAccepted: {
imageSource = fileDialog.file
txtName.text = fileDialog.file.toString().replace(/^.*[\\\/]/,
@ -164,6 +182,10 @@ Item {
opacity: 1
anchors.topMargin: 5
}
PropertyChanges {
target: txtPlaceholder
opacity: 0
}
},
State {
name: "nothingSelected"
@ -186,6 +208,12 @@ Item {
duration: 300
easing.type: Easing.OutQuart
}
PropertyAnimation {
target: txtPlaceholder
property: "opacity"
duration: 300
easing.type: Easing.OutQuart
}
}
]
}

View File

@ -12,7 +12,7 @@ Item {
anchors.fill: parent
property alias radius: mask.radius
property color color: "#de000000"
property color color: "orange"
property var target
property int duration: 600
@ -77,7 +77,7 @@ Item {
NumberAnimation {
target: ink
property: "opacity"
from: 0.25
from: 0.8
to: 0
duration: control.duration
}

View File

@ -1,10 +1,11 @@
import QtQuick 2.12
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Particles 2.0
import QtGraphicalEffects 1.0
import ScreenPlay.Create 1.0
import ScreenPlay.QMLUtilities 1.0
import "Wizards/CreateWallpaper"
@ -13,7 +14,27 @@ Item {
anchors.fill: parent
state: "out"
Component.onCompleted: create.state = "in"
Component.onCompleted: {
create.state = "in"
}
function checkFFMPEG(){
if(!utility.ffmpegAvailable){
ffmpegPopup.open()
}
}
FFMPEGPopup {
id: ffmpegPopup
anchors.centerIn: create
closePolicy: Popup.NoAutoClose
focus: true
modal: true
parent: create
}
property url activeVideoFile: ""
property url activeFolder: ""
@ -364,7 +385,7 @@ Item {
}
}
NumberAnimation {
PropertyAnimation {
target: footer
property: "anchors.bottomMargin"
duration: 400
@ -376,7 +397,7 @@ Item {
to: "new"
reversible: true
NumberAnimation {
PropertyAnimation {
target: footer
property: "anchors.bottomMargin"
duration: 400

View File

@ -72,7 +72,7 @@ Item {
}
Button {
text: qsTr("Import video")
text: utility.ffmpegAvailable ? qsTr("Import video") : qsTr("FFMPEG Needed for import")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
@ -83,13 +83,14 @@ Item {
icon.source: "qrc:/assets/icons/icon_upload.svg"
icon.color: "white"
icon.width: 16
enabled: utility.ffmpegAvailable
icon.height: 16
onClicked: fileDialogImportVideo.open()
}
FileDialog {
id: fileDialogImportVideo
nameFilters: ["Video files (*.webm)"]
onAccepted: {
videoImportConvertFileSelected(
fileDialogImportVideo.currentFile)
@ -244,7 +245,7 @@ Item {
icon.width: 16
icon.height: 16
onClicked: {
utility.requestNavigation("Workshop")
}
}
}

View File

@ -3,9 +3,8 @@ import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
Item {
id:createWidget
id: createWidget
state: "out"
Component.onCompleted: state = "in"
signal buttonPressed(var type, var title, var iconSource)
@ -20,7 +19,7 @@ Item {
color: "white"
font.pointSize: 21
font.family: "Roboto"
font.weight: Font.Thin
}
@ -52,14 +51,14 @@ Item {
id: txtExamples
text: qsTr("Examples Widgets and Scenes")
font.family: "Roboto"
font.pointSize: 16
color: "white"
anchors {
top: btnCreateEmptyWidget.bottom
topMargin: 30
left:parent.left
left: parent.left
leftMargin: 30
}
}
@ -75,7 +74,7 @@ Item {
CreateWidgetButton {
id: btnEmpty1
text: qsTr("Simple clock widget")
buttonActive: true
animOffset: 150
state: createWidget.state
imgSource: "qrc:/assets/icons/icon_time.svg"
@ -86,7 +85,7 @@ Item {
CreateWidgetButton {
id: btnEmpty2
text: qsTr("Musik scene wallpaper visualizer")
buttonActive: true
animOffset: 200
state: createWidget.state
imgSource: "qrc:/assets/icons/icon_library_music.svg"
@ -98,7 +97,7 @@ Item {
id: btnEmpty3
text: qsTr("Changing scene wallpaper via unsplash.com")
imgSource: "qrc:/assets/icons/icon_scene.svg"
buttonActive: true
animOffset: 250
state: createWidget.state
onClicked: {
@ -164,6 +163,16 @@ Item {
to: "in"
reversible: true
ScriptAction {
script: {
if (state === "out") {
btnEmpty1.state = "out"
btnEmpty2.state = "out"
btnEmpty3.state = "out"
}
}
}
PropertyAnimation {
target: txtCreate
properties: "opacity,anchors.topMargin"
@ -187,14 +196,8 @@ Item {
]
}
/*##^## Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -12,12 +12,12 @@ Item {
Component.onCompleted: btnEmpty.state = "in"
property int animOffset: 0
property string text
signal clicked
property bool buttonActive: true
property bool buttonActive: false
property string imgSource: "qrc:/assets/icons/icon_library_music.svg"
signal clicked
RectangularGlow {
id: effect
anchors {
@ -52,6 +52,7 @@ Item {
height: 30
sourceSize: Qt.size(30, 30)
source: imgSource
opacity: buttonActive ? 1 : .25
anchors {
left: parent.left
leftMargin: 20
@ -61,6 +62,7 @@ Item {
ColorOverlay {
color: "gray"
source: imgIcon
opacity: buttonActive ? 1 : .25
anchors.fill: imgIcon
}
@ -68,7 +70,7 @@ Item {
id: name
text: btnEmpty.text
font.family: "Roboto"
opacity: buttonActive ? 1 : .25
font.pointSize: 14
color: "gray"
anchors {
@ -78,11 +80,10 @@ Item {
}
}
Text {
text: ">"
font.family: "Roboto"
font.pointSize: 18
opacity: buttonActive ? 1 : .25
color: "#b9b9b9"
anchors {
right: parent.right
@ -182,14 +183,14 @@ Item {
ParallelAnimation {
ParallelAnimation {
NumberAnimation {
PropertyAnimation {
target: bg
property: "opacity"
duration: 400
easing.type: Easing.InOutQuart
}
NumberAnimation {
PropertyAnimation {
target: bg
property: "anchors.topMargin"
easing.type: Easing.InOutQuart
@ -200,7 +201,7 @@ Item {
PauseAnimation {
duration: 200
}
NumberAnimation {
PropertyAnimation {
target: effect
property: "opacity"
duration: 400

View File

@ -0,0 +1,341 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Particles 2.0
import QtGraphicalEffects 1.0
import ScreenPlay.Create 1.0
import ScreenPlay.QMLUtilities 1.0
import "Wizards/CreateWallpaper"
Popup {
id: ffmpegPopup
height: 600
padding: 30
width: 900
Connections {
target: utility
onAquireFFMPEGStatusChanged: {
switch (aquireFFMPEGStatus) {
case QMLUtilities.Init:
break
case QMLUtilities.Download:
btnNotNow.enabled = false
btnDownload.enabled = false
busyIndicator.running = true
txtStatus.text = qsTr("Begin downloading FFMPEG")
break
case QMLUtilities.DownloadFailed:
btnNotNow.enabled = true
txtStatus.text = qsTr("FFMPEG download failed")
busyIndicator.running = false
break
case QMLUtilities.DownloadSuccessful:
txtStatus.text = qsTr("FFMPEG download successful")
break
case QMLUtilities.Extracting:
txtStatus.text = qsTr("Extracting FFMPEG")
break
case QMLUtilities.ExtractingFailedReadFromBuffer:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR extracting ffmpeg from RAM")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFMPEG:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR extracing ffmpeg")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFMPEGSave:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR saving FFMPEG to disk")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFPROBE:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR extracing FFPROBE")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFPROBESave:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR saving FFPROBE to disk")
busyIndicator.running = false
break
case QMLUtilities.ExtractingSuccessful:
txtStatus.text = qsTr("Extraction successful")
break
case QMLUtilities.FinishedSuccessful:
txtStatus.text = qsTr("All done and ready to go!")
busyIndicator.running = false
column.state = "finishedSuccessful"
utility.setFfmpegAvailable(true)
break
}
}
}
Dialog {
id: closeDialog
title: qsTr("You cannot create Wallper without FFMPEG")
standardButtons: Dialog.Ok | Dialog.Cancel
onAccepted: closeDialog.close()
onRejected: ffmpegPopup.close()
anchors.centerIn: Overlay.overlay
closePolicy: Popup.NoAutoClose
focus: true
height: 200
modal: true
width: 300
}
ColumnLayout {
id: column
anchors.fill: parent
Text {
id: txtDownloadFFMPEG
text: qsTr("Before we can start creating content you need to download FFMPEG")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 16
height: 50
Layout.fillWidth: true
color: "gray"
font.family: "Roboto"
}
Rectangle {
id: name
Layout.fillHeight: true
Layout.fillWidth: true
color: "#eeeeee"
Item {
width: parent.width * .33
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
}
Image {
id: imgFFMPEGLogo
source: "qrc:/assets/images/FFmpeg_Logo_new.svg"
width: sourceSize.width
height: sourceSize.height
anchors {
horizontalCenter: parent.horizontalCenter
margins: 20
top: parent.top
}
}
BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
running: false
}
Text {
id: txtStatus
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 14
height: 50
Layout.fillWidth: true
color: Material.color(Material.Orange)
font.family: "Roboto"
wrapMode: Text.WordWrap
anchors {
top: busyIndicator.bottom
topMargin: 20
right: parent.right
left: parent.left
}
}
}
Item {
width: parent.width * .66
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
}
Flickable {
anchors.fill: parent
clip: true
contentHeight: txtExpander.paintedHeight + 100
contentWidth: parent.width
ScrollBar.vertical: ScrollBar {
snapMode: ScrollBar.SnapOnRelease
policy: ScrollBar.AlwaysOn
}
MouseArea {
anchors.fill: parent
id: maHoverEffect
}
Text {
id: txtExpander
anchors {
fill: parent
margins: 30
leftMargin: 0
}
color: "#626262"
height: txtExpander.paintedHeight
wrapMode: Text.WordWrap
font.pointSize: 12
font.family: "Roboto"
onLinkHovered: maHoverEffect.cursorShape = Qt.PointingHandCursor
onLinkActivated: Qt.openUrlExternally(link)
linkColor: Material.color(Material.LightBlue)
text: qsTr("<b>Why do we bother you with this?</b>
<br><br> Well its because of <b>copyright</b> and many many <b>patents</b>.
" + "Files like .mp4 or .webm are containers for video and audio. Every audio
" + "and video file is encoded with a certain codec. These can be open sour
ce" + "and free to use like <a href='https://wikipedia.org/wiki/VP8'>VP8</a> and the newer <a href='https://wikipedia.org/wiki/VP9'>VP9</a> (the one YouTube uses for their web
ms)" + "but there are also some proproatary ones like <a href='https://wikipedia.org/wiki/H.264/MPEG-4_AVC'>h264</a> and the successor <a href='https://wikipedia.org/wiki/High_Efficiency_Video_Coding'>h265</a>." + "
<br>
<br>
" + "\n\n We as software developer now need to deal with stuff like this in a field we
" + "are do not have any expertise in. The desicion to enable only free codecs for content was
" + "an easy one but we still need to provide a way for our user to import wallpape
r " + "without a hassle. We do not provide <a href='https://ffmpeg.org/'>FFMPEG</a> f
or " + "converting video and audio with ScreenPlay because we are not allowed to. We let the user download <a href='https://ffmpeg.org/'>FFMPEG</a> wich " + "is perfectly fine!
<br>
Sorry for this little inconvenience :)" + "
<br>
<br>
<center>
<b>
IF YOU DO NOT HAVE A INTERNET CONNECT YOU CAN SIMPLY PUT FFMPEG AND FFPROBE
IN THE SAME FOLDER AS YOUR SCREENPLAY EXECUTABLE!
</b>
<br>
<br>
This is usually:
<br> C:\\Program Files (x86)\\Steam\\steamapps\\common\\ScreenPlay
<br>
if you installed ScreenPlay via Steam!
</center>
<br>
<br>
" + "<b>~ Kelteseth | Elias Steurer</b>")
}
}
}
}
RowLayout {
spacing: 20
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
Button {
id:btnDownload
text: qsTr("Download FFMPEG")
onClicked: utility.downloadFFMPEG()
highlighted: true
Layout.fillWidth: true
}
Button {
id:btnNotNow
text: qsTr("Not now!")
onClicked: closeDialog.open()
Layout.fillWidth: true
}
}
states: [
State {
name: "finishedSuccessful"
PropertyChanges {
target: column
opacity: 0
enabled: false
}
PropertyChanges {
target: successWrapper
opacity: 1
enabled: true
}
}
]
transitions: [
Transition {
from: "*"
to: "finishedSuccessful"
PropertyAnimation {
target: successWrapper
property: "opacity"
duration: 250
}
}
]
}
Item {
id: successWrapper
anchors.fill: parent
anchors.margins: 30
opacity: 0
enabled: false
Text {
id: txtDownloadFFMPEGComplete
text: qsTr("You can now start creating content!")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 16
height: 50
Layout.fillWidth: true
color: "gray"
font.family: "Roboto"
anchors {
horizontalCenter: parent.horizontalCenter
top:parent.top
topMargin: 30
}
}
Image {
id: imgOk
fillMode: Image.PreserveAspectFit
source: "qrc:/assets/icons/baseline-done-24px.svg"
width: 180
height: width
sourceSize: Qt.size(width,width)
anchors.centerIn: parent
smooth: true
}
ColorOverlay {
anchors.fill: imgOk
source: imgOk
color: Material.color(Material.LightGreen)
}
Button {
text: qsTr("Start!")
highlighted: true
onClicked: ffmpegPopup.close()
anchors {
horizontalCenter: parent.horizontalCenter
top: imgOk.bottom
margins: 30
}
}
}
}

View File

@ -30,37 +30,40 @@ Item {
target: screenPlayCreate
onCreateWallpaperStateChanged: {
if (state === CreateImportVideo.State.ConvertingPreviewImageFinished) {
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.png"
switch (state) {
case CreateImportVideo.ConvertingPreviewImageFinished:
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.jpg"
imgPreview.visible = true
txtConvert.text = qsTr("Converting Video preview mp4")
}
if (state === CreateImportVideo.State.ConvertingPreviewVideo) {
break
case CreateImportVideo.ConvertingPreviewVideo:
txtConvert.text = qsTr("Generating preview video...")
}
if (state === CreateImportVideo.State.ConvertingPreviewGif) {
break
case CreateImportVideo.ConvertingPreviewGif:
txtConvert.text = qsTr("Generating preview gif...")
}
if (state === CreateImportVideo.State.ConvertingPreviewGifFinished) {
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.gif"
imgPreview.visible = true
imgPreview.playing = true
}
if (state === CreateImportVideo.State.ConvertingAudio) {
break
case CreateImportVideo.ConvertingPreviewGifFinished:
gifPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.gif"
imgPreview.visible = false
gifPreview.visible = true
gifPreview.playing = true
break
case CreateImportVideo.ConvertingAudio:
txtConvert.text = qsTr("Converting Audio...")
}
if (state === CreateImportVideo.State.ConvertingVideo) {
txtConvert.text = qsTr("Converting Video...")
}
if (state === CreateImportVideo.State.Finished) {
break
case CreateImportVideo.ConvertingVideo:
txtConvert.text = qsTr("Converting Video... This can take some time!")
break
case CreateImportVideo.ConvertingVideoError:
txtConvert.text = qsTr("Converting Video ERROR!")
break
case CreateImportVideo.Finished:
txtConvert.text = ""
conversionFinishedSuccessful = true
busyIndicator.running = false
wrapperContent.checkCanSave()
break
}
}
onProgressChanged: {
@ -108,9 +111,16 @@ Item {
left: parent.left
}
AnimatedImage {
Image {
id: imgPreview
asynchronous: true
visible: false
anchors.fill: parent
}
AnimatedImage {
id: gifPreview
asynchronous: true
playing: true
visible: false
anchors.fill: parent
@ -148,7 +158,7 @@ Item {
}
ImageSelector {
id: previewSelector
placeHolderText: qsTr("You can set your own preview image here!")
anchors {
top: imgWrapper.bottom
topMargin: 20
@ -292,10 +302,8 @@ Item {
}
}
/*##^## Designer {
D{i:0;autoSize:true;height:480;width:950}
}
##^##*/

View File

@ -34,14 +34,15 @@ Item {
Connections {
target: screenPlayCreate
onCreateWallpaperStateChanged: {
if (state === CreateImportVideo.State.AnalyseVideoError || state
=== CreateImportVideo.State.ConvertingPreviewGifError || state
=== CreateImportVideo.State.ConvertingPreviewImageError || state
=== CreateImportVideo.State.ConvertingAudioError || state
=== CreateImportVideo.State.AbortCleanupError || state
=== CreateImportVideo.State.CopyFilesError || state
=== CreateImportVideo.State.CreateProjectFileError || state
=== CreateImportVideo.State.CreateTmpFolderError) {
if (state === CreateImportVideo.AnalyseVideoError || state
=== CreateImportVideo.ConvertingVideoError || state
=== CreateImportVideo.ConvertingPreviewGifError || state
=== CreateImportVideo.ConvertingPreviewImageError || state
=== CreateImportVideo.ConvertingAudioError || state
=== CreateImportVideo.AbortCleanupError || state
=== CreateImportVideo.CopyFilesError || state
=== CreateImportVideo.CreateProjectFileError || state
=== CreateImportVideo.CreateTmpFolderError) {
createNew.state = "result"
}
}

View File

@ -7,7 +7,6 @@ Item {
id: pageInstalled
state: "out"
signal setSidebaractiveItem(var screenId, var type)
signal setNavigationItem(var pos)
signal setSidebarActive(var active)
@ -16,6 +15,7 @@ Item {
Component.onCompleted: {
pageInstalled.state = "in"
installedListFilter.sortByRoleType("All")
}
Connections {
@ -166,12 +166,7 @@ Item {
workshopID: screenWorkshopID
itemIndex: index
Connections {
target: delegate
onItemClicked: {
setSidebaractiveItem(screenId, type)
}
}
}
ScrollBar.vertical: ScrollBar {

View File

@ -17,14 +17,13 @@ Item {
property int workshopID: 0
property int itemIndex
property string screenId: ""
signal itemClicked(var screenId, var type)
onTypeChanged: {
if (type === "widget") {
if(type.endsWith("Widget"))
icnType.source = "qrc:/assets/icons/icon_widgets.svg"
} else if (type === "qmlScene") {
icnType.source = "qrc:/assets/icons/icon_code.svg"
}
if(type.endsWith("Wallpaper"))
icnType.source = "qrc:/assets/icons/icon_movie.svg"
}
Component.onCompleted: {
@ -190,19 +189,22 @@ Item {
onEntered: {
if (!hasMenuOpen) {
screenPlayItem.state = "hover"
screenPlayItemImage.state = "hover"
screenPlayItemImage.enter()
}
}
onExited: {
if (!hasMenuOpen) {
screenPlayItem.state = "visible"
screenPlayItemImage.state = "loaded"
screenPlayItemImage.exit()
}
}
onClicked: {
if (mouse.button === Qt.LeftButton) {
itemClicked(screenId, type)
utility.setSidebarItem(screenPlayItem.screenId, screenPlayItem.type.toString())
} else if (mouse.button === Qt.RightButton) {
if (workshopID != 0) {
miWorkshop.enabled = true
@ -289,7 +291,6 @@ Item {
}
PropertyChanges {
target: screenPlayItemWrapper
y: 0
opacity: 1
}
PropertyChanges {
@ -299,28 +300,6 @@ Item {
}
]
transitions: [
Transition {
from: "invisible"
to: "visible"
// PropertyAnimation {
// target: screenPlayItemWrapper
// properties: "y"
// duration: 300
// easing.type: Easing.OutQuart
// }
// OpacityAnimator {
// target: screenPlayItemWrapper
// duration: 500
// easing.type: Easing.OutQuart
// }
// PropertyAnimation {
// target: effect
// property: "opacity"
// duration: 500
// easing.type: Easing.OutQuart
// }
},
Transition {
from: "visible"
to: "hover"

View File

@ -41,6 +41,7 @@ Item {
id: imgGIFPreview
asynchronous: true
playing: false
opacity: 0
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: screenPlayItemImage.sourceImageGIF.trim()
@ -62,6 +63,14 @@ Item {
target: image
opacity: 1
}
},
State {
name: "hover"
PropertyChanges {
target: imgGIFPreview
opacity: 1
}
}
]
@ -76,6 +85,18 @@ Item {
duration: 300
easing.type: Easing.OutQuart
}
},
Transition {
from: "loaded"
to: "hover"
reversible: true
PropertyAnimation {
target: imgGIFPreview
property: "opacity"
duration: 400
easing.type: Easing.OutQuart
}
}
]
}

View File

@ -11,10 +11,52 @@ Item {
width: 400
state: "inactive"
focus: true
property real navHeight
property string type
property string activeScreen
Connections {
target: utility
onSetSidebarItem: {
// Toggle sidebar if clicked on the same content twice
if (activeScreen === screenId && sidebar.state !== "inactive") {
sidebar.state = "inactive"
return
}
activeScreen = screenId
sidebar.type = type
switch (type) {
case "videoWallpaper":
state = "activeScene"
return
case "htmlWallpaper":
state = "activeScene"
return
case "qmlWallpaper":
state = "activeScene"
return
case "godotWallpaper":
state = "activeScene"
return
case "qmlWidget":
state = "activeWidget"
return
case "htmlWidget":
state = "activeWidget"
return
case "standaloneWidget":
state = "activeWidget"
return
}
}
}
MouseArea {
id: mouseAreaHelper
anchors.fill: parent
@ -24,9 +66,8 @@ Item {
onActiveScreenChanged: {
txtHeadline.text = installedListModel.get(activeScreen).screenTitle
image.source = Qt.resolvedUrl(
installedListModel.absoluteStoragePath + "/"
+ activeScreen + "/" + installedListModel.get(
activeScreen).screenPreview)
installedListModel.absoluteStoragePath + "/" + activeScreen
+ "/" + installedListModel.get(activeScreen).screenPreview)
}
Item {
@ -161,7 +202,7 @@ Item {
id: txtHeadline
text: qsTr("Headline")
height: 60
font.family: "Roboto"
font.weight: Font.Thin
verticalAlignment: Text.AlignVCenter
@ -182,7 +223,7 @@ Item {
id: txtHeadlineMonitor
text: qsTr("Select a Monitor to display the content")
height: 50
horizontalAlignment: Qt.AlignHCenter
font.family: "Roboto"
font.pointSize: 14
@ -236,7 +277,7 @@ Item {
id: txtSliderVolume
text: qsTr("Volume")
height: 30
font.family: "Roboto"
verticalAlignment: Text.AlignVCenter
font.pointSize: 10
@ -291,7 +332,7 @@ Item {
id: txtComboBoxFillMode
text: qsTr("Fill Mode")
height: 30
font.family: "Roboto"
verticalAlignment: Text.AlignVCenter
font.pointSize: 10
@ -347,20 +388,21 @@ Item {
}
onClicked: {
if (type === "video" || type === "qmlScene" || type === "html") {
if (type.endsWith("Wallpaper")) {
screenPlay.createWallpaper(
monitorSelection.activeMonitorIndex, installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get(activeScreen).screenPreview,
(Math.round(sliderVolume.value * 100) / 100),
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
), type)
sidebar.state = "inactive"
} else if (type === "widget" ) {
} else {
screenPlay.createWidget(
installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get(
activeScreen).screenPreview)
}
sidebar.state = "inactive"
}
}
}

View File

@ -96,7 +96,7 @@ Item {
onProjectSettingsListModelFound: {
gridView.model = li
// TODO via states
if (type == "video") {
if (type == "videoWallpaper") {
videoControlWrapper.z = 10
gridView.z = 0
videoControlWrapper.visible = true
@ -116,11 +116,11 @@ Item {
Button {
id: btnRemoveAllWallpaper
text: qsTr("Remove all wallpaper")
text: qsTr("Remove all wallpaper and Widgets")
Material.background: Material.Orange
Material.foreground: "white"
onClicked: {
screenPlay.removeAllWallpaper()
screenPlay.closeAllConnections()
monitors.state = "inactive"
}
@ -254,25 +254,25 @@ Item {
to: "inactive"
reversible: true
NumberAnimation {
PropertyAnimation {
target: background
property: "opacity"
duration: 200
easing.type: Easing.OutQuart
}
NumberAnimation {
PropertyAnimation {
target: monitorsSettingsWrapper
property: "anchors.topMargin"
duration: 200
easing.type: Easing.OutQuart
easing.type: Easing.OutQuad
}
NumberAnimation {
target: monitors
property: "opacity"
duration: 200
easing.type: Easing.OutQuart
easing.type: Easing.OutQuad
}
}
]

View File

@ -40,7 +40,7 @@ Item {
Text {
id: txtAmountActiveWallpapers
text: screenPlaySettings.activeWallpaperCounter
text: screenPlaySettings.activeWallpaperCounter + screenPlaySettings.activeWidgetsCounter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "orange"

View File

@ -15,9 +15,9 @@ Create::Create(const shared_ptr<Settings>& settings, QObject* parent)
, m_settings(settings)
{
qRegisterMetaType<CreateImportVideo::State>();
qRegisterMetaType<CreateImportVideo::ImportVideoState>("CreateImportVideo::ImportVideoState");
qmlRegisterUncreatableType<CreateImportVideo>("ScreenPlay.Create", 1, 0, "CreateImportVideo", "Error only for enums");
qmlRegisterType<Create>("ScreenPlay.Create", 1, 0, "Create");
qmlRegisterType<CreateImportVideo>("ScreenPlay.Create", 1, 0, "CreateImportVideo");
}
// Constructor for the QMLEngine
@ -25,9 +25,9 @@ Create::Create()
: QObject(nullptr)
, m_settings(nullptr)
{
qRegisterMetaType<CreateImportVideo::State>();
qRegisterMetaType<CreateImportVideo::ImportVideoState>("CreateImportVideo::ImportVideoState");
qmlRegisterUncreatableType<ScreenPlay::CreateImportVideo>("ScreenPlay.Create", 1, 0, "CreateImportVideo", "Error only for enums");
qmlRegisterType<Create>("ScreenPlay.Create", 1, 0, "Create");
qmlRegisterType<CreateImportVideo>("ScreenPlay.Create", 1, 0, "CreateImportVideo");
}
void Create::createWallpaperStart(QString videoPath)
@ -41,7 +41,7 @@ void Create::createWallpaperStart(QString videoPath)
auto folderName = QString("_tmp_" + QTime::currentTime().toString()).replace(":", "");
if (!dir.mkdir(folderName)) {
emit createWallpaperStateChanged(CreateImportVideo::State::CreateTmpFolderError);
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CreateTmpFolderError);
emit abortCreateWallpaper();
return;
}
@ -53,6 +53,9 @@ void Create::createWallpaperStart(QString videoPath)
connect(m_createImportVideo, &CreateImportVideo::createWallpaperStateChanged, this, &Create::createWallpaperStateChanged);
connect(m_createImportVideoThread, &QThread::started, m_createImportVideo, &CreateImportVideo::process);
connect(m_createImportVideo, &CreateImportVideo::canceled, this, &Create::abortAndCleanup);
connect(m_createImportVideo, &CreateImportVideo::createWallpaperStateChanged, this, [](CreateImportVideo::ImportVideoState state) {
qDebug() << state;
});
connect(m_createImportVideo, &CreateImportVideo::finished, m_createImportVideoThread, &QThread::quit);
connect(m_createImportVideo, &CreateImportVideo::finished, m_createImportVideo, &QObject::deleteLater);
connect(m_createImportVideoThread, &QThread::finished, m_createImportVideoThread, &QObject::deleteLater);
@ -66,58 +69,74 @@ void Create::saveWallpaper(QString title, QString description, QString filePath,
filePath.remove("file:///");
previewImagePath.remove("file:///");
emit createWallpaperStateChanged(CreateImportVideo::State::CopyFiles);
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CopyFiles);
QFileInfo previewImageFile(previewImagePath);
if (!QFile::copy(previewImagePath, m_workingDir + "/" + previewImageFile.fileName())) {
qDebug() << "Could not copy" << previewImagePath << " to " << m_workingDir + "/" + previewImageFile.fileName();
emit createWallpaperStateChanged(CreateImportVideo::State::CopyFilesError);
return;
if (previewImageFile.exists()) {
if (!QFile::copy(previewImagePath, m_workingDir + "/" + previewImageFile.fileName())) {
qDebug() << "Could not copy" << previewImagePath << " to " << m_workingDir + "/" + previewImageFile.fileName();
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CopyFilesError);
return;
}
}
QFileInfo filePathFile(filePath);
if (!QFile::copy(filePath, m_workingDir + "/" + filePathFile.fileName())) {
qDebug() << "Could not copy" << filePath << " to " << m_workingDir + "/" + filePathFile.fileName();
emit createWallpaperStateChanged(CreateImportVideo::State::CopyFilesError);
return;
if (filePath.endsWith(".webm")) {
if (!QFile::copy(filePath, m_workingDir + "/" + filePathFile.fileName())) {
qDebug() << "Could not copy" << filePath << " to " << m_workingDir + "/" + filePathFile.fileName();
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CopyFilesError);
return;
}
}
emit createWallpaperStateChanged(CreateImportVideo::State::CopyFilesFinished);
emit createWallpaperStateChanged(CreateImportVideo::State::CreateProjectFile);
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CopyFilesFinished);
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CreateProjectFile);
QFile file(m_workingDir + "/project.json");
QJsonObject obj;
obj.insert("description", description);
obj.insert("title", title);
obj.insert("youtube", youtube);
obj.insert("file", "video.webm");
obj.insert("previewGIF", "preview.gif");
obj.insert("previewWEBM", filePathFile.fileName());
obj.insert("preview", previewImageFile.fileName());
obj.insert("type", "video");
QJsonArray arr;
for (QString tmp : tags) {
arr.append(tmp);
// If the input file is a webm we don't need to convert it
if (filePath.endsWith(".webm")) {
obj.insert("file", filePathFile.fileName());
} else {
obj.insert("file", filePathFile.baseName() + ".webm");
}
obj.insert("previewGIF", "preview.gif");
obj.insert("previewWEBM", "preview.webm");
if (previewImageFile.exists()) {
obj.insert("preview", previewImageFile.fileName());
} else {
obj.insert("preview", "preview.jpg");
}
obj.insert("tags", arr);
obj.insert("type", "videoWallpaper");
QJsonArray tagsJsonArray;
for (QString tmp : tags) {
tagsJsonArray.append(tmp);
}
obj.insert("tags", tagsJsonArray);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qDebug() << "Could not open /project.json";
emit createWallpaperStateChanged(CreateImportVideo::State::CreateProjectFileError);
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CreateProjectFileError);
return;
}
QTextStream out(&file);
out.setCodec("UTF-8");
QJsonDocument doc(obj);
out << doc.toJson();
file.close();
emit createWallpaperStateChanged(CreateImportVideo::State::CreateProjectFileFinished);
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::CreateProjectFileFinished);
}
void Create::abortAndCleanup()
{
qWarning() << "Abort and Cleanup!";
if (m_createImportVideo == nullptr || m_createImportVideoThread == nullptr) {
qDebug() << m_createImportVideo << m_createImportVideoThread;
return;
@ -134,7 +153,7 @@ void Create::abortAndCleanup()
if (exportPath.exists()) {
if (!exportPath.removeRecursively()) {
emit createWallpaperStateChanged(CreateImportVideo::State::AbortCleanupError);
emit createWallpaperStateChanged(CreateImportVideo::ImportVideoState::AbortCleanupError);
qWarning() << "Could not delete temp exportPath: " << exportPath;
} else {
qDebug() << "cleanup " << tmpExportPath;

View File

@ -28,8 +28,6 @@
namespace ScreenPlay {
using std::shared_ptr,
std::make_shared;
@ -56,7 +54,7 @@ public:
}
signals:
void createWallpaperStateChanged(CreateImportVideo::State state);
void createWallpaperStateChanged(CreateImportVideo::ImportVideoState state);
void processOutput(QString text);
void progressChanged(float progress);
void abortCreateWallpaper();

View File

@ -8,7 +8,7 @@ namespace ScreenPlay {
class only exsits as long as the user creates a wallpaper and gets
destroyed if the creation was successful or not.
The state get propagated via createWallpaperStateChanged(CreateImportVideo::State state);
The state get propagated via createWallpaperStateChanged(ImportVideoState state);
\todo
- Maybe: Replace with QThread to avoid running QCoreApplication::processEvents();?
@ -28,13 +28,6 @@ CreateImportVideo::CreateImportVideo(const QString& videoPath, const QString& ex
void CreateImportVideo::process()
{
qDebug() << "start converting video in thread: " << QThread::currentThreadId();
auto cleanup = qScopeGuard([this] {
qDebug() << "ABORT";
this->requestInterruption();
emit canceled();
});
if (!createWallpaperInfo())
return;
@ -42,13 +35,19 @@ void CreateImportVideo::process()
if (!createWallpaperVideoPreview())
return;
if (!createWallpaperImagePreview())
return;
if (!createWallpaperGifPreview())
return;
if (!createWallpaperVideo())
return;
if (!extractWallpaperAudio())
return;
emit createWallpaperStateChanged(CreateImportVideo::State::Finished);
emit createWallpaperStateChanged(ImportVideoState::Finished);
}
bool CreateImportVideo::createWallpaperInfo()
@ -71,7 +70,7 @@ bool CreateImportVideo::createWallpaperInfo()
#endif
pro.data()->start();
emit createWallpaperStateChanged(CreateImportVideo::State::AnalyseVideo);
emit createWallpaperStateChanged(ImportVideoState::AnalyseVideo);
while (!pro.data()->waitForFinished(100)) {
if (QThread::currentThread()->isInterruptionRequested()) {
qDebug() << "Interrupt thread";
@ -83,13 +82,13 @@ bool CreateImportVideo::createWallpaperInfo()
}
QCoreApplication::processEvents();
}
emit createWallpaperStateChanged(CreateImportVideo::State::AnalyseVideoFinished);
emit createWallpaperStateChanged(ImportVideoState::AnalyseVideoFinished);
QJsonObject obj;
QJsonParseError err;
QJsonDocument doc = QJsonDocument::fromJson(pro.data()->readAll(), &err);
if (err.error != QJsonParseError::NoError) {
emit processOutput("Error parsing ffmpeg json output");
emit createWallpaperStateChanged(CreateImportVideo::State::AnalyseVideoError);
emit createWallpaperStateChanged(ImportVideoState::AnalyseVideoError);
return false;
}
@ -98,13 +97,14 @@ bool CreateImportVideo::createWallpaperInfo()
// Get video length
QJsonObject objFormat = obj.value("format").toObject();
qDebug() << objFormat;
bool okParseDuration = false;
auto tmpLength = objFormat.value("duration").toVariant().toFloat(&okParseDuration);
if (!okParseDuration) {
qDebug() << "Error parsing video length";
emit processOutput("Error parsing video length");
emit createWallpaperStateChanged(CreateImportVideo::State::AnalyseVideoError);
emit createWallpaperStateChanged(ImportVideoState::AnalyseVideoError);
return false;
}
@ -133,8 +133,8 @@ bool CreateImportVideo::createWallpaperInfo()
}
int framerate = 0;
double value1 = static_cast<double>(avgFrameRateList.at(0).toInt());
double value2 = static_cast<double>(avgFrameRateList.at(1).toInt());
double value1 = avgFrameRateList.at(0).toDouble();
double value2 = avgFrameRateList.at(1).toDouble();
framerate = qCeil(value1 / value2);
m_framerate = framerate;
@ -170,7 +170,7 @@ bool CreateImportVideo::createWallpaperVideoPreview()
#ifdef Q_OS_MACOS
proConvertPreviewMP4.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg");
#endif
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewVideo);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewVideo);
proConvertPreviewWebM.data()->start();
while (!proConvertPreviewWebM.data()->waitForFinished(100)) //Wake up every 100ms and check if we must exit
@ -191,7 +191,7 @@ bool CreateImportVideo::createWallpaperVideoPreview()
QFile previewVideo(m_exportPath + "/preview.webm");
if (!previewVideo.exists() && !(previewVideo.size() > 0)) {
emit processOutput(tmpErr);
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewVideoError);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewVideoError);
return false;
}
}
@ -199,7 +199,7 @@ bool CreateImportVideo::createWallpaperVideoPreview()
//this->processOutput(proConvertPreviewWebM.data()->readAll());
proConvertPreviewWebM.data()->close();
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewVideoFinished);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewVideoFinished);
return true;
}
@ -207,7 +207,7 @@ bool CreateImportVideo::createWallpaperVideoPreview()
bool CreateImportVideo::createWallpaperGifPreview()
{
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewGif);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewGif);
QStringList args;
args.append("-y");
@ -245,14 +245,14 @@ bool CreateImportVideo::createWallpaperGifPreview()
if (!tmpErrGif.isEmpty()) {
QFile previewGif(m_exportPath + "/preview.gif");
if (!previewGif.exists() && !(previewGif.size() > 0)) {
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewGifError);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewGifError);
return false;
}
}
//this->processOutput(proConvertGif.data()->readAll());
proConvertGif.data()->close();
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewGifFinished);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewGifFinished);
return true;
}
@ -260,7 +260,7 @@ bool CreateImportVideo::createWallpaperGifPreview()
bool CreateImportVideo::createWallpaperImagePreview()
{
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewImage);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewImage);
QStringList args;
args.clear();
@ -274,7 +274,7 @@ bool CreateImportVideo::createWallpaperImagePreview()
args.append("1");
args.append("-q:v");
args.append("2");
args.append(m_exportPath + "/preview.png");
args.append(m_exportPath + "/preview.jpg");
QScopedPointer<QProcess> proConvertImage(new QProcess());
proConvertImage.data()->setArguments(args);
@ -301,16 +301,97 @@ bool CreateImportVideo::createWallpaperImagePreview()
}
QString tmpErrImg = proConvertImage.data()->readAllStandardError();
if (!tmpErrImg.isEmpty()) {
QFile previewImg(m_exportPath + "/preview.png");
QFile previewImg(m_exportPath + "/preview.jpg");
if (!previewImg.exists() && !(previewImg.size() > 0)) {
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewImageError);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewImageError);
return false;
}
}
//this->processOutput(proConvertImage.data()->readAll());
proConvertImage.data()->close();
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingPreviewImageFinished);
emit createWallpaperStateChanged(ImportVideoState::ConvertingPreviewImageFinished);
return true;
}
bool CreateImportVideo::createWallpaperVideo()
{
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideo);
if(m_videoPath.endsWith(".webm")){
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoFinished);
if (!QFile::copy(m_videoPath, m_exportPath + "/video.webm")) {
qDebug() << "Could not copy" << m_videoPath << " to " << m_exportPath + "/video.webm";
emit createWallpaperStateChanged(ImportVideoState::CopyFilesError);
return false;
}
return true;
}
QStringList args;
args.clear();
args.append("-hide_banner");
args.append("-y");
args.append("-stats");
args.append("-i");
args.append(m_videoPath);
args.append("-c:v");
args.append("libvpx-vp9");
args.append("-crf");
args.append("30");
args.append("-threads");
args.append("8");
args.append("-slices");
args.append("8");
args.append("-cpu-used");
args.append("4");
args.append("-pix_fmt");
args.append("yuv420p");
args.append("-b:v");
args.append("0");
QFileInfo file(m_videoPath);
QString convertedFileAbsolutePath {m_exportPath +"/"+ file.baseName() +".webm"};
args.append(convertedFileAbsolutePath);
QScopedPointer<QProcess> proConvertVideo(new QProcess());
proConvertVideo.data()->setArguments(args);
#ifdef Q_OS_WIN
proConvertVideo.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg.exe");
#endif
#ifdef Q_OS_MACOS
proConvertImage.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg");
#endif
proConvertVideo.data()->start();
while (!proConvertVideo.data()->waitForFinished(100)) //Wake up every 100ms and check if we must exit
{
if (QThread::currentThread()->isInterruptionRequested()) {
qDebug() << "Interrupt thread";
proConvertVideo.data()->terminate();
if (!proConvertVideo.data()->waitForFinished(1000)) {
proConvertVideo.data()->kill();
}
break;
}
QCoreApplication::processEvents();
}
QString tmpErrImg = proConvertVideo.data()->readAllStandardError();
if (!tmpErrImg.isEmpty()) {
QFile video(convertedFileAbsolutePath);
if (!video.exists() && !(video.size() > 0)) {
qDebug() << convertedFileAbsolutePath << proConvertVideo.data()->readAll();
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoError);
return false;
}
}
proConvertVideo.data()->close();
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoFinished);
return true;
}
@ -318,7 +399,7 @@ bool CreateImportVideo::createWallpaperImagePreview()
bool CreateImportVideo::extractWallpaperAudio()
{
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingAudio);
emit createWallpaperStateChanged(ImportVideoState::ConvertingAudio);
QStringList args;
args.clear();
@ -360,14 +441,14 @@ bool CreateImportVideo::extractWallpaperAudio()
if (!tmpErrImg.isEmpty()) {
QFile previewImg(m_exportPath + "/audio.mp3");
if (!previewImg.exists() && !(previewImg.size() > 0)) {
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingAudioError);
emit createWallpaperStateChanged(ImportVideoState::ConvertingAudioError);
return false;
}
}
//this->processOutput(proConvertAudio.data()->readAll());
proConvertAudio.data()->close();
emit createWallpaperStateChanged(CreateImportVideo::State::ConvertingAudioFinished);
emit createWallpaperStateChanged(ImportVideoState::ConvertingAudioFinished);
return true;
}

View File

@ -11,10 +11,10 @@
#include <QJsonParseError>
#include <QObject>
#include <QProcess>
#include <QScopeGuard>
#include <QString>
#include <QThread>
#include <QtMath>
#include <QScopeGuard>
namespace ScreenPlay {
@ -22,10 +22,17 @@ class CreateImportVideo : public QObject {
Q_OBJECT
public:
CreateImportVideo() {}
CreateImportVideo(QObject* parent = nullptr);
explicit CreateImportVideo(const QString& videoPath, const QString& exportPath, QObject* parent = nullptr);
~CreateImportVideo() {}
enum class State {
QString m_videoPath;
QString m_exportPath;
QString m_format;
int m_length = 0;
int m_framerate = 0;
enum class ImportVideoState {
Idle,
Started,
AnalyseVideo,
@ -43,11 +50,9 @@ public:
ConvertingAudio,
ConvertingAudioFinished,
ConvertingAudioError,
// Oh well... Due to so many patents around video codecs
// the user has to convert the video on his own :(
// ConvertingVideo,
// ConvertingVideoFinished,
// ConvertingVideoError,
ConvertingVideo,
ConvertingVideoFinished,
ConvertingVideoError,
CopyFiles,
CopyFilesFinished,
CopyFilesError,
@ -58,15 +63,10 @@ public:
CreateTmpFolderError,
Finished,
};
Q_ENUM(State)
QString m_videoPath;
QString m_exportPath;
int m_length = 0;
int m_framerate = 0;
Q_ENUM(ImportVideoState)
signals:
void createWallpaperStateChanged(CreateImportVideo::State state);
void createWallpaperStateChanged(CreateImportVideo::ImportVideoState state);
void processOutput(QString text);
void finished();
void canceled();
@ -79,6 +79,9 @@ public slots:
bool createWallpaperVideoPreview();
bool createWallpaperGifPreview();
bool createWallpaperImagePreview();
bool createWallpaperVideo();
bool extractWallpaperAudio();
};
}
Q_DECLARE_METATYPE(ScreenPlay::CreateImportVideo::ImportVideoState)

View File

@ -26,10 +26,10 @@ void InstalledListFilter::sortByRoleType(QString type)
setFilterWildcard("*");
} else if (type == "Wallpaper") {
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
setFilterFixedString("video");
setFilterWildcard("*Wallpaper");
} else if (type == "Widgets") {
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
setFilterFixedString("widget");
setFilterWildcard("*Widget");
}
if (type == "Scenes") {
setFilterRole(InstalledListModel::InstalledRole::TypeRole);

View File

@ -1,13 +1,11 @@
#include "installedlistmodel.h"
/*!
\class Installed List Model
\brief Lists all installed wallpapers, widgets etc. from a given Path
*/
namespace ScreenPlay {
InstalledListModel::InstalledListModel(QObject* parent)
@ -85,13 +83,12 @@ bool InstalledListModel::getProjectByAbsoluteStoragePath(QUrl* path, ProjectFile
return false;
}
void InstalledListModel::append(const QJsonObject obj, const QString folderName)
void InstalledListModel::append(const QJsonObject& obj, const QString& folderName)
{
beginInsertRows(QModelIndex(), m_screenPlayFiles.size(), m_screenPlayFiles.size());
ProjectFile tmpFile(obj, folderName, m_absoluteStoragePath);
m_screenPlayFiles.append(tmpFile);
m_screenPlayFiles.append(ProjectFile(obj, folderName, m_absoluteStoragePath));
endInsertRows();
}
@ -122,34 +119,29 @@ void InstalledListModel::loadInstalledContent()
if (!(parseError.error == QJsonParseError::NoError))
continue;
if (jsonProject.object().value("type").toString() == "scene")
if (jsonProject.isEmpty() || jsonProject.object().empty())
continue;
if (jsonProject.isEmpty())
if (!obj.contains("file") || !obj.contains("type"))
continue;
if (jsonProject.object().empty())
continue;
QStringList availableTypes {
"qmlWallpaper",
"htmlWallpaper",
"videoWallpaper",
"godotWallpaper",
//Some settings dont have a file type
QString fileEnding;
if (obj.contains("file")) {
fileEnding = obj.value("file").toString();
if (!obj.contains("type")) {
obj.insert("type", "video");
}
"qmlWidget",
"htmlWidget",
"standaloneWidget"
};
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene" || fileEnding.endsWith(".html")))
emit addInstalledItem(obj, item.baseName());
if (obj.value("type") == "qmlWidget" || obj.value("type") == "standalonewidget")
emit addInstalledItem(obj, item.baseName());
}
if (availableTypes.contains(obj.value("type").toString()))
emit addInstalledItem(obj, item.baseName());
}
emit installedLoadingFinished();
});
}
QVariantMap InstalledListModel::get(QString folderId)

View File

@ -56,7 +56,7 @@ public:
public slots:
void loadInstalledContent();
void append(const QJsonObject, const QString);
void append(const QJsonObject &, const QString &);
void reset();
int getAmountItemLoaded();

View File

@ -13,12 +13,11 @@
*/
namespace ScreenPlay {
struct ProjectFile {
ProjectFile(const QJsonObject& obj,
const QString& folderName,
const QUrl& absolutePath)
const QString& folderName,
const QUrl& absolutePath)
{
if (obj.contains("description"))
@ -36,18 +35,8 @@ struct ProjectFile {
if (obj.contains("title"))
m_title = obj.value("title");
if (obj.contains("type")) {
QString tmp = obj.value("type").toString().toLower();
if (tmp == "video") {
m_type = "video";
} else if (tmp == "qmlwidget" || tmp == "standalonewidget") {
m_type = "widget";
} else if (tmp == "qmlscene") {
m_type = "qmlScene";
} else if (tmp == "html") {
m_type = "html";
}
}
if (obj.contains("type"))
m_type = obj.value("type").toString();
if (obj.contains("workshopid")) {
m_workshopID = obj.value("workshopid").toInt();

View File

@ -1,7 +1,5 @@
#include "qmlutilities.h"
#include <QProcess>
namespace ScreenPlay {
/*!
@ -13,9 +11,28 @@ namespace ScreenPlay {
\endlist
*/
QMLUtilities::QMLUtilities(QObject* parent)
QMLUtilities::QMLUtilities(QNetworkAccessManager* networkAccessManager, QObject* parent)
: QObject(parent)
, m_networkAccessManager { networkAccessManager }
{
qRegisterMetaType<QMLUtilities::AquireFFMPEGStatus>();
qmlRegisterUncreatableType<QMLUtilities>("ScreenPlay.QMLUtilities", 1, 0, "QMLUtilities", "Error only for enums");
QString path = QGuiApplication::instance()->applicationDirPath()+"/";
QFile fileFFMPEG;
QFile fileFFPROBE;
#ifdef Q_OS_WIN
fileFFMPEG.setFileName(path + "ffmpeg.exe");
fileFFPROBE.setFileName(path + "ffprobe.exe");
#elif defined(Q_OS_OSX)
fileFFMPEG.setFileName(path + "ffmpeg");
fileFFPROBE.setFileName(path + "ffprobe");
#endif
if(fileFFMPEG.exists() && fileFFPROBE.exists())
setFfmpegAvailable(true);
}
void QMLUtilities::setNavigation(QString nav)
{
@ -109,4 +126,100 @@ void QMLUtilities::QMLUtilities::requestAllLDataProtection()
});
}
void QMLUtilities::downloadFFMPEG()
{
QNetworkRequest req;
#ifdef Q_OS_WIN
req.setUrl(QUrl("https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1.4-win64-static.zip"));
#elif defined(Q_OS_OSX)
req.setUrl(QUrl("https://ffmpeg.zeranoe.com/builds/macos64/static/ffmpeg-4.1.4-macos64-static.zip"));
#endif
setAquireFFMPEGStatus(AquireFFMPEGStatus::Download);
QNetworkReply* reply = m_networkAccessManager->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply]() {
using namespace libzippp;
using namespace std;
setAquireFFMPEGStatus(AquireFFMPEGStatus::DownloadSuccessful);
QByteArray download = reply->readAll();
auto* archive = ZipArchive::fromBuffer(download.data(), download.size(), ZipArchive::OpenMode::READ_ONLY, true);
if (archive == nullptr) {
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedReadFromBuffer);
return;
}
string path = QGuiApplication::instance()->applicationDirPath().toStdString() + "/";
#ifdef Q_OS_WIN
ZipEntry entryFFMPEG = archive->getEntry("ffmpeg-4.1.4-win64-static/bin/ffmpeg.exe");
std::string entryFFMPEGPath = path + "ffmpeg.exe";
#elif defined(Q_OS_OSX)
ZipEntry entryFFMPEG = archive->getEntry("ffmpeg-4.1.4-macos64-static/bin/ffmpeg");
std::string entryFFMPEGPath = path + "ffmpeg";
#endif
if (entryFFMPEG.isNull()) {
qDebug() << "null";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFMPEG);
return;
}
if (!saveExtractedByteArray(entryFFMPEG, entryFFMPEGPath)) {
qDebug() << "could not save ffmpeg";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFMPEGSave);
return;
}
#ifdef Q_OS_WIN
ZipEntry entryFFPROBE = archive->getEntry("ffmpeg-4.1.4-win64-static/bin/ffprobe.exe");
std::string entryFFPROBEPath = path + "ffprobe.exe";
#elif defined(Q_OS_OSX)
ZipEntry entryFFPROBE = archive->getEntry("ffmpeg-4.1.4-macos64-static/bin/ffprobe");
std::string entryFFPROBEPath = path + "ffprobe";
#endif
if (entryFFPROBE.isNull()) {
qDebug() << "null";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFPROBE);
return;
}
if (!saveExtractedByteArray(entryFFPROBE, entryFFPROBEPath)) {
qDebug() << "could not save ffprobe";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFPROBESave);
return;
}
setAquireFFMPEGStatus(AquireFFMPEGStatus::FinishedSuccessful);
});
QObject::connect(reply, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error),
[this](QNetworkReply::NetworkError code) {
this->setAquireFFMPEGStatus(AquireFFMPEGStatus::DownloadFailed);
});
}
bool QMLUtilities::saveExtractedByteArray(libzippp::ZipEntry& entry, std::string& absolutePathAndName)
{
std::ofstream ofUnzippedFile(absolutePathAndName, std::ofstream::binary);
if (ofUnzippedFile) {
if (entry.readContent(ofUnzippedFile) != 0) {
qDebug() << "Error cannot read ffmpeg zip content";
return false;
}
} else {
qDebug() << "Coud not open ofstream" << QString::fromStdString(absolutePathAndName);
return false;
}
ofUnzippedFile.close();
return true;
}
}

View File

@ -3,26 +3,71 @@
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QGuiApplication>
#include <QNetworkAccessManager>
#include <QObject>
#include <QProcess>
#include <QScopeGuard>
#include <QString>
#include <QtConcurrent/QtConcurrent>
#include <QNetworkReply>
#include <QProcess>
#include <qqml.h>
#include <fstream>
#include <iostream>
#include "libzippp/libzippp.h"
namespace ScreenPlay {
class QMLUtilities : public QObject {
Q_OBJECT
Q_PROPERTY(bool ffmpegAvailable READ ffmpegAvailable WRITE setFfmpegAvailable NOTIFY ffmpegAvailableChanged)
Q_PROPERTY(AquireFFMPEGStatus aquireFFMPEGStatus READ aquireFFMPEGStatus WRITE setAquireFFMPEGStatus NOTIFY aquireFFMPEGStatusChanged)
public:
explicit QMLUtilities(QObject* parent = nullptr);
explicit QMLUtilities(QNetworkAccessManager* networkAccessManager, QObject* parent = nullptr);
enum class AquireFFMPEGStatus {
Init,
Download,
DownloadFailed,
DownloadSuccessful,
Extracting,
ExtractingFailedReadFromBuffer,
ExtractingFailedFFMPEG,
ExtractingFailedFFMPEGSave,
ExtractingFailedFFPROBE,
ExtractingFailedFFPROBESave,
ExtractingSuccessful,
FinishedSuccessful,
};
Q_ENUM(AquireFFMPEGStatus)
bool ffmpegAvailable() const
{
return m_ffmpegAvailable;
}
AquireFFMPEGStatus aquireFFMPEGStatus() const
{
return m_aquireFFMPEGStatus;
}
signals:
void requestNavigation(QString nav);
void requestNavigationActive(bool isActive);
void requestToggleWallpaperConfiguration();
void setSidebarItem(QString screenId, QString type);
void allLicenseLoaded(QString licensesText);
void allDataProtectionLoaded(QString dataProtectionText);
void ffmpegAvailableChanged(bool ffmpegAvailable);
void aquireFFMPEGStatusChanged(AquireFFMPEGStatus aquireFFMPEGStatus);
public slots:
void setNavigation(QString nav);
void setNavigationActive(bool isActive);
@ -32,6 +77,33 @@ public slots:
void requestAllLicenses();
void requestAllLDataProtection();
void downloadFFMPEG();
QString fixWindowsPath(QString url);
void setFfmpegAvailable(bool ffmpegAvailable)
{
if (m_ffmpegAvailable == ffmpegAvailable)
return;
m_ffmpegAvailable = ffmpegAvailable;
emit ffmpegAvailableChanged(m_ffmpegAvailable);
}
void setAquireFFMPEGStatus(AquireFFMPEGStatus aquireFFMPEGStatus)
{
if (m_aquireFFMPEGStatus == aquireFFMPEGStatus)
return;
m_aquireFFMPEGStatus = aquireFFMPEGStatus;
emit aquireFFMPEGStatusChanged(m_aquireFFMPEGStatus);
}
private:
QNetworkAccessManager* m_networkAccessManager;
bool m_ffmpegAvailable { false };
bool saveExtractedByteArray(libzippp::ZipEntry& entry, std::string& absolutePathAndName);
AquireFFMPEGStatus m_aquireFFMPEGStatus { AquireFFMPEGStatus::Init };
};
}

View File

@ -21,8 +21,12 @@ void ScreenPlayManager::createWallpaper(
const QString& previewImage, const float volume,
const QString& fillMode, const QString& type)
{
removeWallpaperAt(monitorIndex);
ProjectFile project {};
if (!m_installedListModel->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) {
qWarning() << "Failed to receive getProjectByAbsoluteStoragePath";
return;
}
@ -54,6 +58,8 @@ void ScreenPlayManager::createWidget(QUrl absoluteStoragePath, const QString& pr
return;
}
m_settings->increaseActiveWidgetsCounter();
m_screenPlayWidgets.emplace_back(
make_unique<ScreenPlayWidget>(
generateID(),
@ -64,12 +70,14 @@ void ScreenPlayManager::createWidget(QUrl absoluteStoragePath, const QString& pr
this));
}
void ScreenPlayManager::removeAllWallpaper()
void ScreenPlayManager::closeAllConnections()
{
if (m_settings && !m_screenPlayWallpapers.empty()) {
m_sdkconnector->closeAllWallpapers();
if (!m_screenPlayWidgets.empty() || !m_screenPlayWallpapers.empty()) {
m_sdkconnector->closeAllConnections();
m_settings->setActiveWallpaperCounter(0);
m_settings->setActiveWidgetsCounter(0);
m_screenPlayWallpapers.clear();
m_screenPlayWidgets.clear();
emit allWallpaperRemoved();
}
return;
@ -80,7 +88,7 @@ void ScreenPlayManager::requestProjectSettingsListModelAt(const int index)
for (const unique_ptr<ScreenPlayWallpaper>& uPtrWallpaper : m_screenPlayWallpapers) {
if (!uPtrWallpaper->screenNumber().empty() && uPtrWallpaper->screenNumber()[0] == index) { // ??? only at index == 0
emit projectSettingsListModelFound(
uPtrWallpaper->projectSettingsListModel().data(),
uPtrWallpaper->projectSettingsListModel().get(),
uPtrWallpaper->type());
return;
}

View File

@ -57,7 +57,7 @@ public slots:
const QString& previewImage, const float volume,
const QString& fillMode, const QString& type);
void createWidget(QUrl absoluteStoragePath, const QString& previewImage);
void removeAllWallpaper();
void closeAllConnections();
void requestProjectSettingsListModelAt(const int index);
void setWallpaperValue(const int at, const QString& key, const QString& value);
void setAllWallpaperValue(const QString& key, const QString& value);

View File

@ -16,7 +16,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const vector<int>& screenNumber,
const QString& type,
QObject* parent)
: QObject(parent)
, m_projectSettingsListModel { QSharedPointer<ProjectSettingsListModel>::create(projectPath + "/project.json") }
, m_projectSettingsListModel { make_shared<ProjectSettingsListModel>(projectPath + "/project.json") }
, m_screenNumber { move(screenNumber) }
, m_projectPath { projectPath }
, m_previewImage { previewImage }
@ -48,7 +48,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const vector<int>& screenNumber,
//qDebug() << "Creating ScreenPlayWallpaper " << proArgs;
m_process.setArguments(proArgs);
m_process.setProgram(m_settings->screenPlayWindowPath().toString());
m_process.setProgram(m_settings->screenPlayWallpaperPath().toString());
m_process.startDetached();
}
}

View File

@ -7,6 +7,7 @@
#include "projectsettingslistmodel.h"
#include "settings.h"
namespace ScreenPlay {
using std::shared_ptr,
std::make_shared,
@ -35,7 +36,7 @@ public:
~ScreenPlayWallpaper() {}
const QSharedPointer<ProjectSettingsListModel>& projectSettingsListModel() const noexcept
const shared_ptr<ProjectSettingsListModel>& projectSettingsListModel() const
{
return m_projectSettingsListModel;
}
@ -120,7 +121,7 @@ public slots:
private:
QProcess m_process;
QSharedPointer<ProjectSettingsListModel> m_projectSettingsListModel;
shared_ptr<ProjectSettingsListModel> m_projectSettingsListModel;
vector<int> m_screenNumber;
QString m_projectPath;
QString m_previewImage;

View File

@ -5,12 +5,12 @@
namespace ScreenPlay {
SDKConnector::SDKConnector(QObject* parent)
: QObject(parent)
, m_server { make_unique<QLocalServer>() }
{
m_server = QSharedPointer<QLocalServer>(new QLocalServer(this));
connect(m_server.data(), &QLocalServer::newConnection, this, &SDKConnector::newConnection);
if (!m_server.data()->listen("ScreenPlay")) {
//TODO what to do if no ScreenPlay local socket can be open
connect(m_server.get(), &QLocalServer::newConnection, this, &SDKConnector::newConnection);
if (!m_server->listen("ScreenPlay")) {
qErrnoWarning("Could not open Local Socket with the name ScreenPlay. Usually this means another ScreenPlay instance is running!");
}
}
@ -20,10 +20,10 @@ void SDKConnector::readyRead()
void SDKConnector::newConnection()
{
m_clients.append(QSharedPointer<SDKConnection>(new SDKConnection(m_server.data()->nextPendingConnection())));
m_clients.append(make_shared<SDKConnection>(m_server->nextPendingConnection()));
}
void SDKConnector::closeAllWallpapers()
void SDKConnector::closeAllConnections()
{
for (int i = 0; i < m_clients.size(); ++i) {
m_clients.at(i)->close();
@ -34,7 +34,7 @@ void SDKConnector::closeAllWallpapers()
void SDKConnector::closeWallpapersAt(int at)
{
for (const QSharedPointer<SDKConnection>& refSDKConnection : m_clients) {
for (const shared_ptr<SDKConnection>& refSDKConnection : m_clients) {
refSDKConnection->close();
if (!refSDKConnection->monitor().empty()) {
// problem here !!
@ -54,13 +54,13 @@ void SDKConnector::setWallpaperValue(QString appID, QString key, QString value)
{
for (int i = 0; i < m_clients.count(); ++i) {
if (m_clients.at(i).data()->appID() == appID) {
if (m_clients.at(i)->appID() == appID) {
QJsonObject obj;
obj.insert(key, QJsonValue(value));
QByteArray send = QJsonDocument(obj).toJson();
m_clients.at(i).data()->socket()->write(send);
m_clients.at(i).data()->socket()->waitForBytesWritten();
m_clients.at(i)->socket()->write(send);
m_clients.at(i)->socket()->waitForBytesWritten();
}
}
}
@ -68,14 +68,14 @@ void SDKConnector::setWallpaperValue(QString appID, QString key, QString value)
void SDKConnector::setSceneValue(QString appID, QString key, QString value)
{
for (int i = 0; i < m_clients.count(); ++i) {
if (m_clients.at(i).data()->appID() == appID) {
if (m_clients.at(i)->appID() == appID) {
QJsonObject obj;
obj.insert("type", QJsonValue("qmlScene"));
obj.insert(key, QJsonValue(value));
QByteArray send = QJsonDocument(obj).toJson();
m_clients.at(i).data()->socket()->write(send);
m_clients.at(i).data()->socket()->waitForBytesWritten();
m_clients.at(i)->socket()->write(send);
m_clients.at(i)->socket()->waitForBytesWritten();
}
}
}

View File

@ -4,10 +4,11 @@
#include <QLocalServer>
#include <QLocalSocket>
#include <QObject>
#include <QSharedPointer>
#include <QTimer>
#include <QVector>
#include <memory>
/*!
\class SDKConnector
\brief Used for every Wallpaper, Scene or Widget communication via Windows pipes/QLocalSocket
@ -17,6 +18,11 @@
namespace ScreenPlay {
class SDKConnection;
using std::make_unique,
std::unique_ptr,
std::shared_ptr,
std::make_shared;
class SDKConnector : public QObject {
Q_OBJECT
public:
@ -25,14 +31,15 @@ public:
public slots:
void readyRead();
void newConnection();
void closeAllWallpapers();
void closeAllConnections();
void closeWallpapersAt(int at);
void setWallpaperValue(QString appID, QString key, QString value);
void setSceneValue(QString appID, QString key, QString value);
private:
QSharedPointer<QLocalServer> m_server;
QVector<QSharedPointer<SDKConnection>> m_clients;
unique_ptr<QLocalServer> m_server;
QVector<shared_ptr<SDKConnection>> m_clients;
};
class SDKConnection : public QObject {

View File

@ -18,11 +18,11 @@ Settings::Settings(const shared_ptr<InstalledListModel>& ilm,
const shared_ptr<SDKConnector>& sdkc,
QObject* parent)
: QObject(parent)
, m_version(QVersionNumber(0, 0, 1))
, m_profileListModel(plm)
, m_installedListModel(ilm)
, m_monitorListModel(mlm)
, m_sdkconnector(sdkc)
, m_version { QVersionNumber(0, 0, 1) }
, m_profileListModel { plm }
, m_installedListModel { ilm }
, m_monitorListModel { mlm }
, m_sdkconnector { sdkc }
{
auto* app = static_cast<QGuiApplication*>(QGuiApplication::instance());
@ -121,8 +121,8 @@ Settings::Settings(const shared_ptr<InstalledListModel>& ilm,
m_localStoragePath = QUrl::fromUserInput(configObj.value("absoluteStoragePath").toString());
}
if (m_qSettings.value("ScreenPlayInstalledPath").isNull()) {
m_qSettings.setValue("ScreenPlayInstalledPath", QDir::toNativeSeparators(m_localStoragePath.toString().remove("file:///")));
if (m_qSettings.value("ScreenPlayContentPath").toUrl() != m_localStoragePath) {
m_qSettings.setValue("ScreenPlayContentPath", QDir::toNativeSeparators(m_localStoragePath.toString().remove("file:///")));
m_qSettings.sync();
}
@ -241,14 +241,14 @@ void Settings::setupWidgetAndWindowPaths()
if (SPWorkingDir.cdUp()) {
#ifdef Q_OS_OSX
setScreenPlayWindowPath(QUrl::fromUserInput(SPWorkingDir.path() + "/../../../ScreenPlayWindow/ScreenPlayWindow.app/Contents/MacOS/ScreenPlayWindow").toLocalFile());
setScreenPlayWallpaperPath(QUrl::fromUserInput(SPWorkingDir.path() + "/../../../ScreenPlayWallpaper/ScreenPlayWallpaper.app/Contents/MacOS/ScreenPlayWallpaper").toLocalFile());
setScreenPlayWidgetPath(QUrl::fromUserInput(SPWorkingDir.path() + "/../../../ScreenPlayWidget/ScreenPlayWidget.app/Contents/MacOS/ScreenPlayWidget").toLocalFile());
qDebug() << "Setting ScreenPlayWindow Path to " << settings.getScreenPlayWindowPath();
qDebug() << "Setting ScreenPlayWallpaper Path to " << settings.getScreenPlayWallpaperPath();
qDebug() << "Setting ScreenPlayWdiget Path to " << settings.getScreenPlayWidgetPath();
#endif
#ifdef Q_OS_WIN
setScreenPlayWindowPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWindow/debug/ScreenPlayWindow.exe"));
setScreenPlayWallpaperPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWallpaper/debug/ScreenPlayWallpaper.exe"));
setScreenPlayWidgetPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWidget/debug/ScreenPlayWidget.exe"));
#endif
}
@ -269,12 +269,12 @@ void Settings::setupWidgetAndWindowPaths()
// In QtCreator is the dir above ScreenPlay.exe (!)
SPWorkingDir.cdUp();
SPWorkingDir.cd("ScreenPlayWindow");
SPWorkingDir.cd("ScreenPlayWallpaper");
if (QDir(SPWorkingDir.path() + "/release").exists()) {
// If started by QtCreator
SPWorkingDir.cd("release");
setScreenPlayWindowPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWindow.exe"));
setScreenPlayWallpaperPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWallpaper.exe"));
SPWorkingDir.cdUp();
SPWorkingDir.cdUp();
SPWorkingDir.cd("ScreenPlayWidget");
@ -282,7 +282,7 @@ void Settings::setupWidgetAndWindowPaths()
setScreenPlayWidgetPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWidget.exe"));
} else {
// If started by Steam
setScreenPlayWindowPath(QUrl("ScreenPlayWindow.exe"));
setScreenPlayWallpaperPath(QUrl("ScreenPlayWallpaper.exe"));
setScreenPlayWidgetPath(QUrl("ScreenPlayWidget.exe"));
}
#endif

View File

@ -14,7 +14,6 @@
#include <QProcessEnvironment>
#include <QQmlPropertyMap>
#include <QSettings>
#include <QSharedPointer>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
@ -47,7 +46,7 @@ using std::shared_ptr,
class Settings : public QObject {
Q_OBJECT
Q_PROPERTY(QVersionNumber version READ version )
Q_PROPERTY(QVersionNumber version READ version)
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
@ -55,7 +54,9 @@ class Settings : public QObject {
Q_PROPERTY(bool offlineMode READ offlineMode WRITE setOfflineMode NOTIFY offlineModeChanged)
Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged)
Q_PROPERTY(QString decoder READ decoder WRITE setDecoder NOTIFY decoderChanged)
Q_PROPERTY(int activeWallpaperCounter READ activeWallpaperCounter WRITE setActiveWallpaperCounter NOTIFY activeWallpaperCounterChanged)
Q_PROPERTY(int activeWidgetsCounter READ activeWidgetsCounter WRITE setActiveWidgetsCounter NOTIFY activeWidgetsCounterChanged)
public:
explicit Settings(
@ -71,9 +72,9 @@ public:
return m_version;
}
QUrl screenPlayWindowPath() const
QUrl screenPlayWallpaperPath() const
{
return m_screenPlayWindowPath;
return m_screenPlayWallpaperPath;
}
QUrl localStoragePath() const
@ -96,14 +97,14 @@ public:
return m_offlineMode;
}
QUrl getScreenPlayWindowPath() const
QUrl setScreenPlayWallpaperPath() const
{
return m_screenPlayWindowPath;
return m_screenPlayWallpaperPath;
}
void setScreenPlayWindowPath(const QUrl& screenPlayWindowPath)
void setScreenPlayWallpaperPath(const QUrl& screenPlayWallpaperPath)
{
m_screenPlayWindowPath = screenPlayWindowPath;
m_screenPlayWallpaperPath = screenPlayWallpaperPath;
}
QUrl getScreenPlayBasePath() const
@ -131,7 +132,6 @@ public:
return m_offlineMode;
}
bool autostart() const
{
return m_autostart;
@ -152,6 +152,10 @@ public:
return m_decoder;
}
int activeWidgetsCounter() const
{
return m_activeWidgetsCounter;
}
signals:
void autostartChanged(bool autostart);
@ -164,6 +168,7 @@ signals:
void activeWallpaperCounterChanged(int activeWallpaperCounter);
void pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame);
void offlineModeChanged(bool offlineMode);
void activeWidgetsCounterChanged(int activeWidgetsCounter);
public slots:
void writeSingleSettingConfig(QString name, QVariant value);
@ -252,6 +257,18 @@ public slots:
emit activeWallpaperCounterChanged(m_activeWallpaperCounter);
}
void increaseActiveWidgetsCounter()
{
m_activeWidgetsCounter++;
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
}
void decreaseActivewidgetsCounter()
{
m_activeWidgetsCounter--;
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
}
void increaseActiveWallpaperCounter()
{
m_activeWallpaperCounter++;
@ -287,6 +304,15 @@ public slots:
void loadActiveProfiles();
void setActiveWidgetsCounter(int activeWidgetsCounter)
{
if (m_activeWidgetsCounter == activeWidgetsCounter)
return;
m_activeWidgetsCounter = activeWidgetsCounter;
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
}
private:
void createDefaultConfig();
void setupWidgetAndWindowPaths();
@ -302,17 +328,18 @@ private:
QUrl m_localStoragePath;
QUrl m_localSettingsPath;
QUrl m_screenPlayWindowPath;
QUrl m_screenPlayWallpaperPath;
QUrl m_screenPlayWidgetPath;
QUrl m_screenPlayBasePath;
bool m_pauseWallpaperWhenIngame = true;
bool m_autostart = true;
bool m_highPriorityStart = true;
bool m_sendStatistics = false;
bool m_offlineMode = true;
bool m_pauseWallpaperWhenIngame { true };
bool m_autostart { true };
bool m_highPriorityStart { true };
bool m_sendStatistics { false };
bool m_offlineMode { true };
QString m_decoder = "";
int m_activeWallpaperCounter = 0;
QString m_decoder { "" };
int m_activeWallpaperCounter { 0 };
int m_activeWidgetsCounter { 0 };
};
}

View File

@ -53,6 +53,7 @@ ScreenPlaySDK::ScreenPlaySDK(QQuickItem* parent)
ScreenPlaySDK::~ScreenPlaySDK()
{
m_socket.disconnectFromServer();
}
void ScreenPlaySDK::connected()

View File

@ -4,7 +4,7 @@ CONFIG += c++17
DEFINES += QT_DEPRECATED_WARNINGS
TARGETPATH = ScreenPlayWindow
TARGETPATH = ScreenPlayWallpaper
RESOURCES += \

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -30,9 +30,8 @@
</style>
</head>
<body>
<h2 id="errorMsg">If you can read this something went wrong. Oh well....</h2>
<video id="videoPlayer" oncontextmenu="return false;" width="100%" height="100%" loop autoplay>
<source id="videoSource" type="video/webm" oncontextmenu="return false;" width="100%" height="100%"> Your browser does not support the video tag. WTF?
<source id="videoSource" type="video/webm" oncontextmenu="return false;" width="100%" height="100%">
</video>
</body>
</html>

View File

@ -24,7 +24,6 @@ int main(int argc, char* argv[])
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
// This gives us nice clickable output in QtCreator
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
@ -37,9 +36,10 @@ int main(int argc, char* argv[])
if (argumentList.length() == 1) {
QVector<int> list;
list.append(0);
#if defined(Q_OS_WIN)
WinWindow window(list, "test", "appid", "1");
// WinWindow window(list, "D:/672870/827874818", "appid", "1");
//WinWindow window(list, "D:/672870/827874818", "appid", "1");
#endif
#if defined(Q_OS_LINUX)
LinuxWindow window(list, "test", "appid", "1");

View File

@ -13,7 +13,6 @@ Rectangle {
}
}
property bool canFadeIn: true
Component.onCompleted: {
@ -40,10 +39,11 @@ Rectangle {
webView.enabled = true
break
case Wallpaper.WallpaperType.Qml:
loader.enabled = true
loader.source = Qt.resolvedUrl(window.fullContentPath)
fadeIn()
break
}
fadeIn()
}
function fadeIn() {
@ -55,10 +55,29 @@ Rectangle {
}
}
Loader {
id: loader
anchors.fill: parent
onLoaded: loader.z = 999
Timer {
id: fadeInTimer
interval: 50
onTriggered: fadeIn()
}
OpacityAnimator {
id: animFadeIn
target: imgCover
from: 1
to: 0
duration: 800
easing.type: Easing.InOutQuad
}
OpacityAnimator {
id: animFadeOut
target: imgCover
from: 0
to: 1
duration: 800
easing.type: Easing.InOutQuad
onFinished: window.terminate()
}
WebEngineView {
@ -66,7 +85,6 @@ Rectangle {
enabled: false
anchors.fill: parent
onLoadProgressChanged: {
if (loadProgress === 100) {
var src = ""
@ -78,7 +96,7 @@ Rectangle {
src += "videoPlayer.play();"
webView.runJavaScript(src, function (result) {
fadeIn()
fadeInTimer.start()
})
}
}
@ -86,20 +104,33 @@ Rectangle {
onJavaScriptConsoleMessage: print(lineNumber, message)
}
OpacityAnimator {
id: animFadeIn
target: imgCover
from: 1
to: 0
duration: 300
easing.type: Easing.InCubic
Loader {
id: loader
anchors.fill: parent
enabled: false
}
Image {
id: imgCover
anchors.fill: parent
anchors {
top: parent.top
topMargin: {
if(desktopProperties.windowsVersion >= 1903){
return -(1080 / 9)
} else {
return 0;
}
}
left: parent.left
right: parent.right
}
sourceSize.width: root.width
source: Qt.resolvedUrl("file:///" + desktopProperties.wallpaperPath)
Component.onCompleted: {
switch (desktopProperties.wallpaperStyle) {
case 10:
imgCover.fillMode = Image.PreserveAspectCrop
@ -134,7 +165,7 @@ Rectangle {
onQmlExit: {
webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;")
window.destroyThis()
animFadeOut.start()
}
onQmlSceneValueReceived: {
@ -178,5 +209,4 @@ Rectangle {
}
}
}
}

View File

@ -12,6 +12,8 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent)
qRegisterMetaType<BaseWindow::WallpaperType>();
qmlRegisterType<BaseWindow>("ScreenPlay.Wallpaper", 1, 0, "Wallpaper");
setOSVersion(QSysInfo::productVersion());
if (projectFilePath == "test") {
setType(BaseWindow::WallpaperType::Qml);
setFullContentPath("qrc:/test.qml");
@ -29,13 +31,13 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent)
/* project.json example:
*{
* "title": "example title",
* "description": "",
* "file": "example.webm",
* "preview": "preview.png",
* "previewGIF": "preview.gif",
* "previewMP4": "preview.mp4",
* "title": "example title",
* "type": "video"
* "previewWEBM": "preview.webm",
* "type": "videoWallpaper"
*}
*/
@ -57,22 +59,22 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent)
setFullContentPath("file:///" + projectFilePath + "/" + projectObject.value("file").toString());
if (projectObject.value("type") == "video") {
if (projectObject.value("type") == "videoWallpaper") {
setType(BaseWindow::WallpaperType::Video);
return;
}
if (projectObject.value("type") == "scene") {
if (projectObject.value("type") == "threeJSWallpaper") {
setType(BaseWindow::WallpaperType::ThreeJSScene);
return;
}
if (projectObject.value("type") == "qml") {
if (projectObject.value("type") == "qmlWallpaper") {
setType(BaseWindow::WallpaperType::Qml);
return;
}
if (projectObject.value("type") == "html") {
if (projectObject.value("type") == "htmlWallpaper") {
setType(BaseWindow::WallpaperType::Html);
return;
}
@ -109,4 +111,6 @@ void BaseWindow::messageReceived(QString key, QString value)
setIsPlaying(tmp);
return;
}
emit qmlSceneValueReceived(key, value);
}

View File

@ -9,6 +9,7 @@
#include <QObject>
#include <QString>
#include <QtQml>
#include <QSysInfo>
class BaseWindow : public QObject {
Q_OBJECT
@ -24,7 +25,9 @@ public:
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(float playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
Q_PROPERTY(WallpaperType type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(QString OSVersion READ OSVersion WRITE setOSVersion NOTIFY OSVersionChanged)
QSysInfo m_sysinfo;
enum class WallpaperType {
Video,
Html,
@ -68,6 +71,11 @@ public:
return m_appID;
}
QString OSVersion() const
{
return m_OSVersion;
}
signals:
void loopsChanged(bool loops);
void volumeChanged(float volume);
@ -79,6 +87,8 @@ signals:
void qmlExit();
void qmlSceneValueReceived(QString key, QString value);
void OSVersionChanged(QString OSVersion);
public slots:
virtual void destroyThis() {}
virtual void setVisible(bool show) { Q_UNUSED(show) }
@ -151,6 +161,15 @@ public slots:
emit appIDChanged(m_appID);
}
void setOSVersion(QString OSVersion)
{
if (m_OSVersion == OSVersion)
return;
m_OSVersion = OSVersion;
emit OSVersionChanged(m_OSVersion);
}
private:
bool m_loops = true;
bool m_isPlaying = true;
@ -162,4 +181,5 @@ private:
QString m_appID;
WallpaperType m_type = BaseWindow::WallpaperType::Qml;
QString m_OSVersion;
};

View File

@ -27,4 +27,14 @@ WindowsDesktopProperties::WindowsDesktopProperties(QObject* parent)
int colorB = colorStringRGBList.at(2).toInt();
setColor(QColor::fromRgb(colorR, colorG, colorB));
}
QSettings settingsWindowsVersion("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
bool canParse {false};
int value = settingsWindowsVersion.value("ReleaseId").toInt(&canParse);
if(canParse)
setWindowsVersion(value);
qDebug() << settingsWindowsVersion.value("ReleaseId").toInt();
}

View File

@ -2,11 +2,11 @@
#include <QColor>
#include <QDebug>
#include <QList>
#include <QObject>
#include <QPoint>
#include <QSettings>
#include <QString>
#include <QList>
#include <qqml.h>
#include <qt_windows.h>
@ -16,6 +16,7 @@ class WindowsDesktopProperties : public QObject {
public:
explicit WindowsDesktopProperties(QObject* parent = nullptr);
Q_PROPERTY(int windowsVersion READ windowsVersion WRITE setWindowsVersion NOTIFY windowsVersionChanged)
Q_PROPERTY(QString wallpaperPath READ wallpaperPath WRITE setWallpaperPath NOTIFY wallpaperPathChanged)
Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(bool isTiled READ isTiled WRITE setIsTiled NOTIFY isTiledChanged)
@ -56,6 +57,11 @@ public:
return m_color;
}
int windowsVersion() const
{
return m_windowsVersion;
}
signals:
void wallpaperPathChanged(QString wallpaperPath);
@ -68,6 +74,8 @@ signals:
void colorChanged(QColor color);
void windowsVersionChanged(int windowsVersion);
public slots:
void setWallpaperPath(QString wallpaperPath)
{
@ -111,10 +119,20 @@ public slots:
emit colorChanged(m_color);
}
void setWindowsVersion(int windowsVersion)
{
if (m_windowsVersion == windowsVersion)
return;
m_windowsVersion = windowsVersion;
emit windowsVersionChanged(m_windowsVersion);
}
private:
QString m_wallpaperPath;
QPoint m_position;
bool m_isTiled;
int m_wallpaperStyle;
QColor m_color;
int m_windowsVersion;
};

View File

@ -107,13 +107,15 @@ WinWindow::WinWindow(QVector<int>& activeScreensList, QString projectPath, QStri
m_window.setSource(QUrl("qrc:/mainWindow.qml"));
// MUST be called before setting hook for events!
winGlobalHook = &m_window;
if (!(mouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookCallback, nullptr, 0))) {
qDebug() << "Faild to install mouse hook!";
if(type() == BaseWindow::WallpaperType::Qml){
winGlobalHook = &m_window;
if (!(mouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookCallback, nullptr, 0))) {
qDebug() << "Faild to install mouse hook!";
}
}
// FIXME WORKAROUND:
// There is a strange bug when we open the ScreenPlayWindow project on its one
// There is a strange bug when we open the ScreenPlayWallpaper project on its one
// that if we set ShowWindow(m_windowHandle, SW_HIDE); we can no longer set
// the window visible via set Visible.
if (projectPath != "test") {
@ -138,14 +140,7 @@ void WinWindow::setVisible(bool show)
void WinWindow::destroyThis()
{
ShowWindow(m_windowHandle, SW_HIDE);
// Force refresh so that we display the regular
// desktop wallpaper again
ShowWindow(m_windowHandleWorker, SW_HIDE);
ShowWindow(m_windowHandleWorker, SW_SHOW);
QCoreApplication::quit();
emit qmlExit();
}
void WinWindow::calcOffsets()
@ -202,3 +197,15 @@ bool WinWindow::searchWorkerWindowToParentTo()
return EnumWindows(SearchForWorkerWindow, reinterpret_cast<LPARAM>(&m_windowHandleWorker));
}
void WinWindow::terminate()
{
ShowWindow(m_windowHandle, SW_HIDE);
// Force refresh so that we display the regular
// desktop wallpaper again
ShowWindow(m_windowHandleWorker, SW_HIDE);
ShowWindow(m_windowHandleWorker, SW_SHOW);
QCoreApplication::quit();
}

View File

@ -26,6 +26,7 @@ public:
public slots:
void setVisible(bool show) override;
void destroyThis() override;
void terminate();
private:
void calcOffsets();
@ -33,10 +34,6 @@ private:
void setupWallpaperForAllScreens();
bool searchWorkerWindowToParentTo();
signals:
void qmlSceneValueReceived(const QString key, const QString value);
private:
int m_windowOffsetX = 0;
int m_windowOffsetY = 0;

View File

@ -3,5 +3,8 @@
<file>assets/image/noisy-texture-3.png</file>
<file>test.qml</file>
<file>mainWidget.qml</file>
<file>assets/icons/baseline-close-24px.svg</file>
<file>assets/icons/baseline-opacity-24px.svg</file>
<file>assets/icons/baseline-settings-20px.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 239 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M24 0H0v24h24V0zm0 0H0v24h24V0zM0 24h24V0H0v24z"/><path d="M17.66 8L12 2.35 6.34 8C4.78 9.56 4 11.64 4 13.64s.78 4.11 2.34 5.67 3.61 2.35 5.66 2.35 4.1-.79 5.66-2.35S20 15.64 20 13.64 19.22 9.56 17.66 8zM6 14c.01-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 17.99 12 18 14H6z"/></svg>

After

Width:  |  Height:  |  Size: 393 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="none" d="M0 0h20v20H0V0z"/><path d="M15.95 10.78c.03-.25.05-.51.05-.78s-.02-.53-.06-.78l1.69-1.32c.15-.12.19-.34.1-.51l-1.6-2.77c-.1-.18-.31-.24-.49-.18l-1.99.8c-.42-.32-.86-.58-1.35-.78L12 2.34c-.03-.2-.2-.34-.4-.34H8.4c-.2 0-.36.14-.39.34l-.3 2.12c-.49.2-.94.47-1.35.78l-1.99-.8c-.18-.07-.39 0-.49.18l-1.6 2.77c-.1.18-.06.39.1.51l1.69 1.32c-.04.25-.07.52-.07.78s.02.53.06.78L2.37 12.1c-.15.12-.19.34-.1.51l1.6 2.77c.1.18.31.24.49.18l1.99-.8c.42.32.86.58 1.35.78l.3 2.12c.04.2.2.34.4.34h3.2c.2 0 .37-.14.39-.34l.3-2.12c.49-.2.94-.47 1.35-.78l1.99.8c.18.07.39 0 .49-.18l1.6-2.77c.1-.18.06-.39-.1-.51l-1.67-1.32zM10 13c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"/></svg>

After

Width:  |  Height:  |  Size: 774 B

View File

@ -1,18 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import ScreenPlay.screenplaysdk 1.0
Item {
id: mainWindow
visible: true
anchors.fill: parent
OpacityAnimator {
id: animFadeOut
from: 1
to: 0
target: parent
duration: 800
easing.type: Easing.InOutQuad
onFinished: window.destroyThis()
}
Rectangle {
id: bgColor
anchors.fill: parent
color: "white"
//color: "#1A1F22"
opacity: .15
}
@ -28,12 +34,14 @@ Item {
anchors.fill: parent
asynchronous: true
source: {
Qt.resolvedUrl(window.sourcePath)
Qt.resolvedUrl(window.sourcePath)
}
onStatusChanged: {
if (loader.status === Loader.Ready) {
Connections {
target: loader.item
onSizeChanged: {
mainWindow.width = size.width
mainWindow.height = size.height
}
}
}
@ -41,37 +49,20 @@ Item {
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onPressed: {
window.setClickPos(Qt.point(mouse.x, mouse.y))
}
onPositionChanged: {
window.setPos(mouse.x, mouse.y)
if (mouseArea.pressed)
window.setPos(mouse.x, mouse.y)
}
onClicked: {
if (mouse.button === Qt.RightButton) {
contextMenu.popup()
}
}
}
Menu {
id: contextMenu
MenuItem {
text: qsTr("Close Widget")
onClicked: {
Qt.quit()
}
}
}
Connections {
target: window
onQmlSceneValueReceived: {
var obj2 = 'import QtQuick 2.12; Item {Component.onCompleted: loader.item.'
+ key + ' = ' + value + '; }'
@ -80,5 +71,45 @@ Item {
}
}
MouseArea {
id: mouseAreaClose
width: 20
height: width
anchors {
top: parent.top
right: parent.right
}
cursorShape: Qt.PointingHandCursor
onClicked: {
window.setWindowBlur(0)
animFadeOut.start()
}
Image {
source: "qrc:/assets/icons/baseline-close-24px.svg"
anchors.centerIn: parent
}
}
MouseArea {
id: mouseAreaResize
width: 20
height: width
anchors {
bottom: parent.bottom
right: parent.right
}
cursorShape: Qt.SizeFDiagCursor
property point clickPosition
onPressed: {
clickPosition = Qt.point(mouseX, mouseY)
}
onPositionChanged: {
if (mouseAreaResize.pressed) {
window.setWidgetSize(clickPosition.x + mouseX,
clickPosition.y + mouseY)
}
}
}
}

View File

@ -4,11 +4,9 @@
WidgetWindow::WidgetWindow(QString projectPath, QString appid, QObject* parent)
: QObject(parent)
, m_appID { appid }
{
m_appID = appid;
Qt::WindowFlags flags = m_window.flags();
m_window.setWidth(300);
m_window.setHeight(300);
@ -18,7 +16,7 @@ WidgetWindow::WidgetWindow(QString projectPath, QString appid, QObject* parent)
#ifdef Q_OS_WIN
m_hwnd = reinterpret_cast<HWND>(m_window.winId());
SetWindowBlur(m_hwnd);
setWindowBlur();
#endif
if (projectPath != "test") {
@ -44,9 +42,9 @@ WidgetWindow::WidgetWindow(QString projectPath, QString appid, QObject* parent)
// Instead of setting "renderType: Text.NativeRendering" every time
// we can set it here once :)
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
// m_window.setResizeMode(QQuickView::ResizeMode::SizeViewToRootObject);
m_window.setSource(QUrl("qrc:/mainWidget.qml"));
m_window.show();
}
void WidgetWindow::setSize(QSize size)
@ -80,8 +78,14 @@ void WidgetWindow::setClickPos(const QPoint& clickPos)
m_clickPos = clickPos;
}
void WidgetWindow::setWidgetSize(const int with, const int height)
{
m_window.setWidth(with);
m_window.setHeight(height);
}
#ifdef Q_OS_WIN
void WidgetWindow::SetWindowBlur(HWND hWnd)
void WidgetWindow::setWindowBlur(unsigned int style)
{
const HINSTANCE hModule = LoadLibrary(TEXT("user32.dll"));
@ -108,9 +112,9 @@ void WidgetWindow::SetWindowBlur(HWND hWnd)
typedef BOOL(WINAPI * pSetWindowCompositionAttribute)(HWND, WINCOMPATTRDATA*);
const pSetWindowCompositionAttribute SetWindowCompositionAttribute = (pSetWindowCompositionAttribute)GetProcAddress(hModule, "SetWindowCompositionAttribute");
if (SetWindowCompositionAttribute) {
ACCENTPOLICY policy = { static_cast<int>(Accent::BLURBEHIND), 0, 0, 0 }; // ACCENT_ENABLE_BLURBEHIND=3...
ACCENTPOLICY policy = { static_cast<int>(style), 0, 0, 0 }; // ACCENT_ENABLE_BLURBEHIND=3...
WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) }; // WCA_ACCENT_POLICY=19
SetWindowCompositionAttribute(hWnd, &data);
SetWindowCompositionAttribute(m_hwnd, &data);
}
FreeLibrary(hModule);
}

View File

@ -56,13 +56,18 @@ signals:
void typeChanged(QString type);
void projectConfigChanged(QString projectConfig);
void sourcePathChanged(QString sourcePath);
void qmlSceneValueReceived(QString key, QString value);
public slots:
void setSize(QSize size);
void destroyThis();
void messageReceived(QString key, QString value);
void setPos(int xPos, int yPos);
void setClickPos(const QPoint& clickPos);
void setWidgetSize(const int with, const int height);
#ifdef Q_OS_WIN
void setWindowBlur(unsigned int style = 3);
#endif
void setAppID(QString appID)
{
@ -89,11 +94,6 @@ public slots:
emit projectConfigChanged(m_projectConfig);
}
void setPos(int xPos, int yPos);
void setClickPos(const QPoint& clickPos);
#ifdef Q_OS_WIN
void SetWindowBlur(HWND hWnd);
#endif
void setSourcePath(QString sourcePath)
{
if (m_sourcePath == sourcePath)
@ -104,9 +104,9 @@ public slots:
}
private:
QString m_appID;
QString m_type = "qmlWidget";
QString m_projectConfig;
QString m_appID { "" };
QString m_type { "qmlWidget" };
QString m_projectConfig { "" };
QJsonObject m_project;
#ifdef Q_OS_WIN
HWND m_hwnd;
@ -114,5 +114,5 @@ private:
QPoint m_clickPos = { 0, 0 };
QQuickView m_window;
QString m_sourcePath;
QString m_sourcePath { "" };
};

Some files were not shown because too many files have changed in this diff Show More