From 0ba2c09787dbe3b852546dd24b437b832d575e4a Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:10:04 -0700 Subject: [PATCH] refactor(Application.h): reduce include chain Include only what's absolutely necessary to reduce headers pulled into a translation unit. If you need access to instance's from `APPLICATION` include `BaseInstance.h` separately Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/Application.h | 17 +++++++++++++---- launcher/include/base.pch.hpp | 1 + launcher/include/qtcore.pch.hpp | 6 ++++++ launcher/minecraft/ShortcutUtils.h | 1 + launcher/minecraft/auth/AuthFlow.h | 1 - launcher/minecraft/auth/AuthStep.h | 1 - 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/launcher/Application.h b/launcher/Application.h index 041e5b892..1ffc6e153 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -37,6 +37,8 @@ #pragma once +#include + #include #include #include @@ -44,12 +46,12 @@ #include #include #include -#include -#include +#include "QObjectPtr.h" #include "launch/LogModel.h" -#include "minecraft/launch/MinecraftTarget.h" +#include "minecraft/auth/MinecraftAccount.h" +#include "settings/SettingsObject.h" class LaunchController; class LocalPeer; @@ -74,6 +76,13 @@ class ITheme; class MCEditTool; class ThemeManager; class IconTheme; +class BaseInstance; + +struct MinecraftTarget; + +// pointers for lazy people +using InstancePtr = std::shared_ptr; +using MinecraftTargetPtr = std::shared_ptr; namespace Meta { class Index; @@ -212,7 +221,7 @@ class Application : public QApplication { bool launch(BaseInstance* instance, bool online = true, bool demo = false, - MinecraftTarget::Ptr targetToJoin = nullptr, + MinecraftTargetPtr targetToJoin = nullptr, MinecraftAccountPtr accountToUse = nullptr, const QString& offlineName = QString()); bool kill(BaseInstance* instance); diff --git a/launcher/include/base.pch.hpp b/launcher/include/base.pch.hpp index 989d1eeec..ecaf41fdd 100644 --- a/launcher/include/base.pch.hpp +++ b/launcher/include/base.pch.hpp @@ -3,6 +3,7 @@ #define PRISM_PRECOMPILED_BASE_HEADERS_H #include +#include #include #include #include diff --git a/launcher/include/qtcore.pch.hpp b/launcher/include/qtcore.pch.hpp index d7c24ddb6..b8836618a 100644 --- a/launcher/include/qtcore.pch.hpp +++ b/launcher/include/qtcore.pch.hpp @@ -5,9 +5,15 @@ #include #include #include + +#include +#include + #include +#include #include +#include #include diff --git a/launcher/minecraft/ShortcutUtils.h b/launcher/minecraft/ShortcutUtils.h index b995c36bd..5cf31f9b2 100644 --- a/launcher/minecraft/ShortcutUtils.h +++ b/launcher/minecraft/ShortcutUtils.h @@ -37,6 +37,7 @@ #pragma once #include "Application.h" +#include "BaseInstance.h" #include #include diff --git a/launcher/minecraft/auth/AuthFlow.h b/launcher/minecraft/auth/AuthFlow.h index 710509d8e..d881a7691 100644 --- a/launcher/minecraft/auth/AuthFlow.h +++ b/launcher/minecraft/auth/AuthFlow.h @@ -2,7 +2,6 @@ #include #include -#include #include #include diff --git a/launcher/minecraft/auth/AuthStep.h b/launcher/minecraft/auth/AuthStep.h index aaaec6e7f..f8131509f 100644 --- a/launcher/minecraft/auth/AuthStep.h +++ b/launcher/minecraft/auth/AuthStep.h @@ -1,6 +1,5 @@ #pragma once #include -#include #include #include "QObjectPtr.h"