1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-25 04:02:50 +01:00

Fix none steam builds and installer

Refactor Navigation to use Qt style navigation
This commit is contained in:
Elias Steurer 2022-04-23 19:26:55 +02:00
parent 50f198050d
commit 41967b541c
15 changed files with 118 additions and 324 deletions

View File

@ -8,7 +8,7 @@ project(
LANGUAGES CXX)
# This sets cmake to compile all dlls into the main directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@ -70,7 +70,6 @@ execute_process(
add_compile_definitions(COMPILE_INFO="Build Date: ${BUILD_DATE}. Git Hash: ${GIT_COMMIT_HASH}. ")
add_compile_definitions(SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_compile_definitions(SCREENPLAY_STEAM="${SCREENPLAY_STEAM}")
if(UNIX AND NOT APPLE)
# Fixes QWebEngine linker errors on Ubuntu 20.04
@ -113,6 +112,6 @@ message(STATUS "[PROJECT] VCPKG_TARGET_TRIPLET = ${VCPKG_TARGET_TRIPLET}")
message(STATUS "[PROJECT] CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
message(STATUS "[PROJECT] CMAKE_VERSION = ${CMAKE_VERSION}")
if(${SCREENPLAY_CREATE_INSTALLER})
if(${SCREENPLAY_INSTALLER})
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateIFWInstaller.cmake)
endif()

View File

@ -84,7 +84,6 @@ set(QML
qml/Monitors/MonitorsProjectSettingItem.qml
qml/Monitors/SaveNotification.qml
qml/Navigation/Navigation.qml
qml/Navigation/NavigationItem.qml
qml/Navigation/WindowNavButton.qml
qml/Navigation/WindowNavigation.qml
qml/Settings/SettingBool.qml
@ -160,9 +159,16 @@ target_link_libraries(
ScreenPlayQmlplugin
ScreenPlayUtil
ScreenPlayUtilplugin
ScreenPlayWorkshopplugin
ScreenPlayWorkshop
SteamSDKQtEnums)
if(${SCREENPLAY_STEAM})
target_compile_definitions(ScreenPlayLib PRIVATE SCREENPLAY_STEAM=1)
target_link_libraries(
ScreenPlayLib
PUBLIC ScreenPlayWorkshopplugin
ScreenPlayWorkshop)
endif()
target_include_directories(ScreenPlayLib PUBLIC )
qt_add_executable(${PROJECT_NAME} main.cpp)
@ -171,6 +177,13 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlayLib)
if(${SCREENPLAY_TESTS})
add_executable(tst_ScreenPlay tests/tst_main.cpp)
target_link_libraries(tst_ScreenPlay PRIVATE ScreenPlayLib Qt6::Test)
if(${SCREENPLAY_STEAM})
target_compile_definitions(tst_ScreenPlay PRIVATE SCREENPLAY_STEAM=1)
target_link_libraries(
tst_ScreenPlay
PUBLIC ScreenPlayWorkshopplugin
ScreenPlayWorkshop)
endif()
endif()

View File

@ -40,8 +40,9 @@
Q_IMPORT_QML_PLUGIN(ScreenPlayQmlPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
#ifdef SCREENPLAY_STEAM
Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin)
#endif
int main(int argc, char* argv[])
{
Q_INIT_RESOURCE(Resources);

View File

@ -83,7 +83,7 @@ ApplicationWindow {
"sidebar": sidebar
})
if (!ScreenPlay.settings.silentStart)
root.showNormal()
root.show()
}
Item {

View File

@ -56,12 +56,10 @@ Item {
TabButton {
text: qsTr("All")
font.family: ScreenPlay.settings.font
icon.height: 16
icon.width: 16
height: parent.height
width: implicitWidth
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_installed.svg"
onClicked: {
setSidebarActive(false)
@ -76,10 +74,8 @@ Item {
text: qsTr("Scenes")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
width: implicitWidth
height: parent.height
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_code.svg"
onClicked: {
setSidebarActive(false)
@ -94,10 +90,8 @@ Item {
text: qsTr("Videos")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
height: parent.height
width: implicitWidth
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_movie.svg"
onClicked: {
setSidebarActive(false)
@ -112,10 +106,8 @@ Item {
text: qsTr("Widgets")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
height: parent.height
width: implicitWidth
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_widgets.svg"
onClicked: {
setSidebarActive(false)

View File

@ -69,83 +69,98 @@ Rectangle {
target: ScreenPlay.util
}
Row {
TabBar {
id: row
height: 60
height: 50
currentIndex: 2
anchors {
top: parent.top
right: parent.right
bottom: parent.bottom
left: parent.left
leftMargin: 20
}
spacing: 0
NavigationItem {
TabButton {
id: navCreate
state: "inactive"
name: "Create"
text: qsTr("Create")
iconSource: "qrc:/assets/icons/icon_plus.svg"
onPageClicked: function (name) {
root.onPageChanged(name)
icon.height: 16
icon.width: 16
font.pointSize: 12
height: parent.height
width: implicitWidth
icon.source: "qrc:/assets/icons/icon_plus.svg"
onClicked: {
root.onPageChanged("Create")
}
objectName: "createTab"
background: Item {}
}
NavigationItem {
TabButton {
id: navWorkshop
state: "inactive"
name: "Workshop"
enabled: ScreenPlay.settings.steamVersion
text: qsTr("Workshop")
iconSource: "qrc:/assets/icons/icon_steam.svg"
onPageClicked: function (name) {
root.onPageChanged(name)
icon.height: 16
icon.width: 16
font.pointSize: 12
height: parent.height
width: implicitWidth
icon.source: "qrc:/assets/icons/icon_steam.svg"
onClicked: {
root.onPageChanged("Workshop")
}
objectName: "workshopTab"
background: Item {}
}
NavigationItem {
TabButton {
id: navInstalled
state: "active"
name: "Installed"
text: qsTr("Installed")
amount: ScreenPlay.installedListModel.count
iconSource: "qrc:/assets/icons/icon_installed.svg"
onPageClicked: function (name) {
root.onPageChanged(name)
text: qsTr("Installed") + " " + ScreenPlay.installedListModel.count
icon.height: 16
icon.width: 16
font.pointSize: 12
height: parent.height
width: implicitWidth
icon.source: "qrc:/assets/icons/icon_installed.svg"
onClicked: {
root.onPageChanged("Installed")
}
objectName: "installedTab"
background: Item {}
}
NavigationItem {
TabButton {
id: navCommunity
state: "inactive"
name: "Community"
text: qsTr("Community")
iconSource: "qrc:/assets/icons/icon_community.svg"
onPageClicked: function (name) {
root.onPageChanged(name)
icon.height: 16
icon.width: 16
font.pointSize: 12
height: parent.height
width: implicitWidth
icon.source: "qrc:/assets/icons/icon_community.svg"
onClicked: {
root.onPageChanged("Community")
}
objectName: "communityTab"
background: Item {}
}
NavigationItem {
TabButton {
id: navSettings
state: "inactive"
name: "Settings"
text: qsTr("Settings")
iconSource: "qrc:/assets/icons/icon_settings.svg"
onPageClicked: function (name) {
root.onPageChanged(name)
icon.height: 16
icon.width: 16
font.pointSize: 12
height: parent.height
width: implicitWidth
icon.source: "qrc:/assets/icons/icon_settings.svg"
onClicked: {
root.onPageChanged("Settings")
}
objectName: "settingsTab"
background: Item {}
}
}

View File

@ -1,191 +0,0 @@
import QtQuick
import Qt5Compat.GraphicalEffects
import QtQuick.Controls.Material
import ScreenPlay 1.0
Item {
id: navigationItem
property string iconSource: "qrc:/assets/icons/icon_installed.svg"
property string name
property alias text: txt.text
property alias amount: txtAmount.text
property bool enabled: true
signal pageClicked(string name)
function setActive(isActive) {
if (isActive)
navigationItem.state = "active";
else
navigationItem.state = "inactive";
}
width: txtAmount.paintedWidth + txt.paintedWidth + icon.paintedWidth + 40
height: 60
state: "inactive"
onEnabledChanged: {
if (!enabled) {
navigationItem.width = 0;
navigationItem.opacity = 0;
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
navigationItem.pageClicked(navigationItem.name);
}
Image {
id: icon
source: iconSource
width: 16
height: 16
sourceSize.height: 16
sourceSize.width: 16
fillMode: Image.PreserveAspectFit
anchors.left: parent.left
anchors.leftMargin: 10
anchors.verticalCenter: parent.verticalCenter
}
Text {
id: txtAmount
anchors.left: icon.right
anchors.leftMargin: 10
font.pointSize: 14
color: Material.primaryTextColor
anchors.verticalCenter: parent.verticalCenter
font.family: ScreenPlay.settings.font
font.weight: Font.Normal
text: ""
}
Text {
id: txt
anchors.left: txtAmount.right
anchors.leftMargin: navigationItem.amount == "" ? 0 : 5
text: "name"
font.pointSize: 12
color: Material.primaryTextColor
anchors.verticalCenter: parent.verticalCenter
font.family: ScreenPlay.settings.font
font.weight: Font.Normal
}
ColorOverlay {
id: iconColorOverlay
anchors.fill: icon
source: icon
color: Material.accentColor
}
Rectangle {
id: navIndicator
y: 83
height: 3
color: Material.accent
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
}
}
Behavior on width {
PropertyAnimation {
duration: 50
}
}
states: [
State {
name: "active"
PropertyChanges {
target: navIndicator
anchors.bottomMargin: 0
}
PropertyChanges {
target: iconColorOverlay
color: Material.accent
}
},
State {
name: "disabled"
PropertyChanges {
target: navIndicator
anchors.bottomMargin: -3
}
PropertyChanges {
target: iconColorOverlay
color: "#00000000"
}
},
State {
name: "inactive"
PropertyChanges {
target: navIndicator
anchors.bottomMargin: -3
}
PropertyChanges {
target: iconColorOverlay
color: "#00000000"
}
}
]
transitions: [
Transition {
from: "*"
to: "active"
NumberAnimation {
properties: "anchors.bottomMargin"
duration: 200
easing.type: Easing.OutQuart
}
},
Transition {
from: "*"
to: "disabled"
NumberAnimation {
properties: "anchors.bottomMargin"
duration: 200
easing.type: Easing.OutQuart
}
},
Transition {
from: "*"
to: "inactive"
NumberAnimation {
properties: "anchors.bottomMargin"
duration: 100
easing.type: Easing.OutQuart
}
}
]
}

View File

@ -42,8 +42,9 @@ Settings::Settings(const std::shared_ptr<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 SCREENPLAY_STEAM
setSteamVersion(true);
#endif
#ifdef Q_OS_WIN
setDesktopEnvironment(DesktopEnvironment::Windows);
#endif

View File

@ -45,8 +45,9 @@
Q_IMPORT_QML_PLUGIN(ScreenPlayQmlPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
#ifdef SCREENPLAY_STEAM
Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin)
#endif
class ScreenPlayTest : public QObject {
Q_OBJECT

View File

@ -10,67 +10,34 @@ Window {
visible: true
title: qsTr("ScreenPlayShader")
Image {
id: img
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: "qrc:/ScreenPlayShader/assets/test_image_andras-vas-Bd7gNnWJBkU-unsplash.jpg"
// layer.enabled: true
// layer.effect: ShaderEffect {
// property real amplitude: 0.04 * .1
// property real frequency: 2
// property real time: 0
// property real framerate: 60
// property real updateInterval: Math.round(
// (1000 / framerate) * 10) / 10
Image {
id: img
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: "qrc:/ScreenPlayShader/assets/test_image_andras-vas-Bd7gNnWJBkU-unsplash.jpg"
layer.enabled: true
layer.effect: ShaderEffect {
property real amplitude: 0.04 * .1
property real frequency: 2
property real time: 0
property real framerate: 60
property real updateInterval: Math.round(
(1000 / framerate) * 10) / 10
// Timer {
// interval: updateInterval
// onIntervalChanged: print(updateInterval)
// running: true
// repeat: true
// onTriggered: {
// if (parent.time > 600) {
// parent.time = 0
// }
// parent.time += 1
// }
// }
Timer {
interval: updateInterval
onIntervalChanged: print(updateInterval)
running: true
repeat: true
onTriggered: {
if (parent.time > 600) {
parent.time = 0
}
parent.time += 1
}
}
// fragmentShader: "/shaders/water.frag.qsb"
// }
fragmentShader: "/shaders/wobble.frag.qsb"
}
// Image {
// id: img
// anchors.fill: parent
// fillMode: Image.PreserveAspectCrop
// layer.enabled: true
// layer.effect: ShaderEffect {
// property real amplitude: 0.04 * .1
// property real frequency: 2
// property real time: 0
// property real framerate: 60
// property size resolution: Qt.size(1920,1080)
// property real updateInterval: Math.round(
// (1000 / framerate) * 10) / 10
// Timer {
// interval: updateInterval
// onIntervalChanged: print(updateInterval)
// running: true
// repeat: true
// onTriggered: {
// if (parent.time > 600) {
// parent.time = 0
// }
// parent.time += 1
// }
// }
// // fragmentShader: "/shaders/lightning.frag.qsb"
// vertexShader: "/shaders/lightning.vert.qsb"
// }
// source: "qrc:/ScreenPlayWorkshop/assets/mask_01.png"
// }
}
}

View File

@ -14,8 +14,6 @@ Dialog {
modal: true
focus: true
Overlay.modal: ModalBackgroundBlur {
id: blurBg
sourceItem: root.modalSource

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import Qt5Compat.GraphicalEffects
import QtQuick.Controls.Material
import QtQuick.Layouts
import ScreenPlayUtil 1.0
Popup {
id: root

View File

@ -4,7 +4,7 @@ import QtQuick.Layouts
import QtQuick.Controls.Material
import Qt5Compat.GraphicalEffects
import ScreenPlayWorkshop 1.0
import ScreenPlayUtil 1.0
Popup {
id: popupOffline
@ -22,9 +22,9 @@ Popup {
required property ScreenPlayWorkshop workshop
required property SteamWorkshop steam
required property Item modalSource
// Overlay.modal: ModalBackgroundBlur {
// sourceItem: root.modalSource
// }
Overlay.modal: ModalBackgroundBlur {
sourceItem: root.modalSource
}
ColumnLayout {
anchors.fill: parent
@ -63,7 +63,6 @@ Popup {
text: qsTr("Back")
Layout.alignment: Qt.AlignHCenter
onClicked: {
ScreenPlay.util.setNavigation("Installed")
popupOffline.close()
}
}

View File

@ -1,7 +1,7 @@
#include "steam/steam_qt_enums_generated.h"
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQml/qqmlextensionplugin.h>
#include "steam/steam_qt_enums_generated.h"
Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin)
@ -18,7 +18,6 @@ int main(int argc, char* argv[])
"SteamEnums",
"Error: only enums");
QQmlApplicationEngine engine;
// The first subfolder is the libraryName followed by the regular
// folder strucutre: LibararyName/Subfolder

View File

@ -144,11 +144,11 @@ if __name__ == "__main__":
print("Starting build with type %s. Qt Version: %s. Root path: %s" % (args.build_type, qt_version, root_path))
if args.build_steam:
build_steam = "OFF"
build_steam = "ON"
if args.build_tests:
build_tests = "OFF"
build_tests = "ON"
if args.build_installer:
build_installer = "OFF"
build_installer = "ON"
cmake_configure_command = f'cmake ../ \
-DCMAKE_PREFIX_PATH={qt_path} \