mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-22 10:42:29 +01:00
Multiple refactoring....
Bump Qt to 6.3 to fix video loop Remove no longer working shader and add new WIP: Shader compilation path is wrong for some reason Add Steamless version content path Remove cmake-format: sortable from CMakeLists.txt Add Widnow scale indocator icon to the bottom right Remove unused doctest and benchmark Fix tests and installer cmake logic
This commit is contained in:
parent
42bdd7682c
commit
77a81451ca
1
.gitignore
vendored
1
.gitignore
vendored
@ -250,3 +250,4 @@ cython_debug/
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
/aqtinstall.log
|
||||
/ThirdParty/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
project(CMake)
|
||||
|
||||
set(FILES
|
||||
# cmake-format: sortable
|
||||
|
||||
CopyRecursive.cmake
|
||||
CreateIFWInstaller.cmake
|
||||
FetchContentThirdParty.cmake
|
||||
|
@ -7,6 +7,8 @@ project(
|
||||
HOMEPAGE_URL "https://screen-play.app/"
|
||||
LANGUAGES CXX)
|
||||
|
||||
|
||||
|
||||
# This sets cmake to compile all dlls into the main directory
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
@ -14,8 +16,8 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
set(SCREENPLAY_IFW_ROOT "")
|
||||
option(SCREENPLAY_STEAM "For FOSS distribution so we do not bundle proprietary code." ON)
|
||||
option(SCREENPLAY_TESTS "Enables UI tests." OFF)
|
||||
option(SCREENPLAY_CREATE_INSTALLER "Indicates whether an installer via the Qt Installer Framework is created." OFF)
|
||||
option(SCREENPLAY_TESTS "Enables UI tests." ON)
|
||||
option(SCREENPLAY_INSTALLER "Indicates whether an installer via the Qt Installer Framework is created." OFF)
|
||||
|
||||
# Gitlab CI has many ENV variables. We use this one to check if the current build happens inside the CI
|
||||
if(DEFINED ENV{CI_COMMIT_MESSAGE})
|
||||
@ -87,13 +89,13 @@ add_subdirectory(ScreenPlayUtil)
|
||||
add_subdirectory(ScreenPlayWeather)
|
||||
add_subdirectory(CMake)
|
||||
add_subdirectory(Tools)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FetchContentThirdParty.cmake)
|
||||
|
||||
# Only add target SteamSDKQtEnums
|
||||
add_subdirectory(ScreenPlayWorkshop/SteamSDK)
|
||||
if(${SCREENPLAY_STEAM})
|
||||
add_subdirectory(ScreenPlayWorkshop)
|
||||
else()
|
||||
# Only add target SteamSDKQtEnums
|
||||
add_subdirectory(ScreenPlayWorkshop/SteamSDK)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@ -104,7 +106,7 @@ message(STATUS "[DEFINE] SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DI
|
||||
message(STATUS "[DEFINE] BUILD_DATE = ${BUILD_DATE}")
|
||||
message(STATUS "[DEFINE] BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "[DEFINE] GIT_COMMIT_HASH = ${GIT_COMMIT_HASH}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_CREATE_INSTALLER = ${SCREENPLAY_CREATE_INSTALLER}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_INSTALLER = ${SCREENPLAY_INSTALLER}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_STEAM = ${SCREENPLAY_STEAM}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_TESTS = ${SCREENPLAY_TESTS}")
|
||||
message(STATUS "[PROJECT] CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")
|
||||
|
@ -5,7 +5,6 @@ set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
set(SOURCES
|
||||
# cmake-format: sortable
|
||||
app.cpp
|
||||
src/create.cpp
|
||||
src/createimportvideo.cpp
|
||||
@ -24,7 +23,6 @@ set(SOURCES
|
||||
src/wizards.cpp)
|
||||
|
||||
set(HEADER
|
||||
# cmake-format: sortable
|
||||
app.h
|
||||
src/create.h
|
||||
src/createimportstates.h
|
||||
@ -45,7 +43,6 @@ set(HEADER
|
||||
src/wizards.h)
|
||||
|
||||
set(QML
|
||||
# cmake-format: sortable
|
||||
main.qml
|
||||
qml/Common/CloseIcon.qml
|
||||
qml/Common/ColorPicker.qml
|
||||
@ -142,7 +139,6 @@ set(QML
|
||||
qml/Workshop/WorkshopItem.qml)
|
||||
|
||||
set(TS_FILES
|
||||
# cmake-format: sortable
|
||||
translations/ScreenPlay_.ts
|
||||
translations/ScreenPlay_de_DE.ts
|
||||
translations/ScreenPlay_es_ES.ts
|
||||
@ -160,7 +156,6 @@ set(TS_FILES
|
||||
# Needed on macos
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(doctest CONFIG REQUIRED)
|
||||
|
||||
# CURL must be included before sentry because sentry needs the module and does not include it itself on macos...
|
||||
find_package(CURL CONFIG REQUIRED)
|
||||
@ -191,7 +186,6 @@ target_link_libraries(
|
||||
ScreenPlayLib
|
||||
PUBLIC ScreenPlaySDK
|
||||
ScreenPlayUtil
|
||||
doctest::doctest
|
||||
sentry::sentry
|
||||
Threads::Threads
|
||||
Qt6::Quick
|
||||
|
@ -130,5 +130,6 @@
|
||||
<file>qml/Create/WizardsFiles/QMLWidgetMain.qml</file>
|
||||
<file>assets/icons/font-awsome/patreon-brands.svg</file>
|
||||
<file>assets/images/steam_offline.png</file>
|
||||
<file>assets/images/scale_window_indicator.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
ScreenPlay/assets/images/scale_window_indicator.png
Normal file
BIN
ScreenPlay/assets/images/scale_window_indicator.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -39,9 +39,6 @@
|
||||
Q_IMPORT_QML_PLUGIN(ScreenPlayQmlPlugin)
|
||||
|
||||
#include <sentry.h>
|
||||
#define DOCTEST_CONFIG_IMPLEMENT
|
||||
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
@ -49,17 +46,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
QApplication qtGuiApp(argc, argv);
|
||||
|
||||
// Unit tests
|
||||
doctest::Context context;
|
||||
context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
|
||||
context.setOption("order-by", "name"); // sort the test cases by their name
|
||||
context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
|
||||
context.setOption("no-run", true); // No tests are executed by default
|
||||
context.applyCommandLine(argc, argv); // Every setOption call after applyCommandLine overrides the command line arguments
|
||||
const int testResult = context.run();
|
||||
if (context.shouldExit())
|
||||
return testResult;
|
||||
|
||||
ScreenPlay::App app;
|
||||
|
||||
if (app.m_isAnotherScreenPlayInstanceRunning) {
|
||||
|
@ -38,14 +38,16 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
if (name === "Installed") {
|
||||
stackView.replace("qrc:/ScreenPlayQml/qml/Installed/Installed.qml", {
|
||||
stackView.replace("qrc:/ScreenPlayQml/qml/Installed/Installed.qml",
|
||||
{
|
||||
"sidebar": sidebar
|
||||
})
|
||||
return
|
||||
}
|
||||
stackView.replace("qrc:/ScreenPlayQml/qml/" + name + "/" + name + ".qml", {
|
||||
"modalSource": content
|
||||
})
|
||||
stackView.replace(
|
||||
"qrc:/ScreenPlayQml/qml/" + name + "/" + name + ".qml", {
|
||||
"modalSource": content
|
||||
})
|
||||
sidebar.state = "inactive"
|
||||
}
|
||||
|
||||
@ -55,10 +57,11 @@ ApplicationWindow {
|
||||
visible: false
|
||||
width: 1400
|
||||
height: 788
|
||||
title: "ScreenPlay Alpha - " + ScreenPlay.version()
|
||||
title: "ScreenPlay Alpha - V" + ScreenPlay.version()
|
||||
minimumHeight: 450
|
||||
minimumWidth: 1050
|
||||
property bool enableCustomWindowNavigation: Qt.platform.os === "windows" || Qt.platform.os === "osx"
|
||||
property bool enableCustomWindowNavigation: Qt.platform.os === "windows"
|
||||
|| Qt.platform.os === "osx"
|
||||
|
||||
// Partial workaround for
|
||||
// https://bugreports.qt.io/browse/QTBUG-86047
|
||||
@ -74,7 +77,7 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if(root.enableCustomWindowNavigation){
|
||||
if (root.enableCustomWindowNavigation) {
|
||||
root.flags = Qt.FramelessWindowHint | Qt.Window
|
||||
}
|
||||
setTheme(ScreenPlay.settings.theme)
|
||||
@ -82,7 +85,7 @@ ApplicationWindow {
|
||||
"sidebar": sidebar
|
||||
})
|
||||
if (!ScreenPlay.settings.silentStart)
|
||||
root.show()
|
||||
root.showNormal()
|
||||
}
|
||||
|
||||
Item {
|
||||
@ -117,7 +120,7 @@ ApplicationWindow {
|
||||
id: windowNav
|
||||
enabled: root.enableCustomWindowNavigation
|
||||
visible: enabled
|
||||
z:5
|
||||
z: 5
|
||||
modalSource: content
|
||||
width: parent.width
|
||||
window: root
|
||||
@ -126,13 +129,12 @@ ApplicationWindow {
|
||||
Item {
|
||||
id: content
|
||||
anchors {
|
||||
top: root.enableCustomWindowNavigation ? windowNav.bottom : parent.top
|
||||
top: root.enableCustomWindowNavigation ? windowNav.bottom : parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
function onThemeChanged(theme) {
|
||||
setTheme(theme)
|
||||
@ -287,15 +289,17 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Item {
|
||||
width: 15
|
||||
height: width
|
||||
color: "#555"
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: 1
|
||||
}
|
||||
Image {
|
||||
source: "qrc:/assets/images/scale_window_indicator.png"
|
||||
}
|
||||
MouseArea {
|
||||
id: maResize
|
||||
anchors.fill: parent
|
||||
|
@ -6,7 +6,7 @@ import ScreenPlay 1.0
|
||||
SystemTrayIcon {
|
||||
id: root
|
||||
|
||||
property var window
|
||||
property Window window
|
||||
visible: true
|
||||
icon.source: "qrc:/assets/icons/app.ico"
|
||||
tooltip: qsTr("ScreenPlay - Double click to change you settings.")
|
||||
|
@ -75,7 +75,7 @@ Item {
|
||||
id: txtHeadline
|
||||
|
||||
y: 80
|
||||
text: qsTr("Get free Widgets and Wallpaper via the Steam Workshop")
|
||||
text: ScreenPlay.settings.steamVersion ? qsTr("Get free Widgets and Wallpaper via the Steam Workshop") : qsTr("Get content via our forum")
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.capitalization: Font.Capitalize
|
||||
wrapMode: Text.WordWrap
|
||||
|
@ -383,7 +383,8 @@ Item {
|
||||
volume = Math.round(sliderVolume.slider.value * 100) / 100;
|
||||
|
||||
const screenFile = ScreenPlay.installedListModel.get(root.contentFolderName).m_file;
|
||||
ScreenPlay.screenPlayManager.createWallpaper(root.type, cbVideoFillMode.currentValue, absoluteStoragePath, previewImage, screenFile, activeMonitors, volume, 1, {}, true);
|
||||
let success =ScreenPlay.screenPlayManager.createWallpaper(root.type, cbVideoFillMode.currentValue, absoluteStoragePath, previewImage, screenFile, activeMonitors, volume, 1, {}, true);
|
||||
print(success)
|
||||
}
|
||||
if (JSUtil.isWidget(root.type))
|
||||
ScreenPlay.screenPlayManager.createWidget(type, Qt.point(0, 0), absoluteStoragePath, previewImage, {}, true);
|
||||
|
@ -19,7 +19,7 @@ Rectangle {
|
||||
|
||||
Text {
|
||||
id: title
|
||||
text: qsTr("ScreenPlay Alpha %1 - Open Source Wallpaper And Widgets").arg(
|
||||
text: qsTr("ScreenPlay Alpha V%1 - Open Source Wallpaper And Widgets").arg(
|
||||
ScreenPlay.version())
|
||||
color: Material.primaryTextColor
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "screenplaymanager.h"
|
||||
#include <QScopeGuard>
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
namespace ScreenPlay {
|
||||
|
||||
@ -171,7 +170,7 @@ bool ScreenPlayManager::createWallpaper(
|
||||
for (auto& wallpaper : m_screenPlayWallpapers) {
|
||||
if (wallpaper->screenNumber().length() == 1) {
|
||||
if (monitors.at(0) == wallpaper->screenNumber().at(0)) {
|
||||
wallpaper->replace(
|
||||
return wallpaper->replace(
|
||||
path,
|
||||
previewImage,
|
||||
file,
|
||||
@ -180,8 +179,6 @@ bool ScreenPlayManager::createWallpaper(
|
||||
type,
|
||||
m_settings->checkWallpaperVisible());
|
||||
m_monitorListModel->setWallpaperMonitor(wallpaper, monitorIndex);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
@ -721,9 +718,4 @@ bool ScreenPlayManager::loadProfiles()
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST_CASE("Loads profiles.json")
|
||||
{
|
||||
GlobalVariables globalVariables;
|
||||
ScreenPlayManager manager;
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ void ScreenPlayWallpaper::setSDKConnection(std::unique_ptr<SDKConnection> connec
|
||||
/*!
|
||||
\brief Replaces the current wallpaper with the given one.
|
||||
*/
|
||||
void ScreenPlayWallpaper::replace(
|
||||
bool ScreenPlayWallpaper::replace(
|
||||
const QString& absolutePath,
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
@ -250,11 +250,11 @@ void ScreenPlayWallpaper::replace(
|
||||
{
|
||||
|
||||
if (m_isExiting)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!m_connection) {
|
||||
qWarning() << "Cannot replace for unconnected wallpaper!";
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_previewImage = previewImage;
|
||||
@ -272,8 +272,9 @@ void ScreenPlayWallpaper::replace(
|
||||
obj.insert("file", file);
|
||||
obj.insert("checkWallpaperVisible", checkWallpaperVisible);
|
||||
|
||||
m_connection->sendMessage(QJsonDocument(obj).toJson(QJsonDocument::Compact));
|
||||
const bool success = m_connection->sendMessage(QJsonDocument(obj).toJson(QJsonDocument::Compact));
|
||||
emit requestSave();
|
||||
return success;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
|
||||
bool start();
|
||||
|
||||
void replace(
|
||||
bool replace(
|
||||
const QString& absolutePath,
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
|
@ -40,6 +40,10 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
|
||||
: QObject(parent)
|
||||
, m_globalVariables { globalVariables }
|
||||
{
|
||||
const QString qtVersion = QString("Qt Version: %1.%2.%3").arg(QT_VERSION_MAJOR).arg(QT_VERSION_MINOR).arg(QT_VERSION_PATCH);
|
||||
setGitBuildHash(COMPILE_INFO + qtVersion);
|
||||
setSteamVersion(!(QString(SCREENPLAY_STEAM).compare("OFF", Qt::CaseInsensitive) ? false : true));
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
setDesktopEnvironment(DesktopEnvironment::Windows);
|
||||
#endif
|
||||
@ -99,11 +103,7 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
|
||||
}
|
||||
|
||||
initInstalledPath();
|
||||
|
||||
setupWidgetAndWindowPaths();
|
||||
const QString qtVersion = QString("Qt Version: %1.%2.%3").arg(QT_VERSION_MAJOR).arg(QT_VERSION_MINOR).arg(QT_VERSION_PATCH);
|
||||
setGitBuildHash(COMPILE_INFO + qtVersion);
|
||||
setSteamVersion(!(QString(SCREENPLAY_STEAM).compare("OFF", Qt::CaseInsensitive) ? false : true));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -195,8 +195,19 @@ void Settings::restoreDefault(const QString& appConfigLocation, const QString& s
|
||||
|
||||
void Settings::initInstalledPath()
|
||||
{
|
||||
// If empty use steam workshop location
|
||||
if (QString(m_qSettings.value("ScreenPlayContentPath").toString()).isEmpty()) {
|
||||
const QString contentPath = m_qSettings.value("ScreenPlayContentPath").toString();
|
||||
|
||||
// Steamless
|
||||
if (!steamVersion() && contentPath.isEmpty()) {
|
||||
const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
|
||||
m_qSettings.setValue("ScreenPlayContentPath", QUrl::fromUserInput(path));
|
||||
m_qSettings.sync();
|
||||
m_globalVariables->setLocalStoragePath(path);
|
||||
return;
|
||||
}
|
||||
|
||||
// Steam
|
||||
if (contentPath.isEmpty()) {
|
||||
|
||||
/*
|
||||
* ! We must use this (ugly) method, because to stay FOSS we cannot call the steamAPI here !
|
||||
@ -233,10 +244,10 @@ void Settings::initInstalledPath()
|
||||
} else {
|
||||
qWarning() << "The following path could not be resolved to search for workshop content: " << path;
|
||||
}
|
||||
|
||||
} else {
|
||||
m_globalVariables->setLocalStoragePath(QUrl::fromUserInput(m_qSettings.value("ScreenPlayContentPath").toString()));
|
||||
return;
|
||||
}
|
||||
|
||||
m_globalVariables->setLocalStoragePath(QUrl::fromUserInput(contentPath));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -9,10 +9,10 @@ find_package(
|
||||
COMPONENTS Quick Network Core
|
||||
REQUIRED)
|
||||
|
||||
set(SOURCES # cmake-format: sortable
|
||||
set(SOURCES
|
||||
src/screenplay-sdk_plugin.cpp src/screenplaysdk.cpp)
|
||||
|
||||
set(HEADER # cmake-format: sortable
|
||||
set(HEADER
|
||||
inc/screenplay-sdk_plugin.h inc/screenplaysdk.h)
|
||||
|
||||
add_library(${PROJECT_NAME} ${SOURCES} ${HEADER})
|
||||
|
@ -1,3 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(ScreenPlayShader LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
@ -9,60 +10,46 @@ find_package(
|
||||
COMPONENTS Quick Core ShaderTools
|
||||
REQUIRED)
|
||||
|
||||
# Because this is a plugin, we need this for testing and development. This can be disabled when using the plugin in your project directly.
|
||||
option(tst_ScreenPlayShader "Builds TextProject" ON)
|
||||
|
||||
set(QML_RESOURCES
|
||||
# cmake-format: sortable
|
||||
shader/lightning.frag
|
||||
shader/lightning.vert
|
||||
shader/water.frag
|
||||
shader/water.vert)
|
||||
|
||||
# https://doc.qt.io/qt-6/qtshadertools-build.html
|
||||
qt6_add_shaders(
|
||||
${PROJECT_NAME}
|
||||
"${PROJECT_NAME}Shaders"
|
||||
PREFIX
|
||||
"/shader"
|
||||
FILES
|
||||
lightning.frag
|
||||
lightning.vert
|
||||
water.frag
|
||||
water.vert)
|
||||
|
||||
set(QML # cmake-format: sortable
|
||||
set(QML
|
||||
src/ShadertoyShader.qml src/TestMain.qml)
|
||||
|
||||
set(QML_PLUGIN_SOURCES # cmake-format: sortable
|
||||
src/shaderlibrary.cpp)
|
||||
|
||||
set(QML_PLUGIN_HEADER # cmake-format: sortable
|
||||
src/shaderlibrary.h)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC)
|
||||
qt_add_library(${PROJECT_NAME} STATIC)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src/)
|
||||
qt6_add_shaders(${PROJECT_NAME} "shaders"
|
||||
BATCHABLE
|
||||
PRECOMPILE
|
||||
PREFIX
|
||||
"/ScreenPlayShader"
|
||||
FILES
|
||||
#shader/lightning.frag
|
||||
#shader/lightning.vert
|
||||
shaders/wobble.frag
|
||||
shaders/water.frag
|
||||
shaders/water.vert)
|
||||
|
||||
qt_add_qml_module(
|
||||
${PROJECT_NAME}
|
||||
URI
|
||||
${PROJECT_NAME}
|
||||
OUTPUT_DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/bin/${PROJECT_NAME}
|
||||
VERSION
|
||||
1.0
|
||||
QML_FILES
|
||||
${QML}
|
||||
SOURCES
|
||||
${QML_PLUGIN_SOURCES}
|
||||
${QML_PLUGIN_HEADER}
|
||||
RESOURCES
|
||||
${QML_RESOURCES})
|
||||
# https://doc.qt.io/qt-6/qtshadertools-build.html
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick Qt6::Gui)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick)
|
||||
|
||||
if(${tst_ScreenPlayShader})
|
||||
if(${SCREENPLAY_TESTS})
|
||||
qt_add_executable(tst_ScreenPlayShader src/TestMain.cpp)
|
||||
target_link_libraries(tst_ScreenPlayShader PRIVATE Qt6::Quick ${PROJECT_NAME}plugin)
|
||||
target_compile_definitions(tst_ScreenPlayShader PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
endif()
|
||||
|
||||
qt_add_qml_module(
|
||||
tst_ScreenPlayShader
|
||||
URI
|
||||
ScreenPlayShader
|
||||
VERSION
|
||||
1.0
|
||||
QML_FILES
|
||||
${QML})
|
||||
|
||||
|
||||
target_link_libraries(tst_ScreenPlayShader PRIVATE
|
||||
Qt6::Quick
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Qml
|
||||
Qt::Quick
|
||||
${PROJECT_NAME})
|
||||
|
||||
endif()
|
||||
|
@ -1,59 +0,0 @@
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform sampler2D qt_Texture0;
|
||||
varying vec4 qt_TexCoord0;
|
||||
|
||||
//uniform float reflectionOffset; // allows player to control reflection position
|
||||
//uniform float reflectionBlur ; // works only if projec's driver is set to GLES3, more information here https://docs.godotengine.org/ru/stable/tutorials/shading/screen-reading_shaders.html
|
||||
//uniform float calculatedOffset ; // this is controlled by script, it takes into account camera position and water object position, that way reflection stays in the same place when camera is moving
|
||||
//uniform float calculatedAspect ; // is controlled by script, ensures that noise is not affected by object scale
|
||||
//uniform sampler2D noiseTexture;
|
||||
//uniform float offsetStrength;
|
||||
//uniform float maxOffset;
|
||||
|
||||
//uniform vec2 distortionScale;
|
||||
//uniform vec2 distortionSpeed;
|
||||
|
||||
//uniform float waveSmoothing;
|
||||
|
||||
//uniform float mainWaveSpeed ;
|
||||
//uniform float mainWaveFrequency ;
|
||||
//uniform float mainWaveAmplitude;
|
||||
|
||||
//uniform float secondWaveSpeed ;
|
||||
//uniform float secondWaveFrequency ;
|
||||
//uniform float secondWaveAmplitude ;
|
||||
|
||||
//uniform float thirdWaveSpeed ;
|
||||
//uniform float thirdWaveFrequency ;
|
||||
//uniform float thirdWaveAmplitude ;
|
||||
|
||||
//uniform float squashing ;
|
||||
|
||||
//uniform vec4 shorelineColor; //: hint_color = vec4(1.);
|
||||
//uniform float shorelineSize; //: hint_range(0., 0.1) = 0.0025;
|
||||
//uniform float shorelineFoamSize ; // : hint_range(0., 0.1)
|
||||
//uniform float foamSpeed;
|
||||
//uniform vec2 foamScale;
|
||||
|
||||
uniform float time;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = fragCoord.xy / iResolution.xy;
|
||||
vec4 texture_color = vec4(0.192156862745098, 0.6627450980392157, 0.9333333333333333, 1.0);
|
||||
|
||||
vec4 k = vec4(time)*0.8;
|
||||
k.xy = uv * 7.0;
|
||||
float val1 = length(0.5-fract(k.xyw*=mat3(vec3(-2.0,-1.0,0.0), vec3(3.0,-1.0,1.0), vec3(1.0,-1.0,-1.0))*0.5));
|
||||
float val2 = length(0.5-fract(k.xyw*=mat3(vec3(-2.0,-1.0,0.0), vec3(3.0,-1.0,1.0), vec3(1.0,-1.0,-1.0))*0.2));
|
||||
float val3 = length(0.5-fract(k.xyw*=mat3(vec3(-2.0,-1.0,0.0), vec3(3.0,-1.0,1.0), vec3(1.0,-1.0,-1.0))*0.5));
|
||||
vec4 color = vec4 ( pow(min(min(val1,val2),val3), 7.0) * 3.0)+texture_color;
|
||||
gl_FragColor = color;
|
||||
|
||||
//gl_FragColor = texture2D(qt_Texture0, qt_TexCoord0.st);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
attribute vec4 qt_Vertex;
|
||||
attribute vec4 qt_MultiTexCoord0;
|
||||
uniform mat4 qt_ModelViewProjectionMatrix;
|
||||
varying vec4 qt_TexCoord0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;
|
||||
qt_TexCoord0 = qt_MultiTexCoord0;
|
||||
}
|
12
ScreenPlayShader/shaders/water.frag
Normal file
12
ScreenPlayShader/shaders/water.frag
Normal file
@ -0,0 +1,12 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec2 coord;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
};
|
||||
layout(binding = 1) uniform sampler2D src;
|
||||
void main() {
|
||||
vec4 tex = texture(src, coord);
|
||||
fragColor = vec4(vec3(dot(tex.rgb, vec3(0.344, 0.5, 0.156))), tex.a) * qt_Opacity;
|
||||
}
|
13
ScreenPlayShader/shaders/water.vert
Normal file
13
ScreenPlayShader/shaders/water.vert
Normal file
@ -0,0 +1,13 @@
|
||||
#version 440
|
||||
layout(location = 0) in vec4 qt_Vertex;
|
||||
layout(location = 1) in vec2 qt_MultiTexCoord0;
|
||||
layout(location = 0) out vec2 coord;
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
};
|
||||
|
||||
void main() {
|
||||
coord = qt_MultiTexCoord0;
|
||||
gl_Position = qt_Matrix * qt_Vertex;
|
||||
}
|
20
ScreenPlayShader/shaders/wobble.frag
Normal file
20
ScreenPlayShader/shaders/wobble.frag
Normal file
@ -0,0 +1,20 @@
|
||||
#version 440
|
||||
|
||||
layout(location = 0) in vec2 qt_TexCoord0;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
layout(binding = 1) uniform sampler2D source;
|
||||
|
||||
layout(std140, binding = 0) uniform buf {
|
||||
mat4 qt_Matrix;
|
||||
float qt_Opacity;
|
||||
float amplitude;
|
||||
float frequency;
|
||||
float time;
|
||||
} ubuf;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = sin(ubuf.time + ubuf.frequency * qt_TexCoord0);
|
||||
fragColor = texture(source, qt_TexCoord0 + ubuf.amplitude * vec2(p.y, -p.x)) * ubuf.qt_Opacity;
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
#include <QVersionNumber>
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
|
||||
Q_IMPORT_QML_PLUGIN(ScreenPlayShaderPlugin)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -2,7 +2,6 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import ScreenPlayShader 1.0
|
||||
|
||||
Window {
|
||||
id: root
|
||||
@ -11,6 +10,21 @@ Window {
|
||||
visible: true
|
||||
title: qsTr("ScreenPlayShader")
|
||||
|
||||
Image {
|
||||
id: img
|
||||
anchors.centerIn: parent
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: ShaderEffect {
|
||||
//property variant source: theSource
|
||||
property real amplitude: 0.04 * 1
|
||||
property real frequency: 20
|
||||
property real time: 0
|
||||
NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
|
||||
|
||||
fragmentShader: " :/ScreenPlayShader/shaders/wobble.frag.qsb"
|
||||
}
|
||||
source: Qt.resolvedUrl(
|
||||
"file:///C:/Users/Eli/Desktop/jasmin-ne-Z4zOxNBri5I-unsplash.jpg")
|
||||
}
|
||||
}
|
||||
|
@ -21,15 +21,15 @@
|
||||
ShaderLibrary::ShaderLibrary(QQuickItem* parent)
|
||||
: QQuickItem(parent)
|
||||
{
|
||||
QFile lightningFragFile("qrc:/ScreenPlaySysInfo/src/lightning.frag");
|
||||
QFile lightningFragFile(":/shader/lightning.frag");
|
||||
lightningFragFile.open(QIODevice::ReadOnly);
|
||||
QFile lightningVertFile("qrc:/ScreenPlaySysInfo/src/lightning.vert");
|
||||
QFile lightningVertFile(":/shader/lightning.vert");
|
||||
lightningVertFile.open(QIODevice::ReadOnly);
|
||||
m_lightning = std::make_unique<Shader>(lightningVertFile.readAll(), lightningFragFile.readAll());
|
||||
|
||||
QFile waterFragFile("qrc:/ScreenPlaySysInfo/src/water.frag");
|
||||
QFile waterFragFile(":/shader/water.frag");
|
||||
waterFragFile.open(QIODevice::ReadOnly);
|
||||
QFile waterVertFile("qrc:/ScreenPlaySysInfo/src/water.vert");
|
||||
QFile waterVertFile(":/shader/water.vert");
|
||||
waterVertFile.open(QIODevice::ReadOnly);
|
||||
m_water = std::make_unique<Shader>(waterVertFile.readAll(), waterFragFile.readAll());
|
||||
}
|
||||
|
@ -14,14 +14,12 @@ find_package(
|
||||
COMPONENTS Quick Core
|
||||
REQUIRED)
|
||||
|
||||
# Because this is a plugin, we need this for testing and development. This can be disabled when using the plugin in your project directly.
|
||||
option(tst_ScreenPlaySysInfo "Builds TextProject" ON)
|
||||
|
||||
set(QML # cmake-format: sortable
|
||||
set(QML
|
||||
src/TestMain.qml)
|
||||
|
||||
set(QML_PLUGIN_SOURCES
|
||||
# cmake-format: sortable
|
||||
|
||||
src/cpu.cpp
|
||||
src/gpu.cpp
|
||||
src/ipaddress.cpp
|
||||
@ -31,7 +29,7 @@ set(QML_PLUGIN_SOURCES
|
||||
src/uptime.cpp)
|
||||
|
||||
set(QML_PLUGIN_HEADER
|
||||
# cmake-format: sortable
|
||||
|
||||
src/cpu.h
|
||||
src/gpu.h
|
||||
src/ipaddress.h
|
||||
@ -41,10 +39,13 @@ set(QML_PLUGIN_HEADER
|
||||
src/sysinfo.h
|
||||
src/uptime.h)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC)
|
||||
qt_add_library(${PROJECT_NAME} STATIC)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick infoware)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src/)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ole32.lib winmm.lib)
|
||||
endif()
|
||||
|
||||
qt_add_qml_module(
|
||||
${PROJECT_NAME}
|
||||
@ -60,7 +61,7 @@ qt_add_qml_module(
|
||||
${QML_PLUGIN_SOURCES}
|
||||
${QML_PLUGIN_HEADER})
|
||||
|
||||
if(${tst_ScreenPlaySysInfo})
|
||||
if(${SCREENPLAY_TESTS})
|
||||
qt_add_executable(tst_ScreenPlaySysInfo src/TestMain.cpp)
|
||||
target_link_libraries(tst_ScreenPlaySysInfo PRIVATE Qt6::Quick ${PROJECT_NAME}plugin)
|
||||
target_compile_definitions(tst_ScreenPlaySysInfo PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
|
@ -9,11 +9,11 @@ find_package(
|
||||
COMPONENTS Core Quick
|
||||
REQUIRED)
|
||||
|
||||
set(SOURCES # cmake-format: sortable
|
||||
set(SOURCES
|
||||
inc/public/ScreenPlayUtil/httpfileserver.cpp src/contenttypes.cpp src/util.cpp)
|
||||
|
||||
set(HEADER
|
||||
# cmake-format: sortable
|
||||
|
||||
inc/public/ScreenPlayUtil/AutoPropertyHelpers.h
|
||||
inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h
|
||||
inc/public/ScreenPlayUtil/contenttypes.h
|
||||
@ -27,7 +27,7 @@ set(HEADER
|
||||
inc/public/ScreenPlayUtil/SingletonHelper.h
|
||||
inc/public/ScreenPlayUtil/util.h)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADER})
|
||||
qt_add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADER})
|
||||
|
||||
find_path(CPP_HTTPLIB_INCLUDE_DIRS "httplib.h")
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CPP_HTTPLIB_INCLUDE_DIRS})
|
||||
|
@ -19,23 +19,23 @@ find_package(
|
||||
Positioning)
|
||||
|
||||
if(WIN32)
|
||||
set(SOURCES # cmake-format: sortable
|
||||
set(SOURCES
|
||||
src/windowsdesktopproperties.cpp src/winwindow.cpp)
|
||||
set(HEADER # cmake-format: sortable
|
||||
set(HEADER
|
||||
src/windowsdesktopproperties.h src/winwindow.h)
|
||||
elseif(APPLE)
|
||||
set(SOURCES # cmake-format: sortable
|
||||
set(SOURCES
|
||||
src/macintegration.cpp src/macwindow.cpp)
|
||||
set(HEADER
|
||||
# cmake-format: sortable
|
||||
|
||||
src/macbridge.h
|
||||
src/MacBridge.mm
|
||||
src/macintegration.h
|
||||
src/macwindow.h)
|
||||
elseif(UNIX)
|
||||
set(SOURCES # cmake-format: sortable
|
||||
set(SOURCES
|
||||
src/linuxwindow.cpp)
|
||||
set(HEADER # cmake-format: sortable
|
||||
set(HEADER
|
||||
src/linuxwindow.h)
|
||||
endif()
|
||||
|
||||
@ -43,7 +43,7 @@ set(SOURCES ${SOURCES} main.cpp src/basewindow.cpp)
|
||||
set(HEADER ${HEADER} src/basewindow.h)
|
||||
|
||||
set(QML
|
||||
# cmake-format: sortable
|
||||
|
||||
qml/GifWallpaper.qml
|
||||
qml/MultimediaView.qml
|
||||
qml/MultimediaWebView.qml
|
||||
@ -71,7 +71,6 @@ target_link_libraries(
|
||||
PRIVATE ScreenPlaySDK
|
||||
ScreenPlayUtil
|
||||
ScreenPlayWeatherplugin
|
||||
ScreenPlaySysInfoplugin
|
||||
Qt6::Quick
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
@ -81,6 +80,9 @@ target_link_libraries(
|
||||
Qt6::Multimedia
|
||||
Qt6::WebEngineCore
|
||||
Qt6::WebEngineQuick)
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlaySysInfoplugin)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
include(CopyRecursive)
|
||||
|
@ -11,11 +11,16 @@ Item {
|
||||
property bool isWindows: Qt.platform.os === "windows"
|
||||
signal requestFadeIn
|
||||
|
||||
property string source: Wallpaper.projectSourceFileAbsolute
|
||||
onSourceChanged: {
|
||||
// Qt 6.3 workaround
|
||||
mediaPlayer.stop()
|
||||
mediaPlayer.source = Qt.resolvedUrl(root.source)
|
||||
mediaPlayer.play()
|
||||
}
|
||||
|
||||
MediaPlayer {
|
||||
id: mediaPlayer
|
||||
|
||||
|
||||
source: Wallpaper.projectSourceFileAbsolute
|
||||
Component.onCompleted: {
|
||||
mediaPlayer.play()
|
||||
root.requestFadeIn()
|
||||
|
@ -32,7 +32,6 @@ Rectangle {
|
||||
loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml"
|
||||
}
|
||||
|
||||
print(loader.source)
|
||||
fadeIn()
|
||||
break
|
||||
case InstalledType.HTMLWallpaper:
|
||||
@ -197,7 +196,9 @@ Rectangle {
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: -3 // To fix the offset from setupWallpaperForOneScreen
|
||||
// To fix the offset from setupWallpaperForOneScreen
|
||||
// but I'm not sure when it happens
|
||||
//topMargin: -3
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ void BaseWindow::replaceWallpaper(
|
||||
if (type.contains("websiteWallpaper", Qt::CaseInsensitive)) {
|
||||
setProjectSourceFileAbsolute(file);
|
||||
} else {
|
||||
setProjectSourceFileAbsolute(QUrl::fromLocalFile(absolutePath + "/" + file));
|
||||
setProjectSourceFileAbsolute(QUrl::fromUserInput(absolutePath + "/" + file));
|
||||
}
|
||||
|
||||
if (m_type == ScreenPlay::InstalledType::InstalledType::QMLWallpaper || m_type == ScreenPlay::InstalledType::InstalledType::HTMLWallpaper)
|
||||
|
@ -3,25 +3,22 @@ project(
|
||||
VERSION 0.1
|
||||
LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(
|
||||
Qt6 6.2
|
||||
Qt6
|
||||
COMPONENTS Core Quick
|
||||
REQUIRED)
|
||||
|
||||
# Because this is a plugin, we need this for testing and development. This can be disabled when using the plugin in your project directly.
|
||||
option(tst_ScreenPlayWeather "Builds TextProject" ON)
|
||||
|
||||
set(QML # cmake-format: sortable
|
||||
set(QML
|
||||
src/TestMain.qml)
|
||||
|
||||
set(QML_PLUGIN_SOURCES # cmake-format: sortable
|
||||
set(QML_PLUGIN_SOURCES
|
||||
src/screenplayweather.cpp)
|
||||
|
||||
set(QML_PLUGIN_HEADER # cmake-format: sortable
|
||||
set(QML_PLUGIN_HEADER
|
||||
src/day.h src/screenplayweather.h)
|
||||
|
||||
qt_add_library(${PROJECT_NAME} STATIC)
|
||||
@ -42,7 +39,7 @@ qt_add_qml_module(
|
||||
${QML_PLUGIN_SOURCES}
|
||||
${QML_PLUGIN_HEADER})
|
||||
|
||||
if(${tst_ScreenPlayWeather})
|
||||
if(${SCREENPLAY_TESTS})
|
||||
qt_add_executable(tst_ScreenPlayWeather src/TestMain.cpp)
|
||||
target_link_libraries(tst_ScreenPlayWeather PRIVATE Qt6::Quick ${PROJECT_NAME}plugin)
|
||||
target_compile_definitions(tst_ScreenPlayWeather PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QVersionNumber>
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
|
||||
Q_IMPORT_QML_PLUGIN(ScreenPlayWeatherPlugin)
|
||||
|
@ -4,13 +4,13 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
set(SOURCES # cmake-format: sortable
|
||||
set(SOURCES
|
||||
main.cpp src/widgetwindow.cpp)
|
||||
|
||||
set(HEADER # cmake-format: sortable
|
||||
set(HEADER
|
||||
src/widgetwindow.h)
|
||||
|
||||
set(QML # cmake-format: sortable
|
||||
set(QML
|
||||
qml/Test.qml qml/Widget.qml)
|
||||
|
||||
find_package(
|
||||
@ -49,6 +49,10 @@ target_link_libraries(
|
||||
Qt6::WebEngineCore
|
||||
Qt6::WebEngineQuick)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlaySysInfoplugin)
|
||||
endif()
|
||||
|
||||
qt_add_qml_module(
|
||||
${PROJECT_NAME}
|
||||
URI
|
||||
|
@ -1,17 +1,23 @@
|
||||
project(ScreenPlayWorkshop LANGUAGES CXX)
|
||||
project(ScreenPlayWorkshop
|
||||
VERSION 0.1
|
||||
LANGUAGES CXX)
|
||||
|
||||
add_subdirectory(SteamSDK)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(
|
||||
Qt6
|
||||
COMPONENTS Quick Widgets Gui
|
||||
REQUIRED)
|
||||
|
||||
|
||||
set(QML
|
||||
src/TestMain.qml)
|
||||
|
||||
set(SOURCES
|
||||
# cmake-format: sortable
|
||||
|
||||
src/installedlistmodel.cpp
|
||||
src/steamaccount.cpp
|
||||
src/steamapiwrapper.cpp
|
||||
@ -22,7 +28,7 @@ set(SOURCES
|
||||
src/workshop.cpp)
|
||||
|
||||
set(HEADER
|
||||
# cmake-format: sortable
|
||||
|
||||
src/installedlistmodel.h
|
||||
src/steamaccount.h
|
||||
src/steamapiwrapper.h
|
||||
@ -51,26 +57,32 @@ elseif(UNIX)
|
||||
set(STEAM_BIN ${STEAM_LIB})
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADER})
|
||||
qt_add_library(${PROJECT_NAME} STATIC)
|
||||
# Needed by the automatic generated target missing includes
|
||||
# https://github.com/qt/qtdeclarative/blob/7a7064e14f094e843e1ee832cc927e86f887621a/src/qml/Qt6QmlMacros.cmake#L2042
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src/)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE Qt6::Core
|
||||
PUBLIC Qt6::Core
|
||||
Qt6::Quick
|
||||
${STEAM_LIB}
|
||||
ScreenPlayUtil
|
||||
SteamSDK)
|
||||
SteamSDK
|
||||
SteamSDKQtEnums)
|
||||
|
||||
qt_add_qml_module(
|
||||
${PROJECT_NAME}
|
||||
OUTPUT_DIRECTORY
|
||||
${WORKSHOP_PLUGIN_DIR}
|
||||
URI
|
||||
"Workshop"
|
||||
OUTPUT_DIRECTORY
|
||||
${WORKSHOP_PLUGIN_DIR}
|
||||
VERSION
|
||||
1.0
|
||||
QML_FILES
|
||||
${QML}
|
||||
SOURCES
|
||||
${SOURCES}
|
||||
${HEADER}
|
||||
VERSION
|
||||
1.0)
|
||||
${HEADER})
|
||||
|
||||
if(${SCREENPLAY_STEAM})
|
||||
if(APPLE)
|
||||
@ -88,21 +100,8 @@ if(${SCREENPLAY_STEAM})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Needed by the automatic generated target missing includes
|
||||
# https://github.com/qt/qtdeclarative/blob/7a7064e14f094e843e1ee832cc927e86f887621a/src/qml/Qt6QmlMacros.cmake#L2042
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src/)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE Qt6::Core
|
||||
Qt6::Quick
|
||||
${STEAM_LIB}
|
||||
ScreenPlayUtil
|
||||
SteamSDK
|
||||
SteamSDKQtEnums)
|
||||
|
||||
if(${tst_ScreenPlayWorkshop})
|
||||
qt_add_executable(tst_ScreenPlayWorkshop src/TestMain.cpp)
|
||||
target_link_libraries(tst_ScreenPlayWorkshop PRIVATE Qt6::Quick ${PROJECT_NAME}plugin)
|
||||
target_compile_definitions(tst_ScreenPlayWorkshop PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
endif()
|
||||
#if(${SCREENPLAY_TESTS})
|
||||
# qt_add_executable(tst_ScreenPlayWorkshop src/TestMain.cpp)
|
||||
# target_link_libraries(tst_ScreenPlayWorkshop PRIVATE Qt6::Quick ${PROJECT_NAME}plugin)
|
||||
# target_compile_definitions(tst_ScreenPlayWorkshop PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
#endif()
|
||||
|
@ -52,13 +52,13 @@ set(HEADER
|
||||
public/steam/steamuniverse.h)
|
||||
|
||||
if(${SCREENPLAY_STEAM})
|
||||
add_library(${PROJECT_NAME} STATIC ${HEADER})
|
||||
qt_add_library(${PROJECT_NAME} STATIC ${HEADER})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC public/)
|
||||
target_link_libraries(${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
# We allaways need the generated enums as a workaround to register these enums in app.cpp. Registering in the ScreenPlayWorkshop plugin does
|
||||
# not work for some reason.
|
||||
add_library(SteamSDKQtEnums STATIC public/steam/steam_qt_enums_generated.h)
|
||||
qt_add_library(SteamSDKQtEnums STATIC public/steam/steam_qt_enums_generated.h)
|
||||
target_include_directories(SteamSDKQtEnums PUBLIC public/)
|
||||
target_link_libraries(SteamSDKQtEnums PRIVATE Qt6::Core)
|
||||
|
25
ScreenPlayWorkshop/src/TestMain.cpp
Normal file
25
ScreenPlayWorkshop/src/TestMain.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
|
||||
Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
// The first subfolder is the libraryName followed by the regular
|
||||
// folder strucutre: LibararyName/Subfolder
|
||||
const QUrl url(u"qrc:/ScreenPlayWorkshop/src/TestMain.qml"_qs);
|
||||
QObject::connect(
|
||||
&engine, &QQmlApplicationEngine::objectCreated,
|
||||
&app, [url](QObject* obj, const QUrl& objUrl) {
|
||||
if (!obj && url == objUrl)
|
||||
QCoreApplication::exit(-1);
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
engine.load(url);
|
||||
|
||||
return app.exec();
|
||||
}
|
14
ScreenPlayWorkshop/src/TestMain.qml
Normal file
14
ScreenPlayWorkshop/src/TestMain.qml
Normal file
@ -0,0 +1,14 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import Workshop 1.0
|
||||
|
||||
Window {
|
||||
id: root
|
||||
width: 1366
|
||||
height: 768
|
||||
visible: true
|
||||
title: qsTr("ScreenPlayWorkshop")
|
||||
|
||||
}
|
@ -34,7 +34,7 @@ namespace ScreenPlayWorkshop {
|
||||
class InstalledListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
|
||||
QML_NAMED_ELEMENT(InstalledListModel)
|
||||
QML_ELEMENT
|
||||
Q_PROPERTY(QUrl absoluteStoragePath READ absoluteStoragePath WRITE setabsoluteStoragePath NOTIFY absoluteStoragePathChanged)
|
||||
|
||||
public:
|
||||
|
@ -16,7 +16,8 @@ namespace ScreenPlayWorkshop {
|
||||
|
||||
class SteamAccount : public QObject {
|
||||
Q_OBJECT
|
||||
QML_NAMED_ELEMENT(SteamAccount)
|
||||
QML_ELEMENT
|
||||
|
||||
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged)
|
||||
Q_PROPERTY(quint32 accountID READ accountID WRITE setAccountID NOTIFY accountIDChanged)
|
||||
Q_PROPERTY(QImage avatar READ avatar WRITE setAvatar NOTIFY avatarChanged)
|
||||
|
@ -40,8 +40,8 @@ struct SteamItemUpdate {
|
||||
|
||||
class SteamWorkshop : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
|
||||
QML_NAMED_ELEMENT(SteamWorkshop)
|
||||
Q_PROPERTY(bool online READ online WRITE setOnline NOTIFY onlineChanged)
|
||||
Q_PROPERTY(unsigned long long itemProcessed READ itemProcessed WRITE setItemProcessed NOTIFY itemProcessedChanged)
|
||||
Q_PROPERTY(unsigned long long bytesTotal READ bytesTotal WRITE setBytesTotal NOTIFY bytesTotalChanged)
|
||||
|
@ -2,7 +2,7 @@ project(Tools LANGUAGES CXX)
|
||||
|
||||
file(GLOB PYTHON *.py)
|
||||
|
||||
set(FILES # cmake-format: sortable
|
||||
set(FILES
|
||||
Installer/installscript.qs Installer/package.xml)
|
||||
|
||||
add_custom_target(
|
||||
|
102
Tools/build.py
102
Tools/build.py
@ -8,39 +8,25 @@ import time
|
||||
from pathlib import Path
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
qt_version = "6.2.3"
|
||||
steam_build = "OFF"
|
||||
build_tests = "OFF"
|
||||
create_installer = "OFF"
|
||||
|
||||
qt_path = ""
|
||||
cmake_target_triplet = ""
|
||||
cmake_build_type = ""
|
||||
executable_file_ending = ""
|
||||
deploy_command = ""
|
||||
aqt_path = ""
|
||||
cmake_bin_path = ""
|
||||
|
||||
file_endings = [".ninja_deps", ".ninja", ".ninja_log", ".lib", ".a", ".dylib", ".exp",
|
||||
".manifest", ".cmake", ".cbp", "CMakeCache.txt"]
|
||||
|
||||
vcvars = "" # We support 2019 or 2022
|
||||
|
||||
# Based on https://gist.github.com/l2m2/0d3146c53c767841c6ba8c4edbeb4c2c
|
||||
def get_vs_env_dict():
|
||||
vcvars = "" # We support 2019 or 2022
|
||||
|
||||
# Hardcoded VS path
|
||||
# check if vcvars64.bat is available
|
||||
# check if vcvars64.bat is available.
|
||||
msvc_2019_path = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat"
|
||||
msvc_2022_path = "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat"
|
||||
|
||||
if Path(msvc_2019_path).exists():
|
||||
vcvars = msvc_2019_path
|
||||
elif Path(msvc_2022_path).exists():
|
||||
# Prefer newer MSVC and override if exists
|
||||
if Path(msvc_2022_path).exists():
|
||||
vcvars = msvc_2022_path
|
||||
else:
|
||||
raise RuntimeError("No Visual Studio installation found, only 2019 and 2022 are supported.")
|
||||
|
||||
print("Loading MSVC env variables via {vcvars}".format(vcvars=vcvars))
|
||||
print(f"\n\nLoading MSVC env variables via {vcvars}\n\n")
|
||||
|
||||
cmd = [vcvars, '&&', 'set']
|
||||
popen = subprocess.Popen(
|
||||
@ -79,11 +65,11 @@ if __name__ == "__main__":
|
||||
help="Absolute qt path. If not set the default path is used\Windows: C:\Qt\nLinux & macOS:~/Qt/.")
|
||||
parser.add_argument('-sign', action="store_true", dest="sign_build",
|
||||
help="Enable if you want to sign the apps. This is macOS only for now.")
|
||||
parser.add_argument('-steam', action="store_true", dest="steam_build",
|
||||
parser.add_argument('-steam', action="store_true", dest="build_steam",
|
||||
help="Enable if you want to build the Steam workshop plugin.")
|
||||
parser.add_argument('-tests', action="store_true", dest="build_tests",
|
||||
help="Build tests.")
|
||||
parser.add_argument('-installer', action="store_true", dest="create_installer",
|
||||
parser.add_argument('-installer', action="store_true", dest="build_installer",
|
||||
help="Create a installer.")
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -92,12 +78,38 @@ if __name__ == "__main__":
|
||||
exit(1)
|
||||
|
||||
root_path = Path.cwd()
|
||||
qt_version = "6.3.0"
|
||||
qt_path = ""
|
||||
build_steam = "OFF"
|
||||
build_tests = "OFF"
|
||||
build_installer = "OFF"
|
||||
cmake_target_triplet = ""
|
||||
cmake_build_type = ""
|
||||
executable_file_ending = ""
|
||||
deploy_command = ""
|
||||
aqt_path = ""
|
||||
cmake_bin_path = ""
|
||||
|
||||
remove_files_from_build_folder = [
|
||||
".ninja_deps",
|
||||
".ninja",
|
||||
".ninja_log",
|
||||
".lib",
|
||||
".a",
|
||||
".dylib",
|
||||
".exp",
|
||||
".manifest",
|
||||
".cmake",
|
||||
".cbp",
|
||||
"CMakeCache.txt",
|
||||
"steam_appid.txt" # This file is only needed for testing. It must not be in a release version!
|
||||
]
|
||||
|
||||
if root_path.name == "Tools":
|
||||
root_path = root_path.parent
|
||||
|
||||
if args.use_aqt:
|
||||
aqt_path = Path(("{root_path}/../aqt/").format(root_path=root_path)).resolve()
|
||||
aqt_path = Path(f"{root_path}/../aqt/").resolve()
|
||||
|
||||
if not Path(aqt_path).exists():
|
||||
print("aqt path does not exist at %s. Please make sure you have installed aqt." % aqt_path)
|
||||
@ -127,40 +139,34 @@ if __name__ == "__main__":
|
||||
raise NotImplementedError("Unsupported platform, ScreenPlay only supports Windows, macOS and Linux.")
|
||||
|
||||
# Prepare
|
||||
cmake_toolchain_file = ("'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'").format(root_path=root_path)
|
||||
cmake_toolchain_file = f"'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'"
|
||||
print("cmake_toolchain_file: %s " % cmake_toolchain_file)
|
||||
print("Starting build with type %s. Qt Version: %s. Root path: %s" % (args.build_type, qt_version, root_path))
|
||||
|
||||
if args.steam_build:
|
||||
steam_build = "ON"
|
||||
if args.build_steam:
|
||||
build_steam = "OFF"
|
||||
if args.build_tests:
|
||||
build_tests = "ON"
|
||||
if args.create_installer:
|
||||
create_installer = "ON"
|
||||
build_tests = "OFF"
|
||||
if args.build_installer:
|
||||
build_installer = "OFF"
|
||||
|
||||
cmake_configure_command = 'cmake ../ \
|
||||
-DCMAKE_PREFIX_PATH={prefix_path} \
|
||||
-DCMAKE_BUILD_TYPE={type} \
|
||||
-DVCPKG_TARGET_TRIPLET={triplet} \
|
||||
-DCMAKE_TOOLCHAIN_FILE={toolchain} \
|
||||
-DSCREENPLAY_STEAM={steam} \
|
||||
-DSCREENPLAY_TESTS={tests} \
|
||||
-DSCREENPLAY_CREATE_INSTALLER={installer} \
|
||||
cmake_configure_command = f'cmake ../ \
|
||||
-DCMAKE_PREFIX_PATH={qt_path} \
|
||||
-DCMAKE_BUILD_TYPE={args.build_type} \
|
||||
-DVCPKG_TARGET_TRIPLET={cmake_target_triplet} \
|
||||
-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file} \
|
||||
-DSCREENPLAY_STEAM={build_steam} \
|
||||
-DSCREENPLAY_TESTS={build_tests} \
|
||||
-DSCREENPLAY_INSTALLER={build_installer} \
|
||||
-G "CodeBlocks - Ninja" \
|
||||
-B.'.format(
|
||||
prefix_path=qt_path,
|
||||
type=args.build_type,
|
||||
triplet=cmake_target_triplet,
|
||||
toolchain=cmake_toolchain_file,
|
||||
steam=steam_build,
|
||||
tests = build_tests,
|
||||
installer= create_installer)
|
||||
-B.'
|
||||
|
||||
build_folder = root_path.joinpath(f"build-{cmake_target_triplet}-{args.build_type}")
|
||||
clean_build_dir(build_folder)
|
||||
|
||||
# Build
|
||||
start_time = time.time()
|
||||
print(cmake_configure_command)
|
||||
run(cmake_configure_command, cwd=build_folder)
|
||||
run("cmake --build . --target all", cwd=build_folder)
|
||||
|
||||
@ -251,20 +257,20 @@ if __name__ == "__main__":
|
||||
# Some dlls like openssl do no longer get copied automatically.
|
||||
# Lets just copy all of them into bin.
|
||||
if platform.system() == "Windows":
|
||||
vcpkg_bin_path = Path(("{root_path}/../ScreenPlay-vcpkg/installed/x64-windows/bin").format(root_path=root_path)).resolve()
|
||||
vcpkg_bin_path = Path(f"{root_path}/../ScreenPlay-vcpkg/installed/x64-windows/bin").resolve()
|
||||
print(vcpkg_bin_path)
|
||||
for file in vcpkg_bin_path.iterdir():
|
||||
if file.suffix == ".dll" and file.is_file():
|
||||
print(file, bin_dir)
|
||||
shutil.copy2(file, bin_dir)
|
||||
|
||||
for file_ending in file_endings:
|
||||
for file_ending in remove_files_from_build_folder:
|
||||
for file in bin_dir.rglob("*" + file_ending):
|
||||
if file.is_file():
|
||||
print("Remove: %s" % file.resolve())
|
||||
file.unlink()
|
||||
|
||||
if args.create_installer:
|
||||
if args.build_installer:
|
||||
os.chdir(build_folder)
|
||||
print("Running cpack at: ", os.getcwd())
|
||||
run("cpack", cwd=build_folder)
|
||||
|
@ -13,8 +13,6 @@ vcpkg_packages_list = [
|
||||
"openssl",
|
||||
"curl",
|
||||
"sentry-native",
|
||||
"doctest",
|
||||
"benchmark",
|
||||
"cpp-httplib"
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user