Commit 5a8583cd authored by Elias Steurer's avatar Elias Steurer 🇩🇪

Fix steam workshopID

Refactor from int to QVariant that can hold
unsinged long ling int that is needed because
as of this writing steamid are now bigger
than int
parent d37f4030
......@@ -184,7 +184,7 @@ Item {
type: m_type
screenId: m_folderId
absoluteStoragePath: m_absoluteStoragePath
workshopID: m_workshopID
publishedFileID: m_publishedFileID
itemIndex: index
onOpenContextMenu: {
// Set the menu to the current item informations
......
......@@ -16,7 +16,7 @@ Item {
property string screenId
property url absoluteStoragePath
property var type: InstalledType.Unknown
property int workshopID: 0
property var publishedFileID: 0
property int itemIndex
signal openContextMenu(point position)
......
......@@ -47,14 +47,14 @@ Drawer {
property url videoPreview
property alias imgUrl: img.source
property string name
property int workshopID
property var publishedFileID
property int itemIndex
property int subscriptionCount
property bool subscribed: false
function setWorkshopItem(id, imgUrl, videoPreview, subscriptionCount) {
function setWorkshopItem(publishedFileID, imgUrl, videoPreview, subscriptionCount) {
if (root.workshopID === id) {
if (root.publishedFileID === publishedFileID) {
if (!root.visible) {
root.open()
} else {
......@@ -63,7 +63,7 @@ Drawer {
return
}
webView.opacity = 0
root.workshopID = id
root.publishedFileID = publishedFileID
root.imgUrl = imgUrl
root.subscriptionCount = subscriptionCount
root.videoPreview = videoPreview
......@@ -74,7 +74,8 @@ Drawer {
if (!root.visible) {
root.open()
}
SP.Workshop.steamWorkshop.requestWorkshopItemDetails(workshopID)
SP.Workshop.steamWorkshop.requestWorkshopItemDetails(publishedFileID)
webView.setVideo()
}
......@@ -236,7 +237,7 @@ Drawer {
ToolTip.visible: hovered
ToolTip.text: qsTr("Click here if you like the content")
onClicked: {
SP.Workshop.steamWorkshop.vote(root.workshopID,
SP.Workshop.steamWorkshop.vote(root.publishedFileID,
true)
txtVotesUp.highlighted = true
txtVotesDown.highlighted = false
......@@ -250,7 +251,7 @@ Drawer {
ToolTip.visible: hovered
ToolTip.text: qsTr("Click here if you do not like the content")
onClicked: {
SP.Workshop.steamWorkshop.vote(root.workshopID,
SP.Workshop.steamWorkshop.vote(root.publishedFileID,
false)
txtVotesUp.highlighted = false
txtVotesDown.highlighted = true
......@@ -318,7 +319,7 @@ Drawer {
icon.source: "qrc:/assets/icons/icon_open_in_new.svg"
text: qsTr("Open In Steam")
onClicked: Qt.openUrlExternally(
"steam://url/CommunityFilePage/" + root.workshopID)
"steam://url/CommunityFilePage/" + root.publishedFileID)
}
}
......@@ -361,7 +362,7 @@ Drawer {
text: root.subscribed ? qsTr("Subscribed!") : qsTr("Subscribe")
onClicked: {
root.subscribed = true
SP.Workshop.steamWorkshop.subscribeItem(root.workshopID)
SP.Workshop.steamWorkshop.subscribeItem(root.publishedFileID)
}
}
}
......
......@@ -325,8 +325,7 @@ Item {
Layout.preferredHeight: searchWrapper.height
font.family: ScreenPlay.settings.font
onActivated: {
Workshop.steamWorkshop.workshopListModel.searchWorkshop(
cbQuerySort.currentValue)
Workshop.steamWorkshop.workshopListModel.searchWorkshop( cbQuerySort.currentValue, 1)
}
model: [{
"value": SteamEnums.k_EUGCQuery_RankedByVote,
......@@ -367,12 +366,12 @@ Item {
delegate: WorkshopItem {
imgUrl: m_workshopPreview
name: m_workshopTitle
workshopID: m_workshopID
publishedFileID: m_publishedFileID
additionalPreviewUrl: m_additionalPreviewUrl
subscriptionCount: m_subscriptionCount
itemIndex: index
onClicked: {
sidebar.setWorkshopItem(workshopID, imgUrl,
sidebar.setWorkshopItem(publishedFileID, imgUrl,
additionalPreviewUrl,
subscriptionCount)
}
......
......@@ -14,13 +14,13 @@ Item {
property url imgUrl
property url additionalPreviewUrl
property string name
property int workshopID
property var publishedFileID: 0
property int itemIndex
property int subscriptionCount
property bool isDownloading: false
signal clicked(int workshopID, url imgUrl)
signal clicked(var publishedFileID, url imgUrl)
RectangularGlow {
id: effect
......@@ -234,7 +234,7 @@ Item {
}
}
onClicked: {
root.clicked(root.workshopID, root.imgUrl)
root.clicked(root.publishedFileID, root.imgUrl)
}
}
MouseArea {
......@@ -249,15 +249,16 @@ Item {
onClicked: {
isDownloading = true
root.state = "downloading"
SP.Workshop.steamWorkshop.subscribeItem(root.workshopID)
SP.Workshop.steamWorkshop.subscribeItem(root.publishedFileID)
ScreenPlay.setTrackerSendEvent("subscribeItem",
root.workshopID)
root.publishedFileID)
}
Connections {
target: SP.Workshop.steamWorkshop
function onWorkshopItemInstalled(appID, publishedFile) {
if (appID === SP.Workshop.steamWorkshop.appID) {
function onWorkshopItemInstalled(appID, publishedFileID) {
if (appID === SP.Workshop.steamWorkshop.appID
&& publishedFileID === root.publishedFileID) {
root.state = "installed"
}
}
......@@ -275,7 +276,7 @@ Item {
}
onClicked: {
Qt.openUrlExternally(
"steam://url/CommunityFilePage/" + root.workshopID)
"steam://url/CommunityFilePage/" + root.publishedFileID)
}
}
}
......
......@@ -104,7 +104,7 @@ Popup {
type: screenType
screenId: screenFolderId
absoluteStoragePath: screenAbsoluteStoragePath
workshopID: screenWorkshopID
publishedFileID: screenPublishedFileID
preview: screenPreview
itemIndex: index
onItemClicked: {
......
......@@ -23,7 +23,7 @@ Item {
property string preview: ""
property string type: ""
property bool hasMenuOpen: false
property int workshopID: 0
property var publishedFileID: 0
property int itemIndex
signal itemClicked(var screenId, var type, var isActive)
......
......@@ -110,8 +110,8 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
return m_screenPlayFiles.at(row).m_file;
case static_cast<int>(ScreenPlayItem::AbsoluteStoragePath):
return m_screenPlayFiles.at(row).m_absoluteStoragePath;
case static_cast<int>(ScreenPlayItem::WorkshopID):
return m_screenPlayFiles.at(row).m_workshopID;
case static_cast<int>(ScreenPlayItem::PublishedFileID):
return m_screenPlayFiles.at(row).m_publishedFileID;
case static_cast<int>(ScreenPlayItem::Tags):
return m_screenPlayFiles.at(row).m_tags;
case static_cast<int>(ScreenPlayItem::SearchType):
......@@ -136,7 +136,7 @@ QHash<int, QByteArray> InstalledListModel::roleNames() const
{ static_cast<int>(ScreenPlayItem::FolderId), "m_folderId" },
{ static_cast<int>(ScreenPlayItem::FileId), "m_file" },
{ static_cast<int>(ScreenPlayItem::AbsoluteStoragePath), "m_absoluteStoragePath" },
{ static_cast<int>(ScreenPlayItem::WorkshopID), "m_workshopID" },
{ static_cast<int>(ScreenPlayItem::PublishedFileID), "m_publishedFileID" },
{ static_cast<int>(ScreenPlayItem::Tags), "m_tags" },
{ static_cast<int>(ScreenPlayItem::SearchType), "m_searchType" },
};
......@@ -206,7 +206,7 @@ QVariantMap InstalledListModel::get(const QString& folderId) const
map.insert("m_file", m_screenPlayFiles[i].m_file);
map.insert("m_type", QVariant::fromValue(m_screenPlayFiles[i].m_type));
map.insert("m_absoluteStoragePath", m_screenPlayFiles[i].m_absoluteStoragePath);
map.insert("m_workshopID", m_screenPlayFiles[i].m_workshopID);
map.insert("m_publishedFileID", m_screenPlayFiles[i].m_publishedFileID);
return map;
}
}
......
......@@ -84,7 +84,7 @@ public:
FolderId,
FileId,
AbsoluteStoragePath,
WorkshopID,
PublishedFileID,
Tags,
SearchType,
};
......
......@@ -82,7 +82,7 @@ struct ProjectFile {
m_title = obj.value("title").toString();
if (obj.contains("workshopid")) {
m_workshopID = obj.value("workshopid").toInt(0);
m_publishedFileID = obj.value("workshopid").toInt(0);
}
if (obj.contains("tags")) {
......@@ -126,7 +126,7 @@ struct ProjectFile {
//Folder name
QString m_folderId;
int m_workshopID { 0 };
QVariant m_publishedFileID { 0 };
QStringList m_tags;
InstalledType::InstalledType m_type = InstalledType::InstalledType::Unknown;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment