mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-22 10:42:29 +01:00
Fix workshop search state when returning 0 items
This commit is contained in:
parent
40bfa967eb
commit
65736cb5ff
@ -16,6 +16,7 @@ Item {
|
||||
property Background background
|
||||
|
||||
Component.onCompleted: {
|
||||
root.state = "searching"
|
||||
searchConnection.target = root.steamWorkshop
|
||||
root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
}
|
||||
@ -26,7 +27,8 @@ Item {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
enabled: gridView.count === 0
|
||||
id: rootMouseArea
|
||||
enabled: false
|
||||
z: enabled ? 10 : 0
|
||||
cursorShape: enabled ? Qt.WaitCursor : Qt.ArrowCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
@ -38,7 +40,7 @@ Item {
|
||||
Connections {
|
||||
id: searchConnection
|
||||
ignoreUnknownSignals: true // This is needed for some reason...
|
||||
function onWorkshopSearchCompleted() {
|
||||
function onWorkshopBannerCompleted() {
|
||||
bannerTxt.text = root.steamWorkshop.workshopListModel.getBannerText(
|
||||
)
|
||||
background.backgroundImage = root.steamWorkshop.workshopListModel.getBannerUrl()
|
||||
@ -46,6 +48,10 @@ Item {
|
||||
bannerTxtUnderline.numberSubscriber
|
||||
= root.steamWorkshop.workshopListModel.getBannerAmountSubscriber()
|
||||
}
|
||||
|
||||
function onWorkshopSearchCompleted(itemCount) {
|
||||
root.state = ""
|
||||
}
|
||||
}
|
||||
|
||||
PopupSteamWorkshopAgreement {
|
||||
@ -314,8 +320,15 @@ Item {
|
||||
id: tiSearch
|
||||
placeholderTextColor: Material.secondaryTextColor
|
||||
placeholderText: qsTr("Search for Wallpaper and Widgets...")
|
||||
onEditingFinished: root.steamWorkshop.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
onEditingFinished: {
|
||||
root.state = "searching"
|
||||
if (tiSearch.text === "")
|
||||
return root.steamWorkshop.searchWorkshop(
|
||||
SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
|
||||
root.steamWorkshop.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
}
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
@ -328,8 +341,11 @@ Item {
|
||||
ToolButton {
|
||||
id: tb
|
||||
icon.source: "qrc:/ScreenPlayWorkshop/assets/icons/icon_search.svg"
|
||||
onClicked: root.steamWorkshop.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
onClicked: {
|
||||
root.state = "searching"
|
||||
root.steamWorkshop.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
}
|
||||
icon.width: 20
|
||||
icon.height: 20
|
||||
anchors {
|
||||
@ -409,6 +425,7 @@ Item {
|
||||
"text": qsTr("Total Unique Subscriptions")
|
||||
}]
|
||||
onActivated: {
|
||||
root.state = "searching"
|
||||
root.steamWorkshop.searchWorkshop(
|
||||
cbQuerySort.currentValue)
|
||||
}
|
||||
@ -459,6 +476,7 @@ Item {
|
||||
text: qsTr("Back")
|
||||
enabled: root.steamWorkshop.workshopListModel.currentPage > 1
|
||||
onClicked: {
|
||||
root.state = "searching"
|
||||
root.steamWorkshop.workshopListModel.setCurrentPage(
|
||||
root.steamWorkshop.workshopListModel.currentPage - 1)
|
||||
root.steamWorkshop.searchWorkshop(
|
||||
@ -483,6 +501,7 @@ Item {
|
||||
enabled: root.steamWorkshop.workshopListModel.currentPage
|
||||
<= root.steamWorkshop.workshopListModel.pages - 1
|
||||
onClicked: {
|
||||
root.state = "searching"
|
||||
root.steamWorkshop.workshopListModel.setCurrentPage(
|
||||
root.steamWorkshop.workshopListModel.currentPage + 1)
|
||||
root.steamWorkshop.searchWorkshop(
|
||||
@ -519,4 +538,14 @@ Item {
|
||||
sidebar.close()
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "searching"
|
||||
PropertyChanges {
|
||||
target: rootMouseArea
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -246,7 +246,9 @@ bool SteamWorkshop::queryWorkshopItemFromHandle(SteamWorkshopListModel* listMode
|
||||
|
||||
if (totalResults <= 0 || results <= 0) {
|
||||
qWarning() << "Invalid result count. Aborting! totalResults:" << totalResults << "results " << results;
|
||||
return {};
|
||||
SteamUGC()->ReleaseQueryUGCRequest(pCallback->m_handle);
|
||||
emit workshopSearchCompleted(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
const float maxResultsPerPage = 50;
|
||||
@ -283,7 +285,7 @@ bool SteamWorkshop::queryWorkshopItemFromHandle(SteamWorkshopListModel* listMode
|
||||
|
||||
// Do not change the background image on every page
|
||||
if (i == 0 && listModel->currentPage() == 1) {
|
||||
emit workshopSearchCompleted();
|
||||
emit workshopBannerCompleted();
|
||||
}
|
||||
|
||||
// const int keyValueTagsCount = SteamUGC()->GetQueryUGCNumKeyValueTags(pCallback->m_handle, i);
|
||||
@ -301,6 +303,8 @@ bool SteamWorkshop::queryWorkshopItemFromHandle(SteamWorkshopListModel* listMode
|
||||
}
|
||||
|
||||
SteamUGC()->ReleaseQueryUGCRequest(pCallback->m_handle);
|
||||
|
||||
emit workshopSearchCompleted(results);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,8 @@ public slots:
|
||||
}
|
||||
|
||||
signals:
|
||||
void workshopSearchCompleted();
|
||||
void workshopSearchCompleted(const int itemCount);
|
||||
void workshopBannerCompleted();
|
||||
void workshopItemCreatedSuccessful(
|
||||
bool userNeedsToAcceptWorkshopLegalAgreement,
|
||||
int eResult,
|
||||
|
Loading…
Reference in New Issue
Block a user