chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-14 18:16:53 +02:00
parent 779f70057b
commit 91ba4cf75e
603 changed files with 15840 additions and 16257 deletions

View File

@ -117,7 +117,7 @@ auto ModpackListModel::data(const QModelIndex& index, int role) const -> QVarian
return {};
}
bool ModpackListModel::setData(const QModelIndex &index, const QVariant &value, [[maybe_unused]] int role)
bool ModpackListModel::setData(const QModelIndex& index, const QVariant& value, [[maybe_unused]] int role)
{
int pos = index.row();
if (pos >= modpacks.size() || pos < 0 || !index.isValid())
@ -183,24 +183,24 @@ void ModpackListModel::refresh()
static auto sortFromIndex(int index) -> QString
{
switch(index){
default:
case 0:
return "relevance";
case 1:
return "downloads";
case 2:
return "follows";
case 3:
return "newest";
case 4:
return "updated";
switch (index) {
default:
case 0:
return "relevance";
case 1:
return "downloads";
case 2:
return "follows";
case 3:
return "newest";
case 4:
return "updated";
}
}
void ModpackListModel::searchWithTerm(const QString& term, const int sort)
{
if(sort > 5 || sort < 0)
if (sort > 5 || sort < 0)
return;
auto sort_str = sortFromIndex(sort);

View File

@ -47,7 +47,7 @@ class Version;
namespace Modrinth {
using LogoMap = QMap<QString, QIcon>;
using LogoCallback = std::function<void (QString)>;
using LogoCallback = std::function<void(QString)>;
class ModpackListModel : public QAbstractListModel {
Q_OBJECT
@ -64,7 +64,7 @@ class ModpackListModel : public QAbstractListModel {
/* Retrieve information from the model at a given index with the given role */
auto data(const QModelIndex& index, int role) const -> QVariant override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
inline void setActiveJob(NetJob::Ptr ptr) { jobPtr = ptr; }
@ -75,7 +75,10 @@ class ModpackListModel : public QAbstractListModel {
void getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback);
inline auto canFetchMore(const QModelIndex& parent) const -> bool override { return parent.isValid() ? false : searchState == CanPossiblyFetchMore; };
inline auto canFetchMore(const QModelIndex& parent) const -> bool override
{
return parent.isValid() ? false : searchState == CanPossiblyFetchMore;
};
public slots:
void searchRequestFinished(QJsonDocument& doc_all);

View File

@ -46,8 +46,7 @@
namespace ResourceDownload {
ModrinthModPage::ModrinthModPage(ModDownloadDialog* dialog, BaseInstance& instance)
: ModPage(dialog, instance)
ModrinthModPage::ModrinthModPage(ModDownloadDialog* dialog, BaseInstance& instance) : ModPage(dialog, instance)
{
m_model = new ModrinthModModel(instance);
m_ui->packView->setModel(m_model);
@ -64,14 +63,15 @@ ModrinthModPage::ModrinthModPage(ModDownloadDialog* dialog, BaseInstance& instan
m_ui->packDescription->setMetaEntry(metaEntryBase());
}
auto ModrinthModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, std::optional<ResourceAPI::ModLoaderTypes> loaders) const -> bool
auto ModrinthModPage::validateVersion(ModPlatform::IndexedVersion& ver,
QString mineVer,
std::optional<ResourceAPI::ModLoaderTypes> loaders) const -> bool
{
auto loaderCompatible = !loaders.has_value();
if (!loaderCompatible) {
auto loaderStrings = ModrinthAPI::getModLoaderStrings(loaders.value());
for (auto remoteLoader : ver.loaders)
{
for (auto remoteLoader : ver.loaders) {
if (loaderStrings.contains(remoteLoader)) {
loaderCompatible = true;
break;
@ -139,9 +139,21 @@ ModrinthShaderPackPage::ModrinthShaderPackPage(ShaderPackDownloadDialog* dialog,
// I don't know why, but doing this on the parent class makes it so that
// other mod providers start loading before being selected, at least with
// my Qt, so we need to implement this in every derived class...
auto ModrinthModPage::shouldDisplay() const -> bool { return true; }
auto ModrinthResourcePackPage::shouldDisplay() const -> bool { return true; }
auto ModrinthTexturePackPage::shouldDisplay() const -> bool { return true; }
auto ModrinthShaderPackPage::shouldDisplay() const -> bool { return true; }
auto ModrinthModPage::shouldDisplay() const -> bool
{
return true;
}
auto ModrinthResourcePackPage::shouldDisplay() const -> bool
{
return true;
}
auto ModrinthTexturePackPage::shouldDisplay() const -> bool
{
return true;
}
auto ModrinthShaderPackPage::shouldDisplay() const -> bool
{
return true;
}
} // namespace ResourceDownload

View File

@ -43,18 +43,33 @@
#include "ui/pages/modplatform/ModPage.h"
#include "ui/pages/modplatform/ResourcePackPage.h"
#include "ui/pages/modplatform/TexturePackPage.h"
#include "ui/pages/modplatform/ShaderPackPage.h"
#include "ui/pages/modplatform/TexturePackPage.h"
namespace ResourceDownload {
namespace Modrinth {
static inline QString displayName() { return "Modrinth"; }
static inline QIcon icon() { return APPLICATION->getThemedIcon("modrinth"); }
static inline QString id() { return "modrinth"; }
static inline QString debugName() { return "Modrinth"; }
static inline QString metaEntryBase() { return "ModrinthPacks"; }
static inline QString displayName()
{
return "Modrinth";
}
static inline QIcon icon()
{
return APPLICATION->getThemedIcon("modrinth");
}
static inline QString id()
{
return "modrinth";
}
static inline QString debugName()
{
return "Modrinth";
}
static inline QString metaEntryBase()
{
return "ModrinthPacks";
}
} // namespace Modrinth
class ModrinthModPage : public ModPage {
Q_OBJECT
@ -78,7 +93,8 @@ class ModrinthModPage : public ModPage {
[[nodiscard]] inline auto helpPage() const -> QString override { return "Mod-platform"; }
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, std::optional<ResourceAPI::ModLoaderTypes> loaders = {}) const -> bool override;
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, std::optional<ResourceAPI::ModLoaderTypes> loaders = {}) const
-> bool override;
};
class ModrinthResourcePackPage : public ResourcePackResourcePage {