clarify some method names and comments
This commit is contained in:
		| @@ -97,7 +97,7 @@ void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallbac | ||||
|     } | ||||
| } | ||||
|  | ||||
| void ListModel::populateVersions(ModPlatform::IndexedPack const& current) | ||||
| void ListModel::requestModVersions(ModPlatform::IndexedPack const& current) | ||||
| { | ||||
|     auto netJob = new NetJob(QString("%1::ModVersions(%2)").arg(m_parent->debugName()).arg(current.name), APPLICATION->network()); | ||||
|     auto response = new QByteArray(); | ||||
| @@ -106,7 +106,7 @@ void ListModel::populateVersions(ModPlatform::IndexedPack const& current) | ||||
|     netJob->addNetAction(Net::Download::makeByteArray(m_parent->apiProvider()->getVersionsURL(addonId), response)); | ||||
|  | ||||
|     QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId]{ | ||||
|         m_parent->onGetVersionsSucceeded(m_parent, response, addonId); | ||||
|         m_parent->onRequestVersionsSucceeded(m_parent, response, addonId); | ||||
|     }); | ||||
|  | ||||
|     QObject::connect(netJob, &NetJob::finished, this, [response, netJob] { | ||||
|   | ||||
| @@ -22,25 +22,26 @@ class ListModel : public QAbstractListModel { | ||||
|  | ||||
|     int rowCount(const QModelIndex& parent) const override; | ||||
|     int columnCount(const QModelIndex& parent) const override; | ||||
|  | ||||
|     QVariant data(const QModelIndex& index, int role) const override; | ||||
|     Qt::ItemFlags flags(const QModelIndex& index) const override; | ||||
|  | ||||
|     bool canFetchMore(const QModelIndex& parent) const override; | ||||
|     void fetchMore(const QModelIndex& parent) override; | ||||
|  | ||||
|     void getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback); | ||||
|     void searchWithTerm(const QString& term, const int sort); | ||||
|  | ||||
|     virtual void populateVersions(const ModPlatform::IndexedPack& current); | ||||
|     virtual void requestModVersions(const ModPlatform::IndexedPack& current); | ||||
|  | ||||
|    protected slots: | ||||
|     virtual void searchRequestFinished() = 0; | ||||
|  | ||||
|     void performPaginatedSearch(); | ||||
|     void searchRequestFailed(QString reason); | ||||
|  | ||||
|     void logoFailed(QString logo); | ||||
|     void logoLoaded(QString logo, QIcon out); | ||||
|  | ||||
|     void searchRequestFailed(QString reason); | ||||
|     void performPaginatedSearch(); | ||||
|  | ||||
|    protected: | ||||
|     virtual const char** getSorts() const = 0; | ||||
| @@ -51,17 +52,18 @@ class ListModel : public QAbstractListModel { | ||||
|     ModPage* m_parent; | ||||
|  | ||||
|     QList<ModPlatform::IndexedPack> modpacks; | ||||
|     QStringList m_failedLogos; | ||||
|     QStringList m_loadingLogos; | ||||
|  | ||||
|     LogoMap m_logoMap; | ||||
|     QMap<QString, LogoCallback> waitingCallbacks; | ||||
|     QStringList m_failedLogos; | ||||
|     QStringList m_loadingLogos; | ||||
|  | ||||
|     QString currentSearchTerm; | ||||
|     int currentSort = 0; | ||||
|     int nextSearchOffset = 0; | ||||
|     enum SearchState { None, CanPossiblyFetchMore, ResetRequested, Finished } searchState = None; | ||||
|  | ||||
|     NetJob::Ptr jobPtr; | ||||
|     QByteArray response; | ||||
|  | ||||
| }; | ||||
| }  // namespace ModPlatform | ||||
|   | ||||
| @@ -98,7 +98,7 @@ void ModPage::onSelectionChanged(QModelIndex first, QModelIndex second) | ||||
|         ui->modSelectionButton->setText(tr("Loading versions...")); | ||||
|         ui->modSelectionButton->setEnabled(false); | ||||
|  | ||||
|         listModel->populateVersions(current); | ||||
|         listModel->requestModVersions(current); | ||||
|     } else { | ||||
|         for (int i = 0; i < current.versions.size(); i++) { | ||||
|             ui->versionSelectionBox->addItem(current.versions[i].version, QVariant(i)); | ||||
|   | ||||
| @@ -23,20 +23,21 @@ class ModPage : public QWidget, public BasePage { | ||||
|     explicit ModPage(ModDownloadDialog* dialog, BaseInstance* instance, ModAPI* api); | ||||
|     virtual ~ModPage(); | ||||
|  | ||||
|     /* The name visible to the user */ | ||||
|     /* Affects what the user sees */ | ||||
|     virtual QString displayName() const override = 0; | ||||
|     virtual QIcon icon() const override = 0; | ||||
|     virtual QString id() const override = 0; | ||||
|     virtual QString helpPage() const override = 0; | ||||
|  | ||||
|     /* Used internally */ | ||||
|     virtual QString metaEntryBase() const = 0; | ||||
|     /* This only appears in the debug console */ | ||||
|     virtual QString debugName() const = 0; | ||||
|  | ||||
|  | ||||
|     virtual bool shouldDisplay() const override = 0; | ||||
|     const ModAPI* apiProvider() const { return api.get(); }; | ||||
|  | ||||
|     virtual void onGetVersionsSucceeded(ModPage*, QByteArray*, QString) = 0; | ||||
|     virtual void onRequestVersionsSucceeded(ModPage*, QByteArray*, QString) = 0; | ||||
|  | ||||
|     void openedImpl() override; | ||||
|     bool eventFilter(QObject* watched, QEvent* event) override; | ||||
|   | ||||
| @@ -36,7 +36,7 @@ FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance* instance) | ||||
|  | ||||
| bool FlameModPage::shouldDisplay() const { return true; } | ||||
|  | ||||
| void FlameModPage::onGetVersionsSucceeded(ModPage* instance, QByteArray* response, QString addonId) | ||||
| void FlameModPage::onRequestVersionsSucceeded(ModPage* instance, QByteArray* response, QString addonId) | ||||
| { | ||||
|     if (addonId != current.addonId) { | ||||
|         return;  // wrong request | ||||
|   | ||||
| @@ -22,5 +22,5 @@ class FlameModPage : public ModPage { | ||||
|     bool shouldDisplay() const override; | ||||
|  | ||||
|    private: | ||||
|     void onGetVersionsSucceeded(ModPage*, QByteArray*, QString) override; | ||||
|     void onRequestVersionsSucceeded(ModPage*, QByteArray*, QString) override; | ||||
| }; | ||||
|   | ||||
| @@ -35,7 +35,7 @@ ModrinthPage::ModrinthPage(ModDownloadDialog* dialog, BaseInstance* instance) | ||||
|  | ||||
| bool ModrinthPage::shouldDisplay() const { return true; } | ||||
|  | ||||
| void ModrinthPage::onGetVersionsSucceeded(ModPage* instance, QByteArray* response, QString addonId) | ||||
| void ModrinthPage::onRequestVersionsSucceeded(ModPage* instance, QByteArray* response, QString addonId) | ||||
| { | ||||
|     if (addonId != current.addonId) { return; } | ||||
|     QJsonParseError parse_error; | ||||
|   | ||||
| @@ -22,5 +22,5 @@ class ModrinthPage : public ModPage { | ||||
|     bool shouldDisplay() const override; | ||||
|  | ||||
|    private: | ||||
|     void onGetVersionsSucceeded(ModPage*, QByteArray*, QString) override; | ||||
|     void onRequestVersionsSucceeded(ModPage*, QByteArray*, QString) override; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user