mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Add working lazy loading steam api
This commit is contained in:
parent
9c24a947ef
commit
b92c76f081
@ -1,5 +1,4 @@
|
|||||||
|
#include <QDebug>
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
@ -53,8 +52,6 @@ int main(int argc, char* argv[])
|
|||||||
trsl.load(":/translations/ScreenPlay_de.qm");
|
trsl.load(":/translations/ScreenPlay_de.qm");
|
||||||
app.installTranslator(&trsl);
|
app.installTranslator(&trsl);
|
||||||
|
|
||||||
QObject::connect(&app, &QGuiApplication::screenRemoved, [&]() { qDebug() << "removed"; });
|
|
||||||
|
|
||||||
QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf");
|
QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf");
|
||||||
QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Light.ttf");
|
QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Light.ttf");
|
||||||
QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Regular.ttf");
|
QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Regular.ttf");
|
||||||
@ -70,19 +67,6 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
app.setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
|
app.setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
|
||||||
|
|
||||||
bool steamErrorRestart = false;
|
|
||||||
bool steamErrorAPIInit = false;
|
|
||||||
|
|
||||||
if (SteamAPI_RestartAppIfNecessary(steamID)) {
|
|
||||||
qWarning() << "SteamAPI_RestartAppIfNecessary";
|
|
||||||
steamErrorRestart = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SteamAPI_Init()) {
|
|
||||||
qWarning() << "Could not init steam sdk!";
|
|
||||||
steamErrorAPIInit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMLUtilities qmlUtil;
|
QMLUtilities qmlUtil;
|
||||||
InstalledListModel installedListModel;
|
InstalledListModel installedListModel;
|
||||||
MonitorListModel monitorListModel(&app);
|
MonitorListModel monitorListModel(&app);
|
||||||
@ -115,7 +99,7 @@ int main(int argc, char* argv[])
|
|||||||
SPBaseDir.cd("ScreenPlay");
|
SPBaseDir.cd("ScreenPlay");
|
||||||
settings.setScreenPlayBasePath(QUrl(SPBaseDir.path()));
|
settings.setScreenPlayBasePath(QUrl(SPBaseDir.path()));
|
||||||
|
|
||||||
#elif QT_NO_DEBUG
|
#elif
|
||||||
settings.setScreenPlayBasePath(QUrl(SPWorkingDir.path()));
|
settings.setScreenPlayBasePath(QUrl(SPWorkingDir.path()));
|
||||||
|
|
||||||
// If we build in the release version we must be cautious!
|
// If we build in the release version we must be cautious!
|
||||||
@ -149,8 +133,7 @@ int main(int argc, char* argv[])
|
|||||||
profileListModel.loadProfiles();
|
profileListModel.loadProfiles();
|
||||||
settings.loadActiveProfiles();
|
settings.loadActiveProfiles();
|
||||||
|
|
||||||
QQmlApplicationEngine errorWindowEngine,mainWindowEngine;
|
QQmlApplicationEngine mainWindowEngine;
|
||||||
StartupError suError(&mainWindowEngine, &errorWindowEngine);
|
|
||||||
mainWindowEngine.rootContext()->setContextProperty("screenPlay", &screenPlay);
|
mainWindowEngine.rootContext()->setContextProperty("screenPlay", &screenPlay);
|
||||||
mainWindowEngine.rootContext()->setContextProperty("screenPlayCreate", &create);
|
mainWindowEngine.rootContext()->setContextProperty("screenPlayCreate", &create);
|
||||||
mainWindowEngine.rootContext()->setContextProperty("utility", &qmlUtil);
|
mainWindowEngine.rootContext()->setContextProperty("utility", &qmlUtil);
|
||||||
@ -161,15 +144,7 @@ int main(int argc, char* argv[])
|
|||||||
mainWindowEngine.rootContext()->setContextProperty("profileListModel", &profileListModel);
|
mainWindowEngine.rootContext()->setContextProperty("profileListModel", &profileListModel);
|
||||||
mainWindowEngine.rootContext()->setContextProperty("screenPlaySettings", &settings);
|
mainWindowEngine.rootContext()->setContextProperty("screenPlaySettings", &settings);
|
||||||
mainWindowEngine.rootContext()->setContextProperty("steamWorkshop", &steamWorkshop);
|
mainWindowEngine.rootContext()->setContextProperty("steamWorkshop", &steamWorkshop);
|
||||||
|
|
||||||
if (steamErrorRestart || steamErrorAPIInit) {
|
|
||||||
errorWindowEngine.load(QUrl(QStringLiteral("qrc:/qml/StartupErrorWindow.qml")));
|
|
||||||
errorWindowEngine.rootContext()->setContextProperty("suError", &suError);
|
|
||||||
settings.setOfflineMode(true);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
mainWindowEngine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
mainWindowEngine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||||
}
|
|
||||||
|
|
||||||
// Set visible if the -silent parameter was not set
|
// Set visible if the -silent parameter was not set
|
||||||
QStringList argumentList = app.arguments();
|
QStringList argumentList = app.arguments();
|
||||||
@ -177,12 +152,6 @@ int main(int argc, char* argv[])
|
|||||||
settings.setMainWindowVisible(true);
|
settings.setMainWindowVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer for steam polls. WTF?
|
|
||||||
QTimer timer;
|
|
||||||
QObject::connect(&timer, &QTimer::timeout, [&]() { SteamAPI_RunCallbacks(); });
|
|
||||||
timer.setInterval(100);
|
|
||||||
timer.start();
|
|
||||||
|
|
||||||
QObject::connect(&steamWorkshop, &SteamWorkshop::workshopSearchResult,
|
QObject::connect(&steamWorkshop, &SteamWorkshop::workshopSearchResult,
|
||||||
&steamWorkshopListModel, &SteamWorkshopListModel::append, Qt::QueuedConnection);
|
&steamWorkshopListModel, &SteamWorkshopListModel::append, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ ApplicationWindow {
|
|||||||
if (!screenPlaySettings.autostart) {
|
if (!screenPlaySettings.autostart) {
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
|
steamWorkshop.initSteam()
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchPage(name) {
|
function switchPage(name) {
|
||||||
|
@ -36,6 +36,7 @@ Rectangle {
|
|||||||
|
|
||||||
//Avoid crashing screenplay when steam is not available
|
//Avoid crashing screenplay when steam is not available
|
||||||
if (name === "Workshop" && screenPlaySettings.offlineMode) {
|
if (name === "Workshop" && screenPlaySettings.offlineMode) {
|
||||||
|
steamWorkshop.initSteam()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,6 +220,11 @@ void Settings::createDefaultConfig()
|
|||||||
defaultSettings.close();
|
defaultSettings.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getOfflineMode() const
|
||||||
|
{
|
||||||
|
return m_offlineMode;
|
||||||
|
}
|
||||||
|
|
||||||
QUrl Settings::getScreenPlayWidgetPath() const
|
QUrl Settings::getScreenPlayWidgetPath() const
|
||||||
{
|
{
|
||||||
return m_screenPlayWidgetPath;
|
return m_screenPlayWidgetPath;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "sdkconnector.h"
|
#include "sdkconnector.h"
|
||||||
#include "steam/steam_api.h"
|
#include "steam/steam_api.h"
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <qt_windows.h>
|
#include <qt_windows.h>
|
||||||
#endif
|
#endif
|
||||||
/*!
|
/*!
|
||||||
\class Settings
|
\class Settings
|
||||||
@ -98,7 +98,6 @@ public:
|
|||||||
return m_hasWorkshopBannerSeen;
|
return m_hasWorkshopBannerSeen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int activeWallpaperCounter() const
|
int activeWallpaperCounter() const
|
||||||
{
|
{
|
||||||
return m_activeWallpaperCounter;
|
return m_activeWallpaperCounter;
|
||||||
@ -121,7 +120,9 @@ public:
|
|||||||
void setScreenPlayBasePath(QUrl screenPlayBasePath);
|
void setScreenPlayBasePath(QUrl screenPlayBasePath);
|
||||||
|
|
||||||
QUrl getScreenPlayWidgetPath() const;
|
QUrl getScreenPlayWidgetPath() const;
|
||||||
void setScreenPlayWidgetPath(const QUrl &screenPlayWidgetPath);
|
void setScreenPlayWidgetPath(const QUrl& screenPlayWidgetPath);
|
||||||
|
|
||||||
|
bool getOfflineMode() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void autostartChanged(bool autostart);
|
void autostartChanged(bool autostart);
|
||||||
@ -171,9 +172,15 @@ public slots:
|
|||||||
|
|
||||||
if (autostart) {
|
if (autostart) {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#ifdef QT_DEBUG
|
||||||
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||||
settings.setValue("ScreenPlay", QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + " -silent");
|
settings.setValue("ScreenPlay", QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + " -silent");
|
||||||
settings.sync();
|
settings.sync();
|
||||||
|
#else
|
||||||
|
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||||
|
settings.setValue("ScreenPlay", QDir::toNativeSeparators("C:/Program Files (x86)/Steam/steamapps/common/ScreenPlay/ScreenPlay/ScreenPlay.exe") + " -silent");
|
||||||
|
settings.sync();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -315,6 +322,5 @@ private:
|
|||||||
int m_activeWallpaperCounter = 0;
|
int m_activeWallpaperCounter = 0;
|
||||||
QGuiApplication* m_qGuiApplication;
|
QGuiApplication* m_qGuiApplication;
|
||||||
|
|
||||||
bool m_offlineMode = false;
|
bool m_offlineMode = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,11 +3,38 @@
|
|||||||
SteamWorkshop::SteamWorkshop(QObject* parent)
|
SteamWorkshop::SteamWorkshop(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
initSteam();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SteamWorkshop::initSteam()
|
||||||
|
{
|
||||||
|
if(m_settings->offlineMode()){
|
||||||
|
|
||||||
|
if (SteamAPI_RestartAppIfNecessary(m_appID)) {
|
||||||
|
qWarning() << "SteamAPI_RestartAppIfNecessary";
|
||||||
|
m_steamErrorRestart = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SteamAPI_Init()) {
|
||||||
|
qWarning() << "Could not init steam sdk!";
|
||||||
|
m_steamErrorAPIInit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!(m_steamErrorAPIInit || m_steamErrorRestart)){
|
||||||
|
m_settings->setOfflineMode(false);
|
||||||
|
m_pollTimer = new QTimer(this);
|
||||||
|
QObject::connect(m_pollTimer, &QTimer::timeout, [&]() { SteamAPI_RunCallbacks(); });
|
||||||
|
m_pollTimer->setInterval(250);
|
||||||
|
m_pollTimer->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamWorkshop::SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm, Settings* s)
|
SteamWorkshop::SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm, Settings* s)
|
||||||
{
|
{
|
||||||
m_AppId = nConsumerAppId;
|
m_appID = nConsumerAppId;
|
||||||
m_workshopListModel = wlm;
|
m_workshopListModel = wlm;
|
||||||
m_settings = s;
|
m_settings = s;
|
||||||
|
|
||||||
@ -20,7 +47,7 @@ SteamWorkshop::SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm
|
|||||||
|
|
||||||
void SteamWorkshop::createWorkshopItem()
|
void SteamWorkshop::createWorkshopItem()
|
||||||
{
|
{
|
||||||
SteamAPICall_t hSteamAPICall = SteamUGC()->CreateItem(m_AppId, EWorkshopFileType::k_EWorkshopFileTypeCommunity);
|
SteamAPICall_t hSteamAPICall = SteamUGC()->CreateItem(m_appID, EWorkshopFileType::k_EWorkshopFileTypeCommunity);
|
||||||
m_createWorkshopItemCallResult.Set(hSteamAPICall, this, &SteamWorkshop::workshopItemCreated);
|
m_createWorkshopItemCallResult.Set(hSteamAPICall, this, &SteamWorkshop::workshopItemCreated);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +56,7 @@ void SteamWorkshop::workshopItemCreated(CreateItemResult_t* pCallback, bool bIOF
|
|||||||
if (bIOFailure)
|
if (bIOFailure)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_UGCUpdateHandle = SteamUGC()->StartItemUpdate(m_AppId, pCallback->m_nPublishedFileId);
|
m_UGCUpdateHandle = SteamUGC()->StartItemUpdate(m_appID, pCallback->m_nPublishedFileId);
|
||||||
emit workshopItemCreated(pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement, pCallback->m_eResult, pCallback->m_nPublishedFileId);
|
emit workshopItemCreated(pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement, pCallback->m_eResult, pCallback->m_nPublishedFileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +110,16 @@ void SteamWorkshop::submitWorkshopItem(QString title, QString description, QStri
|
|||||||
SteamUGC()->SetItemUpdateLanguage(m_UGCUpdateHandle, QByteArray(language.toLatin1()).data());
|
SteamUGC()->SetItemUpdateLanguage(m_UGCUpdateHandle, QByteArray(language.toLatin1()).data());
|
||||||
SteamUGC()->SetItemContent(m_UGCUpdateHandle, QByteArray(absoluteContentPath.toLatin1()).data());
|
SteamUGC()->SetItemContent(m_UGCUpdateHandle, QByteArray(absoluteContentPath.toLatin1()).data());
|
||||||
SteamUGC()->SetItemPreview(m_UGCUpdateHandle, QByteArray(preview.toLatin1()).data());
|
SteamUGC()->SetItemPreview(m_UGCUpdateHandle, QByteArray(preview.toLatin1()).data());
|
||||||
|
auto tagList = new QScopedPointer<SteamParamStringArray_t>(new SteamParamStringArray_t);
|
||||||
|
|
||||||
|
|
||||||
|
//const char** cchKey[5][2000];
|
||||||
|
|
||||||
|
|
||||||
|
//tagList->data()->m_ppStrings = cchKey;
|
||||||
|
//tagList->data()->m_nNumStrings = 1;
|
||||||
|
//tagList->data()->m_ppStrings[1][0] = QByteArray("asas").data();
|
||||||
|
SteamUGC()->SetItemTags(m_UGCUpdateHandle,tagList->data());
|
||||||
|
|
||||||
auto visibility = static_cast<ERemoteStoragePublishedFileVisibility>(remoteStoragePublishedFileVisibility);
|
auto visibility = static_cast<ERemoteStoragePublishedFileVisibility>(remoteStoragePublishedFileVisibility);
|
||||||
SteamUGC()->SetItemVisibility(m_UGCUpdateHandle, visibility);
|
SteamUGC()->SetItemVisibility(m_UGCUpdateHandle, visibility);
|
||||||
@ -194,8 +231,8 @@ void SteamWorkshop::searchWorkshop()
|
|||||||
{
|
{
|
||||||
m_UGCSearchHandle = SteamUGC()->CreateQueryAllUGCRequest(EUGCQuery::k_EUGCQuery_RankedByVote,
|
m_UGCSearchHandle = SteamUGC()->CreateQueryAllUGCRequest(EUGCQuery::k_EUGCQuery_RankedByVote,
|
||||||
EUGCMatchingUGCType::k_EUGCMatchingUGCType_Items,
|
EUGCMatchingUGCType::k_EUGCMatchingUGCType_Items,
|
||||||
m_AppId,
|
m_appID,
|
||||||
m_AppId,
|
m_appID,
|
||||||
1);
|
1);
|
||||||
SteamUGC()->SetAllowCachedResponse(m_UGCSearchHandle, 3000);
|
SteamUGC()->SetAllowCachedResponse(m_UGCSearchHandle, 3000);
|
||||||
//Important: First send the request to get the Steam API Call
|
//Important: First send the request to get the Steam API Call
|
||||||
@ -210,15 +247,22 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
|||||||
if (bIOFailure)
|
if (bIOFailure)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QtConcurrent::run([this, pCallback]() {});
|
//QtConcurrent::run([this, pCallback]() { });
|
||||||
|
|
||||||
SteamUGCDetails_t details;
|
SteamUGCDetails_t details;
|
||||||
const int urlLength = 200;
|
const int urlLength = 200;
|
||||||
char url[urlLength];
|
char url[urlLength];
|
||||||
uint32 previews = 0;
|
uint32 previews = 0;
|
||||||
uint32 subscriber = 0;
|
uint32 subscriber = 0;
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
uint32 keyValueTags = 0;
|
||||||
|
const int cchKeySize = 2000;
|
||||||
|
char* cchKey[cchKeySize];
|
||||||
|
const int cchValueSize = 2000;
|
||||||
|
char* pchValue[cchValueSize];
|
||||||
|
|
||||||
uint32 results = pCallback->m_unTotalMatchingResults;
|
uint32 results = pCallback->m_unTotalMatchingResults;
|
||||||
qDebug() << results;
|
|
||||||
|
|
||||||
for (uint32 i = 0; i < results; i++) {
|
for (uint32 i = 0; i < results; i++) {
|
||||||
if (SteamUGC()->GetQueryUGCResult(pCallback->m_handle, i, &details)) {
|
if (SteamUGC()->GetQueryUGCResult(pCallback->m_handle, i, &details)) {
|
||||||
@ -234,6 +278,12 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
|||||||
} else {
|
} else {
|
||||||
emit workshopSearchResult(details.m_nPublishedFileId, QString(details.m_rgchTitle), QUrl(urlData), 0);
|
emit workshopSearchResult(details.m_nPublishedFileId, QString(details.m_rgchTitle), QUrl(urlData), 0);
|
||||||
}
|
}
|
||||||
|
// keyValueTags = SteamUGC()->GetQueryUGCNumKeyValueTags(pCallback->m_handle, i);
|
||||||
|
// if (keyValueTags >= 0) {
|
||||||
|
// if (SteamUGC()->GetQueryUGCKeyValueTag(pCallback->m_handle, i, 0, cchKey, cchKeySize, cchValueSize, pchValue)) {
|
||||||
|
// qDebug() << QByteArray(pchKey) << QByteArray(pchValue);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
// if(SteamUGC()->GetQueryUGCStatistic(pCallback->m_handle,i,EItemStatistic::k_EItemStatistic_NumSubscriptions,&subscriber)){
|
// if(SteamUGC()->GetQueryUGCStatistic(pCallback->m_handle,i,EItemStatistic::k_EItemStatistic_NumSubscriptions,&subscriber)){
|
||||||
|
|
||||||
// }
|
// }
|
||||||
@ -242,6 +292,11 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
|||||||
qDebug() << "Loading error!";
|
qDebug() << "Loading error!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamUGC()->ReleaseQueryUGCRequest(pCallback->m_handle);
|
SteamUGC()->ReleaseQueryUGCRequest(pCallback->m_handle);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SteamWorkshop::onWorkshopItemInstalled(ItemInstalled_t* itemInstalled)
|
||||||
|
{
|
||||||
|
emit workshopItemInstalled(itemInstalled->m_unAppID, itemInstalled->m_nPublishedFileId);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "steam/steam_api.h"
|
#include "steam/steam_api.h"
|
||||||
#include "steamworkshoplistmodel.h"
|
#include "steamworkshoplistmodel.h"
|
||||||
|
#include <QScopedPointer>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
@ -14,6 +15,7 @@
|
|||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Steam Workshop
|
\class Steam Workshop
|
||||||
@ -64,15 +66,22 @@ public:
|
|||||||
|
|
||||||
Q_PROPERTY(unsigned int itemProcessed READ itemProcessed WRITE setItemProcessed NOTIFY itemProcessedChanged)
|
Q_PROPERTY(unsigned int itemProcessed READ itemProcessed WRITE setItemProcessed NOTIFY itemProcessedChanged)
|
||||||
Q_PROPERTY(unsigned int bytesTotal READ bytesTotal WRITE setBytesTotal NOTIFY bytesTotalChanged)
|
Q_PROPERTY(unsigned int bytesTotal READ bytesTotal WRITE setBytesTotal NOTIFY bytesTotalChanged)
|
||||||
|
Q_PROPERTY(unsigned int appID READ appID WRITE setAppID NOTIFY appIDChanged)
|
||||||
// Properties
|
// Properties
|
||||||
unsigned int itemProcessed() const { return m_itemProcessed; }
|
unsigned int itemProcessed() const { return m_itemProcessed; }
|
||||||
unsigned int bytesTotal() const { return m_bytesTotal; }
|
unsigned int bytesTotal() const { return m_bytesTotal; }
|
||||||
|
|
||||||
|
unsigned int appID() const
|
||||||
|
{
|
||||||
|
return m_appID;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
int getItemUpdateProcess();
|
int getItemUpdateProcess();
|
||||||
bool contentFolderExist(QString folder);
|
bool contentFolderExist(QString folder);
|
||||||
|
|
||||||
|
void initSteam();
|
||||||
void searchWorkshop();
|
void searchWorkshop();
|
||||||
void createWorkshopItem();
|
void createWorkshopItem();
|
||||||
void submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, const QUrl projectFile, const QUrl videoFile, int publishedFileId);
|
void submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, const QUrl projectFile, const QUrl videoFile, int publishedFileId);
|
||||||
@ -99,30 +108,50 @@ public slots:
|
|||||||
emit bytesTotalChanged(m_bytesTotal);
|
emit bytesTotalChanged(m_bytesTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAppID(unsigned int appID)
|
||||||
|
{
|
||||||
|
if (m_appID == appID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_appID = appID;
|
||||||
|
emit appIDChanged(m_appID);
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void workshopItemCreated(bool userNeedsToAcceptWorkshopLegalAgreement, int eResult, int publishedFileId);
|
void workshopItemCreated(bool userNeedsToAcceptWorkshopLegalAgreement, int eResult, int publishedFileId);
|
||||||
void workshopSearched();
|
void workshopSearched();
|
||||||
void localWorkshopCreationStatusChanged(LocalWorkshopCreationStatus::Value status);
|
void localWorkshopCreationStatusChanged(LocalWorkshopCreationStatus::Value status);
|
||||||
void remoteWorkshopCreationStatusChanged(RemoteWorkshopCreationStatus::Value status);
|
void remoteWorkshopCreationStatusChanged(RemoteWorkshopCreationStatus::Value status);
|
||||||
void workshopSearchResult(unsigned int id, QString title, QUrl imgUrl,int subscriber);
|
void workshopSearchResult(unsigned int id, QString title, QUrl imgUrl,int subscriber);
|
||||||
|
void workshopItemInstalled(int appID,int publishedFile);
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
void itemProcessedChanged(unsigned int itemProcessed);
|
void itemProcessedChanged(unsigned int itemProcessed);
|
||||||
void bytesTotalChanged(unsigned int bytesTotal);
|
void bytesTotalChanged(unsigned int bytesTotal);
|
||||||
|
|
||||||
|
void appIDChanged(unsigned int appID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void workshopItemCreated(CreateItemResult_t* pCallback, bool bIOFailure);
|
void workshopItemCreated(CreateItemResult_t* pCallback, bool bIOFailure);
|
||||||
CCallResult<SteamWorkshop, CreateItemResult_t> m_createWorkshopItemCallResult;
|
CCallResult<SteamWorkshop, CreateItemResult_t> m_createWorkshopItemCallResult;
|
||||||
|
|
||||||
void onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool bIOFailure);
|
void onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool bIOFailure);
|
||||||
CCallResult<SteamWorkshop, SteamUGCQueryCompleted_t> m_steamUGCQueryResult;
|
CCallResult<SteamWorkshop, SteamUGCQueryCompleted_t> m_steamUGCQueryResult;
|
||||||
|
|
||||||
AppId_t m_AppId;
|
STEAM_CALLBACK( SteamWorkshop, onWorkshopItemInstalled, ItemInstalled_t );
|
||||||
|
|
||||||
|
|
||||||
UGCUpdateHandle_t m_UGCUpdateHandle = 0;
|
UGCUpdateHandle_t m_UGCUpdateHandle = 0;
|
||||||
UGCQueryHandle_t m_UGCSearchHandle = 0;
|
UGCQueryHandle_t m_UGCSearchHandle = 0;
|
||||||
SteamAPICall_t m_searchCall;
|
SteamAPICall_t m_searchCall;
|
||||||
SteamWorkshopListModel* m_workshopListModel;
|
SteamWorkshopListModel* m_workshopListModel;
|
||||||
Settings* m_settings;
|
Settings* m_settings;
|
||||||
|
QTimer* m_pollTimer;
|
||||||
|
|
||||||
|
bool m_steamErrorRestart = false;
|
||||||
|
bool m_steamErrorAPIInit = false;
|
||||||
unsigned int m_itemProcessed = 0;
|
unsigned int m_itemProcessed = 0;
|
||||||
unsigned int m_bytesTotal = 0;
|
unsigned int m_bytesTotal = 0;
|
||||||
|
unsigned int m_appID;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user