diff options
author | Petr Mrázek <peterix@users.noreply.github.com> | 2021-03-26 20:37:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 20:37:48 +0000 |
commit | 5400d4e61389694597381f360e0462932d33bfe1 (patch) | |
tree | 490876d0083f9fc5b1f0a311c5acf68562aec0cb /application/pages/modplatform | |
parent | adf2301b2aa146fa02595b68cf75507709f96862 (diff) | |
parent | 8e6400e8d8c3a2ec1b734c4405b27dd2b547a835 (diff) | |
download | PrismLauncher-5400d4e61389694597381f360e0462932d33bfe1.tar.gz PrismLauncher-5400d4e61389694597381f360e0462932d33bfe1.tar.bz2 PrismLauncher-5400d4e61389694597381f360e0462932d33bfe1.zip |
Merge pull request #3690 from jamierocks/ftb-search-edge
NOISSUE Fix edgecase where new searches won't be processed
Diffstat (limited to 'application/pages/modplatform')
-rw-r--r-- | application/pages/modplatform/ftb/FtbListModel.cpp | 29 | ||||
-rw-r--r-- | application/pages/modplatform/ftb/FtbListModel.h | 3 |
2 files changed, 13 insertions, 19 deletions
diff --git a/application/pages/modplatform/ftb/FtbListModel.cpp b/application/pages/modplatform/ftb/FtbListModel.cpp index 63236827..98973f2e 100644 --- a/application/pages/modplatform/ftb/FtbListModel.cpp +++ b/application/pages/modplatform/ftb/FtbListModel.cpp @@ -106,21 +106,22 @@ void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallbac void ListModel::searchWithTerm(const QString &term) { - if(currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) { + if(searchState != Failed && currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) { + // unless the search has failed, then there is no need to perform an identical search. return; } currentSearchTerm = term; + if(jobPtr) { jobPtr->abort(); - searchState = ResetRequested; - return; - } - else { - beginResetModel(); - modpacks.clear(); - endResetModel(); - searchState = None; + jobPtr.reset(); } + + beginResetModel(); + modpacks.clear(); + endResetModel(); + searchState = None; + performSearch(); } @@ -154,15 +155,7 @@ void ListModel::searchRequestFailed(QString reason) jobPtr.reset(); remainingPacks.clear(); - if(searchState == ResetRequested) { - beginResetModel(); - modpacks.clear(); - endResetModel(); - - performSearch(); - } else { - searchState = Finished; - } + searchState = Failed; } void ListModel::requestPack() diff --git a/application/pages/modplatform/ftb/FtbListModel.h b/application/pages/modplatform/ftb/FtbListModel.h index 9c057d73..de94e6ba 100644 --- a/application/pages/modplatform/ftb/FtbListModel.h +++ b/application/pages/modplatform/ftb/FtbListModel.h @@ -57,7 +57,8 @@ private: None, CanPossiblyFetchMore, ResetRequested, - Finished + Finished, + Failed, } searchState = None; NetJobPtr jobPtr; int currentPack; |