Revert all the disaster

This commit is contained in:
Sebastian-byte
2021-07-13 19:50:52 -05:00
parent 869a92b2a2
commit 59ffdc8ff6
105 changed files with 4816 additions and 403 deletions

View File

@@ -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();