refactor: de-duplicate common code in network mod APIs

This commit is contained in:
flow
2022-03-07 16:46:08 -03:00
parent f714adf6d2
commit 16bfafa29e
8 changed files with 109 additions and 133 deletions

View File

@ -53,6 +53,11 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
return QVariant();
}
QString ListModel::debugName() const
{
return m_parent->debugName();
}
void ListModel::logoLoaded(QString logo, QIcon out)
{
m_loadingLogos.removeAll(logo);
@ -99,8 +104,9 @@ void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallbac
}
}
void ListModel::requestModVersions(ModPlatform::IndexedPack const& current) {
m_parent->apiProvider()->getVersions(this, current.addonId.toString(), m_parent->debugName());
void ListModel::requestModVersions(ModPlatform::IndexedPack const& current)
{
m_parent->apiProvider()->getVersions(this, current.addonId.toString());
}
void ListModel::performPaginatedSearch()

View File

@ -1,6 +1,5 @@
#pragma once
#include <qjsondocument.h>
#include <QAbstractListModel>
#include "modplatform/ModAPI.h"
@ -24,6 +23,9 @@ class ListModel : public QAbstractListModel {
int rowCount(const QModelIndex& parent) const override;
int columnCount(const QModelIndex& parent) const override;
QString debugName() const;
/* Retrieve information from the model at a given index with the given role */
QVariant data(const QModelIndex& index, int role) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;