format the code (#4717)
This commit is contained in:
@@ -50,8 +50,8 @@
|
|||||||
#include "tools/GenericProfiler.h"
|
#include "tools/GenericProfiler.h"
|
||||||
#include "ui/InstanceWindow.h"
|
#include "ui/InstanceWindow.h"
|
||||||
#include "ui/MainWindow.h"
|
#include "ui/MainWindow.h"
|
||||||
#include "ui/ViewLogWindow.h"
|
|
||||||
#include "ui/ToolTipFilter.h"
|
#include "ui/ToolTipFilter.h"
|
||||||
|
#include "ui/ViewLogWindow.h"
|
||||||
|
|
||||||
#include "ui/dialogs/ProgressDialog.h"
|
#include "ui/dialogs/ProgressDialog.h"
|
||||||
#include "ui/instanceview/AccessibleInstanceView.h"
|
#include "ui/instanceview/AccessibleInstanceView.h"
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ class SecurityBookmarkFileAccess {
|
|||||||
bool m_readOnly;
|
bool m_readOnly;
|
||||||
|
|
||||||
NSURL* securityScopedBookmarkToNSURL(QByteArray& bookmark, bool& isStale);
|
NSURL* securityScopedBookmarkToNSURL(QByteArray& bookmark, bool& isStale);
|
||||||
public:
|
|
||||||
|
public:
|
||||||
/// \param readOnly A boolean indicating whether the bookmark should be read-only.
|
/// \param readOnly A boolean indicating whether the bookmark should be read-only.
|
||||||
SecurityBookmarkFileAccess(bool readOnly = false);
|
SecurityBookmarkFileAccess(bool readOnly = false);
|
||||||
~SecurityBookmarkFileAccess();
|
~SecurityBookmarkFileAccess();
|
||||||
@@ -86,4 +87,4 @@ public:
|
|||||||
bool isAccessingPath(const QString& path);
|
bool isAccessingPath(const QString& path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //FILEACCESS_H
|
#endif // FILEACCESS_H
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ QStringList MinecraftInstance::getNativeJars()
|
|||||||
return nativeJars;
|
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??
|
// TODO: does this still work??
|
||||||
QString result;
|
QString result;
|
||||||
@@ -506,7 +506,6 @@ static QString replaceTokensIn(const QString &text, const QMap<QString, QString>
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList MinecraftInstance::extraArguments()
|
QStringList MinecraftInstance::extraArguments()
|
||||||
{
|
{
|
||||||
auto list = BaseInstance::extraArguments();
|
auto list = BaseInstance::extraArguments();
|
||||||
@@ -521,7 +520,7 @@ QStringList MinecraftInstance::extraArguments()
|
|||||||
if (!addn.isEmpty()) {
|
if (!addn.isEmpty()) {
|
||||||
QMap<QString, QString> tokenMapping = makeProfileVarMapping(m_components->getProfile());
|
QMap<QString, QString> tokenMapping = makeProfileVarMapping(m_components->getProfile());
|
||||||
|
|
||||||
for (const QString &item : addn) {
|
for (const QString& item : addn) {
|
||||||
list.append(replaceTokensIn(item, tokenMapping));
|
list.append(replaceTokensIn(item, tokenMapping));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -764,7 +763,6 @@ QStringList MinecraftInstance::processMinecraftArgs(AuthSessionPtr session, Mine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> tokenMapping = makeProfileVarMapping(profile);
|
QMap<QString, QString> tokenMapping = makeProfileVarMapping(profile);
|
||||||
|
|
||||||
// yggdrasil!
|
// yggdrasil!
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ LauncherPartLaunch::LauncherPartLaunch(LaunchTask* parent)
|
|||||||
if (parent->instance()->settings()->get("CloseAfterLaunch").toBool()) {
|
if (parent->instance()->settings()->get("CloseAfterLaunch").toBool()) {
|
||||||
static const QRegularExpression s_settingUser(".*Setting user.+", QRegularExpression::CaseInsensitiveOption);
|
static const QRegularExpression s_settingUser(".*Setting user.+", QRegularExpression::CaseInsensitiveOption);
|
||||||
std::shared_ptr<QMetaObject::Connection> connection{ new QMetaObject::Connection };
|
std::shared_ptr<QMetaObject::Connection> connection{ new QMetaObject::Connection };
|
||||||
*connection = connect(&m_process, &LoggedProcess::log, this,
|
*connection =
|
||||||
[connection](const QStringList& lines, [[maybe_unused]] MessageLevel level) {
|
connect(&m_process, &LoggedProcess::log, this, [connection](const QStringList& lines, [[maybe_unused]] MessageLevel level) {
|
||||||
qDebug() << lines;
|
qDebug() << lines;
|
||||||
if (lines.filter(s_settingUser).length() != 0) {
|
if (lines.filter(s_settingUser).length() != 0) {
|
||||||
APPLICATION->closeAllWindows();
|
APPLICATION->closeAllWindows();
|
||||||
disconnect(*connection);
|
disconnect(*connection);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(&m_process, &LoggedProcess::log, this, &LauncherPartLaunch::logLines);
|
connect(&m_process, &LoggedProcess::log, this, &LauncherPartLaunch::logLines);
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ bool ResourceFolderModel::update()
|
|||||||
},
|
},
|
||||||
Qt::ConnectionType::QueuedConnection);
|
Qt::ConnectionType::QueuedConnection);
|
||||||
|
|
||||||
Task::Ptr preUpdate{createPreUpdateTask()};
|
Task::Ptr preUpdate{ createPreUpdateTask() };
|
||||||
|
|
||||||
if (preUpdate != nullptr) {
|
if (preUpdate != nullptr) {
|
||||||
auto task = new SequentialTask("ResourceFolderModel::update");
|
auto task = new SequentialTask("ResourceFolderModel::update");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "FileSystem.h"
|
|
||||||
#include "ShaderPackFolderModel.h"
|
#include "ShaderPackFolderModel.h"
|
||||||
|
#include "FileSystem.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class ShaderPackIndexMigrateTask : public Task {
|
class ShaderPackIndexMigrateTask : public Task {
|
||||||
|
|||||||
@@ -25,11 +25,9 @@
|
|||||||
|
|
||||||
namespace ModPlatform {
|
namespace ModPlatform {
|
||||||
|
|
||||||
static const QMap<QString, IndexedVersionType> s_indexed_version_type_names = {
|
static const QMap<QString, IndexedVersionType> s_indexed_version_type_names = { { "release", IndexedVersionType::Release },
|
||||||
{ "release", IndexedVersionType::Release },
|
{ "beta", IndexedVersionType::Beta },
|
||||||
{ "beta", IndexedVersionType::Beta },
|
{ "alpha", IndexedVersionType::Alpha } };
|
||||||
{ "alpha", IndexedVersionType::Alpha }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const QList<ModLoaderType> loaderList = { NeoForge, Forge, Cauldron, LiteLoader, Quilt, Fabric,
|
static const QList<ModLoaderType> loaderList = { NeoForge, Forge, Cauldron, LiteLoader, Quilt, Fabric,
|
||||||
Babric, BTA, LegacyFabric, Ornithe, Rift };
|
Babric, BTA, LegacyFabric, Ornithe, Rift };
|
||||||
@@ -45,11 +43,13 @@ QList<ModLoaderType> modLoaderTypesToList(ModLoaderTypes flags)
|
|||||||
return flagList;
|
return flagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IndexedVersionType::toString() const {
|
QString IndexedVersionType::toString() const
|
||||||
|
{
|
||||||
return s_indexed_version_type_names.key(m_type, "unknown");
|
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);
|
return s_indexed_version_type_names.value(type, IndexedVersionType::Unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ struct IndexedVersionType {
|
|||||||
Enum m_type;
|
Enum m_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Dependency {
|
struct Dependency {
|
||||||
QVariant addonId;
|
QVariant addonId;
|
||||||
DependencyType type;
|
DependencyType type;
|
||||||
@@ -121,8 +120,7 @@ struct IndexedVersion {
|
|||||||
|
|
||||||
QString getVersionDisplayString() const
|
QString getVersionDisplayString() const
|
||||||
{
|
{
|
||||||
auto release_type =
|
auto release_type = version_type.isValid() ? QString(" [%1]").arg(version_type.toString()) : "";
|
||||||
version_type.isValid() ? QString(" [%1]").arg(version_type.toString()) : "";
|
|
||||||
auto versionStr = !version.contains(version_number) ? version_number : "";
|
auto versionStr = !version.contains(version_number) ? version_number : "";
|
||||||
QString gameVersion = "";
|
QString gameVersion = "";
|
||||||
for (auto v : mcVersion) {
|
for (auto v : mcVersion) {
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) ->
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ver_type = ModPlatform::IndexedVersionType::Unknown;
|
ver_type = ModPlatform::IndexedVersionType::Unknown;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
file.version_type = ver_type;
|
file.version_type = ver_type;
|
||||||
|
|
||||||
|
|||||||
@@ -145,12 +145,9 @@ void legacyInstanceParsing(QString path, std::optional<ModPlatform::ModLoaderTyp
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (const Exception& e) {
|
||||||
catch (const Exception& e)
|
|
||||||
{
|
|
||||||
qDebug() << "Couldn't load ftb version json: " << e.cause();
|
qDebug() << "Couldn't load ftb version json: " << e.cause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace FTBImportAPP
|
} // namespace FTBImportAPP
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
#include "settings/OverrideSetting.h"
|
#include "settings/OverrideSetting.h"
|
||||||
#include "settings/Setting.h"
|
#include "settings/Setting.h"
|
||||||
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QVariant>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#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)
|
// 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();
|
return setting->get().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -251,8 +251,7 @@ void readIndex(const QString& path, QMap<QString, Language>& languages)
|
|||||||
Language lang(iter.key());
|
Language lang(iter.key());
|
||||||
|
|
||||||
auto langObj = Json::requireObject(iter.value());
|
auto langObj = Json::requireObject(iter.value());
|
||||||
lang.setTranslationStats(langObj["translated"].toInt(), langObj["untranslated"].toInt(),
|
lang.setTranslationStats(langObj["translated"].toInt(), langObj["untranslated"].toInt(), langObj["fuzzy"].toInt());
|
||||||
langObj["fuzzy"].toInt());
|
|
||||||
lang.file_name = Json::requireString(langObj, "file");
|
lang.file_name = Json::requireString(langObj, "file");
|
||||||
lang.file_sha1 = Json::requireString(langObj, "sha1");
|
lang.file_sha1 = Json::requireString(langObj, "sha1");
|
||||||
lang.file_size = Json::requireInteger(langObj, "size");
|
lang.file_size = Json::requireInteger(langObj, "size");
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
#include "ToolTipFilter.h"
|
#include "ToolTipFilter.h"
|
||||||
|
|
||||||
bool ToolTipFilter::eventFilter(QObject* obj, QEvent* ev) {
|
bool ToolTipFilter::eventFilter(QObject* obj, QEvent* ev)
|
||||||
|
{
|
||||||
if (ev->type() == QEvent::ToolTip) {
|
if (ev->type() == QEvent::ToolTip) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,12 +18,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <QEvent>
|
||||||
#include <qevent.h>
|
#include <QObject>
|
||||||
|
|
||||||
class ToolTipFilter : public QObject
|
class ToolTipFilter : public QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject* obj, QEvent* event);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ ViewLogWindow::ViewLogWindow(QWidget* parent)
|
|||||||
setWindowTitle(tr("View Launcher Logs"));
|
setWindowTitle(tr("View Launcher Logs"));
|
||||||
setCentralWidget(m_page);
|
setCentralWidget(m_page);
|
||||||
setMinimumSize(m_page->size());
|
setMinimumSize(m_page->size());
|
||||||
setContentsMargins(6, 6, 0, 6); // the "Other Logs" instance page has 6px padding on the right,
|
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.
|
// to have equal padding in all directions in the dialog we add it to all other sides.
|
||||||
m_page->opened();
|
m_page->opened();
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
|
|
||||||
#include "ui_ChooseOfflineNameDialog.h"
|
#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->setupUi(this);
|
||||||
ui->label->setText(message);
|
ui->label->setText(message);
|
||||||
|
|||||||
@@ -44,8 +44,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "ui/dialogs/CustomMessageBox.h"
|
|
||||||
#include "ui/dialogs/ChooseOfflineNameDialog.h"
|
#include "ui/dialogs/ChooseOfflineNameDialog.h"
|
||||||
|
#include "ui/dialogs/CustomMessageBox.h"
|
||||||
#include "ui/dialogs/MSALoginDialog.h"
|
#include "ui/dialogs/MSALoginDialog.h"
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|||||||
@@ -393,9 +393,10 @@ bool NilModFolderPage::shouldDisplay() const
|
|||||||
// Helper function so this doesn't need to be duplicated 3 times
|
// Helper function so this doesn't need to be duplicated 3 times
|
||||||
inline bool ModFolderPage::handleNoModLoader()
|
inline bool ModFolderPage::handleNoModLoader()
|
||||||
{
|
{
|
||||||
int resp = QMessageBox::question(this, this->tr("Missing Mod Loader"),
|
int resp =
|
||||||
this->tr("You need to install a compatible mod loader before installing mods. Would you like to do so?"),
|
QMessageBox::question(this, this->tr("Missing Mod Loader"),
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
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) {
|
switch (resp) {
|
||||||
case QMessageBox::Yes: {
|
case QMessageBox::Yes: {
|
||||||
// Should be safe
|
// Should be safe
|
||||||
|
|||||||
@@ -193,8 +193,8 @@ void ListModel::performPaginatedSearch()
|
|||||||
callbacks.on_succeed = [this](auto& doc) { searchRequestFinished(doc); };
|
callbacks.on_succeed = [this](auto& doc) { searchRequestFinished(doc); };
|
||||||
callbacks.on_fail = [this](QString reason, int) { searchRequestFailed(reason); };
|
callbacks.on_fail = [this](QString reason, int) { searchRequestFailed(reason); };
|
||||||
callbacks.on_abort = [this] {
|
callbacks.on_abort = [this] {
|
||||||
qCritical() << "Search task aborted by an unknown reason!";
|
qCritical() << "Search task aborted by an unknown reason!";
|
||||||
searchRequestFailed("Aborted");
|
searchRequestFailed("Aborted");
|
||||||
};
|
};
|
||||||
|
|
||||||
auto netJob = api.searchProjects({ ModPlatform::ResourceType::Modpack, m_nextSearchOffset, m_currentSearchTerm, sort, m_filter->loaders,
|
auto netJob = api.searchProjects({ ModPlatform::ResourceType::Modpack, m_nextSearchOffset, m_currentSearchTerm, sort, m_filter->loaders,
|
||||||
|
|||||||
@@ -163,8 +163,8 @@ void ModpackListModel::performPaginatedSearch()
|
|||||||
callbacks.on_succeed = [this](auto& doc) { searchRequestFinished(doc); };
|
callbacks.on_succeed = [this](auto& doc) { searchRequestFinished(doc); };
|
||||||
callbacks.on_fail = [this](QString reason, int) { searchRequestFailed(reason); };
|
callbacks.on_fail = [this](QString reason, int) { searchRequestFailed(reason); };
|
||||||
callbacks.on_abort = [this] {
|
callbacks.on_abort = [this] {
|
||||||
qCritical() << "Search task aborted by an unknown reason!";
|
qCritical() << "Search task aborted by an unknown reason!";
|
||||||
searchRequestFailed("Aborted");
|
searchRequestFailed("Aborted");
|
||||||
};
|
};
|
||||||
|
|
||||||
auto netJob = api.searchProjects({ ModPlatform::ResourceType::Modpack, m_nextSearchOffset, m_currentSearchTerm, sort, m_filter->loaders,
|
auto netJob = api.searchProjects({ ModPlatform::ResourceType::Modpack, m_nextSearchOffset, m_currentSearchTerm, sort, m_filter->loaders,
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ void PageContainer::addButtons(QLayout* buttons)
|
|||||||
m_layout->addLayout(buttons, 2, 1, 1, 2);
|
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);
|
m_pageList->setProperty("_kde_side_panel_view", sidebar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user