Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into concurrent
This commit is contained in:
commit
04acd27dab
4
.clang-tidy
Normal file
4
.clang-tidy
Normal file
@ -0,0 +1,4 @@
|
||||
Checks:
|
||||
- modernize-use-using
|
||||
|
||||
SystemHeaders: false
|
@ -388,7 +388,7 @@ QString BaseInstance::name() const
|
||||
|
||||
QString BaseInstance::windowTitle() const
|
||||
{
|
||||
return BuildConfig.LAUNCHER_DISPLAYNAME + ": " + name().replace(QRegularExpression("\\s+"), " ");
|
||||
return BuildConfig.LAUNCHER_DISPLAYNAME + ": " + name();
|
||||
}
|
||||
|
||||
// FIXME: why is this here? move it to MinecraftInstance!!!
|
||||
|
@ -64,7 +64,7 @@ class LaunchTask;
|
||||
class BaseInstance;
|
||||
|
||||
// pointer for lazy people
|
||||
typedef std::shared_ptr<BaseInstance> InstancePtr;
|
||||
using InstancePtr = std::shared_ptr<BaseInstance>;
|
||||
|
||||
/*!
|
||||
* \brief Base class for instances.
|
||||
|
@ -51,7 +51,7 @@ class BaseVersionList : public QAbstractListModel {
|
||||
ArchitectureRole,
|
||||
SortRole
|
||||
};
|
||||
typedef QList<int> RoleList;
|
||||
using RoleList = QList<int>;
|
||||
|
||||
explicit BaseVersionList(QObject* parent = 0);
|
||||
|
||||
|
@ -123,26 +123,35 @@ namespace fs = ghc::filesystem;
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
|
||||
typedef struct _DUPLICATE_EXTENTS_DATA {
|
||||
struct _DUPLICATE_EXTENTS_DATA {
|
||||
HANDLE FileHandle;
|
||||
LARGE_INTEGER SourceFileOffset;
|
||||
LARGE_INTEGER TargetFileOffset;
|
||||
LARGE_INTEGER ByteCount;
|
||||
} DUPLICATE_EXTENTS_DATA, *PDUPLICATE_EXTENTS_DATA;
|
||||
};
|
||||
|
||||
typedef struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER {
|
||||
using DUPLICATE_EXTENTS_DATA = _DUPLICATE_EXTENTS_DATA;
|
||||
using PDUPLICATE_EXTENTS_DATA = _DUPLICATE_EXTENTS_DATA*;
|
||||
|
||||
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER {
|
||||
WORD ChecksumAlgorithm; // Checksum algorithm. e.g. CHECKSUM_TYPE_UNCHANGED, CHECKSUM_TYPE_NONE, CHECKSUM_TYPE_CRC32
|
||||
WORD Reserved; // Must be 0
|
||||
DWORD Flags; // FSCTL_INTEGRITY_FLAG_xxx
|
||||
DWORD ChecksumChunkSizeInBytes;
|
||||
DWORD ClusterSizeInBytes;
|
||||
} FSCTL_GET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER;
|
||||
};
|
||||
|
||||
typedef struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER {
|
||||
using FSCTL_GET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER;
|
||||
using PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER*;
|
||||
|
||||
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER {
|
||||
WORD ChecksumAlgorithm; // Checksum algorithm. e.g. CHECKSUM_TYPE_UNCHANGED, CHECKSUM_TYPE_NONE, CHECKSUM_TYPE_CRC32
|
||||
WORD Reserved; // Must be 0
|
||||
DWORD Flags; // FSCTL_INTEGRITY_FLAG_xxx
|
||||
} FSCTL_SET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER;
|
||||
};
|
||||
|
||||
using FSCTL_SET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER;
|
||||
using PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER*;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -172,7 +172,7 @@ class ExportToZipTask : public Task {
|
||||
void setExcludeFiles(QStringList excludeFiles) { m_exclude_files = excludeFiles; }
|
||||
void addExtraFile(QString fileName, QByteArray data) { m_extra_files.insert(fileName, data); }
|
||||
|
||||
typedef std::optional<QString> ZipResult;
|
||||
using ZipResult = std::optional<QString>;
|
||||
|
||||
protected:
|
||||
virtual void executeTask() override;
|
||||
|
@ -10,7 +10,7 @@ class VersionProxyModel : public QAbstractProxyModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Column { Name, ParentVersion, Branch, Type, Architecture, Path, Time };
|
||||
typedef QHash<BaseVersionList::ModelRoles, std::shared_ptr<Filter>> FilterMap;
|
||||
using FilterMap = QHash<BaseVersionList::ModelRoles, std::shared_ptr<Filter>>;
|
||||
|
||||
public:
|
||||
VersionProxyModel(QObject* parent = 0);
|
||||
|
@ -22,8 +22,8 @@ struct JavaCheckResult {
|
||||
enum class Validity { Errored, ReturnedInvalidData, Valid } validity = Validity::Errored;
|
||||
};
|
||||
|
||||
typedef shared_qobject_ptr<QProcess> QProcessPtr;
|
||||
typedef shared_qobject_ptr<JavaChecker> JavaCheckerPtr;
|
||||
using QProcessPtr = shared_qobject_ptr<QProcess>;
|
||||
using JavaCheckerPtr = shared_qobject_ptr<JavaChecker>;
|
||||
class JavaChecker : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "tasks/Task.h"
|
||||
|
||||
class JavaCheckerJob;
|
||||
typedef shared_qobject_ptr<JavaCheckerJob> JavaCheckerJobPtr;
|
||||
using JavaCheckerJobPtr = shared_qobject_ptr<JavaCheckerJob>;
|
||||
|
||||
// FIXME: this just seems horribly redundant
|
||||
class JavaCheckerJob : public Task {
|
||||
|
@ -42,4 +42,4 @@ struct JavaInstall : public BaseVersion {
|
||||
bool recommended = false;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<JavaInstall> JavaInstallPtr;
|
||||
using JavaInstallPtr = std::shared_ptr<JavaInstall>;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
class Agent;
|
||||
|
||||
typedef std::shared_ptr<Agent> AgentPtr;
|
||||
using AgentPtr = std::shared_ptr<Agent>;
|
||||
|
||||
class Agent {
|
||||
public:
|
||||
|
@ -105,4 +105,4 @@ class Component : public QObject, public ProblemProvider {
|
||||
bool m_loaded = false;
|
||||
};
|
||||
|
||||
typedef shared_qobject_ptr<Component> ComponentPtr;
|
||||
using ComponentPtr = shared_qobject_ptr<Component>;
|
||||
|
@ -52,7 +52,7 @@
|
||||
class Library;
|
||||
class MinecraftInstance;
|
||||
|
||||
typedef std::shared_ptr<Library> LibraryPtr;
|
||||
using LibraryPtr = std::shared_ptr<Library>;
|
||||
|
||||
class Library {
|
||||
friend class OneSixVersionFormat;
|
||||
|
@ -710,7 +710,7 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
|
||||
{
|
||||
QString windowParams;
|
||||
if (settings()->get("LaunchMaximized").toBool())
|
||||
windowParams = "max";
|
||||
windowParams = "maximized";
|
||||
else
|
||||
windowParams =
|
||||
QString("%1x%2").arg(settings()->get("MinecraftWinWidth").toInt()).arg(settings()->get("MinecraftWinHeight").toInt());
|
||||
@ -718,6 +718,19 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
|
||||
launchScript += "windowParams " + windowParams + "\n";
|
||||
}
|
||||
|
||||
// launcher info
|
||||
{
|
||||
launchScript += "launcherBrand " + BuildConfig.LAUNCHER_NAME + "\n";
|
||||
launchScript += "launcherVersion " + BuildConfig.printableVersionString() + "\n";
|
||||
}
|
||||
|
||||
// instance info
|
||||
{
|
||||
launchScript += "instanceName " + name() + "\n";
|
||||
launchScript += "instanceIconKey " + name() + "\n";
|
||||
launchScript += "instanceIconPath icon.png\n"; // we already save a copy here
|
||||
}
|
||||
|
||||
// legacy auth
|
||||
if (session) {
|
||||
launchScript += "userName " + session->player_name + "\n";
|
||||
|
@ -174,4 +174,4 @@ class MinecraftInstance : public BaseInstance {
|
||||
mutable std::shared_ptr<GameOptions> m_game_options;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<MinecraftInstance> MinecraftInstancePtr;
|
||||
using MinecraftInstancePtr = std::shared_ptr<MinecraftInstance>;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
struct MojangDownloadInfo {
|
||||
// types
|
||||
typedef std::shared_ptr<MojangDownloadInfo> Ptr;
|
||||
using Ptr = std::shared_ptr<MojangDownloadInfo>;
|
||||
|
||||
// data
|
||||
/// Local filesystem path. WARNING: not used, only here so we can pass through mojang files unmolested!
|
||||
@ -23,7 +23,7 @@ struct MojangLibraryDownloadInfo {
|
||||
MojangLibraryDownloadInfo() {}
|
||||
|
||||
// types
|
||||
typedef std::shared_ptr<MojangLibraryDownloadInfo> Ptr;
|
||||
using Ptr = std::shared_ptr<MojangLibraryDownloadInfo>;
|
||||
|
||||
// methods
|
||||
MojangDownloadInfo* getDownloadInfo(QString classifier)
|
||||
@ -42,7 +42,7 @@ struct MojangLibraryDownloadInfo {
|
||||
|
||||
struct MojangAssetIndexInfo : public MojangDownloadInfo {
|
||||
// types
|
||||
typedef std::shared_ptr<MojangAssetIndexInfo> Ptr;
|
||||
using Ptr = std::shared_ptr<MojangAssetIndexInfo>;
|
||||
|
||||
// methods
|
||||
MojangAssetIndexInfo() {}
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "VersionFile.h"
|
||||
|
||||
namespace ProfileUtils {
|
||||
typedef QStringList PatchOrder;
|
||||
using PatchOrder = QStringList;
|
||||
|
||||
/// Read and parse a OneSix format order file
|
||||
bool readOverrideOrders(QString path, PatchOrder& order);
|
||||
|
@ -43,4 +43,4 @@ struct AuthSession {
|
||||
bool demo = false;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<AuthSession> AuthSessionPtr;
|
||||
using AuthSessionPtr = std::shared_ptr<AuthSession>;
|
||||
|
@ -54,7 +54,7 @@ class Task;
|
||||
class AccountTask;
|
||||
class MinecraftAccount;
|
||||
|
||||
typedef shared_qobject_ptr<MinecraftAccount> MinecraftAccountPtr;
|
||||
using MinecraftAccountPtr = shared_qobject_ptr<MinecraftAccount>;
|
||||
Q_DECLARE_METATYPE(MinecraftAccountPtr)
|
||||
|
||||
/**
|
||||
|
@ -26,4 +26,4 @@ struct MinecraftServerTarget {
|
||||
static MinecraftServerTarget parse(const QString& fullAddress);
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<MinecraftServerTarget> MinecraftServerTargetPtr;
|
||||
using MinecraftServerTargetPtr = std::shared_ptr<MinecraftServerTarget>;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QtNetwork/QtNetwork>
|
||||
#include "tasks/Task.h"
|
||||
|
||||
typedef shared_qobject_ptr<class SkinDelete> SkinDeletePtr;
|
||||
using SkinDeletePtr = shared_qobject_ptr<class SkinDelete>;
|
||||
|
||||
class SkinDelete : public Task {
|
||||
Q_OBJECT
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <memory>
|
||||
#include "tasks/Task.h"
|
||||
|
||||
typedef shared_qobject_ptr<class SkinUpload> SkinUploadPtr;
|
||||
using SkinUploadPtr = shared_qobject_ptr<class SkinUpload>;
|
||||
|
||||
class SkinUpload : public Task {
|
||||
Q_OBJECT
|
||||
|
@ -45,7 +45,7 @@ struct Modpack {
|
||||
QIcon icon;
|
||||
};
|
||||
|
||||
typedef QList<Modpack> ModpackList;
|
||||
using ModpackList = QList<Modpack>;
|
||||
|
||||
Modpack parseDirectory(QString path);
|
||||
|
||||
|
@ -31,7 +31,7 @@ struct Modpack {
|
||||
QString packCode;
|
||||
};
|
||||
|
||||
typedef QList<Modpack> ModpackList;
|
||||
using ModpackList = QList<Modpack>;
|
||||
|
||||
} // namespace LegacyFTB
|
||||
|
||||
|
@ -87,7 +87,7 @@ class NetRequest : public NetAction {
|
||||
std::unique_ptr<Sink> m_sink;
|
||||
Options m_options;
|
||||
|
||||
typedef const QLoggingCategory& (*logCatFunc)();
|
||||
using logCatFunc = const QLoggingCategory& (*)();
|
||||
logCatFunc logCat = taskUploadLogC;
|
||||
|
||||
std::chrono::steady_clock m_clock;
|
||||
|
@ -51,4 +51,4 @@ class NewsEntry : public QObject {
|
||||
QString link;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<NewsEntry> NewsEntryPtr;
|
||||
using NewsEntryPtr = std::shared_ptr<NewsEntry>;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class IPathMatcher {
|
||||
public:
|
||||
typedef std::shared_ptr<IPathMatcher> Ptr;
|
||||
using Ptr = std::shared_ptr<IPathMatcher>;
|
||||
|
||||
public:
|
||||
virtual ~IPathMatcher() {}
|
||||
|
@ -26,8 +26,8 @@
|
||||
class Setting;
|
||||
class SettingsObject;
|
||||
|
||||
typedef std::shared_ptr<SettingsObject> SettingsObjectPtr;
|
||||
typedef std::weak_ptr<SettingsObject> SettingsObjectWeakPtr;
|
||||
using SettingsObjectPtr = std::shared_ptr<SettingsObject>;
|
||||
using SettingsObjectWeakPtr = std::weak_ptr<SettingsObject>;
|
||||
|
||||
/*!
|
||||
* \brief The SettingsObject handles communicating settings between the application and a
|
||||
|
@ -77,7 +77,7 @@ struct TaskStepProgress {
|
||||
|
||||
Q_DECLARE_METATYPE(TaskStepProgress)
|
||||
|
||||
typedef QList<std::shared_ptr<TaskStepProgress>> TaskStepProgressList;
|
||||
using TaskStepProgressList = QList<std::shared_ptr<TaskStepProgress>>;
|
||||
|
||||
class Task : public QObject, public QRunnable {
|
||||
Q_OBJECT
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "FileIgnoreProxy.h"
|
||||
|
||||
class BaseInstance;
|
||||
typedef std::shared_ptr<BaseInstance> InstancePtr;
|
||||
using InstancePtr = std::shared_ptr<BaseInstance>;
|
||||
|
||||
namespace Ui {
|
||||
class ExportInstanceDialog;
|
||||
|
@ -59,7 +59,7 @@ class AccessibleInstanceView : public QAccessibleTableInterface, public QAccessi
|
||||
|
||||
protected:
|
||||
// maybe vector
|
||||
typedef QHash<int, QAccessible::Id> ChildCache;
|
||||
using ChildCache = QHash<int, QAccessible::Id>;
|
||||
mutable ChildCache childToId;
|
||||
|
||||
virtual ~AccessibleInstanceView();
|
||||
|
@ -77,4 +77,4 @@ class BasePage {
|
||||
bool isOpened = false;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<BasePage> BasePagePtr;
|
||||
using BasePagePtr = std::shared_ptr<BasePage>;
|
||||
|
@ -26,7 +26,7 @@ class BasePageProvider {
|
||||
};
|
||||
|
||||
class GenericPageProvider : public BasePageProvider {
|
||||
typedef std::function<BasePage*()> PageCreator;
|
||||
using PageCreator = std::function<BasePage*()>;
|
||||
|
||||
public:
|
||||
explicit GenericPageProvider(const QString& dialogTitle) : m_dialogTitle(dialogTitle) {}
|
||||
|
@ -68,8 +68,8 @@
|
||||
#include <FileSystem.h>
|
||||
#include "RWStorage.h"
|
||||
|
||||
typedef RWStorage<QString, QIcon> SharedIconCache;
|
||||
typedef std::shared_ptr<SharedIconCache> SharedIconCachePtr;
|
||||
using SharedIconCache = RWStorage<QString, QIcon>;
|
||||
using SharedIconCachePtr = std::shared_ptr<SharedIconCache>;
|
||||
|
||||
class ThumbnailingResult : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
namespace Atl {
|
||||
|
||||
typedef QMap<QString, QIcon> LogoMap;
|
||||
typedef std::function<void(QString)> LogoCallback;
|
||||
using LogoMap = QMap<QString, QIcon>;
|
||||
using LogoCallback = std::function<void(QString)>;
|
||||
|
||||
class ListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
namespace Flame {
|
||||
|
||||
typedef QMap<QString, QIcon> LogoMap;
|
||||
typedef std::function<void(QString)> LogoCallback;
|
||||
using LogoMap = QMap<QString, QIcon>;
|
||||
using LogoCallback = std::function<void(QString)>;
|
||||
|
||||
class ListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
namespace LegacyFTB {
|
||||
|
||||
typedef QMap<QString, QIcon> FTBLogoMap;
|
||||
typedef std::function<void(QString)> LogoCallback;
|
||||
using FTBLogoMap = QMap<QString, QIcon>;
|
||||
using LogoCallback = std::function<void(QString)>;
|
||||
|
||||
class FilterModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
namespace Technic {
|
||||
|
||||
typedef std::function<void(QString)> LogoCallback;
|
||||
using LogoCallback = std::function<void(QString)>;
|
||||
|
||||
class ListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
|
@ -64,8 +64,7 @@ bool JavaWizardPage::validatePage()
|
||||
}
|
||||
case JavaSettingsWidget::ValidationStatus::AllOK: {
|
||||
settings->set("JavaPath", m_java_widget->javaPath());
|
||||
return true;
|
||||
}
|
||||
} /* fallthrough */
|
||||
case JavaSettingsWidget::ValidationStatus::JavaBad: {
|
||||
// Memory
|
||||
auto s = APPLICATION->settings();
|
||||
|
2
libraries/.clang-tidy
Normal file
2
libraries/.clang-tidy
Normal file
@ -0,0 +1,2 @@
|
||||
# We don't care about linting third-party code.
|
||||
Checks: -*
|
@ -105,13 +105,16 @@ public final class EntryPoint {
|
||||
return ExitCode.ABORT;
|
||||
}
|
||||
|
||||
setProperties(params);
|
||||
|
||||
String launcherType = params.getString("launcher");
|
||||
|
||||
try {
|
||||
LegacyProxy.applyOnlineFixes(params);
|
||||
|
||||
Launcher launcher;
|
||||
String type = params.getString("launcher");
|
||||
|
||||
switch (type) {
|
||||
switch (launcherType) {
|
||||
case "standard":
|
||||
launcher = new StandardLauncher(params);
|
||||
break;
|
||||
@ -121,7 +124,7 @@ public final class EntryPoint {
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid launcher type: " + type);
|
||||
throw new IllegalArgumentException("Invalid launcher type: " + launcherType);
|
||||
}
|
||||
|
||||
launcher.launch();
|
||||
@ -138,6 +141,39 @@ public final class EntryPoint {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setProperties(Parameters params) {
|
||||
String launcherBrand = params.getString("launcherBrand", null);
|
||||
String launcherVersion = params.getString("launcherVersion", null);
|
||||
String name = params.getString("instanceName", null);
|
||||
String iconId = params.getString("instanceIconKey", null);
|
||||
String iconPath = params.getString("instanceIconPath", null);
|
||||
String windowTitle = params.getString("windowTitle", null);
|
||||
String windowDimensions = params.getString("windowParams", null);
|
||||
|
||||
if (launcherBrand != null)
|
||||
System.setProperty("minecraft.launcher.brand", launcherBrand);
|
||||
if (launcherVersion != null)
|
||||
System.setProperty("minecraft.launcher.version", launcherVersion);
|
||||
|
||||
// set useful properties for mods
|
||||
if (name != null)
|
||||
System.setProperty("org.prismlauncher.instance.name", name);
|
||||
if (iconId != null)
|
||||
System.setProperty("org.prismlauncher.instance.icon.id", iconId);
|
||||
if (iconPath != null)
|
||||
System.setProperty("org.prismlauncher.instance.icon.path", iconPath);
|
||||
if (windowTitle != null)
|
||||
System.setProperty("org.prismlauncher.window.title", windowTitle);
|
||||
if (windowDimensions != null)
|
||||
System.setProperty("org.prismlauncher.window.dimensions", windowDimensions);
|
||||
|
||||
// set multimc properties for compatibility
|
||||
if (name != null)
|
||||
System.setProperty("multimc.instance.title", name);
|
||||
if (iconId != null)
|
||||
System.setProperty("multimc.instance.icon", iconId);
|
||||
}
|
||||
|
||||
private static PreLaunchAction parseLine(String input, Parameters params) throws ParseException {
|
||||
switch (input) {
|
||||
case "":
|
||||
|
@ -83,7 +83,7 @@ public abstract class AbstractLauncher implements Launcher {
|
||||
|
||||
String windowParams = params.getString("windowParams", null);
|
||||
|
||||
if ("max".equals(windowParams) || windowParams == null) {
|
||||
if ("maximized".equals(windowParams) || windowParams == null) {
|
||||
maximize = windowParams != null;
|
||||
|
||||
width = DEFAULT_WINDOW_WIDTH;
|
||||
|
Loading…
Reference in New Issue
Block a user