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

Fix namespace inconsistensies

Add namespace to Q_PROPERTIES to make moc and qmlls happy
This commit is contained in:
Elias Steurer 2024-10-25 16:29:52 +02:00
parent ced1a62bba
commit 7cba81c60c
17 changed files with 67 additions and 85 deletions

View File

@ -14,7 +14,7 @@ class GlobalVariables : public QObject {
QML_UNCREATABLE("")
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
Q_PROPERTY(Version version READ version WRITE setVersion NOTIFY versionChanged FINAL)
Q_PROPERTY(ScreenPlay::GlobalVariables::Version version READ version WRITE setVersion NOTIFY versionChanged FINAL)
Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged FINAL)
Q_PROPERTY(QUrl localSettingsPath READ localSettingsPath WRITE setLocalSettingsPath NOTIFY localSettingsPathChanged FINAL)
Q_PROPERTY(QUrl wallpaperExecutablePath READ wallpaperExecutablePath WRITE setWallpaperExecutablePath NOTIFY wallpaperExecutablePathChanged FINAL)

View File

@ -26,7 +26,8 @@ class ScreenPlayWidget : public QObject {
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
Q_PROPERTY(ContentTypes::InstalledType type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(
ScreenPlay::ContentTypes::InstalledType type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(qint64 processID READ processID WRITE setProcessID NOTIFY processIDChanged FINAL)
public:

View File

@ -2,6 +2,7 @@
#pragma once
#include "ScreenPlayUtil/contenttypes.h"
#include <QDebug>
#include <QDir>
#include <QFileInfoList>
@ -13,12 +14,10 @@
#include <QString>
#include <QStringList>
#include <QUuid>
#include "ScreenPlayUtil/contenttypes.h"
namespace ScreenPlay {
class WallpaperData
{
class WallpaperData {
Q_GADGET
QML_ANONYMOUS
Q_PROPERTY(bool isLooping READ isLooping WRITE setIsLooping)
@ -29,8 +28,8 @@ class WallpaperData
Q_PROPERTY(float volume READ volume WRITE setVolume)
Q_PROPERTY(QString file READ file WRITE setFile)
Q_PROPERTY(QJsonObject properties READ properties WRITE setProperties)
Q_PROPERTY(ContentTypes::InstalledType type READ type WRITE setType)
Q_PROPERTY(Video::FillMode fillMode READ fillMode WRITE setFillMode)
Q_PROPERTY(ScreenPlay::ContentTypes::InstalledType type READ type WRITE setType)
Q_PROPERTY(ScreenPlay::Video::FillMode fillMode READ fillMode WRITE setFillMode)
Q_PROPERTY(QVector<int> monitors READ monitors WRITE setMonitors)
public:
// Getters

View File

@ -1,12 +1,12 @@
// GENERATED FILE DO NOT EDIT
// TO REGENERATE run ScreenPlayInternal\SteamSDK
// > python.exe updateEnums.py
// > python.exe generate_qt_enums.py
#pragma once
#include <QObject>
#include <QQmlEngine>
namespace ScreenPlay {
namespace ScreenPlayWorkshop {
class Steam : public QObject {
Q_OBJECT

View File

@ -1,7 +1,5 @@
#include "ScreenPlayUtil/steamenumsgenerated.h"
namespace ScreenPlay {
Steam::Steam()
{
}
}
namespace ScreenPlayWorkshop {
Steam::Steam() { }
} // namespace ScreenPlayWorkshop

View File

@ -54,8 +54,8 @@ public:
Q_PROPERTY(float currentTime READ currentTime WRITE setCurrentTime NOTIFY currentTimeChanged)
Q_PROPERTY(ScreenPlay::ContentTypes::InstalledType type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(ScreenPlay::Video::VideoCodec videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged)
Q_PROPERTY(QString OSVersion READ OSVersion WRITE setOSVersion NOTIFY OSVersionChanged)
Q_PROPERTY(ScreenPlaySDK* sdk READ sdk WRITE setSdk NOTIFY sdkChanged)
Q_PROPERTY(QString OSVersion READ OSVersion WRITE setOSVersion NOTIFY OSVersionChanged)
bool loops() const { return m_loops; }
float volume() const { return m_volume; }

View File

@ -9,7 +9,7 @@
\inmodule ScreenPlayWallpaper
\brief .
*/
namespace ScreenPlay {
WindowsDesktopProperties::WindowsDesktopProperties(QObject* parent)
: QObject(parent)
{
@ -58,5 +58,5 @@ WindowsDesktopProperties::WindowsDesktopProperties(QObject* parent)
if (canParse)
setWindowsVersion(value);
}
}
#include "moc_windowsdesktopproperties.cpp"

View File

@ -13,6 +13,7 @@
#include <qqml.h>
#include <qt_windows.h>
namespace ScreenPlay {
class WindowsDesktopProperties : public QObject {
Q_OBJECT
@ -123,3 +124,4 @@ private:
int m_windowsVersion;
QSize m_defaultWallpaperSize;
};
}

View File

@ -25,7 +25,7 @@ namespace ScreenPlay {
class WinWindow : public BaseWindow {
Q_OBJECT
Q_PROPERTY(WindowsDesktopProperties* windowsDesktopProperties READ windowsDesktopProperties WRITE setWindowsDesktopProperties NOTIFY windowsDesktopPropertiesChanged)
Q_PROPERTY(ScreenPlay::WindowsDesktopProperties* windowsDesktopProperties READ windowsDesktopProperties WRITE setWindowsDesktopProperties NOTIFY windowsDesktopPropertiesChanged)
public:
WindowsDesktopProperties* windowsDesktopProperties() const { return m_windowsDesktopProperties.get(); }

View File

@ -35,7 +35,7 @@ if __name__ == '__main__':
#include <QObject>
#include <QQmlEngine>
namespace ScreenPlay {
namespace ScreenPlayWorkshop {
class Steam : public QObject {
Q_OBJECT

View File

@ -13,9 +13,9 @@ namespace ScreenPlayWorkshop {
class ScreenPlayWorkshop : public QObject {
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(InstalledListModel* installedListModel READ installedListModel NOTIFY installedListModelChanged)
Q_PROPERTY(SteamWorkshop* steamWorkshop READ steamWorkshop NOTIFY steamWorkshopChanged)
// Prefix :: to tell the compiler its a namespace
Q_PROPERTY(::ScreenPlayWorkshop::InstalledListModel* installedListModel READ installedListModel NOTIFY installedListModelChanged)
Q_PROPERTY(::ScreenPlayWorkshop::SteamWorkshop* steamWorkshop READ steamWorkshop NOTIFY steamWorkshopChanged)
public:
explicit ScreenPlayWorkshop();

View File

@ -10,7 +10,7 @@
#include "steam/steamtypes.h"
#include "steamapiwrapper.h"
namespace ScreenPlay {
namespace ScreenPlayWorkshop {
bool setItemTags(const QVariant& updateHandle, const QStringList& tags)
{
auto pTags = std::make_unique<SteamParamStringArray_t>();

View File

@ -6,20 +6,20 @@
#include "ScreenPlayUtil/steamenumsgenerated.h"
#include "steam/steamtypes.h"
namespace ScreenPlay {
namespace ScreenPlayWorkshop {
struct ItemUpdateData {
QString m_title;
QString m_description;
QString m_updateLanguage;
QString m_metadata;
ScreenPlay::Steam::ERemoteStoragePublishedFileVisibility visibility;
ScreenPlayWorkshop::Steam::ERemoteStoragePublishedFileVisibility visibility;
QStringList m_tags;
QString m_content; // update item content from this local folder
QString m_preview;
QMap<QString, QString> m_keyValueTag; // add new key-value tags for the item. Note that there can be multiple values for a tag.
QString m_changeNote;
QPair<QString, ScreenPlay::Steam::EItemPreviewType> m_previewFile;
QPair<QString, ScreenPlay::Steam::EItemPreviewType> m_previewVideo;
QPair<QString, ScreenPlayWorkshop::Steam::EItemPreviewType> m_previewFile;
QPair<QString, ScreenPlayWorkshop::Steam::EItemPreviewType> m_previewVideo;
const char* title() const { return m_title.toUtf8().data(); }
const char* description() const { return m_description.toUtf8().data(); }

View File

@ -27,10 +27,7 @@
namespace ScreenPlayWorkshop {
struct SteamItemUpdate {
SteamItemUpdate(QString absoluteStoragePath)
{
this->absoluteStoragePath = absoluteStoragePath;
}
SteamItemUpdate(QString absoluteStoragePath) { this->absoluteStoragePath = absoluteStoragePath; }
QString absoluteStoragePath;
UGCUpdateHandle_t steamUGCUpdateHandle = 0;
quint64 itemProcessed = 0;
@ -46,10 +43,10 @@ class SteamWorkshop : public QObject {
Q_PROPERTY(quint64 itemProcessed READ itemProcessed WRITE setItemProcessed NOTIFY itemProcessedChanged)
Q_PROPERTY(quint64 bytesTotal READ bytesTotal WRITE setBytesTotal NOTIFY bytesTotalChanged)
Q_PROPERTY(quint64 appID READ appID)
Q_PROPERTY(SteamWorkshopListModel* workshopListModel READ workshopListModel WRITE setWorkshopListModel NOTIFY workshopListModelChanged)
Q_PROPERTY(SteamWorkshopListModel* workshopProfileListModel READ workshopProfileListModel WRITE setWorkshopProfileListModel NOTIFY workshopProfileListModelChanged)
Q_PROPERTY(UploadListModel* uploadListModel READ uploadListModel NOTIFY uploadListModelChanged)
Q_PROPERTY(SteamAccount* steamAccount READ steamAccount WRITE setSteamAccount NOTIFY steamAccountChanged)
Q_PROPERTY(ScreenPlayWorkshop::SteamWorkshopListModel* workshopListModel READ workshopListModel WRITE setWorkshopListModel NOTIFY workshopListModelChanged)
Q_PROPERTY(ScreenPlayWorkshop::SteamWorkshopListModel* workshopProfileListModel READ workshopProfileListModel WRITE setWorkshopProfileListModel NOTIFY workshopProfileListModelChanged)
Q_PROPERTY(ScreenPlayWorkshop::UploadListModel* uploadListModel READ uploadListModel NOTIFY uploadListModelChanged)
Q_PROPERTY(ScreenPlayWorkshop::SteamAccount* steamAccount READ steamAccount WRITE setSteamAccount NOTIFY steamAccountChanged)
Q_PROPERTY(bool steamErrorRestart READ steamErrorRestart WRITE setSteamErrorRestart RESET resetSteamErrorRestart NOTIFY steamErrorRestartChanged)
Q_PROPERTY(bool steamErrorAPIInit READ steamErrorAPIInit WRITE setSteamErrorAPIInit RESET resetSteamErrorAPIInit NOTIFY steamErrorAPIInitChanged)
@ -87,9 +84,8 @@ public slots:
void requestWorkshopItemDetails(const QVariant publishedFileID);
void vote(const QVariant publishedFileID, const bool voteUp);
void subscribeItem(const QVariant publishedFileID);
bool searchWorkshop(const ScreenPlay::Steam::EUGCQuery enumEUGCQuery);
void searchWorkshopByText(const QString text,
const ScreenPlay::Steam::EUGCQuery rankedBy = ScreenPlay::Steam::EUGCQuery::K_EUGCQuery_RankedByTrend);
bool searchWorkshop(const ScreenPlayWorkshop::Steam::EUGCQuery enumEUGCQuery);
void searchWorkshopByText(const QString text, const ScreenPlayWorkshop::Steam::EUGCQuery rankedBy = ScreenPlayWorkshop::Steam::EUGCQuery::K_EUGCQuery_RankedByTrend);
bool checkAndSetQueryActive()
{
@ -176,10 +172,7 @@ public slots:
signals:
void workshopSearchCompleted(const int itemCount);
void workshopBannerCompleted();
void workshopItemCreatedSuccessful(
bool userNeedsToAcceptWorkshopLegalAgreement,
int eResult,
QVariant publishedFileId);
void workshopItemCreatedSuccessful(bool userNeedsToAcceptWorkshopLegalAgreement, int eResult, QVariant publishedFileId);
void workshopItemInstalled(int appID, QVariant publishedFileID);
@ -191,16 +184,15 @@ signals:
void workshopListModelChanged(SteamWorkshopListModel* workshopListModel);
void steamAccountChanged(SteamAccount* steamAccount);
void requestItemDetailReturned(
const QString& title,
const QStringList& tags,
const qulonglong steamIDOwner,
const QString& description,
const quint64 votesUp,
const quint64 votesDown,
const QString& url,
const QVariant fileSize,
const QVariant publishedFileId);
void requestItemDetailReturned(const QString& title,
const QStringList& tags,
const qulonglong steamIDOwner,
const QString& description,
const quint64 votesUp,
const quint64 votesDown,
const QString& url,
const QVariant fileSize,
const QVariant publishedFileId);
void workshopProfileListModelChanged(SteamWorkshopListModel*);

View File

@ -106,7 +106,9 @@ void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool
QFile previewGifFile { absoluteContentdir.path() + "/" + previewGIF };
qInfo() << previewGifFile.size();
if (previewGifFile.exists() && previewGifFile.size() <= (1000 * 1000))
SteamUGC()->AddItemPreviewFile(m_UGCUpdateHandle, QByteArray(QString { absoluteContentPath + "/" + previewGIF }.toUtf8()).data(), EItemPreviewType::k_EItemPreviewType_Image);
SteamUGC()->AddItemPreviewFile(m_UGCUpdateHandle,
QByteArray(QString { absoluteContentPath + "/" + previewGIF }.toUtf8()).data(),
EItemPreviewType::k_EItemPreviewType_Image);
}
if (absoluteContentdir.exists("previewWEBM")) {
@ -114,7 +116,9 @@ void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool
QFile previewWEBMFile { absoluteContentdir.path() + "/" + previewWEBM };
qInfo() << previewWEBMFile.size();
if (previewWEBMFile.exists() && previewWEBMFile.size() <= (1000 * 1000))
SteamUGC()->AddItemPreviewFile(m_UGCUpdateHandle, QByteArray(QString { absoluteContentPath + "/preview.webm" }.toUtf8()).data(), EItemPreviewType::k_EItemPreviewType_Image);
SteamUGC()->AddItemPreviewFile(m_UGCUpdateHandle,
QByteArray(QString { absoluteContentPath + "/preview.webm" }.toUtf8()).data(),
EItemPreviewType::k_EItemPreviewType_Image);
}
QStringList tags;
@ -180,14 +184,12 @@ void SteamWorkshopItem::submitItemUpdateStatus(SubmitItemUpdateResult_t* pCallba
return;
}
qDebug() << pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement
<< pCallback->m_eResult
<< pCallback->m_nPublishedFileId;
qDebug() << pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement << pCallback->m_eResult << pCallback->m_nPublishedFileId;
if (pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement)
emit userNeedsToAcceptWorkshopLegalAgreement();
setStatus(static_cast<ScreenPlay::Steam::EResult>(pCallback->m_eResult));
setStatus(static_cast<ScreenPlayWorkshop::Steam::EResult>(pCallback->m_eResult));
switch (pCallback->m_eResult) {
case EResult::k_EResultOK: {

View File

@ -32,20 +32,17 @@ class SteamWorkshopItem : public QObject {
Q_PROPERTY(QUrl absolutePath READ absolutePath WRITE setAbsolutePath NOTIFY absolutePathChanged)
Q_PROPERTY(int uploadProgress READ uploadProgress WRITE setUploadProgress NOTIFY uploadProgressChanged)
Q_PROPERTY(QUrl absolutePreviewImagePath READ absolutePreviewImagePath WRITE setAbsolutePreviewImagePath NOTIFY absolutePreviewImagePathChanged)
Q_PROPERTY(ScreenPlay::Steam::EResult status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(ScreenPlayWorkshop::Steam::EResult status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(QVariant publishedFileId READ publishedFileId WRITE setPublishedFileId NOTIFY publishedFileIdChanged)
public:
SteamWorkshopItem(
const QString& name,
const QUrl& absolutePath,
const quint64 appID);
SteamWorkshopItem(const QString& name, const QUrl& absolutePath, const quint64 appID);
QString name() const { return m_name; }
QUrl absolutePath() const { return m_absolutePath; }
int uploadProgress() const { return m_uploadProgress; }
QUrl absolutePreviewImagePath() const { return m_absolutePreviewImagePath; }
ScreenPlay::Steam::EResult status() const { return m_status; }
ScreenPlayWorkshop::Steam::EResult status() const { return m_status; }
QVariant publishedFileId() const { return m_publishedFileId; }
public slots:
@ -90,7 +87,7 @@ public slots:
emit absolutePreviewImagePathChanged(m_absolutePreviewImagePath);
}
void setStatus(ScreenPlay::Steam::EResult status)
void setStatus(ScreenPlayWorkshop::Steam::EResult status)
{
if (m_status == status)
return;
@ -115,7 +112,7 @@ signals:
void removeThis(SteamWorkshopItem* item);
void absolutePreviewImagePathChanged(QUrl absolutePreviewImagePath);
void uploadComplete(bool successful);
void statusChanged(ScreenPlay::Steam::EResult status);
void statusChanged(ScreenPlayWorkshop::Steam::EResult status);
void uploadFailed(const quint64 m_PublishedFileId);
void userNeedsToAcceptWorkshopLegalAgreement();
void publishedFileIdChanged(QVariant publishedFileId);
@ -136,7 +133,7 @@ private:
quint64 m_appID { 0 };
const int m_updateTimerInterval { 500 };
int m_uploadProgress { 0 }; // 0 - 100
ScreenPlay::Steam::EResult m_status { ScreenPlay::Steam::EResult::K_EResultNone };
ScreenPlayWorkshop::Steam::EResult m_status { ScreenPlayWorkshop::Steam::EResult::K_EResultNone };
UGCUpdateHandle_t m_UGCUpdateHandle { 0 };
SubmitItemUpdateResult_t m_submitItemUpdateResultHanlde;
QTimer m_updateTimer;

View File

@ -15,10 +15,7 @@ class UploadListModel : public QAbstractListModel {
Q_OBJECT
public:
UploadListModel()
{
QObject::connect(this, &UploadListModel::uploadCompleted, this, &UploadListModel::clearWhenFinished);
}
UploadListModel() { QObject::connect(this, &UploadListModel::uploadCompleted, this, &UploadListModel::clearWhenFinished); }
enum class UploadListModelRole {
NameRole = Qt::UserRole + 1,
@ -98,30 +95,24 @@ public slots:
{
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 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);
};
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::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, [=](ScreenPlay::Steam::EResult status) {
QObject::connect(item.get(), &SteamWorkshopItem::uploadComplete, this, [=](bool successful) { onDataChanged(); });
QObject::connect(item.get(), &SteamWorkshopItem::statusChanged, this, [=](ScreenPlayWorkshop::Steam::EResult status) {
onDataChanged();
bool allItemsUploaded = std::all_of(m_uploadListModelItems.cbegin(), m_uploadListModelItems.cend(), [](const auto& item) {
const auto status = item->status();
return status == ScreenPlay::Steam::EResult::K_EResultOK || status == ScreenPlay::Steam::EResult::K_EResultFail;
return status == ScreenPlayWorkshop::Steam::EResult::K_EResultOK || status == ScreenPlayWorkshop::Steam::EResult::K_EResultFail;
});
if (allItemsUploaded) {