refactor: move url creation for mods to modplatform/

Moves all things related to creating the URLs of the mod platforms
that go to network tasks to a single place, so that:

1. Maintaining and fixing eventual issues is more straightforward.
2. Makes it possible to factor out more common code between the
   different modplatform pages
This commit is contained in:
flow
2022-03-02 23:01:23 -03:00
parent 0dd1c26cf3
commit 2d68308d49
14 changed files with 130 additions and 79 deletions

View File

@ -3,6 +3,7 @@
#include <QAbstractListModel>
#include "modplatform/ModIndex.h"
#include "modplatform/ModAPI.h"
#include "net/NetJob.h"
class ModPage;
@ -30,15 +31,18 @@ class ListModel : public QAbstractListModel {
void searchWithTerm(const QString& term, const int sort);
protected slots:
virtual void performPaginatedSearch() = 0;
virtual void searchRequestFinished() = 0;
void performPaginatedSearch();
void logoFailed(QString logo);
void logoLoaded(QString logo, QIcon out);
void searchRequestFailed(QString reason);
protected:
virtual const char** getSorts() const = 0;
void requestLogo(QString file, QString url);
protected:
@ -56,5 +60,6 @@ class ListModel : public QAbstractListModel {
enum SearchState { None, CanPossiblyFetchMore, ResetRequested, Finished } searchState = None;
NetJob::Ptr jobPtr;
QByteArray response;
};
} // namespace ModPlatform