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.
This commit is contained in:
flow
2022-03-08 11:12:35 -03:00
parent b3c2a56ece
commit 8409aa2571
20 changed files with 86 additions and 84 deletions

View File

@ -33,10 +33,10 @@ void ModPage::openedImpl()
triggerSearch();
}
bool ModPage::eventFilter(QObject* watched, QEvent* event)
auto ModPage::eventFilter(QObject* watched, QEvent* event) -> bool
{
if (watched == ui->searchEdit && event->type() == QEvent::KeyPress) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
auto* keyEvent = dynamic_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Return) {
triggerSearch();
keyEvent->accept();
@ -70,7 +70,7 @@ void ModPage::onSelectionChanged(QModelIndex first, QModelIndex second)
text = "<a href=\"" + current.websiteUrl + "\">" + name + "</a>";
if (!current.authors.empty()) {
auto authorToStr = [](ModPlatform::ModpackAuthor& author) {
auto authorToStr = [](ModPlatform::ModpackAuthor& author) -> QString {
if (author.url.isEmpty()) { return author.name; }
return QString("<a href=\"%1\">%2</a>").arg(author.url, author.name);
};
@ -128,7 +128,7 @@ void ModPage::onModSelected()
void ModPage::updateModVersions()
{
auto packProfile = (static_cast<MinecraftInstance*>(m_instance))->getPackProfile();
auto packProfile = (dynamic_cast<MinecraftInstance*>(m_instance))->getPackProfile();
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
QString loaderString = (packProfile->getComponentVersion("net.minecraftforge").isEmpty()) ? "fabric" : "forge";