format the code

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2026-01-09 22:28:25 +02:00
parent 133842d6a8
commit 53acc60983
21 changed files with 56 additions and 59 deletions

View File

@@ -50,8 +50,8 @@
#include "tools/GenericProfiler.h"
#include "ui/InstanceWindow.h"
#include "ui/MainWindow.h"
#include "ui/ViewLogWindow.h"
#include "ui/ToolTipFilter.h"
#include "ui/ViewLogWindow.h"
#include "ui/dialogs/ProgressDialog.h"
#include "ui/instanceview/AccessibleInstanceView.h"

View File

@@ -42,7 +42,8 @@ class SecurityBookmarkFileAccess {
bool m_readOnly;
NSURL* securityScopedBookmarkToNSURL(QByteArray& bookmark, bool& isStale);
public:
public:
/// \param readOnly A boolean indicating whether the bookmark should be read-only.
SecurityBookmarkFileAccess(bool readOnly = false);
~SecurityBookmarkFileAccess();
@@ -86,4 +87,4 @@ public:
bool isAccessingPath(const QString& path);
};
#endif //FILEACCESS_H
#endif // FILEACCESS_H

View File

@@ -484,7 +484,7 @@ QStringList MinecraftInstance::getNativeJars()
return nativeJars;
}
static QString replaceTokensIn(const QString &text, const QMap<QString, QString> &with)
static QString replaceTokensIn(const QString& text, const QMap<QString, QString>& with)
{
// TODO: does this still work??
QString result;
@@ -506,7 +506,6 @@ static QString replaceTokensIn(const QString &text, const QMap<QString, QString>
return result;
}
QStringList MinecraftInstance::extraArguments()
{
auto list = BaseInstance::extraArguments();
@@ -521,7 +520,7 @@ QStringList MinecraftInstance::extraArguments()
if (!addn.isEmpty()) {
QMap<QString, QString> tokenMapping = makeProfileVarMapping(m_components->getProfile());
for (const QString &item : addn) {
for (const QString& item : addn) {
list.append(replaceTokensIn(item, tokenMapping));
}
}
@@ -764,7 +763,6 @@ QStringList MinecraftInstance::processMinecraftArgs(AuthSessionPtr session, Mine
}
}
QMap<QString, QString> tokenMapping = makeProfileVarMapping(profile);
// yggdrasil!

View File

@@ -55,14 +55,14 @@ LauncherPartLaunch::LauncherPartLaunch(LaunchTask* parent)
if (parent->instance()->settings()->get("CloseAfterLaunch").toBool()) {
static const QRegularExpression s_settingUser(".*Setting user.+", QRegularExpression::CaseInsensitiveOption);
std::shared_ptr<QMetaObject::Connection> connection{ new QMetaObject::Connection };
*connection = connect(&m_process, &LoggedProcess::log, this,
[connection](const QStringList& lines, [[maybe_unused]] MessageLevel level) {
qDebug() << lines;
if (lines.filter(s_settingUser).length() != 0) {
APPLICATION->closeAllWindows();
disconnect(*connection);
}
});
*connection =
connect(&m_process, &LoggedProcess::log, this, [connection](const QStringList& lines, [[maybe_unused]] MessageLevel level) {
qDebug() << lines;
if (lines.filter(s_settingUser).length() != 0) {
APPLICATION->closeAllWindows();
disconnect(*connection);
}
});
}
connect(&m_process, &LoggedProcess::log, this, &LauncherPartLaunch::logLines);

View File

@@ -335,7 +335,7 @@ bool ResourceFolderModel::update()
},
Qt::ConnectionType::QueuedConnection);
Task::Ptr preUpdate{createPreUpdateTask()};
Task::Ptr preUpdate{ createPreUpdateTask() };
if (preUpdate != nullptr) {
auto task = new SequentialTask("ResourceFolderModel::update");

View File

@@ -1,5 +1,5 @@
#include "FileSystem.h"
#include "ShaderPackFolderModel.h"
#include "FileSystem.h"
namespace {
class ShaderPackIndexMigrateTask : public Task {

View File

@@ -25,11 +25,9 @@
namespace ModPlatform {
static const QMap<QString, IndexedVersionType> s_indexed_version_type_names = {
{ "release", IndexedVersionType::Release },
{ "beta", IndexedVersionType::Beta },
{ "alpha", IndexedVersionType::Alpha }
};
static const QMap<QString, IndexedVersionType> s_indexed_version_type_names = { { "release", IndexedVersionType::Release },
{ "beta", IndexedVersionType::Beta },
{ "alpha", IndexedVersionType::Alpha } };
static const QList<ModLoaderType> loaderList = { NeoForge, Forge, Cauldron, LiteLoader, Quilt, Fabric,
Babric, BTA, LegacyFabric, Ornithe, Rift };
@@ -45,11 +43,13 @@ QList<ModLoaderType> modLoaderTypesToList(ModLoaderTypes flags)
return flagList;
}
QString IndexedVersionType::toString() const {
QString IndexedVersionType::toString() const
{
return s_indexed_version_type_names.key(m_type, "unknown");
}
IndexedVersionType IndexedVersionType::fromString(const QString& type) {
IndexedVersionType IndexedVersionType::fromString(const QString& type)
{
return s_indexed_version_type_names.value(type, IndexedVersionType::Unknown);
}

View File

@@ -91,7 +91,6 @@ struct IndexedVersionType {
Enum m_type;
};
struct Dependency {
QVariant addonId;
DependencyType type;
@@ -121,8 +120,7 @@ struct IndexedVersion {
QString getVersionDisplayString() const
{
auto release_type =
version_type.isValid() ? QString(" [%1]").arg(version_type.toString()) : "";
auto release_type = version_type.isValid() ? QString(" [%1]").arg(version_type.toString()) : "";
auto versionStr = !version.contains(version_number) ? version_number : "";
QString gameVersion = "";
for (auto v : mcVersion) {

View File

@@ -156,7 +156,7 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) ->
break;
default:
ver_type = ModPlatform::IndexedVersionType::Unknown;
break;
break;
}
file.version_type = ver_type;

View File

@@ -91,14 +91,14 @@ Modpack parseDirectory(QString path)
modpack.loaderType = ModPlatform::Quilt;
}
}
} else {
} else {
legacyInstanceParsing(path, &modpack.loaderType, &modpack.loaderVersion);
}
} catch (const Exception& e) {
qDebug() << "Couldn't load ftb instance json: " << e.cause();
return {};
}
auto iconFile = QFileInfo(FS::PathCombine(path, "folder.jpg"));
if (iconFile.exists() && iconFile.isFile()) {
modpack.icon = QIcon(iconFile.absoluteFilePath());
@@ -145,12 +145,9 @@ void legacyInstanceParsing(QString path, std::optional<ModPlatform::ModLoaderTyp
break;
}
}
}
catch (const Exception& e)
{
} catch (const Exception& e) {
qDebug() << "Couldn't load ftb version json: " << e.cause();
return;
}
}
} // namespace FTBImportAPP

