mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-25 20:22:39 +01:00
Cleanup and small fixes
This commit is contained in:
parent
38f6262f8e
commit
11905a6370
@ -14,7 +14,7 @@ Item {
|
|||||||
|
|
||||||
property Item modalSource
|
property Item modalSource
|
||||||
|
|
||||||
Component.onCompleted: {
|
StackView.onActivated: {
|
||||||
wizardContentWrapper.state = "in";
|
wizardContentWrapper.state = "in";
|
||||||
stackView.push("qrc:/qml/ScreenPlayApp/qml/Create/StartInfo.qml");
|
stackView.push("qrc:/qml/ScreenPlayApp/qml/Create/StartInfo.qml");
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
StackView.onActivated: {
|
||||||
navWrapper.state = "in";
|
navWrapper.state = "in";
|
||||||
App.installedListFilter.sortBySearchType(SearchType.All);
|
App.installedListFilter.sortBySearchType(SearchType.All);
|
||||||
checkIsContentInstalled();
|
checkIsContentInstalled();
|
||||||
|
@ -76,19 +76,6 @@ Item {
|
|||||||
SettingsHorizontalSeperator {
|
SettingsHorizontalSeperator {
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingBool {
|
|
||||||
headline: qsTr("High priority Autostart")
|
|
||||||
available: false
|
|
||||||
description: qsTr("This options grants ScreenPlay a higher autostart priority than other apps.")
|
|
||||||
isChecked: App.settings.highPriorityStart
|
|
||||||
onCheckboxChanged: {
|
|
||||||
App.settings.setHighPriorityStart(checked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsHorizontalSeperator {
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingBool {
|
SettingBool {
|
||||||
height: 70
|
height: 70
|
||||||
headline: qsTr("Send anonymous crash reports and statistics")
|
headline: qsTr("Send anonymous crash reports and statistics")
|
||||||
@ -240,7 +227,7 @@ Item {
|
|||||||
header: SettingsHeader {
|
header: SettingsHeader {
|
||||||
id: headerPerformance
|
id: headerPerformance
|
||||||
|
|
||||||
text: qsTr("Performance")
|
text: qsTr("Wallpaper and Widgets")
|
||||||
image: "qrc:/qml/ScreenPlayApp/assets/icons/icon_build.svg"
|
image: "qrc:/qml/ScreenPlayApp/assets/icons/icon_build.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,22 +236,10 @@ Item {
|
|||||||
anchors.margins: 20
|
anchors.margins: 20
|
||||||
spacing: 20
|
spacing: 20
|
||||||
|
|
||||||
SettingBool {
|
|
||||||
headline: qsTr("Pause wallpaper video rendering while another app is in the foreground")
|
|
||||||
description: qsTr("We disable the video rendering (not the audio!) for the best performance. If you have problem you can disable this behaviour here. Wallpaper restart required!")
|
|
||||||
isChecked: App.settings.checkWallpaperVisible
|
|
||||||
onCheckboxChanged: function (checked) {
|
|
||||||
App.settings.setCheckWallpaperVisible(checked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsHorizontalSeperator {
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsComboBox {
|
SettingsComboBox {
|
||||||
id: cbVideoFillMode
|
id: cbVideoFillMode
|
||||||
|
|
||||||
headline: qsTr("Default Fill Mode")
|
headline: qsTr("Default Wallpaper Fill Mode")
|
||||||
description: qsTr("Set this property to define how the video is scaled to fit the target area.")
|
description: qsTr("Set this property to define how the video is scaled to fit the target area.")
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
cbVideoFillMode.comboBox.currentIndex = root.indexOfValue(cbVideoFillMode.comboBox.model, App.settings.videoFillMode);
|
cbVideoFillMode.comboBox.currentIndex = root.indexOfValue(cbVideoFillMode.comboBox.model, App.settings.videoFillMode);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <qobjectdefs.h>
|
#include <QtCore/qmetatype.h>
|
||||||
|
#include <QObject>
|
||||||
namespace ScreenPlay {
|
namespace ScreenPlay {
|
||||||
/*!
|
/*!
|
||||||
\namespace ScreenPlay::SearchType
|
\namespace ScreenPlay::SearchType
|
||||||
|
@ -20,7 +20,7 @@ ScreenPlay::WallpaperExitCode MacWindow::start()
|
|||||||
// OSX Development workaround:
|
// OSX Development workaround:
|
||||||
// This folder needs then to be copied into the .app/Contents/MacOS/
|
// This folder needs then to be copied into the .app/Contents/MacOS/
|
||||||
// for the deploy version.
|
// for the deploy version.
|
||||||
m_window.engine()->addImportPath(QGuiApplication::instance()->applicationDirPath()+ "/qml");
|
m_window.engine()->addImportPath(QGuiApplication::instance()->applicationDirPath() + "/qml");
|
||||||
|
|
||||||
// WARNING: Setting Window flags must be called *here*!
|
// WARNING: Setting Window flags must be called *here*!
|
||||||
Qt::WindowFlags flags = m_window.flags();
|
Qt::WindowFlags flags = m_window.flags();
|
||||||
|
@ -33,7 +33,7 @@ int main(int argc, char* argv[])
|
|||||||
// If we start with only one argument (path, appID, type),
|
// If we start with only one argument (path, appID, type),
|
||||||
// it means we want to test a single widget
|
// it means we want to test a single widget
|
||||||
if (argumentList.length() == 1) {
|
if (argumentList.length() == 1) {
|
||||||
//WidgetWindow spwmw("test", "appid", "qmlWidget", { 100, 100 }, true);
|
// WidgetWindow spwmw("test", "appid", "qmlWidget", { 100, 100 }, true);
|
||||||
|
|
||||||
QString exampleContentPath = QString(SCREENPLAY_SOURCE_DIR) + "/Content";
|
QString exampleContentPath = QString(SCREENPLAY_SOURCE_DIR) + "/Content";
|
||||||
QStringList contentFolder = {
|
QStringList contentFolder = {
|
||||||
|
@ -5,8 +5,6 @@ import QtQuick.Controls.Material
|
|||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
import ScreenPlayWorkshop
|
import ScreenPlayWorkshop
|
||||||
import ScreenPlayUtil
|
import ScreenPlayUtil
|
||||||
import ScreenPlayApp
|
|
||||||
import ScreenPlay
|
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: root
|
id: root
|
||||||
|
@ -8,12 +8,12 @@ import "upload/"
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
objectName: "WorkshopProfilePage"
|
||||||
|
|
||||||
property ScreenPlayWorkshop screenPlayWorkshop
|
property ScreenPlayWorkshop screenPlayWorkshop
|
||||||
property SteamWorkshop steamWorkshop
|
property SteamWorkshop steamWorkshop
|
||||||
|
property StackView stackView
|
||||||
signal requestBack
|
StackView.onActivated: steamWorkshop.requestUserItems()
|
||||||
Component.onCompleted: steamWorkshop.requestUserItems()
|
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: scrollView
|
id: scrollView
|
||||||
@ -39,28 +39,11 @@ Item {
|
|||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
spacing: 20
|
spacing: 20
|
||||||
SteamImage {
|
SteamProfilePicture {
|
||||||
id: avatar
|
id: avatar
|
||||||
|
|
||||||
width: 70
|
width: 70
|
||||||
height: 70
|
height: 70
|
||||||
Component.onCompleted: {
|
|
||||||
root.steamWorkshop.steamAccount.loadAvatar();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
function onAvatarChanged(_avatar) {
|
|
||||||
avatar.setImage(_avatar);
|
|
||||||
avatarPlaceholder.opacity = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
target: root.steamWorkshop.steamAccount
|
|
||||||
}
|
|
||||||
Image {
|
|
||||||
id: avatarPlaceholder
|
|
||||||
anchors.fill: parent
|
|
||||||
source: "qrc:/qml/ScreenPlayWorkshop/assets/images/steam_default_avatar.png"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
@ -71,7 +54,9 @@ Item {
|
|||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Back")
|
text: qsTr("Back")
|
||||||
onClicked: root.requestBack()
|
onClicked: {
|
||||||
|
stackView.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,15 +44,6 @@ Item {
|
|||||||
StackView {
|
StackView {
|
||||||
id: stackView
|
id: stackView
|
||||||
property int duration: 300
|
property int duration: 300
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: stackView.currentItem
|
|
||||||
ignoreUnknownSignals: true
|
|
||||||
function onRequestBack() {
|
|
||||||
stackView.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
replaceEnter: Transition {
|
replaceEnter: Transition {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
|
@ -15,7 +15,7 @@ Item {
|
|||||||
property SteamWorkshop steamWorkshop
|
property SteamWorkshop steamWorkshop
|
||||||
property Background background
|
property Background background
|
||||||
|
|
||||||
Component.onCompleted: {
|
StackView.onActivated: {
|
||||||
root.state = "searching";
|
root.state = "searching";
|
||||||
root.steamWorkshop.searchWorkshopByText("");
|
root.steamWorkshop.searchWorkshopByText("");
|
||||||
}
|
}
|
||||||
@ -239,6 +239,7 @@ Item {
|
|||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: btnSteamProfile
|
id: btnSteamProfile
|
||||||
|
objectName: "btnSteamProfile"
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
@ -251,7 +252,8 @@ Item {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/SteamProfile.qml", {
|
stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/SteamProfile.qml", {
|
||||||
"screenPlayWorkshop": root.screenPlayWorkshop,
|
"screenPlayWorkshop": root.screenPlayWorkshop,
|
||||||
"steamWorkshop": root.steamWorkshop
|
"steamWorkshop": root.steamWorkshop,
|
||||||
|
"stackView": root.stackView
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +272,8 @@ Item {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/upload/UploadProject.qml", {
|
stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/upload/UploadProject.qml", {
|
||||||
"screenPlayWorkshop": root.screenPlayWorkshop,
|
"screenPlayWorkshop": root.screenPlayWorkshop,
|
||||||
"steamWorkshop": root.steamWorkshop
|
"steamWorkshop": root.steamWorkshop,
|
||||||
|
"stackView": root.stackView
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,43 +290,44 @@ Item {
|
|||||||
leftMargin: 20
|
leftMargin: 20
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
ToolButton {
|
|
||||||
icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_search.svg"
|
|
||||||
onClicked: {
|
|
||||||
root.state = "searching";
|
|
||||||
root.steamWorkshop.searchWorkshopByText(tiSearch.text);
|
|
||||||
}
|
|
||||||
icon.width: 20
|
|
||||||
icon.height: 20
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: -3
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: tiSearch
|
id: tiSearch
|
||||||
placeholderTextColor: Material.secondaryTextColor
|
placeholderTextColor: Material.secondaryTextColor
|
||||||
placeholderText: qsTr("Search for Wallpaper and Widgets...")
|
placeholderText: qsTr("Search for Wallpaper and Widgets...")
|
||||||
// WORKAROUND:
|
|
||||||
// onEditingFinished causes internal qml layout crash in Qt 6.4
|
|
||||||
Keys.onReturnPressed: event => {
|
Keys.onReturnPressed: event => {
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
|
tiSearch.searchWorkshop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// WORKAROUND:
|
||||||
|
// onEditingFinished causes internal qml layout crash in Qt 6.4
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
interval: 300
|
||||||
|
repeat: false
|
||||||
|
onTriggered: tiSearch.searchWorkshop()
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextEdited: timer.restart()
|
||||||
|
function searchWorkshop() {
|
||||||
if (root.state === "searching") {
|
if (root.state === "searching") {
|
||||||
print("SEARCHING");
|
print("SEARCHING");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
root.state = "searching";
|
root.state = "searching";
|
||||||
print("EDITING FINISHED", root.state);
|
print("EDITING FINISHED", root.state);
|
||||||
if (tiSearch.text === "")
|
if (tiSearch.text === "") {
|
||||||
return root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend);
|
Qt.callLater(function () {
|
||||||
|
root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Qt.callLater(function () {
|
||||||
root.steamWorkshop.searchWorkshopByText(tiSearch.text);
|
root.steamWorkshop.searchWorkshopByText(tiSearch.text);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
leftInset: -20
|
|
||||||
leftPadding: 20
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
right: parent.right
|
right: parent.right
|
||||||
@ -333,20 +337,29 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_close.svg"
|
property bool hasContent: tiSearch.text.length > 0
|
||||||
|
icon.source: hasContent ? "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_close.svg" : "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_search.svg"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (hasContent) {
|
||||||
root.state = "searching";
|
root.state = "searching";
|
||||||
tiSearch.text = "";
|
tiSearch.clear();
|
||||||
|
Qt.callLater(function () {
|
||||||
root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend);
|
root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
root.state = "searching";
|
||||||
|
Qt.callLater(function () {
|
||||||
|
root.steamWorkshop.searchWorkshopByText(tiSearch.text);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
enabled: tiSearch.text !== ""
|
|
||||||
icon.width: 20
|
icon.width: 20
|
||||||
icon.height: 20
|
icon.height: 20
|
||||||
anchors {
|
anchors {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: -3
|
rightMargin: 0
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
bottomMargin: 3
|
bottomMargin: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,7 @@ Item {
|
|||||||
|
|
||||||
property ScreenPlayWorkshop screenPlayWorkshop
|
property ScreenPlayWorkshop screenPlayWorkshop
|
||||||
property SteamWorkshop steamWorkshop
|
property SteamWorkshop steamWorkshop
|
||||||
|
property StackView stackView
|
||||||
signal requestBack
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: headerWrapper
|
id: headerWrapper
|
||||||
@ -109,7 +108,7 @@ Item {
|
|||||||
|
|
||||||
text: qsTr("Abort")
|
text: qsTr("Abort")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.requestBack();
|
stackView.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -14,6 +14,9 @@ SteamAccount::SteamAccount(QObject* parent)
|
|||||||
|
|
||||||
void SteamAccount::loadAvatar()
|
void SteamAccount::loadAvatar()
|
||||||
{
|
{
|
||||||
|
if (!m_avatar.isNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int largeFriendAvatarHandle = SteamFriends()->GetLargeFriendAvatar(m_steamID);
|
int largeFriendAvatarHandle = SteamFriends()->GetLargeFriendAvatar(m_steamID);
|
||||||
|
|
||||||
// Returns 0 if no avatar is set for the user.
|
// Returns 0 if no avatar is set for the user.
|
||||||
@ -43,40 +46,33 @@ void SteamAccount::loadAmountSubscribedItems()
|
|||||||
|
|
||||||
void SteamAccount::onAvatarImageLoaded(AvatarImageLoaded_t* avatarImage)
|
void SteamAccount::onAvatarImageLoaded(AvatarImageLoaded_t* avatarImage)
|
||||||
{
|
{
|
||||||
// If called from another steam app
|
|
||||||
if (m_avatarLoaded)
|
if (m_avatarLoaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int largeFriendAvatarHandle = SteamFriends()->GetLargeFriendAvatar(m_steamID);
|
const int largeFriendAvatarHandle = SteamFriends()->GetLargeFriendAvatar(m_steamID);
|
||||||
|
|
||||||
if (largeFriendAvatarHandle <= 0) {
|
if (largeFriendAvatarHandle <= 0) {
|
||||||
qWarning() << "onAvatarImageLoaded: getLargeFriendAvatarResult retunred: " << largeFriendAvatarHandle;
|
qWarning() << "onAvatarImageLoaded: GetLargeFriendAvatar returned: " << largeFriendAvatarHandle;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 width = 0;
|
uint32 width = 0;
|
||||||
uint32 height = 0;
|
uint32 height = 0;
|
||||||
if (!SteamUtils()->GetImageSize(avatarImage->m_iImage, &width, &height)) {
|
const bool sizeRetrieved = SteamUtils()->GetImageSize(avatarImage->m_iImage, &width, &height);
|
||||||
qWarning() << "Failed GetImageSize";
|
if (!sizeRetrieved) {
|
||||||
|
qWarning() << "onAvatarImageLoaded: Failed to get image size";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int size = width * height * 4;
|
const int imageSize = width * height * 4;
|
||||||
QVector<uint8> imageData;
|
QVector<uint8> imageData(imageSize);
|
||||||
imageData.resize(size);
|
const bool imageRetrieved = SteamUtils()->GetImageRGBA(avatarImage->m_iImage, imageData.data(), imageSize);
|
||||||
|
if (!imageRetrieved) {
|
||||||
if (!SteamUtils()->GetImageRGBA(avatarImage->m_iImage, imageData.data(), size)) {
|
qWarning() << "onAvatarImageLoaded: Failed to load image buffer from callback";
|
||||||
qWarning() << "Failed to load image buffer from callback";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage avatar {
|
const QImage avatar { imageData.data(), static_cast<int>(width), static_cast<int>(height), QImage::Format_RGBA8888 };
|
||||||
imageData.data(),
|
|
||||||
static_cast<int>(width),
|
|
||||||
static_cast<int>(height),
|
|
||||||
QImage::Format_RGBA8888
|
|
||||||
};
|
|
||||||
|
|
||||||
setAvatar(avatar);
|
setAvatar(avatar);
|
||||||
m_avatarLoaded = true;
|
m_avatarLoaded = true;
|
||||||
}
|
}
|
||||||
|
@ -11,17 +11,16 @@
|
|||||||
#include "steamapiwrapper.h"
|
#include "steamapiwrapper.h"
|
||||||
|
|
||||||
namespace SteamApiWrapper {
|
namespace SteamApiWrapper {
|
||||||
bool setItemTags(const QVariant& updateHandle, const QStringList tags)
|
bool setItemTags(const QVariant& updateHandle, const QStringList& tags)
|
||||||
{
|
{
|
||||||
SteamParamStringArray_t* pTags = new SteamParamStringArray_t();
|
auto pTags = std::make_unique<SteamParamStringArray_t>();
|
||||||
const uint32 strCount = tags.size();
|
const uint32_t numTags = tags.size();
|
||||||
pTags->m_ppStrings = new const char*[strCount];
|
pTags->m_nNumStrings = numTags;
|
||||||
pTags->m_nNumStrings = strCount;
|
auto tagStrings = std::make_unique<const char*[]>(numTags);
|
||||||
for (uint32 i = 0; i < strCount; i++) {
|
for (uint32_t i = 0; i < numTags; ++i) {
|
||||||
pTags->m_ppStrings[i] = tags.at(i).toUtf8().data();
|
tagStrings[i] = tags.at(i).toUtf8().constData();
|
||||||
}
|
}
|
||||||
|
pTags->m_ppStrings = tagStrings.get();
|
||||||
return SteamUGC()->SetItemTags(updateHandle.toULongLong(), pTags);
|
return SteamUGC()->SetItemTags(updateHandle.toULongLong(), pTags.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,14 @@ void SteamWorkshopItem::checkUploadProgress()
|
|||||||
if (progress > 0.0f && progress < 1.0f)
|
if (progress > 0.0f && progress < 1.0f)
|
||||||
setUploadProgress((progress * 100));
|
setUploadProgress((progress * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool bIOFailure)
|
void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool bIOFailure)
|
||||||
{
|
{
|
||||||
|
if (!pCallback) {
|
||||||
|
qWarning() << "Invalid CreateItemResult_t pointer";
|
||||||
|
emit removeThis(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement) {
|
if (pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement) {
|
||||||
emit userNeedsToAcceptWorkshopLegalAgreement();
|
emit userNeedsToAcceptWorkshopLegalAgreement();
|
||||||
}
|
}
|
||||||
@ -87,7 +92,7 @@ void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool
|
|||||||
|
|
||||||
QString youtube;
|
QString youtube;
|
||||||
if (jsonObject.contains("youtube")) {
|
if (jsonObject.contains("youtube")) {
|
||||||
language = jsonObject.value("youtube").toString();
|
youtube = jsonObject.value("youtube").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!youtube.isEmpty()) {
|
if (!youtube.isEmpty()) {
|
||||||
@ -132,21 +137,21 @@ void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool
|
|||||||
|
|
||||||
m_UGCUpdateHandle = SteamUGC()->StartItemUpdate(m_appID, pCallback->m_nPublishedFileId);
|
m_UGCUpdateHandle = SteamUGC()->StartItemUpdate(m_appID, pCallback->m_nPublishedFileId);
|
||||||
|
|
||||||
QVector<QByteArray> tagByteArray;
|
QVector<const char*> tagCharArray;
|
||||||
for (const auto& tag : tags) {
|
for (const auto& tag : tags) {
|
||||||
if (tag.length() > 255) {
|
if (tag.length() > 255) {
|
||||||
qInfo() << "Skip to long tag (max 255) " << tag << " with length:" << tag.length();
|
qInfo() << "Skip too long tag (max 255):" << tag;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tagByteArray.append(tag.toUtf8());
|
tagCharArray.append(tag.toUtf8());
|
||||||
pTags->m_ppStrings[i] = tagByteArray.at(i).data();
|
|
||||||
qInfo() << tag.toStdString().c_str() << pTags->m_ppStrings[i];
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
pTags->m_nNumStrings = count;
|
pTags->m_nNumStrings = tagCharArray.count();
|
||||||
bool success = SteamUGC()->SetItemTags(m_UGCUpdateHandle, pTags);
|
pTags->m_ppStrings = tagCharArray.data();
|
||||||
qInfo() << "SetItemTags" << success;
|
|
||||||
|
|
||||||
|
bool success = SteamUGC()->SetItemTags(m_UGCUpdateHandle, pTags);
|
||||||
|
if (!success) {
|
||||||
|
qWarning() << "Failed to set item tags";
|
||||||
|
}
|
||||||
SteamUGC()->AddItemPreviewFile(m_UGCUpdateHandle, QByteArray(preview.toUtf8()).data(), EItemPreviewType::k_EItemPreviewType_Image);
|
SteamUGC()->AddItemPreviewFile(m_UGCUpdateHandle, QByteArray(preview.toUtf8()).data(), EItemPreviewType::k_EItemPreviewType_Image);
|
||||||
SteamUGC()->SetItemTitle(m_UGCUpdateHandle, QByteArray(title.toUtf8().data()));
|
SteamUGC()->SetItemTitle(m_UGCUpdateHandle, QByteArray(title.toUtf8().data()));
|
||||||
SteamUGC()->SetItemDescription(m_UGCUpdateHandle, QByteArray(description.toUtf8()).data());
|
SteamUGC()->SetItemDescription(m_UGCUpdateHandle, QByteArray(description.toUtf8()).data());
|
||||||
@ -159,6 +164,11 @@ void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool
|
|||||||
saveWorkshopID();
|
saveWorkshopID();
|
||||||
|
|
||||||
SteamAPICall_t apicall = SteamUGC()->SubmitItemUpdate(m_UGCUpdateHandle, nullptr);
|
SteamAPICall_t apicall = SteamUGC()->SubmitItemUpdate(m_UGCUpdateHandle, nullptr);
|
||||||
|
if (apicall == k_uAPICallInvalid) {
|
||||||
|
qWarning() << "Failed to submit item update";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_submitItemUpdateResultResult.Set(apicall, this, &SteamWorkshopItem::submitItemUpdateStatus);
|
m_submitItemUpdateResultResult.Set(apicall, this, &SteamWorkshopItem::submitItemUpdateStatus);
|
||||||
m_updateTimer.start(m_updateTimerInterval);
|
m_updateTimer.start(m_updateTimerInterval);
|
||||||
}
|
}
|
||||||
|
@ -94,37 +94,39 @@ public slots:
|
|||||||
m_uploadListModelItems.clear();
|
m_uploadListModelItems.clear();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void append(const QString& name, const QString& path, const quint64 appID)
|
void append(const QString& name, const QString& path, const quint64 appID)
|
||||||
{
|
{
|
||||||
auto item = std::make_unique<SteamWorkshopItem>(name, path, appID);
|
auto item = std::make_unique<SteamWorkshopItem>(name, path, appID);
|
||||||
|
|
||||||
|
const auto roles = QVector<int> {
|
||||||
|
static_cast<int>(UploadListModelRole::UploadProgressRole),
|
||||||
|
static_cast<int>(UploadListModelRole::NameRole),
|
||||||
|
static_cast<int>(UploadListModelRole::AbsolutePreviewImagePath),
|
||||||
|
static_cast<int>(UploadListModelRole::Status)
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto onDataChanged = [&]() {
|
||||||
|
emit this->dataChanged(index(0, 0), index(rowCount() - 1, 0), roles);
|
||||||
|
};
|
||||||
|
|
||||||
QObject::connect(item.get(), &SteamWorkshopItem::userNeedsToAcceptWorkshopLegalAgreement, this, &UploadListModel::userNeedsToAcceptWorkshopLegalAgreement);
|
QObject::connect(item.get(), &SteamWorkshopItem::userNeedsToAcceptWorkshopLegalAgreement, this, &UploadListModel::userNeedsToAcceptWorkshopLegalAgreement);
|
||||||
|
QObject::connect(item.get(), &SteamWorkshopItem::uploadProgressChanged, this, onDataChanged);
|
||||||
|
QObject::connect(item.get(), &SteamWorkshopItem::nameChanged, this, onDataChanged);
|
||||||
|
QObject::connect(item.get(), &SteamWorkshopItem::absolutePreviewImagePathChanged, this, onDataChanged);
|
||||||
|
QObject::connect(item.get(), &SteamWorkshopItem::uploadComplete, this, [=](bool successful) {
|
||||||
|
onDataChanged();
|
||||||
|
});
|
||||||
|
QObject::connect(item.get(), &SteamWorkshopItem::statusChanged, this, [=](ScreenPlayWorkshopSteamEnums::EResult status) {
|
||||||
|
onDataChanged();
|
||||||
|
|
||||||
QObject::connect(item.get(), &SteamWorkshopItem::uploadProgressChanged, this, [this]() {
|
bool allItemsUploaded = std::all_of(m_uploadListModelItems.cbegin(), m_uploadListModelItems.cend(), [](const auto& item) {
|
||||||
emit this->dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int> { static_cast<int>(UploadListModelRole::UploadProgressRole) });
|
const auto status = item->status();
|
||||||
|
return status == ScreenPlayWorkshopSteamEnums::EResult::K_EResultOK || status == ScreenPlayWorkshopSteamEnums::EResult::K_EResultFail;
|
||||||
});
|
});
|
||||||
QObject::connect(item.get(), &SteamWorkshopItem::nameChanged, this, [this]() {
|
|
||||||
emit this->dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int> { static_cast<int>(UploadListModelRole::NameRole) });
|
|
||||||
});
|
|
||||||
QObject::connect(item.get(), &SteamWorkshopItem::absolutePreviewImagePathChanged, this, [this]() {
|
|
||||||
emit this->dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int> { static_cast<int>(UploadListModelRole::AbsolutePreviewImagePath) });
|
|
||||||
});
|
|
||||||
QObject::connect(item.get(), &SteamWorkshopItem::uploadComplete, this, [this](bool successful) {
|
|
||||||
emit this->dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int> { static_cast<int>(UploadListModelRole::AbsolutePreviewImagePath) });
|
|
||||||
});
|
|
||||||
QObject::connect(item.get(), &SteamWorkshopItem::statusChanged, this, [this](ScreenPlayWorkshopSteamEnums::EResult status) {
|
|
||||||
emit this->dataChanged(index(0, 0), index(rowCount() - 1, 0), QVector<int> { static_cast<int>(UploadListModelRole::Status) });
|
|
||||||
|
|
||||||
// Check if all items are
|
if (allItemsUploaded) {
|
||||||
|
|
||||||
for (const auto& item : m_uploadListModelItems) {
|
|
||||||
qDebug() << "item->status() " << item->status();
|
|
||||||
if (!(item->status() != ScreenPlayWorkshopSteamEnums::EResult::K_EResultOK
|
|
||||||
|| item->status() != ScreenPlayWorkshopSteamEnums::EResult::K_EResultFail)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
emit this->uploadCompleted();
|
emit this->uploadCompleted();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||||
|
@ -7,7 +7,7 @@ choco pack
|
|||||||
|
|
||||||
Install the generated nupkg:
|
Install the generated nupkg:
|
||||||
```
|
```
|
||||||
choco install screenplay.0.15.0-RC5.nupkg -dv -s .
|
choco install screenplay.0.15.0-RC6.nupkg -dv -s .
|
||||||
```
|
```
|
||||||
|
|
||||||
Set api key from [https://community.chocolatey.org/account](https://community.chocolatey.org/account):
|
Set api key from [https://community.chocolatey.org/account](https://community.chocolatey.org/account):
|
||||||
@ -17,5 +17,5 @@ choco apikey --key AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAA --source https://push.chocol
|
|||||||
|
|
||||||
Psuh:
|
Psuh:
|
||||||
```
|
```
|
||||||
choco push screenplay.0.15.0-RC5.nupkg --source https://push.chocolatey.org/
|
choco push screenplay.0.15.0-RC6.nupkg --source https://push.chocolatey.org/
|
||||||
```
|
```
|
@ -26,7 +26,7 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe
|
|||||||
<!-- version should MATCH as closely as possible with the underlying software -->
|
<!-- version should MATCH as closely as possible with the underlying software -->
|
||||||
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
|
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
|
||||||
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
|
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
|
||||||
<version>0.15.0-RC5</version>
|
<version>0.15.0-RC6</version>
|
||||||
<packageSourceUrl>https://gitlab.com/kelteseth/ScreenPlay/-/tree/master/Tools/chocolatey/ScreenPlay</packageSourceUrl>
|
<packageSourceUrl>https://gitlab.com/kelteseth/ScreenPlay/-/tree/master/Tools/chocolatey/ScreenPlay</packageSourceUrl>
|
||||||
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
|
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
|
||||||
<owners>Elias Steurer</owners>
|
<owners>Elias Steurer</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
$ErrorActionPreference = 'Stop';
|
$ErrorActionPreference = 'Stop';
|
||||||
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
||||||
$url = ''
|
$url = ''
|
||||||
$url64 = 'https://kelteseth.com/releases/0.15.0-RC5/ScreenPlay-0.15.0-RC5-x64-windows-release.zip'
|
$url64 = 'https://kelteseth.com/releases/0.15.0-RC6/ScreenPlay-0.15.0-RC6-x64-windows-release.zip'
|
||||||
|
|
||||||
$packageArgs = @{
|
$packageArgs = @{
|
||||||
packageName = $env:ChocolateyPackageName
|
packageName = $env:ChocolateyPackageName
|
||||||
|
Loading…
Reference in New Issue
Block a user