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