View File

@@ -19,8 +19,8 @@
#include "settings/OverrideSetting.h"
#include "settings/Setting.h"
#include <QVariant>
#include <QDir>
#include <QVariant>
#include <utility>
#ifdef Q_OS_MACOS
@@ -127,7 +127,8 @@ QString SettingsObject::getPathFromBookmark(const QString& id)
}
// there is no need to use bookmarks if the default value is used or the directory is within the data directory (already can access)
if (setting->get() == setting->defValue() || QDir(setting->get().toString()).absolutePath().startsWith(QDir::current().absolutePath())) {
if (setting->get() == setting->defValue() ||
QDir(setting->get().toString()).absolutePath().startsWith(QDir::current().absolutePath())) {
return setting->get().toString();
}

View File

@@ -251,8 +251,7 @@ void readIndex(const QString& path, QMap<QString, Language>& languages)
Language lang(iter.key());
auto langObj = Json::requireObject(iter.value());
lang.setTranslationStats(langObj["translated"].toInt(), langObj["untranslated"].toInt(),
langObj["fuzzy"].toInt());
lang.setTranslationStats(langObj["translated"].toInt(), langObj["untranslated"].toInt(), langObj["fuzzy"].toInt());
lang.file_name = Json::requireString(langObj, "file");
lang.file_sha1 = Json::requireString(langObj, "sha1");
lang.file_size = Json::requireInteger(langObj, "size");

View File

@@ -19,7 +19,8 @@
#include "ToolTipFilter.h"
bool ToolTipFilter::eventFilter(QObject* obj, QEvent* ev) {
bool ToolTipFilter::eventFilter(QObject* obj, QEvent* ev)
{
if (ev->type() == QEvent::ToolTip) {
return true;
} else {

View File

@@ -18,12 +18,11 @@
#pragma once
#include <qobject.h>
#include <qevent.h>
#include <QEvent>
#include <QObject>
class ToolTipFilter : public QObject
{
class ToolTipFilter : public QObject {
Q_OBJECT
protected:
bool eventFilter(QObject *obj, QEvent *event);
protected:
bool eventFilter(QObject* obj, QEvent* event);
};

View File

@@ -12,8 +12,8 @@ ViewLogWindow::ViewLogWindow(QWidget* parent)
setWindowTitle(tr("View Launcher Logs"));
setCentralWidget(m_page);
setMinimumSize(m_page->size());
setContentsMargins(6, 6, 0, 6); // the "Other Logs" instance page has 6px padding on the right,
// to have equal padding in all directions in the dialog we add it to all other sides.
setContentsMargins(6, 6, 0, 6); // the "Other Logs" instance page has 6px padding on the right,
// to have equal padding in all directions in the dialog we add it to all other sides.
m_page->opened();
show();
}

View File

@@ -23,7 +23,8 @@
#include "ui_ChooseOfflineNameDialog.h"
ChooseOfflineNameDialog::ChooseOfflineNameDialog(const QString& message, QWidget* parent) : QDialog(parent), ui(new Ui::ChooseOfflineNameDialog)
ChooseOfflineNameDialog::ChooseOfflineNameDialog(const QString& message, QWidget* parent)
: QDialog(parent), ui(new Ui::ChooseOfflineNameDialog)
{
ui->setupUi(this);
ui->label->setText(message);

View File

@@ -44,8 +44,8 @@
#include <QDebug>
#include "ui/dialogs/CustomMessageBox.h"
#include "ui/dialogs/ChooseOfflineNameDialog.h"
#include "ui/dialogs/CustomMessageBox.h"
#include "ui/dialogs/MSALoginDialog.h"
#include "Application.h"

View File

@@ -393,9 +393,10 @@ bool NilModFolderPage::shouldDisplay() const
// Helper function so this doesn't need to be duplicated 3 times
inline bool ModFolderPage::handleNoModLoader()
{
int resp = QMessageBox::question(this, this->tr("Missing Mod Loader"),
this->tr("You need to install a compatible mod loader before installing mods. Would you like to do so?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
int resp =
QMessageBox::question(this, this->tr("Missing Mod Loader"),
this->tr("You need to install a compatible mod loader before installing mods. Would you like to do so?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
switch (resp) {
case QMessageBox::Yes: {
// Should be safe
@@ -403,8 +404,8 @@ inline bool ModFolderPage::handleNoModLoader()
InstallLoaderDialog dialog(profile, QString(), this);
bool ret = dialog.exec();
this->m_container->refreshContainer();
// returning negation of dialog.exec which'll be true if the install loader dialog got canceled/closed
// returning negation of dialog.exec which'll be true if the install loader dialog got canceled/closed
// and false if the user went through and installed a loader
return !ret;
}

View File

@@ -193,8 +193,8 @@ void ListModel::performPaginatedSearch()
callbacks.on_succeed = [this](auto& doc) { searchRequestFinished(doc); };
callbacks.on_fail = [this](QString reason, int) { searchRequestFailed(reason); };
callbacks.on_abort = [this] {
qCritical() << "Search task aborted by an unknown reason!";
searchRequestFailed("Aborted");
qCritical() << "Search task aborted by an unknown reason!";
searchRequestFailed("Aborted");
};
auto netJob = api.searchProjects({ ModPlatform::ResourceType::Modpack, m_nextSearchOffset, m_currentSearchTerm, sort, m_filter->loaders,

View File

@@ -163,8 +163,8 @@ void ModpackListModel::performPaginatedSearch()
callbacks.on_succeed = [this](auto& doc) { searchRequestFinished(doc); };
callbacks.on_fail = [this](QString reason, int) { searchRequestFailed(reason); };
callbacks.on_abort = [this] {
qCritical() << "Search task aborted by an unknown reason!";
searchRequestFailed("Aborted");
qCritical() << "Search task aborted by an unknown reason!";
searchRequestFailed("Aborted");
};
auto netJob = api.searchProjects({ ModPlatform::ResourceType::Modpack, m_nextSearchOffset, m_currentSearchTerm, sort, m_filter->loaders,

View File

@@ -207,7 +207,8 @@ void PageContainer::addButtons(QLayout* buttons)
m_layout->addLayout(buttons, 2, 1, 1, 2);
}
void PageContainer::useSidebarStyle(bool sidebar) {
void PageContainer::useSidebarStyle(bool sidebar)
{
m_pageList->setProperty("_kde_side_panel_view", sidebar);
}