aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/ModModel.cpp
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-03-08 11:12:35 -0300
committerflow <thiagodonato300@gmail.com>2022-03-14 17:43:36 -0300
commit8409aa2571d57f015a634a220107d199e88ba2fd (patch)
treee57a9be808be1f4a19b7ae31b1ba846ca53a111b /launcher/ui/pages/modplatform/ModModel.cpp
parentb3c2a56ece925bc6fe327b8824c50f194610b5b9 (diff)
downloadPrismLauncher-8409aa2571d57f015a634a220107d199e88ba2fd.tar.gz
PrismLauncher-8409aa2571d57f015a634a220107d199e88ba2fd.tar.bz2
PrismLauncher-8409aa2571d57f015a634a220107d199e88ba2fd.zip
tidy: Fix clang-tidy issues on files changed in this PR
The checks used are roughly the same as the ones proposed in the clang-tidy PR (except perhaps that I used modernize-* instead of listing them individually,though I don't think this caused any readability detriments). In ModrinthModel.cpp and FlameModModel.cpp I ignored the modernize-avoid-c-arrays one, mostly because making the sorts array an std::array would most likely increase the code complexity because of the virtual function. Aside from that, the static_cast warning from Application.h was not dealt with, since it's not in this PR's scope.
Diffstat (limited to 'launcher/ui/pages/modplatform/ModModel.cpp')
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp
index 6f3c6ce0..cc3c5326 100644
--- a/launcher/ui/pages/modplatform/ModModel.cpp
+++ b/launcher/ui/pages/modplatform/ModModel.cpp
@@ -11,7 +11,7 @@ namespace ModPlatform {
ListModel::ListModel(ModPage* parent) : QAbstractListModel(parent), m_parent(parent) {}
-QString ListModel::debugName() const
+auto ListModel::debugName() const -> QString
{
return m_parent->debugName();
}
@@ -29,7 +29,7 @@ void ListModel::fetchMore(const QModelIndex& parent)
performPaginatedSearch();
}
-QVariant ListModel::data(const QModelIndex& index, int role) const
+auto ListModel::data(const QModelIndex& index, int role) const -> QVariant
{
int pos = index.row();
if (pos >= modpacks.size() || pos < 0 || !index.isValid()) { return QString("INVALID INDEX %1").arg(pos); }
@@ -56,7 +56,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
return v;
}
- return QVariant();
+ return {};
}
void ListModel::requestModVersions(ModPlatform::IndexedPack const& current)
@@ -66,8 +66,8 @@ void ListModel::requestModVersions(ModPlatform::IndexedPack const& current)
void ListModel::performPaginatedSearch()
{
- QString mcVersion = ((MinecraftInstance*)((ModPage*)parent())->m_instance)->getPackProfile()->getComponentVersion("net.minecraft");
- bool hasFabric = !((MinecraftInstance*)((ModPage*)parent())->m_instance)
+ QString mcVersion = (dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))->getPackProfile()->getComponentVersion("net.minecraft");
+ bool hasFabric = !(dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))
->getPackProfile()
->getComponentVersion("net.fabricmc.fabric-loader")
.isEmpty();
@@ -188,7 +188,7 @@ void ListModel::searchRequestFailed(QString reason)
QMessageBox::critical(nullptr, tr("Error"),
QString("%1 %2").arg(m_parent->displayName()).arg(tr("API version too old!\nPlease update PolyMC!")));
// self-destruct
- ((ModDownloadDialog*)((ModPage*)parent())->parentWidget())->reject();
+ (dynamic_cast<ModDownloadDialog*>((dynamic_cast<ModPage*>(parent()))->parentWidget()))->reject();
}
jobPtr.reset();