aboutsummaryrefslogtreecommitdiff
path: root/application/pages/modplatform/technic/TechnicModel.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@users.noreply.github.com>2021-06-20 22:39:03 +0200
committerGitHub <noreply@github.com>2021-06-20 22:39:03 +0200
commitbace6fec1ba7f2fc044b0218e4c2b56dd94767b9 (patch)
treed58fec5fc322905cd44e45292d5a7f7312beb1ab /application/pages/modplatform/technic/TechnicModel.cpp
parenta487234968591361482be18a7de050bc5e7b127d (diff)
parentf7c144c3932a18e1cd96e1ad7505e53ea706a47d (diff)
downloadPrismLauncher-bace6fec1ba7f2fc044b0218e4c2b56dd94767b9.tar.gz
PrismLauncher-bace6fec1ba7f2fc044b0218e4c2b56dd94767b9.tar.bz2
PrismLauncher-bace6fec1ba7f2fc044b0218e4c2b56dd94767b9.zip
Merge pull request #3880 from phit/fix/GH-3720
GH-3720 Fix UI inconsistencies with Modplatforms
Diffstat (limited to 'application/pages/modplatform/technic/TechnicModel.cpp')
-rw-r--r--application/pages/modplatform/technic/TechnicModel.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/application/pages/modplatform/technic/TechnicModel.cpp b/application/pages/modplatform/technic/TechnicModel.cpp
index bf256ab6..a240a94a 100644
--- a/application/pages/modplatform/technic/TechnicModel.cpp
+++ b/application/pages/modplatform/technic/TechnicModel.cpp
@@ -72,7 +72,7 @@ int Technic::ListModel::rowCount(const QModelIndex&) const
void Technic::ListModel::searchWithTerm(const QString& term)
{
- if(currentSearchTerm == term) {
+ if(currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) {
return;
}
currentSearchTerm = term;
@@ -93,9 +93,18 @@ void Technic::ListModel::searchWithTerm(const QString& term)
void Technic::ListModel::performSearch()
{
NetJob *netJob = new NetJob("Technic::Search");
- auto searchUrl = QString(
- "https://api.technicpack.net/search?build=multimc&q=%1"
- ).arg(currentSearchTerm);
+ QString searchUrl = "";
+ if (currentSearchTerm.isEmpty()) {
+ searchUrl = QString(
+ "https://api.technicpack.net/trending?build=multimc"
+ ).arg(currentSearchTerm);
+ }
+ else
+ {
+ searchUrl = QString(
+ "https://api.technicpack.net/search?build=multimc&q=%1"
+ ).arg(currentSearchTerm);
+ }
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
jobPtr = netJob;
jobPtr->start();