diff --git a/CHANGELOG.md b/CHANGELOG.md index 709db721f..d6ec9c0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# MeshMC 12.0.0 (DRAFT) + +## Changed + +* The complexity in the build system has been reduced. + # MeshMC 11.0.0 (DRAFT) ## Highlights diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 8b8591c88..d557c683b 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -6,108 +6,6 @@ project(application) include (UnitTest) -set(CORE_SOURCES - # LOGIC - Base classes and infrastructure - BaseInstaller.h - BaseInstaller.cpp - BaseVersionList.h - BaseVersionList.cpp - InstanceList.h - InstanceList.cpp - InstanceTask.h - InstanceTask.cpp - LoggedProcess.h - LoggedProcess.cpp - Logging.h - Logging.cpp - MessageLevel.cpp - MessageLevel.h - BaseVersion.h - BaseInstance.h - BaseInstance.cpp - Sys.cpp - Sys.h - NullInstance.h - QtCompat.h - ArchiveOpen.h - MMCZip.h - MMCZip.cpp - MMCStrings.h - MMCStrings.cpp - - # The long-running halves of MMCZip, as tasks: an archive big enough to - # need a progress bar is an archive big enough to need a way out, and - # neither is possible from inside a single blocking call. - archive/ExportToZipTask.h - archive/ExportToZipTask.cpp - archive/ExtractZipTask.h - archive/ExtractZipTask.cpp - - # Basic instance manipulation tasks (derived from InstanceTask) - InstanceCreationTask.h - InstanceCreationTask.cpp - InstanceCopyTask.h - InstanceCopyTask.cpp - InstanceImportTask.h - InstanceImportTask.cpp - - # Use tracking separate from memory management - Usable.h - - # Prefix tree where node names are strings between separators - SeparatorPrefixTree.h - - # The checkable file tree the export dialogs are built around, and the - # icon provider that keeps pointing it at an entire instance directory - # from costing a per-file platform lookup. - FileIgnoreProxy.h - FileIgnoreProxy.cpp - FastFileIconProvider.h - FastFileIconProvider.cpp - - # String filters - Filter.h - Filter.cpp - - # JSON parsing helpers - Json.h - Json.cpp - - FileSystem.h - FileSystem.cpp - - Exception.h - - # RW lock protected map - RWStorage.h - - # A variable that has an implicit default value and keeps track of changes - DefaultVariable.h - - # a smart pointer wrapper intended for safer use with Qt signal/slot mechanisms - QObjectPtr.h - - # Compression support - GZip.h - GZip.cpp - - # Command line parameter parsing - Commandline.h - Commandline.cpp - - # Version number string support - Version.h - Version.cpp - - # A Recursive file system watcher - RecursiveFileSystemWatcher.h - RecursiveFileSystemWatcher.cpp - - # Time - MMCTime.h - MMCTime.cpp -) - add_unit_test(FileSystem SOURCES FileSystem_test.cpp LIBS MeshMC_logic @@ -124,68 +22,6 @@ add_unit_test(MMCZip LIBS MeshMC_logic ) -set(PATHMATCHER_SOURCES - # Path matchers - pathmatcher/FSTreeMatcher.h - pathmatcher/IPathMatcher.h - pathmatcher/MultiMatcher.h - pathmatcher/RegexpMatcher.h -) - -set(NET_SOURCES - # network stuffs - net/ByteArraySink.h - net/ChecksumValidator.h - net/Download.cpp - net/Download.h - net/FileSink.cpp - net/FileSink.h - net/HttpMetaCache.cpp - net/HttpMetaCache.h - net/MetaCacheSink.cpp - net/MetaCacheSink.h - net/NetAction.h - net/NetJob.cpp - net/NetJob.h - # The one API question that does not fit in a URL, and so cannot be a - # Net::Download. See net/JsonPost.h. - net/JsonPost.cpp - net/JsonPost.h - net/PasteUpload.cpp - net/PasteUpload.h - net/Sink.h - net/Validator.h -) - -add_unit_test(FileSink - SOURCES net/FileSink_test.cpp - LIBS MeshMC_logic - ) - -# Game launch logic -set(LAUNCH_SOURCES - launch/steps/CheckJava.cpp - launch/steps/CheckJava.h - launch/steps/CreateBackup.cpp - launch/steps/CreateBackup.h - launch/steps/LookupServerAddress.cpp - launch/steps/LookupServerAddress.h - launch/steps/PostLaunchCommand.cpp - launch/steps/PostLaunchCommand.h - launch/steps/PreLaunchCommand.cpp - launch/steps/PreLaunchCommand.h - launch/steps/TextPrint.cpp - launch/steps/TextPrint.h - launch/steps/Update.cpp - launch/steps/Update.h - launch/LaunchStep.cpp - launch/LaunchStep.h - launch/LaunchTask.cpp - launch/LaunchTask.h - launch/LogModel.cpp - launch/LogModel.h -) - # macOS updates go through Sparkle, which replaces the whole signed .app # bundle. Sparkle is not packaged in vcpkg, so the upstream release archive is # fetched and hash-checked here. @@ -214,235 +50,6 @@ if(APPLE AND NOT "${MACOSX_SPARKLE_UPDATE_PUBLIC_KEY}" STREQUAL "" AND NOT "${MA endif() endif() -# Updater, launcher side. -# -# The launcher never checks for updates itself: it drives the standalone -# meshmc-updater executable (built below) so that there is exactly one -# implementation of "which release applies to this install". macOS is the -# exception -- there Sparkle replaces the whole .app bundle, signature check -# included, and reimplementing that would mean reimplementing code signing. -set(UPDATE_SOURCES - updater/ExternalUpdater.h - updater/UpdateLockFile.h - updater/UpdateLockFile.cpp -) - -if(APPLE) - if(MeshMC_SPARKLE_ENABLED) - list(APPEND UPDATE_SOURCES - updater/MacSparkleUpdater.h - updater/MacSparkleUpdater.mm - ) - endif() -else() - list(APPEND UPDATE_SOURCES - updater/MeshMCExternalUpdater.h - updater/MeshMCExternalUpdater.cpp - ) -endif() - -# Rarely used notifications -set(NOTIFICATIONS_SOURCES - # Notifications - short warning messages - notifications/NotificationChecker.h - notifications/NotificationChecker.cpp -) - -# Backend for the news bar... there's usually no news. -set(NEWS_SOURCES - # News System - news/NewsChecker.h - news/NewsChecker.cpp - news/NewsEntry.h - news/NewsEntry.cpp -) - -# Instance backup snapshots (was the BackupSystem .mmco plugin) -set(BACKUP_SOURCES - backup/BackupManager.h - backup/BackupManager.cpp - backup/BackupTask.h - backup/BackupTask.cpp -) - -# Icon interface -set(ICONS_SOURCES - # Icons System and related code - icons/IconUtils.h - icons/IconUtils.cpp -) - -# Support for Minecraft instances and launch -set(MINECRAFT_SOURCES - # Minecraft support - minecraft/auth/AccountData.cpp - minecraft/auth/AccountData.h - minecraft/auth/AccountList.cpp - minecraft/auth/AccountList.h - minecraft/auth/AccountTask.cpp - minecraft/auth/AccountTask.h - minecraft/auth/AuthRequest.cpp - minecraft/auth/AuthRequest.h - minecraft/auth/AuthSession.cpp - minecraft/auth/AuthSession.h - minecraft/auth/AuthStep.cpp - minecraft/auth/AuthStep.h - minecraft/auth/MinecraftAccount.cpp - minecraft/auth/MinecraftAccount.h - minecraft/auth/Parsers.cpp - minecraft/auth/Parsers.h - minecraft/auth/flows/AuthFlow.cpp - minecraft/auth/flows/AuthFlow.h - minecraft/auth/flows/MSA.cpp - minecraft/auth/flows/MSA.h - - minecraft/auth/steps/EntitlementsStep.cpp - minecraft/auth/steps/EntitlementsStep.h - minecraft/auth/steps/GetSkinStep.cpp - minecraft/auth/steps/GetSkinStep.h - minecraft/auth/steps/MeshMCLoginStep.cpp - minecraft/auth/steps/MeshMCLoginStep.h - minecraft/auth/steps/MinecraftProfileStep.cpp - minecraft/auth/steps/MinecraftProfileStep.h - minecraft/auth/steps/MSAStep.cpp - minecraft/auth/steps/MSAStep.h - minecraft/auth/steps/XboxAuthorizationStep.cpp - minecraft/auth/steps/XboxAuthorizationStep.h - minecraft/auth/steps/XboxProfileStep.cpp - minecraft/auth/steps/XboxProfileStep.h - minecraft/auth/steps/XboxUserStep.cpp - minecraft/auth/steps/XboxUserStep.h - minecraft/gameoptions/GameOptions.h - minecraft/gameoptions/GameOptions.cpp - - minecraft/update/AssetUpdateTask.h - minecraft/update/AssetUpdateTask.cpp - minecraft/update/FMLLibrariesTask.cpp - minecraft/update/FMLLibrariesTask.h - minecraft/update/FoldersTask.cpp - minecraft/update/FoldersTask.h - minecraft/update/LibrariesTask.cpp - minecraft/update/LibrariesTask.h - - minecraft/launch/ClaimAccount.cpp - minecraft/launch/ClaimAccount.h - minecraft/launch/CreateGameFolders.cpp - minecraft/launch/CreateGameFolders.h - minecraft/launch/ModMinecraftJar.cpp - minecraft/launch/ModMinecraftJar.h - minecraft/launch/DirectJavaLaunch.cpp - minecraft/launch/DirectJavaLaunch.h - minecraft/launch/ExtractNatives.cpp - minecraft/launch/ExtractNatives.h - minecraft/launch/MeshMCPartLaunch.cpp - minecraft/launch/MeshMCPartLaunch.h - minecraft/launch/MinecraftServerTarget.cpp - minecraft/launch/MinecraftServerTarget.h - minecraft/launch/PrintInstanceInfo.cpp - minecraft/launch/PrintInstanceInfo.h - minecraft/launch/ReconstructAssets.cpp - minecraft/launch/ReconstructAssets.h - minecraft/launch/ScanModFolders.cpp - minecraft/launch/ScanModFolders.h - minecraft/launch/VerifyJavaInstall.cpp - minecraft/launch/VerifyJavaInstall.h - - minecraft/legacy/LegacyModList.h - minecraft/legacy/LegacyModList.cpp - minecraft/legacy/LegacyInstance.h - minecraft/legacy/LegacyInstance.cpp - minecraft/legacy/LegacyUpgradeTask.h - minecraft/legacy/LegacyUpgradeTask.cpp - - minecraft/GradleSpecifier.h - minecraft/MinecraftInstance.cpp - minecraft/MinecraftInstance.h - minecraft/LaunchProfile.cpp - minecraft/LaunchProfile.h - minecraft/Component.cpp - minecraft/Component.h - minecraft/PackProfile.cpp - minecraft/PackProfile.h - minecraft/ComponentUpdateTask.cpp - minecraft/ComponentUpdateTask.h - minecraft/MinecraftLoadAndCheck.h - minecraft/MinecraftLoadAndCheck.cpp - minecraft/MinecraftUpdate.h - minecraft/MinecraftUpdate.cpp - minecraft/MojangVersionFormat.cpp - minecraft/MojangVersionFormat.h - minecraft/Rule.cpp - minecraft/Rule.h - minecraft/OneSixVersionFormat.cpp - minecraft/OneSixVersionFormat.h - minecraft/OpSys.cpp - minecraft/OpSys.h - minecraft/ParseUtils.cpp - minecraft/ParseUtils.h - minecraft/ProfileUtils.cpp - minecraft/ProfileUtils.h - minecraft/ShortcutUtils.cpp - minecraft/ShortcutUtils.h - minecraft/Library.cpp - minecraft/Library.h - minecraft/MojangDownloadInfo.h - minecraft/VersionFile.cpp - minecraft/VersionFile.h - minecraft/VersionFilterData.h - minecraft/VersionFilterData.cpp - minecraft/World.h - minecraft/World.cpp - minecraft/WorldList.h - minecraft/WorldList.cpp - - minecraft/mod/Mod.h - minecraft/mod/Mod.cpp - minecraft/mod/ModDetails.h - minecraft/mod/ModFolderModel.h - minecraft/mod/ModFolderModel.cpp - minecraft/mod/ModFolderLoadTask.h - minecraft/mod/ModFolderLoadTask.cpp - minecraft/mod/LocalModParseTask.h - minecraft/mod/LocalModParseTask.cpp - minecraft/mod/ModMetadataIndex.h - minecraft/mod/ModMetadataIndex.cpp - minecraft/mod/PackwizSidecar.h - minecraft/mod/PackwizSidecar.cpp - minecraft/mod/PackLayout.h - minecraft/mod/PackLayout.cpp - minecraft/mod/ResourcePackFolderModel.h - minecraft/mod/ResourcePackFolderModel.cpp - minecraft/mod/TexturePackFolderModel.h - minecraft/mod/TexturePackFolderModel.cpp - minecraft/mod/ShaderPackFolderModel.h - minecraft/mod/ShaderPackFolderModel.cpp - minecraft/mod/DataPackFolderModel.h - minecraft/mod/DataPackFolderModel.cpp - - # Assets - minecraft/AssetsUtils.h - minecraft/AssetsUtils.cpp - - # Minecraft services - minecraft/services/CapeChange.cpp - minecraft/services/CapeChange.h - minecraft/services/SkinUpload.cpp - minecraft/services/SkinUpload.h - minecraft/services/SkinDelete.cpp - minecraft/services/SkinDelete.h - - # Local skin library - minecraft/skins/SkinEntry.cpp - minecraft/skins/SkinEntry.h - minecraft/skins/SkinLibrary.cpp - minecraft/skins/SkinLibrary.h - minecraft/skins/ProfileSkinImport.cpp - minecraft/skins/ProfileSkinImport.h - - mojang/PackageManifest.h - mojang/PackageManifest.cpp - ) - add_unit_test(GradleSpecifier SOURCES minecraft/GradleSpecifier_test.cpp LIBS MeshMC_logic @@ -492,226 +99,21 @@ add_unit_test(World LIBS MeshMC_logic ) -# the screenshots feature -set(SCREENSHOTS_SOURCES - screenshots/Screenshot.h - screenshots/ImgurUpload.h - screenshots/ImgurUpload.cpp - screenshots/ImgurAlbumCreation.h - screenshots/ImgurAlbumCreation.cpp -) - -set(TASKS_SOURCES - # Tasks - tasks/Task.h - tasks/Task.cpp - tasks/ConcurrentTask.h - tasks/ConcurrentTask.cpp - tasks/SequentialTask.h - tasks/SequentialTask.cpp -) - -set(SETTINGS_SOURCES - # Settings - settings/INIFile.cpp - settings/INIFile.h - settings/INISettingsObject.cpp - settings/INISettingsObject.h - settings/OverrideSetting.cpp - settings/OverrideSetting.h - settings/PassthroughSetting.cpp - settings/PassthroughSetting.h - settings/Setting.cpp - settings/Setting.h - settings/SettingsObject.cpp - settings/SettingsObject.h -) - add_unit_test(INIFile SOURCES settings/INIFile_test.cpp LIBS MeshMC_logic ) -set(JAVA_SOURCES - java/JavaChecker.h - java/JavaChecker.cpp - java/JavaCheckerJob.h - java/JavaCheckerJob.cpp - java/JavaInstall.h - java/JavaInstall.cpp - java/JavaInstallList.h - java/JavaInstallList.cpp - java/JavaUtils.h - java/JavaUtils.cpp - java/JavaVersion.h - java/JavaVersion.cpp -) - -if(NOT MeshMC_DISABLE_JAVA_DOWNLOADER) - list(APPEND JAVA_SOURCES - java/download/JavaRuntime.h - java/download/JavaDownloadTask.h - java/download/JavaDownloadTask.cpp - ) -endif() - add_unit_test(JavaVersion SOURCES java/JavaVersion_test.cpp LIBS MeshMC_logic ) -set(TRANSLATIONS_SOURCES - translations/TranslationsModel.h - translations/TranslationsModel.cpp - translations/POTranslator.h - translations/POTranslator.cpp -) - -set(TOOLS_SOURCES - # Tools - tools/BaseExternalTool.cpp - tools/BaseExternalTool.h - tools/BaseProfiler.cpp - tools/BaseProfiler.h - tools/JProfiler.cpp - tools/JProfiler.h - tools/JVisualVM.cpp - tools/JVisualVM.h - tools/MCEditTool.cpp - tools/MCEditTool.h -) - -set(META_SOURCES - # Metadata sources - meta/JsonFormat.cpp - meta/JsonFormat.h - meta/BaseEntity.cpp - meta/BaseEntity.h - meta/VersionList.cpp - meta/VersionList.h - meta/Version.cpp - meta/Version.h - meta/Index.cpp - meta/Index.h -) - -set(FTB_SOURCES - modplatform/legacy_ftb/PackFetchTask.h - modplatform/legacy_ftb/PackFetchTask.cpp - modplatform/legacy_ftb/PackInstallTask.h - modplatform/legacy_ftb/PackInstallTask.cpp - modplatform/legacy_ftb/PrivatePackManager.h - modplatform/legacy_ftb/PrivatePackManager.cpp - - modplatform/legacy_ftb/PackHelpers.h -) - -set(FLAME_SOURCES - # Flame - modplatform/flame/FlamePackIndex.cpp - modplatform/flame/FlamePackIndex.h - modplatform/flame/PackManifest.h - modplatform/flame/PackManifest.cpp - modplatform/flame/FileResolvingTask.h - modplatform/flame/FileResolvingTask.cpp - modplatform/flame/FlameContentModel.h - modplatform/flame/FlameContentModel.cpp - modplatform/flame/FlameApi.h - modplatform/flame/FlameApi.cpp - # The file identifier CurseForge looks files up by, and the export - # that has to compute it to name a mod instead of shipping it. - modplatform/flame/FlameFingerprint.h - modplatform/flame/FlameFingerprint.cpp - modplatform/flame/FlamePackExportTask.h - modplatform/flame/FlamePackExportTask.cpp -) - -set(MODPACKSCH_SOURCES - modplatform/modpacksch/FTBPackInstallTask.h - modplatform/modpacksch/FTBPackInstallTask.cpp - modplatform/modpacksch/FTBPackManifest.h - modplatform/modpacksch/FTBPackManifest.cpp -) - -set(TECHNIC_SOURCES - modplatform/technic/SingleZipPackInstallTask.h - modplatform/technic/SingleZipPackInstallTask.cpp - modplatform/technic/SolderPackInstallTask.h - modplatform/technic/SolderPackInstallTask.cpp - modplatform/technic/TechnicPackProcessor.h - modplatform/technic/TechnicPackProcessor.cpp -) - -set(ATLAUNCHER_SOURCES - modplatform/atlauncher/ATLPackIndex.cpp - modplatform/atlauncher/ATLPackIndex.h - modplatform/atlauncher/ATLPackInstallTask.cpp - modplatform/atlauncher/ATLPackInstallTask.h - modplatform/atlauncher/ATLPackManifest.cpp - modplatform/atlauncher/ATLPackManifest.h -) - -set(MODRINTH_SOURCES - modplatform/modrinth/ModrinthPackIndex.cpp - modplatform/modrinth/ModrinthPackIndex.h - modplatform/modrinth/ModrinthPackManifest.cpp - modplatform/modrinth/ModrinthPackManifest.h - modplatform/modrinth/ModrinthContentModel.h - modplatform/modrinth/ModrinthContentModel.cpp - modplatform/modrinth/ModrinthApi.h - modplatform/modrinth/ModrinthApi.cpp - modplatform/modrinth/ModrinthPackExportTask.h - modplatform/modrinth/ModrinthPackExportTask.cpp -) - -set(CONTENT_DOWNLOAD_SOURCES - modplatform/ContentApi.h - modplatform/ManagedPackVersions.h - modplatform/ManagedPackVersions.cpp - modplatform/PackContents.h - modplatform/PackContents.cpp - modplatform/VersionPicker.h - modplatform/VersionPicker.cpp - modplatform/ContentProviderModel.h - modplatform/ContentProviderModel.cpp - modplatform/ContentListExport.h - modplatform/ContentListExport.cpp - modplatform/ContentType.h - modplatform/ModDownloadTypes.h - modplatform/DependencyResolver.h - modplatform/DependencyResolver.cpp - modplatform/ContentDownloadTask.h - modplatform/ContentDownloadTask.cpp - modplatform/ModInstallConflictAnalyzer.h - modplatform/ModInstallConflictAnalyzer.cpp - modplatform/ModUpdateCheckTask.h - modplatform/ModUpdateCheckTask.cpp -) - add_unit_test(PackContents SOURCES modplatform/PackContents_test.cpp LIBS MeshMC_logic ) -set(PLUGIN_SOURCES - # MMCO Plugin System - plugin/MMCOFormat.h - plugin/PluginHooks.h - plugin/PluginAPI.h - plugin/PluginMetadata.h - plugin/CoreSupersededPlugins.h - plugin/PluginLoader.h - plugin/PluginLoader.cpp - plugin/PluginManager.h - plugin/PluginManager.cpp - plugin/PluginHookTask.h - plugin/PluginHookTask.cpp - plugin/PluginSignature.h - plugin/PluginSignature.cpp - plugin/PluginDependencyResolver.h - plugin/PluginDependencyResolver.cpp -) - add_unit_test(Index SOURCES meta/Index_test.cpp LIBS MeshMC_logic @@ -724,35 +126,14 @@ add_unit_test(Index # configured without the vcpkg toolchain. nbt++ is a subtree under libraries/ # and is built here. Either way the imported target names below are the same. -set(LOGIC_SOURCES - ${CORE_SOURCES} - ${PATHMATCHER_SOURCES} - ${NET_SOURCES} - ${LAUNCH_SOURCES} - ${UPDATE_SOURCES} - ${NOTIFICATIONS_SOURCES} - ${NEWS_SOURCES} - ${BACKUP_SOURCES} - ${MINECRAFT_SOURCES} - ${SCREENSHOTS_SOURCES} - ${TASKS_SOURCES} - ${SETTINGS_SOURCES} - ${JAVA_SOURCES} - ${TRANSLATIONS_SOURCES} - ${TOOLS_SOURCES} - ${META_SOURCES} - ${ICONS_SOURCES} - ${FTB_SOURCES} - ${FLAME_SOURCES} - ${MODPACKSCH_SOURCES} - ${TECHNIC_SOURCES} - ${ATLAUNCHER_SOURCES} - ${MODRINTH_SOURCES} - ${CONTENT_DOWNLOAD_SOURCES} - ${PLUGIN_SOURCES} -) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +# Add executable +add_library(MeshMC_logic STATIC) -SET(MESHMC_SOURCES +target_sources(MeshMC_logic PRIVATE # Application base Application.h Application.cpp @@ -770,76 +151,10 @@ SET(MESHMC_SOURCES KonamiCode.h KonamiCode.cpp - # Bundled resources - resources/backgrounds/backgrounds.qrc - resources/multimc/multimc.qrc - resources/pe_dark/pe_dark.qrc - resources/pe_light/pe_light.qrc - resources/pe_colored/pe_colored.qrc - resources/pe_blue/pe_blue.qrc - resources/OSX/OSX.qrc - resources/iOS/iOS.qrc - resources/flat/flat.qrc - resources/flat_white/flat_white.qrc - resources/documents/documents.qrc - resources/breeze_dark/breeze_dark.qrc - resources/breeze_light/breeze_light.qrc - resources/shaders/shaders.qrc - resources/meshmc/meshmc.qrc - - # Icons - icons/MMCIcon.h - icons/MMCIcon.cpp - icons/IconList.h - icons/IconList.cpp - - # GUI - windows - ui/GuiUtil.h - ui/GuiUtil.cpp - ui/ColorCache.h - ui/ColorCache.cpp - ui/MainWindow.h - ui/MainWindow.cpp - ui/MacMenuBar.h - ui/MacMenuBar.cpp - ui/InstanceWindow.h - ui/InstanceWindow.cpp - # FIXME: maybe find a better home for this. SkinUtils.cpp SkinUtils.h - # GUI - setup wizard - ui/setupwizard/SetupWizard.h - ui/setupwizard/SetupWizard.cpp - ui/setupwizard/BaseWizardPage.h - ui/setupwizard/JavaWizardPage.cpp - ui/setupwizard/JavaWizardPage.h - ui/setupwizard/LanguageWizardPage.cpp - ui/setupwizard/LanguageWizardPage.h - - # GUI - themes - ui/themes/FusionTheme.cpp - ui/themes/FusionTheme.h - ui/themes/BrightTheme.cpp - ui/themes/BrightTheme.h - ui/themes/GreenDarkTheme.cpp - ui/themes/GreenDarkTheme.h - ui/themes/GreenLightTheme.cpp - ui/themes/GreenLightTheme.h - ui/themes/CustomTheme.cpp - ui/themes/CustomTheme.h - ui/themes/DarkTheme.cpp - ui/themes/DarkTheme.h - ui/themes/ITheme.cpp - ui/themes/ITheme.h - ui/themes/SystemTheme.cpp - ui/themes/SystemTheme.h - ui/themes/ThemeManager.cpp - ui/themes/ThemeManager.h - ui/themes/CatPack.cpp - ui/themes/CatPack.h - # Processes LaunchController.h LaunchController.cpp @@ -850,365 +165,130 @@ SET(MESHMC_SOURCES # Common java checking UI JavaCommon.h JavaCommon.cpp - - # GUI - paged dialog base - ui/pages/BasePage.h - ui/pages/BasePageContainer.h - ui/pages/BasePageProvider.h - - # GUI - instance pages - ui/pages/instance/BackupPage.cpp - ui/pages/instance/BackupPage.h - ui/pages/instance/GameOptionsPage.cpp - ui/pages/instance/GameOptionsPage.h - ui/pages/instance/VersionPage.cpp - ui/pages/instance/VersionPage.h - ui/pages/instance/TexturePackPage.h - ui/pages/instance/ResourcePackPage.h - ui/pages/instance/ShaderPackPage.h - ui/pages/instance/DataPackPage.h - ui/pages/instance/DataPackPage.cpp - ui/pages/instance/ModFolderPage.cpp - ui/pages/instance/ModFolderPage.h - ui/pages/instance/NotesPage.cpp - ui/pages/instance/NotesPage.h - ui/pages/instance/LogPage.cpp - ui/pages/instance/LogPage.h - ui/pages/instance/InstanceSettingsPage.cpp - ui/pages/instance/InstanceSettingsPage.h - ui/pages/instance/ScreenshotsPage.cpp - ui/pages/instance/ScreenshotsPage.h - ui/pages/instance/OtherLogsPage.cpp - ui/pages/instance/OtherLogsPage.h - ui/pages/instance/ServersPage.cpp - ui/pages/instance/ServersPage.h - ui/pages/instance/LegacyUpgradePage.cpp - ui/pages/instance/LegacyUpgradePage.h - ui/pages/instance/ManagedPackPage.cpp - ui/pages/instance/ManagedPackPage.h - ui/pages/instance/WorldListPage.cpp - ui/pages/instance/WorldListPage.h - - # GUI - global settings pages - ui/pages/global/AccountListPage.cpp - ui/pages/global/AccountListPage.h - ui/pages/global/AppearancePage.cpp - ui/pages/global/AppearancePage.h - ui/pages/global/CustomCommandsPage.cpp - ui/pages/global/CustomCommandsPage.h - ui/pages/global/ExternalToolsPage.cpp - ui/pages/global/ExternalToolsPage.h - ui/pages/global/JavaPage.cpp - ui/pages/global/JavaPage.h - ui/pages/global/LanguagePage.cpp - ui/pages/global/LanguagePage.h - ui/pages/global/MinecraftPage.cpp - ui/pages/global/MinecraftPage.h - ui/pages/global/MeshMCPage.cpp - ui/pages/global/MeshMCPage.h - ui/pages/global/ProxyPage.cpp - ui/pages/global/ProxyPage.h - ui/pages/global/PasteEEPage.cpp - ui/pages/global/PasteEEPage.h - - # GUI - platform pages - ui/pages/modplatform/VanillaPage.cpp - ui/pages/modplatform/VanillaPage.h - - ui/pages/modplatform/ContentProviderPage.cpp - ui/pages/modplatform/ContentProviderPage.h - - ui/pages/modplatform/atlauncher/AtlFilterModel.cpp - ui/pages/modplatform/atlauncher/AtlFilterModel.h - ui/pages/modplatform/atlauncher/AtlListModel.cpp - ui/pages/modplatform/atlauncher/AtlListModel.h - ui/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp - ui/pages/modplatform/atlauncher/AtlOptionalModDialog.h - ui/pages/modplatform/atlauncher/AtlPage.cpp - ui/pages/modplatform/atlauncher/AtlPage.h - - ui/pages/modplatform/ftb/FtbFilterModel.cpp - ui/pages/modplatform/ftb/FtbFilterModel.h - ui/pages/modplatform/ftb/FtbListModel.cpp - ui/pages/modplatform/ftb/FtbListModel.h - ui/pages/modplatform/ftb/FtbPage.cpp - ui/pages/modplatform/ftb/FtbPage.h - - ui/pages/modplatform/legacy_ftb/Page.cpp - ui/pages/modplatform/legacy_ftb/Page.h - ui/pages/modplatform/legacy_ftb/ListModel.h - ui/pages/modplatform/legacy_ftb/ListModel.cpp - - ui/pages/modplatform/flame/FlameModel.cpp - ui/pages/modplatform/flame/FlameModel.h - ui/pages/modplatform/flame/FlamePage.cpp - ui/pages/modplatform/flame/FlamePage.h - - ui/pages/modplatform/modrinth/ModrinthModel.cpp - ui/pages/modplatform/modrinth/ModrinthModel.h - ui/pages/modplatform/modrinth/ModrinthPage.cpp - ui/pages/modplatform/modrinth/ModrinthPage.h - - ui/pages/modplatform/technic/TechnicModel.cpp - ui/pages/modplatform/technic/TechnicModel.h - ui/pages/modplatform/technic/TechnicPage.cpp - ui/pages/modplatform/technic/TechnicPage.h - - ui/pages/modplatform/ImportPage.cpp - ui/pages/modplatform/ImportPage.h - - # GUI - dialogs - ui/dialogs/AboutDialog.cpp - ui/dialogs/AboutDialog.h - ui/dialogs/BlockedModsDialog.cpp - ui/dialogs/BlockedModsDialog.h - ui/dialogs/ProfileSelectDialog.cpp - ui/dialogs/ProfileSelectDialog.h - ui/dialogs/ProfileSetupDialog.cpp - ui/dialogs/ProfileSetupDialog.h - ui/dialogs/CopyInstanceDialog.cpp - ui/dialogs/CopyInstanceDialog.h - ui/dialogs/CreateShortcutDialog.cpp - ui/dialogs/CreateShortcutDialog.h - ui/dialogs/CustomMessageBox.cpp - ui/dialogs/CustomMessageBox.h - ui/dialogs/EditAccountDialog.cpp - ui/dialogs/EditAccountDialog.h - ui/dialogs/ExportInstanceDialog.cpp - ui/dialogs/ExportInstanceDialog.h - ui/dialogs/ExportPackDialog.cpp - ui/dialogs/ExportPackDialog.h - ui/dialogs/IconPickerDialog.cpp - ui/dialogs/IconPickerDialog.h - ui/dialogs/InstallLoaderDialog.cpp - ui/dialogs/InstallLoaderDialog.h - ui/dialogs/MSALoginDialog.cpp - ui/dialogs/MSALoginDialog.h - ui/dialogs/NewComponentDialog.cpp - ui/dialogs/NewComponentDialog.h - ui/dialogs/NewInstanceDialog.cpp - ui/dialogs/NewInstanceDialog.h - ui/dialogs/NewsViewerDialog.cpp - ui/dialogs/NewsViewerDialog.h - ui/dialogs/NotificationDialog.cpp - ui/dialogs/NotificationDialog.h - ui/pagedialog/PageDialog.cpp - ui/pagedialog/PageDialog.h - ui/dialogs/PluginsDialog.cpp - ui/dialogs/PluginsDialog.h - ui/dialogs/ProgressDialog.cpp - ui/dialogs/ProgressDialog.h - ui/dialogs/UpdateAvailableDialog.cpp - ui/dialogs/UpdateAvailableDialog.h - ui/dialogs/VersionSelectDialog.cpp - ui/dialogs/VersionSelectDialog.h - ui/dialogs/skins/SkinManageDialog.cpp - ui/dialogs/skins/SkinManageDialog.h - ui/dialogs/skins/render/CubeMesh.cpp - ui/dialogs/skins/render/CubeMesh.h - ui/dialogs/skins/render/PlayerScene.cpp - ui/dialogs/skins/render/PlayerScene.h - ui/dialogs/skins/render/SkinPreviewSurface.cpp - ui/dialogs/skins/render/SkinPreviewSurface.h - ui/dialogs/DownloadContentDialog.cpp - ui/dialogs/DownloadContentDialog.h - ui/dialogs/DownloadSummaryDialog.cpp - ui/dialogs/DownloadSummaryDialog.h - ui/dialogs/ModUpdateDialog.cpp - ui/dialogs/ModUpdateDialog.h - ui/dialogs/ExportListDialog.cpp - ui/dialogs/ExportListDialog.h - ui/dialogs/MeshMCLogsDialog.cpp - ui/dialogs/MeshMCLogsDialog.h - ui/dialogs/UntrustedModsDialog.cpp - ui/dialogs/UntrustedModsDialog.h - - - # GUI - widgets - ui/widgets/Common.cpp - ui/widgets/Common.h - ui/widgets/CustomCommands.cpp - ui/widgets/CustomCommands.h - ui/widgets/DropLabel.cpp - ui/widgets/DropLabel.h - ui/widgets/FocusLineEdit.cpp - ui/widgets/FocusLineEdit.h - ui/widgets/IconLabel.cpp - ui/widgets/IconLabel.h - ui/widgets/JavaSettingsWidget.cpp - ui/widgets/JavaSettingsWidget.h - ui/widgets/LabeledToolButton.cpp - ui/widgets/LabeledToolButton.h - ui/widgets/LanguageSelectionWidget.cpp - ui/widgets/LanguageSelectionWidget.h - ui/widgets/LineSeparator.cpp - ui/widgets/LineSeparator.h - ui/widgets/LogView.cpp - ui/widgets/LogView.h - ui/widgets/MCModInfoFrame.cpp - ui/widgets/MCModInfoFrame.h - ui/widgets/ModListView.cpp - ui/widgets/ModListView.h - ui/widgets/PageContainer.cpp - ui/widgets/PageContainer.h - ui/widgets/PageContainer_p.h - ui/widgets/VersionListView.cpp - ui/widgets/VersionListView.h - ui/widgets/VersionSelectWidget.cpp - ui/widgets/VersionSelectWidget.h - ui/widgets/ProgressWidget.h - ui/widgets/ProgressWidget.cpp - ui/widgets/ProjectItemDelegate.h - ui/widgets/ProjectItemDelegate.cpp - ui/widgets/ProjectDescriptionPage.h - ui/widgets/ProjectDescriptionPage.cpp - ui/widgets/ContentFilterWidget.h - ui/widgets/ContentFilterWidget.cpp - ui/widgets/CheckComboBox.h - ui/widgets/CheckComboBox.cpp - ui/widgets/TaskStepProgressBar.h - ui/widgets/TaskStepProgressBar.cpp - ui/widgets/WideBar.h - ui/widgets/WideBar.cpp - - # GUI - instance group view - ui/instanceview/InstanceProxyModel.cpp - ui/instanceview/InstanceProxyModel.h - ui/instanceview/AccessibleInstanceView.cpp - ui/instanceview/AccessibleInstanceView.h - ui/instanceview/AccessibleInstanceView_p.h - ui/instanceview/InstanceView.cpp - ui/instanceview/InstanceView.h - ui/instanceview/InstanceDelegate.cpp - ui/instanceview/InstanceDelegate.h - ui/instanceview/VisualGroup.cpp - ui/instanceview/VisualGroup.h ) -set(MESHMC_UI_FILES - ui/pages/global/AccountListPage.ui - ui/pages/global/AppearancePage.ui - ui/pages/global/JavaPage.ui - ui/pages/global/MeshMCPage.ui - ui/pages/global/PasteEEPage.ui - ui/pages/global/ProxyPage.ui - ui/pages/global/MinecraftPage.ui - ui/pages/global/ExternalToolsPage.ui - ui/pages/instance/BackupPage.ui - ui/pages/instance/ModFolderPage.ui - ui/pages/instance/NotesPage.ui - ui/pages/instance/LogPage.ui - ui/pages/instance/ServersPage.ui - ui/pages/instance/GameOptionsPage.ui - ui/pages/instance/OtherLogsPage.ui - ui/pages/instance/InstanceSettingsPage.ui - ui/pages/instance/VersionPage.ui - ui/pages/instance/WorldListPage.ui - ui/pages/instance/LegacyUpgradePage.ui - ui/pages/instance/ManagedPackPage.ui - ui/pages/instance/ScreenshotsPage.ui - ui/pages/modplatform/atlauncher/AtlOptionalModDialog.ui - ui/pages/modplatform/atlauncher/AtlPage.ui - ui/pages/modplatform/VanillaPage.ui - ui/pages/modplatform/ContentProviderPage.ui - ui/pages/modplatform/flame/FlamePage.ui - ui/pages/modplatform/modrinth/ModrinthPage.ui - ui/pages/modplatform/legacy_ftb/Page.ui - ui/pages/modplatform/ImportPage.ui - ui/pages/modplatform/ftb/FtbPage.ui - ui/pages/modplatform/technic/TechnicPage.ui - ui/widgets/InstanceCardWidget.ui - ui/widgets/CustomCommands.ui - ui/widgets/MCModInfoFrame.ui - ui/dialogs/CopyInstanceDialog.ui - ui/dialogs/ProfileSetupDialog.ui - ui/dialogs/NewInstanceDialog.ui - ui/dialogs/NotificationDialog.ui - ui/dialogs/UpdateAvailableDialog.ui - ui/dialogs/MeshMCLogsDialog.ui - ui/dialogs/PluginsDialog.ui - ui/dialogs/NewComponentDialog.ui - ui/dialogs/ProfileSelectDialog.ui - ui/dialogs/skins/SkinManageDialog.ui - ui/dialogs/CreateShortcutDialog.ui - ui/dialogs/ExportInstanceDialog.ui - ui/dialogs/ExportPackDialog.ui - ui/dialogs/IconPickerDialog.ui - ui/dialogs/MSALoginDialog.ui - ui/dialogs/AboutDialog.ui - ui/dialogs/EditAccountDialog.ui - ui/dialogs/UntrustedModsDialog.ui - ui/MainWindow.ui -) +######## Windows resource files ######## +if(WIN32) + set(MESHMC_RCS ${CMAKE_BINARY_DIR}/meshmc.rc) +endif() -# Forms used by *both* the launcher and the standalone updater. -# -# They have to be wrapped exactly once: two qt_wrap_ui calls for the same -# form in the same directory would declare two rules generating the same -# ui_*.h, which CMake rejects. Listing the generated sources in both targets -# is fine -- the rule stays single, and each target simply depends on it. -set(MESHMC_SHARED_UI_FILES - ui/dialogs/ProgressDialog.ui - ui/widgets/TaskStepProgressBar.ui -) +target_include_directories(MeshMC_logic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -# Dispatch explicitly on the major version instead of using the versionless -# qt_wrap_ui: on Qt 5 that wrapper is a no-op unless QT_DEFAULT_MAJOR_VERSION -# happens to be set, which would silently generate no ui_*.h headers at all. -if(QT_VERSION_MAJOR EQUAL 6) - qt6_wrap_ui(MESHMC_UI ${MESHMC_UI_FILES}) - qt6_wrap_ui(MESHMC_SHARED_UI ${MESHMC_SHARED_UI_FILES}) -else() - qt5_wrap_ui(MESHMC_UI ${MESHMC_UI_FILES}) - qt5_wrap_ui(MESHMC_SHARED_UI ${MESHMC_SHARED_UI_FILES}) -endif() +target_sources(MeshMC_logic PRIVATE + # LOGIC - Base classes and infrastructure + BaseInstaller.h + BaseInstaller.cpp + BaseVersionList.h + BaseVersionList.cpp + InstanceList.h + InstanceList.cpp + InstanceTask.h + InstanceTask.cpp + LoggedProcess.h + LoggedProcess.cpp + Logging.h + Logging.cpp + MessageLevel.cpp + MessageLevel.h + BaseVersion.h + BaseInstance.h + BaseInstance.cpp + Sys.cpp + Sys.h + NullInstance.h + QtCompat.h + ArchiveOpen.h + MMCZip.h + MMCZip.cpp + MMCStrings.h + MMCStrings.cpp -if(NOT MeshMC_DISABLE_JAVA_DOWNLOADER) - list(APPEND MESHMC_SOURCES - ui/dialogs/JavaDownloadDialog.cpp - ui/dialogs/JavaDownloadDialog.h - ) -endif() + # Basic instance manipulation tasks (derived from InstanceTask) + InstanceCreationTask.h + InstanceCreationTask.cpp + InstanceCopyTask.h + InstanceCopyTask.cpp + InstanceImportTask.h + InstanceImportTask.cpp -if (APPLE) - set(MESHMC_SOURCES - ${MESHMC_SOURCES} - ui/themes/ThemeManager.mm - ) -endif() + # Use tracking separate from memory management + Usable.h -set(MESHMC_QRC_FILES - resources/backgrounds/backgrounds.qrc - resources/multimc/multimc.qrc - resources/pe_dark/pe_dark.qrc - resources/pe_light/pe_light.qrc - resources/pe_colored/pe_colored.qrc - resources/pe_blue/pe_blue.qrc - resources/OSX/OSX.qrc - resources/iOS/iOS.qrc - resources/flat/flat.qrc - resources/flat_white/flat_white.qrc - resources/documents/documents.qrc - resources/breeze_dark/breeze_dark.qrc - resources/breeze_light/breeze_light.qrc - resources/shaders/shaders.qrc - resources/meshmc/meshmc.qrc -) + # Prefix tree where node names are strings between separators + SeparatorPrefixTree.h -# Same reasoning as MESHMC_UI above: never rely on the versionless wrapper. -if(QT_VERSION_MAJOR EQUAL 6) - qt6_add_resources(MESHMC_RESOURCES ${MESHMC_QRC_FILES}) -else() - qt5_add_resources(MESHMC_RESOURCES ${MESHMC_QRC_FILES}) -endif() + # The checkable file tree the export dialogs are built around, and the + # icon provider that keeps pointing it at an entire instance directory + # from costing a per-file platform lookup. + FileIgnoreProxy.h + FileIgnoreProxy.cpp + FastFileIconProvider.h + FastFileIconProvider.cpp -######## Windows resource files ######## -if(WIN32) - set(MESHMC_RCS ${CMAKE_BINARY_DIR}/meshmc.rc) -endif() + # String filters + Filter.h + Filter.cpp -# Add executable -add_library(MeshMC_logic STATIC ${LOGIC_SOURCES} ${MESHMC_SOURCES} ${MESHMC_UI} ${MESHMC_SHARED_UI} ${MESHMC_RESOURCES}) + # JSON parsing helpers + Json.h + Json.cpp + + FileSystem.h + FileSystem.cpp + + Exception.h + + # RW lock protected map + RWStorage.h + + # A variable that has an implicit default value and keeps track of changes + DefaultVariable.h + + # a smart pointer wrapper intended for safer use with Qt signal/slot mechanisms + QObjectPtr.h + + # Compression support + GZip.h + GZip.cpp + + # Command line parameter parsing + Commandline.h + Commandline.cpp + + # Version number string support + Version.h + Version.cpp + + # A Recursive file system watcher + RecursiveFileSystemWatcher.h + RecursiveFileSystemWatcher.cpp + + # Time + MMCTime.h + MMCTime.cpp +) + +add_subdirectory(pathmatcher) +add_subdirectory(net) +add_subdirectory(launch) +add_subdirectory(updater) +add_subdirectory(notifications) +add_subdirectory(news) +add_subdirectory(backup) +add_subdirectory(minecraft) +add_subdirectory(mojang) +add_subdirectory(screenshots) +add_subdirectory(tasks) +add_subdirectory(settings) +add_subdirectory(java) +add_subdirectory(translations) +add_subdirectory(tools) +add_subdirectory(meta) +add_subdirectory(icons) +add_subdirectory(modplatform) +add_subdirectory(plugin) +add_subdirectory(resources) +add_subdirectory(ui) # Declared after MeshMC_logic because it links against it. add_unit_test(CustomTheme @@ -1451,11 +531,14 @@ if(NOT APPLE) # like every other download MeshMC does. ui/dialogs/ProgressDialog.h ui/dialogs/ProgressDialog.cpp + ui/dialogs/ProgressDialog.ui ui/widgets/TaskStepProgressBar.h ui/widgets/TaskStepProgressBar.cpp + ui/widgets/TaskStepProgressBar.ui + updater/meshupdater/SelectReleaseDialog.ui ) - add_library(meshmc_updater_logic STATIC ${MESHUPDATER_SOURCES} ${MESHUPDATER_UI} ${MESHMC_SHARED_UI}) + add_library(meshmc_updater_logic STATIC ${MESHUPDATER_SOURCES} ${MESHUPDATER_UI}) target_include_directories(meshmc_updater_logic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_definitions(meshmc_updater_logic PUBLIC QT_MESSAGELOGCONTEXT) target_link_libraries(meshmc_updater_logic diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index ccb9ecd44..6b14c21fd 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -24,7 +24,6 @@ #include "Application.h" #include "InstanceList.h" #include "MMCZip.h" -#include "archive/ExtractZipTask.h" #include "NullInstance.h" #include "settings/INISettingsObject.h" #include "icons/IconUtils.h" diff --git a/launcher/MMCZip.cpp b/launcher/MMCZip.cpp index 5df77bdbf..37a369f7a 100644 --- a/launcher/MMCZip.cpp +++ b/launcher/MMCZip.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include @@ -998,3 +1000,243 @@ QDateTime MMCZip::getEntryModTime(const QString& zipPath, } return {}; } + +MMCZip::ExportToZipTask::ExportToZipTask(QString outputPath, QDir dir, + QFileInfoList files, + QString destinationPrefix, + bool followSymlinks, QObject* parent) + : Task(parent), m_outputPath(std::move(outputPath)), + m_dir(std::move(dir)), m_files(std::move(files)), + m_destinationPrefix(std::move(destinationPrefix)), + m_followSymlinks(followSymlinks) +{ +} + +MMCZip::ExportToZipTask::ExportToZipTask(QString outputPath, const QString& dir, + QFileInfoList files, + QString destinationPrefix, + bool followSymlinks, QObject* parent) + : ExportToZipTask(std::move(outputPath), QDir(dir), std::move(files), + std::move(destinationPrefix), followSymlinks, parent) +{ +} + +void MMCZip::ExportToZipTask::executeTask() +{ + setStatus(tr("Adding files...")); + setProgress(0, m_files.length() + m_extraFiles.size()); + + m_future = QtConcurrent::run(QThreadPool::globalInstance(), + [this]() { return exportZip(); }); + connect(&m_watcher, &QFutureWatcher::finished, this, + &ExportToZipTask::finish); + m_watcher.setFuture(m_future); +} + +bool MMCZip::ExportToZipTask::abort() +{ + if (m_future.isRunning()) { + m_cancelled.store(true); + /* No emitAborted() here: the worker is between files and has + * to be allowed to finish the one it is on and close the + * archive. finish() reports the abort when it really is + * one. */ + return true; + } + return false; +} + +void MMCZip::ExportToZipTask::reportStatus(const QString& status) +{ + QMetaObject::invokeMethod( + this, [this, status] { setStatus(status); }, Qt::QueuedConnection); +} + +void MMCZip::ExportToZipTask::reportProgress(qint64 current, qint64 total) +{ + QMetaObject::invokeMethod( + this, [this, current, total] { setProgress(current, total); }, + Qt::QueuedConnection); +} + +auto MMCZip::ExportToZipTask::exportZip() -> ZipResult +{ + if (!m_dir.exists()) { + return ZipResult(tr("The folder to export does not exist.")); + } + + ZipWriter zip(m_outputPath); + if (!zip.open()) { + return ZipResult(tr("Could not create '%1': %2") + .arg(m_outputPath, zip.errorString())); + } + + qint64 done = 0; + const qint64 total = m_files.length() + m_extraFiles.size(); + + /* The generated entries first, so that a reader handed a + * truncated archive still finds the manifest that says what it + * was meant to be. */ + for (auto it = m_extraFiles.constBegin(); it != m_extraFiles.constEnd(); + ++it) { + if (m_cancelled.load()) + return ZipResult(); + if (!zip.addFile(it.key(), it.value())) { + return ZipResult(tr("Could not add %1: %2") + .arg(it.key(), zip.errorString())); + } + reportProgress(++done, total); + } + + for (const QFileInfo& file : m_files) { + if (m_cancelled.load()) + return ZipResult(); + + QString absolute = file.absoluteFilePath(); + const QString relative = m_dir.relativeFilePath(absolute); + + if (m_excludeFiles.contains(relative)) { + reportProgress(++done, total); + continue; + } + + reportStatus(tr("Compressing: %1").arg(relative)); + + if (m_followSymlinks) { + /* An instance's mods folder is frequently a tree of + * links into a shared download folder; storing the link + * would export an archive full of dangling paths. */ + if (file.isSymLink()) { + absolute = file.symLinkTarget(); + } else { + const QString canonical = file.canonicalFilePath(); + if (!canonical.isEmpty()) { + absolute = canonical; + } + } + } + + if (!zip.addFile(absolute, m_destinationPrefix + relative)) { + return ZipResult(tr("Could not read and compress %1: %2") + .arg(relative, zip.errorString())); + } + reportProgress(++done, total); + } + + if (!zip.close()) { + return ZipResult(tr("Could not finish '%1': %2") + .arg(m_outputPath, zip.errorString())); + } + return ZipResult(); +} + +void MMCZip::ExportToZipTask::finish() +{ + /* Nothing half-written is left behind for the user to find and + * mistake for a finished export - in either failure case. */ + if (m_cancelled.load()) { + FS::deletePath(m_outputPath); + emitAborted(); + return; + } + + const ZipResult result = m_future.result(); + if (result.has_value()) { + FS::deletePath(m_outputPath); + emitFailed(result.value()); + return; + } + emitSucceeded(); +} + +MMCZip::ExtractZipTask::ExtractZipTask(QString input, QDir outputDir, + QString subdirectory, QObject* parent) + : Task(parent), m_input(std::move(input)), + m_outputDir(std::move(outputDir)), + m_subdirectory(std::move(subdirectory)) +{ +} + +void MMCZip::ExtractZipTask::executeTask() +{ + setStatus(tr("Extracting files...")); + setProgress(0, 0); + + m_future = QtConcurrent::run(QThreadPool::globalInstance(), + [this]() { return extractZip(); }); + connect(&m_watcher, &QFutureWatcher::finished, this, + &ExtractZipTask::finish); + m_watcher.setFuture(m_future); +} + +bool MMCZip::ExtractZipTask::abort() +{ + if (m_future.isRunning()) { + m_cancelled.store(true); + /* The worker cleans up what it already wrote and returns; + * finish() is what turns that into an abort. */ + return true; + } + return false; +} + +void MMCZip::ExtractZipTask::reportStatus(const QString& status) +{ + QMetaObject::invokeMethod( + this, [this, status] { setStatus(status); }, Qt::QueuedConnection); +} + +void MMCZip::ExtractZipTask::reportProgress(qint64 current, qint64 total) +{ + QMetaObject::invokeMethod( + this, [this, current, total] { setProgress(current, total); }, + Qt::QueuedConnection); +} + +auto MMCZip::ExtractZipTask::extractZip() -> ZipResult +{ + /* Both reports come from the extracting thread, so neither may + * touch task state directly. See the header. */ + ExtractReporting reporting; + reporting.progress = [this](qint64 current, qint64 total) { + reportProgress(current, total); + }; + reporting.isCancelled = [this]() { return m_cancelled.load(); }; + reporting.entryStarted = [this](const QString& name) { + if (!name.isEmpty()) { + reportStatus(tr("Unpacking: %1").arg(name)); + } + }; + + const auto extracted = + extractSubDir(m_input, m_subdirectory, m_outputDir.absolutePath(), + reporting); + if (!extracted.has_value()) { + /* Cancellation comes back through the same "no result" door + * as a damaged archive; only we know which it was. */ + if (m_cancelled.load()) { + return ZipResult(); + } + return ZipResult( + tr("Failed to unpack %1. The archive appears to be damaged.") + .arg(QFileInfo(m_input).fileName())); + } + + m_extracted = extracted.value(); + return ZipResult(); +} + +void MMCZip::ExtractZipTask::finish() +{ + if (m_cancelled.load()) { + emitAborted(); + return; + } + + const ZipResult result = m_future.result(); + if (result.has_value()) { + emitFailed(result.value()); + return; + } + emitSucceeded(); +} diff --git a/launcher/MMCZip.h b/launcher/MMCZip.h index a1f8fb22d..25a19d30f 100644 --- a/launcher/MMCZip.h +++ b/launcher/MMCZip.h @@ -20,15 +20,22 @@ #pragma once +#include #include +#include #include #include +#include +#include +#include #include #include #include +#include "tasks/Task.h" #include "minecraft/mod/Mod.h" #include #include +#include struct archive; @@ -283,4 +290,171 @@ namespace MMCZip * Get the modification time of a specific entry in a zip archive. */ QDateTime getEntryModTime(const QString& zipPath, const QString& entryName); + + /* + * Writing a list of files into a zip, off the UI thread. + * + * The export dialogs used to call MMCZip::compressDir() straight + * from the dialog's accept handler: the window froze for as long as + * the instance took to compress - minutes for a modpack with a + * world in it - with no progress and no way out. This is the same + * job as a task, so the progress dialog can show which file is being + * written and the user can change their mind. + * + * The file list is decided by the caller rather than walked here, + * because the callers already know it: they built the tree the user + * unchecked entries in, and a pack export additionally needs the + * same list to write its manifest. See + * MMCZip::collectFileListRecursively(). + * + * `destinationPrefix` is prepended to every entry, which is how a + * pack export puts an instance's files under `overrides/`. + * `excludeFiles` names entries - relative to `dir` - to skip, which + * is how it then leaves out the mods the manifest says to download + * rather than shipping them twice. `extraFiles` are generated + * entries (the manifest itself) and are written before anything from + * disk, so a truncated archive still starts with something a reader + * can identify. + */ + class ExportToZipTask : public Task + { + Q_OBJECT + public: + ExportToZipTask(QString outputPath, QDir dir, QFileInfoList files, + QString destinationPrefix = QString(), + bool followSymlinks = false, QObject* parent = nullptr); + ExportToZipTask(QString outputPath, const QString& dir, + QFileInfoList files, + QString destinationPrefix = QString(), + bool followSymlinks = false, QObject* parent = nullptr); + ~ExportToZipTask() override = default; + + void setExcludeFiles(QStringList excludeFiles) + { + m_excludeFiles = std::move(excludeFiles); + } + void addExtraFile(const QString& fileName, const QByteArray& data) + { + m_extraFiles.insert(fileName, data); + } + + bool canAbort() const override + { + return true; + } + bool abort() override; + + protected: + void executeTask() override; + + private: + /* Empty on success, the reason on failure. */ + using ZipResult = std::optional; + + ZipResult exportZip(); + void finish(); + + /* + * setStatus() / setProgress(), as called from the worker thread. + * + * Those two write plain members - m_status is a QString - and + * ProgressDialog reads them straight off the task when it + * attaches to one that is already running, as does + * ConcurrentTask when it folds a subtask into its step list. + * Writing them from the thread doing the compressing while the + * UI thread reads them is a race over a refcounted string, not + * merely a stale number. + * + * So the report hops back to the thread this task lives on + * first, and only touches task state there. Same reasoning, and + * the same shape, as BackupTask::reportProgress(). + */ + void reportStatus(const QString& status); + void reportProgress(qint64 current, qint64 total); + + QString m_outputPath; + QDir m_dir; + QFileInfoList m_files; + QString m_destinationPrefix; + bool m_followSymlinks; + QStringList m_excludeFiles; + QHash m_extraFiles; + + /* Cancellation is tracked here rather than through + * QFuture::cancel(): the future QtConcurrent::run() hands back + * does not support being cancelled, so isCanceled() on it stays + * false forever and an abort would be silently ignored. */ + std::atomic m_cancelled{false}; + + QFuture m_future; + QFutureWatcher m_watcher; + }; + + /* + * Unpacking an archive, off the UI thread, with a progress bar and a + * way out. + * + * The modpack importer used to hand MMCZip::extractSubDir() to + * QtConcurrent::run() and watch the future: the work did happen in + * the background, but nothing came back until it was over. A + * multi-gigabyte pack looked like a frozen "Extracting modpack" + * label with a bar that never moved, and pressing the dialog's abort + * button did nothing at all, because there was nothing to press it + * against. + * + * `subdirectory` is a prefix inside the archive; only entries under + * it are written out, with the prefix removed. Empty means the whole + * archive - which is what the formats that ship their files at the + * root need. + */ + class ExtractZipTask : public Task + { + Q_OBJECT + public: + ExtractZipTask(QString input, QDir outputDir, + QString subdirectory = QString(), + QObject* parent = nullptr); + ~ExtractZipTask() override = default; + + /* The absolute paths of everything that was written. Only + * meaningful after the task succeeded. */ + QStringList extractedFiles() const + { + return m_extracted; + } + + bool canAbort() const override + { + return true; + } + bool abort() override; + + protected: + void executeTask() override; + + private: + /* Empty on success, the reason on failure. */ + using ZipResult = std::optional; + + ZipResult extractZip(); + void finish(); + + /* See ExportToZipTask: the unpacking runs on a worker thread, + * and task state may only be touched on the thread the task + * lives on. */ + void reportStatus(const QString& status); + void reportProgress(qint64 current, qint64 total); + + QString m_input; + QDir m_outputDir; + QString m_subdirectory; + QStringList m_extracted; + + /* See ExportToZipTask: the future from QtConcurrent::run() cannot + * be cancelled, so the flag has to be ours. */ + std::atomic m_cancelled{false}; + + QFuture m_future; + QFutureWatcher m_watcher; + }; } // namespace MMCZip diff --git a/launcher/archive/ExportToZipTask.cpp b/launcher/archive/ExportToZipTask.cpp deleted file mode 100644 index 7791f18b7..000000000 --- a/launcher/archive/ExportToZipTask.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* SPDX-FileCopyrightText: 2026 Project Tick - * SPDX-FileContributor: Project Tick - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (C) 2026 Project Tick - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "archive/ExportToZipTask.h" - -#include -#include -#include -#include - -#include "FileSystem.h" -#include "MMCZip.h" - -namespace MMCZip -{ - ExportToZipTask::ExportToZipTask(QString outputPath, QDir dir, - QFileInfoList files, - QString destinationPrefix, - bool followSymlinks, QObject* parent) - : Task(parent), m_outputPath(std::move(outputPath)), - m_dir(std::move(dir)), m_files(std::move(files)), - m_destinationPrefix(std::move(destinationPrefix)), - m_followSymlinks(followSymlinks) - { - } - - ExportToZipTask::ExportToZipTask(QString outputPath, const QString& dir, - QFileInfoList files, - QString destinationPrefix, - bool followSymlinks, QObject* parent) - : ExportToZipTask(std::move(outputPath), QDir(dir), std::move(files), - std::move(destinationPrefix), followSymlinks, parent) - { - } - - void ExportToZipTask::executeTask() - { - setStatus(tr("Adding files...")); - setProgress(0, m_files.length() + m_extraFiles.size()); - - m_future = QtConcurrent::run(QThreadPool::globalInstance(), - [this]() { return exportZip(); }); - connect(&m_watcher, &QFutureWatcher::finished, this, - &ExportToZipTask::finish); - m_watcher.setFuture(m_future); - } - - bool ExportToZipTask::abort() - { - if (m_future.isRunning()) { - m_cancelled.store(true); - /* No emitAborted() here: the worker is between files and has - * to be allowed to finish the one it is on and close the - * archive. finish() reports the abort when it really is - * one. */ - return true; - } - return false; - } - - void ExportToZipTask::reportStatus(const QString& status) - { - QMetaObject::invokeMethod( - this, [this, status] { setStatus(status); }, Qt::QueuedConnection); - } - - void ExportToZipTask::reportProgress(qint64 current, qint64 total) - { - QMetaObject::invokeMethod( - this, [this, current, total] { setProgress(current, total); }, - Qt::QueuedConnection); - } - - auto ExportToZipTask::exportZip() -> ZipResult - { - if (!m_dir.exists()) { - return ZipResult(tr("The folder to export does not exist.")); - } - - ZipWriter zip(m_outputPath); - if (!zip.open()) { - return ZipResult(tr("Could not create '%1': %2") - .arg(m_outputPath, zip.errorString())); - } - - qint64 done = 0; - const qint64 total = m_files.length() + m_extraFiles.size(); - - /* The generated entries first, so that a reader handed a - * truncated archive still finds the manifest that says what it - * was meant to be. */ - for (auto it = m_extraFiles.constBegin(); it != m_extraFiles.constEnd(); - ++it) { - if (m_cancelled.load()) - return ZipResult(); - if (!zip.addFile(it.key(), it.value())) { - return ZipResult(tr("Could not add %1: %2") - .arg(it.key(), zip.errorString())); - } - reportProgress(++done, total); - } - - for (const QFileInfo& file : m_files) { - if (m_cancelled.load()) - return ZipResult(); - - QString absolute = file.absoluteFilePath(); - const QString relative = m_dir.relativeFilePath(absolute); - - if (m_excludeFiles.contains(relative)) { - reportProgress(++done, total); - continue; - } - - reportStatus(tr("Compressing: %1").arg(relative)); - - if (m_followSymlinks) { - /* An instance's mods folder is frequently a tree of - * links into a shared download folder; storing the link - * would export an archive full of dangling paths. */ - if (file.isSymLink()) { - absolute = file.symLinkTarget(); - } else { - const QString canonical = file.canonicalFilePath(); - if (!canonical.isEmpty()) { - absolute = canonical; - } - } - } - - if (!zip.addFile(absolute, m_destinationPrefix + relative)) { - return ZipResult(tr("Could not read and compress %1: %2") - .arg(relative, zip.errorString())); - } - reportProgress(++done, total); - } - - if (!zip.close()) { - return ZipResult(tr("Could not finish '%1': %2") - .arg(m_outputPath, zip.errorString())); - } - return ZipResult(); - } - - void ExportToZipTask::finish() - { - /* Nothing half-written is left behind for the user to find and - * mistake for a finished export - in either failure case. */ - if (m_cancelled.load()) { - FS::deletePath(m_outputPath); - emitAborted(); - return; - } - - const ZipResult result = m_future.result(); - if (result.has_value()) { - FS::deletePath(m_outputPath); - emitFailed(result.value()); - return; - } - emitSucceeded(); - } -} // namespace MMCZip diff --git a/launcher/archive/ExportToZipTask.h b/launcher/archive/ExportToZipTask.h deleted file mode 100644 index fb7767ab1..000000000 --- a/launcher/archive/ExportToZipTask.h +++ /dev/null @@ -1,136 +0,0 @@ -/* SPDX-FileCopyrightText: 2026 Project Tick - * SPDX-FileContributor: Project Tick - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (C) 2026 Project Tick - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "tasks/Task.h" - -namespace MMCZip -{ - /* - * Writing a list of files into a zip, off the UI thread. - * - * The export dialogs used to call MMCZip::compressDir() straight - * from the dialog's accept handler: the window froze for as long as - * the instance took to compress - minutes for a modpack with a - * world in it - with no progress and no way out. This is the same - * job as a task, so the progress dialog can show which file is being - * written and the user can change their mind. - * - * The file list is decided by the caller rather than walked here, - * because the callers already know it: they built the tree the user - * unchecked entries in, and a pack export additionally needs the - * same list to write its manifest. See - * MMCZip::collectFileListRecursively(). - * - * `destinationPrefix` is prepended to every entry, which is how a - * pack export puts an instance's files under `overrides/`. - * `excludeFiles` names entries - relative to `dir` - to skip, which - * is how it then leaves out the mods the manifest says to download - * rather than shipping them twice. `extraFiles` are generated - * entries (the manifest itself) and are written before anything from - * disk, so a truncated archive still starts with something a reader - * can identify. - */ - class ExportToZipTask : public Task - { - Q_OBJECT - public: - ExportToZipTask(QString outputPath, QDir dir, QFileInfoList files, - QString destinationPrefix = QString(), - bool followSymlinks = false, QObject* parent = nullptr); - ExportToZipTask(QString outputPath, const QString& dir, - QFileInfoList files, - QString destinationPrefix = QString(), - bool followSymlinks = false, QObject* parent = nullptr); - ~ExportToZipTask() override = default; - - void setExcludeFiles(QStringList excludeFiles) - { - m_excludeFiles = std::move(excludeFiles); - } - void addExtraFile(const QString& fileName, const QByteArray& data) - { - m_extraFiles.insert(fileName, data); - } - - bool canAbort() const override - { - return true; - } - bool abort() override; - - protected: - void executeTask() override; - - private: - /* Empty on success, the reason on failure. */ - using ZipResult = std::optional; - - ZipResult exportZip(); - void finish(); - - /* - * setStatus() / setProgress(), as called from the worker thread. - * - * Those two write plain members - m_status is a QString - and - * ProgressDialog reads them straight off the task when it - * attaches to one that is already running, as does - * ConcurrentTask when it folds a subtask into its step list. - * Writing them from the thread doing the compressing while the - * UI thread reads them is a race over a refcounted string, not - * merely a stale number. - * - * So the report hops back to the thread this task lives on - * first, and only touches task state there. Same reasoning, and - * the same shape, as BackupTask::reportProgress(). - */ - void reportStatus(const QString& status); - void reportProgress(qint64 current, qint64 total); - - QString m_outputPath; - QDir m_dir; - QFileInfoList m_files; - QString m_destinationPrefix; - bool m_followSymlinks; - QStringList m_excludeFiles; - QHash m_extraFiles; - - /* Cancellation is tracked here rather than through - * QFuture::cancel(): the future QtConcurrent::run() hands back - * does not support being cancelled, so isCanceled() on it stays - * false forever and an abort would be silently ignored. */ - std::atomic m_cancelled{false}; - - QFuture m_future; - QFutureWatcher m_watcher; - }; -} // namespace MMCZip diff --git a/launcher/archive/ExtractZipTask.cpp b/launcher/archive/ExtractZipTask.cpp deleted file mode 100644 index a7a55e592..000000000 --- a/launcher/archive/ExtractZipTask.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* SPDX-FileCopyrightText: 2026 Project Tick - * SPDX-FileContributor: Project Tick - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (C) 2026 Project Tick - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "archive/ExtractZipTask.h" - -#include -#include -#include -#include - -#include "MMCZip.h" - -namespace MMCZip -{ - ExtractZipTask::ExtractZipTask(QString input, QDir outputDir, - QString subdirectory, QObject* parent) - : Task(parent), m_input(std::move(input)), - m_outputDir(std::move(outputDir)), - m_subdirectory(std::move(subdirectory)) - { - } - - void ExtractZipTask::executeTask() - { - setStatus(tr("Extracting files...")); - setProgress(0, 0); - - m_future = QtConcurrent::run(QThreadPool::globalInstance(), - [this]() { return extractZip(); }); - connect(&m_watcher, &QFutureWatcher::finished, this, - &ExtractZipTask::finish); - m_watcher.setFuture(m_future); - } - - bool ExtractZipTask::abort() - { - if (m_future.isRunning()) { - m_cancelled.store(true); - /* The worker cleans up what it already wrote and returns; - * finish() is what turns that into an abort. */ - return true; - } - return false; - } - - void ExtractZipTask::reportStatus(const QString& status) - { - QMetaObject::invokeMethod( - this, [this, status] { setStatus(status); }, Qt::QueuedConnection); - } - - void ExtractZipTask::reportProgress(qint64 current, qint64 total) - { - QMetaObject::invokeMethod( - this, [this, current, total] { setProgress(current, total); }, - Qt::QueuedConnection); - } - - auto ExtractZipTask::extractZip() -> ZipResult - { - /* Both reports come from the extracting thread, so neither may - * touch task state directly. See the header. */ - ExtractReporting reporting; - reporting.progress = [this](qint64 current, qint64 total) { - reportProgress(current, total); - }; - reporting.isCancelled = [this]() { return m_cancelled.load(); }; - reporting.entryStarted = [this](const QString& name) { - if (!name.isEmpty()) { - reportStatus(tr("Unpacking: %1").arg(name)); - } - }; - - const auto extracted = - extractSubDir(m_input, m_subdirectory, m_outputDir.absolutePath(), - reporting); - if (!extracted.has_value()) { - /* Cancellation comes back through the same "no result" door - * as a damaged archive; only we know which it was. */ - if (m_cancelled.load()) { - return ZipResult(); - } - return ZipResult( - tr("Failed to unpack %1. The archive appears to be damaged.") - .arg(QFileInfo(m_input).fileName())); - } - - m_extracted = extracted.value(); - return ZipResult(); - } - - void ExtractZipTask::finish() - { - if (m_cancelled.load()) { - emitAborted(); - return; - } - - const ZipResult result = m_future.result(); - if (result.has_value()) { - emitFailed(result.value()); - return; - } - emitSucceeded(); - } -} // namespace MMCZip diff --git a/launcher/archive/ExtractZipTask.h b/launcher/archive/ExtractZipTask.h deleted file mode 100644 index 26b7501bf..000000000 --- a/launcher/archive/ExtractZipTask.h +++ /dev/null @@ -1,102 +0,0 @@ -/* SPDX-FileCopyrightText: 2026 Project Tick - * SPDX-FileContributor: Project Tick - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (C) 2026 Project Tick - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -#include "tasks/Task.h" - -namespace MMCZip -{ - /* - * Unpacking an archive, off the UI thread, with a progress bar and a - * way out. - * - * The modpack importer used to hand MMCZip::extractSubDir() to - * QtConcurrent::run() and watch the future: the work did happen in - * the background, but nothing came back until it was over. A - * multi-gigabyte pack looked like a frozen "Extracting modpack" - * label with a bar that never moved, and pressing the dialog's abort - * button did nothing at all, because there was nothing to press it - * against. - * - * `subdirectory` is a prefix inside the archive; only entries under - * it are written out, with the prefix removed. Empty means the whole - * archive - which is what the formats that ship their files at the - * root need. - */ - class ExtractZipTask : public Task - { - Q_OBJECT - public: - ExtractZipTask(QString input, QDir outputDir, - QString subdirectory = QString(), - QObject* parent = nullptr); - ~ExtractZipTask() override = default; - - /* The absolute paths of everything that was written. Only - * meaningful after the task succeeded. */ - QStringList extractedFiles() const - { - return m_extracted; - } - - bool canAbort() const override - { - return true; - } - bool abort() override; - - protected: - void executeTask() override; - - private: - /* Empty on success, the reason on failure. */ - using ZipResult = std::optional; - - ZipResult extractZip(); - void finish(); - - /* See ExportToZipTask: the unpacking runs on a worker thread, - * and task state may only be touched on the thread the task - * lives on. */ - void reportStatus(const QString& status); - void reportProgress(qint64 current, qint64 total); - - QString m_input; - QDir m_outputDir; - QString m_subdirectory; - QStringList m_extracted; - - /* See ExportToZipTask: the future from QtConcurrent::run() cannot - * be cancelled, so the flag has to be ours. */ - std::atomic m_cancelled{false}; - - QFuture m_future; - QFutureWatcher m_watcher; - }; -} // namespace MMCZip diff --git a/launcher/backup/CMakeLists.txt b/launcher/backup/CMakeLists.txt new file mode 100644 index 000000000..7bd83abea --- /dev/null +++ b/launcher/backup/CMakeLists.txt @@ -0,0 +1,7 @@ +# Instance backup snapshots (was the BackupSystem .mmco plugin) +target_sources(MeshMC_logic PRIVATE + BackupManager.h + BackupManager.cpp + BackupTask.h + BackupTask.cpp +) diff --git a/launcher/icons/CMakeLists.txt b/launcher/icons/CMakeLists.txt new file mode 100644 index 000000000..26fa475d5 --- /dev/null +++ b/launcher/icons/CMakeLists.txt @@ -0,0 +1,10 @@ +# Icon interface +target_sources(MeshMC_logic PRIVATE + # Icons System and related code + MMCIcon.h + MMCIcon.cpp + IconList.h + IconList.cpp + IconUtils.h + IconUtils.cpp +) diff --git a/launcher/java/CMakeLists.txt b/launcher/java/CMakeLists.txt new file mode 100644 index 000000000..18dbf6455 --- /dev/null +++ b/launcher/java/CMakeLists.txt @@ -0,0 +1,16 @@ +target_sources(MeshMC_logic PRIVATE + JavaChecker.h + JavaChecker.cpp + JavaCheckerJob.h + JavaCheckerJob.cpp + JavaInstall.h + JavaInstall.cpp + JavaInstallList.h + JavaInstallList.cpp + JavaUtils.h + JavaUtils.cpp + JavaVersion.h + JavaVersion.cpp +) + +add_subdirectory(download) diff --git a/launcher/java/download/CMakeLists.txt b/launcher/java/download/CMakeLists.txt new file mode 100644 index 000000000..170d31cf5 --- /dev/null +++ b/launcher/java/download/CMakeLists.txt @@ -0,0 +1,7 @@ +if(NOT MeshMC_DISABLE_JAVA_DOWNLOADER) + target_sources(MeshMC_logic PRIVATE + JavaRuntime.h + JavaDownloadTask.h + JavaDownloadTask.cpp + ) +endif() diff --git a/launcher/launch/CMakeLists.txt b/launcher/launch/CMakeLists.txt new file mode 100644 index 000000000..8822e5513 --- /dev/null +++ b/launcher/launch/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(MeshMC_logic PRIVATE + LaunchStep.cpp + LaunchStep.h + LaunchTask.cpp + LaunchTask.h + LogModel.cpp + LogModel.h +) + +add_subdirectory(steps) diff --git a/launcher/launch/steps/CMakeLists.txt b/launcher/launch/steps/CMakeLists.txt new file mode 100644 index 000000000..686eafdc7 --- /dev/null +++ b/launcher/launch/steps/CMakeLists.txt @@ -0,0 +1,16 @@ +target_sources(MeshMC_logic PRIVATE + CheckJava.cpp + CheckJava.h + CreateBackup.cpp + CreateBackup.h + LookupServerAddress.cpp + LookupServerAddress.h + PostLaunchCommand.cpp + PostLaunchCommand.h + PreLaunchCommand.cpp + PreLaunchCommand.h + TextPrint.cpp + TextPrint.h + Update.cpp + Update.h +) diff --git a/launcher/meta/CMakeLists.txt b/launcher/meta/CMakeLists.txt new file mode 100644 index 000000000..e6aceafce --- /dev/null +++ b/launcher/meta/CMakeLists.txt @@ -0,0 +1,13 @@ +target_sources(MeshMC_logic PRIVATE + # Metadata sources + JsonFormat.cpp + JsonFormat.h + BaseEntity.cpp + BaseEntity.h + VersionList.cpp + VersionList.h + Version.cpp + Version.h + Index.cpp + Index.h +) diff --git a/launcher/minecraft/CMakeLists.txt b/launcher/minecraft/CMakeLists.txt new file mode 100644 index 000000000..936e07b6b --- /dev/null +++ b/launcher/minecraft/CMakeLists.txt @@ -0,0 +1,64 @@ +# Support for Minecraft instances and launch +target_sources(MeshMC_logic PRIVATE + GradleSpecifier.h + MinecraftInstance.cpp + MinecraftInstance.h + LaunchProfile.cpp + LaunchProfile.h + Component.cpp + Component.h + PackProfile.cpp + PackProfile.h + ComponentUpdateTask.cpp + ComponentUpdateTask.h + MinecraftLoadAndCheck.h + MinecraftLoadAndCheck.cpp + MinecraftUpdate.h + MinecraftUpdate.cpp + MojangVersionFormat.cpp + MojangVersionFormat.h + Rule.cpp + Rule.h + OneSixVersionFormat.cpp + OneSixVersionFormat.h + OpSys.cpp + OpSys.h + ParseUtils.cpp + ParseUtils.h + ProfileUtils.cpp + ProfileUtils.h + ShortcutUtils.cpp + ShortcutUtils.h + Library.cpp + Library.h + MojangDownloadInfo.h + VersionFile.cpp + VersionFile.h + VersionFilterData.h + VersionFilterData.cpp + World.h + World.cpp + WorldList.h + WorldList.cpp + + # Assets + AssetsUtils.h + AssetsUtils.cpp + + # Local skin library + skins/SkinEntry.cpp + skins/SkinEntry.h + skins/SkinLibrary.cpp + skins/SkinLibrary.h + skins/ProfileSkinImport.cpp + skins/ProfileSkinImport.h +) + +add_subdirectory(auth) +add_subdirectory(gameoptions) +add_subdirectory(update) +add_subdirectory(launch) +add_subdirectory(legacy) +add_subdirectory(mod) +add_subdirectory(services) +add_subdirectory(skins) diff --git a/launcher/minecraft/auth/CMakeLists.txt b/launcher/minecraft/auth/CMakeLists.txt new file mode 100644 index 000000000..401b845d1 --- /dev/null +++ b/launcher/minecraft/auth/CMakeLists.txt @@ -0,0 +1,21 @@ +target_sources(MeshMC_logic PRIVATE + AccountData.cpp + AccountData.h + AccountList.cpp + AccountList.h + AccountTask.cpp + AccountTask.h + AuthRequest.cpp + AuthRequest.h + AuthSession.cpp + AuthSession.h + AuthStep.cpp + AuthStep.h + MinecraftAccount.cpp + MinecraftAccount.h + Parsers.cpp + Parsers.h +) + +add_subdirectory(flows) +add_subdirectory(steps) diff --git a/launcher/minecraft/auth/flows/CMakeLists.txt b/launcher/minecraft/auth/flows/CMakeLists.txt new file mode 100644 index 000000000..a4880d89e --- /dev/null +++ b/launcher/minecraft/auth/flows/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(MeshMC_logic PRIVATE + AuthFlow.cpp + AuthFlow.h + MSA.cpp + MSA.h +) diff --git a/launcher/minecraft/auth/steps/CMakeLists.txt b/launcher/minecraft/auth/steps/CMakeLists.txt new file mode 100644 index 000000000..ca6b844cb --- /dev/null +++ b/launcher/minecraft/auth/steps/CMakeLists.txt @@ -0,0 +1,18 @@ +target_sources(MeshMC_logic PRIVATE + EntitlementsStep.cpp + EntitlementsStep.h + GetSkinStep.cpp + GetSkinStep.h + MeshMCLoginStep.cpp + MeshMCLoginStep.h + MinecraftProfileStep.cpp + MinecraftProfileStep.h + MSAStep.cpp + MSAStep.h + XboxAuthorizationStep.cpp + XboxAuthorizationStep.h + XboxProfileStep.cpp + XboxProfileStep.h + XboxUserStep.cpp + XboxUserStep.h +) diff --git a/launcher/minecraft/gameoptions/CMakeLists.txt b/launcher/minecraft/gameoptions/CMakeLists.txt new file mode 100644 index 000000000..d047d77f6 --- /dev/null +++ b/launcher/minecraft/gameoptions/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(MeshMC_logic PRIVATE + GameOptions.h + GameOptions.cpp +) diff --git a/launcher/minecraft/launch/CMakeLists.txt b/launcher/minecraft/launch/CMakeLists.txt new file mode 100644 index 000000000..fb8661f81 --- /dev/null +++ b/launcher/minecraft/launch/CMakeLists.txt @@ -0,0 +1,24 @@ +target_sources(MeshMC_logic PRIVATE + ClaimAccount.cpp + ClaimAccount.h + CreateGameFolders.cpp + CreateGameFolders.h + ModMinecraftJar.cpp + ModMinecraftJar.h + DirectJavaLaunch.cpp + DirectJavaLaunch.h + ExtractNatives.cpp + ExtractNatives.h + MeshMCPartLaunch.cpp + MeshMCPartLaunch.h + MinecraftServerTarget.cpp + MinecraftServerTarget.h + PrintInstanceInfo.cpp + PrintInstanceInfo.h + ReconstructAssets.cpp + ReconstructAssets.h + ScanModFolders.cpp + ScanModFolders.h + VerifyJavaInstall.cpp + VerifyJavaInstall.h +) \ No newline at end of file diff --git a/launcher/minecraft/legacy/CMakeLists.txt b/launcher/minecraft/legacy/CMakeLists.txt new file mode 100644 index 000000000..18006483f --- /dev/null +++ b/launcher/minecraft/legacy/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(MeshMC_logic PRIVATE + LegacyModList.h + LegacyModList.cpp + LegacyInstance.h + LegacyInstance.cpp + LegacyUpgradeTask.h + LegacyUpgradeTask.cpp +) diff --git a/launcher/minecraft/mod/CMakeLists.txt b/launcher/minecraft/mod/CMakeLists.txt new file mode 100644 index 000000000..58c605551 --- /dev/null +++ b/launcher/minecraft/mod/CMakeLists.txt @@ -0,0 +1,25 @@ +target_sources(MeshMC_logic PRIVATE + Mod.h + Mod.cpp + ModDetails.h + ModFolderModel.h + ModFolderModel.cpp + ModFolderLoadTask.h + ModFolderLoadTask.cpp + LocalModParseTask.h + LocalModParseTask.cpp + ModMetadataIndex.h + ModMetadataIndex.cpp + PackwizSidecar.h + PackwizSidecar.cpp + PackLayout.h + PackLayout.cpp + ResourcePackFolderModel.h + ResourcePackFolderModel.cpp + TexturePackFolderModel.h + TexturePackFolderModel.cpp + ShaderPackFolderModel.h + ShaderPackFolderModel.cpp + DataPackFolderModel.h + DataPackFolderModel.cpp +) diff --git a/launcher/minecraft/services/CMakeLists.txt b/launcher/minecraft/services/CMakeLists.txt new file mode 100644 index 000000000..3d09a6f17 --- /dev/null +++ b/launcher/minecraft/services/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(MeshMC_logic PRIVATE + # Minecraft services + CapeChange.cpp + CapeChange.h + SkinUpload.cpp + SkinUpload.h + SkinDelete.cpp + SkinDelete.h +) diff --git a/launcher/minecraft/skins/CMakeLists.txt b/launcher/minecraft/skins/CMakeLists.txt new file mode 100644 index 000000000..9676f3cb5 --- /dev/null +++ b/launcher/minecraft/skins/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(MeshMC_logic PRIVATE + # Local skin library + SkinEntry.cpp + SkinEntry.h + SkinLibrary.cpp + SkinLibrary.h + ProfileSkinImport.cpp + ProfileSkinImport.h +) diff --git a/launcher/minecraft/update/CMakeLists.txt b/launcher/minecraft/update/CMakeLists.txt new file mode 100644 index 000000000..ffeffda16 --- /dev/null +++ b/launcher/minecraft/update/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(MeshMC_logic PRIVATE + AssetUpdateTask.h + AssetUpdateTask.cpp + FMLLibrariesTask.cpp + FMLLibrariesTask.h + FoldersTask.cpp + FoldersTask.h + LibrariesTask.cpp + LibrariesTask.h +) diff --git a/launcher/modplatform/CMakeLists.txt b/launcher/modplatform/CMakeLists.txt new file mode 100644 index 000000000..565e86f23 --- /dev/null +++ b/launcher/modplatform/CMakeLists.txt @@ -0,0 +1,30 @@ +target_sources(MeshMC_logic PRIVATE + ContentApi.h + ManagedPackVersions.h + ManagedPackVersions.cpp + PackContents.h + PackContents.cpp + VersionPicker.h + VersionPicker.cpp + ContentProviderModel.h + ContentProviderModel.cpp + ContentListExport.h + ContentListExport.cpp + ContentType.h + ModDownloadTypes.h + DependencyResolver.h + DependencyResolver.cpp + ContentDownloadTask.h + ContentDownloadTask.cpp + ModInstallConflictAnalyzer.h + ModInstallConflictAnalyzer.cpp + ModUpdateCheckTask.h + ModUpdateCheckTask.cpp +) + +add_subdirectory(atlauncher) +add_subdirectory(flame) +add_subdirectory(legacy_ftb) +add_subdirectory(modpacksch) +add_subdirectory(modrinth) +add_subdirectory(technic) diff --git a/launcher/modplatform/atlauncher/CMakeLists.txt b/launcher/modplatform/atlauncher/CMakeLists.txt new file mode 100644 index 000000000..4b23e6493 --- /dev/null +++ b/launcher/modplatform/atlauncher/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(MeshMC_logic PRIVATE + ATLPackIndex.cpp + ATLPackIndex.h + ATLPackInstallTask.cpp + ATLPackInstallTask.h + ATLPackManifest.cpp + ATLPackManifest.h +) diff --git a/launcher/modplatform/flame/CMakeLists.txt b/launcher/modplatform/flame/CMakeLists.txt new file mode 100644 index 000000000..4f09cd222 --- /dev/null +++ b/launcher/modplatform/flame/CMakeLists.txt @@ -0,0 +1,19 @@ +target_sources(MeshMC_logic PRIVATE + # Flame + FlamePackIndex.cpp + FlamePackIndex.h + PackManifest.h + PackManifest.cpp + FileResolvingTask.h + FileResolvingTask.cpp + FlameContentModel.h + FlameContentModel.cpp + FlameApi.h + FlameApi.cpp + # The file identifier CurseForge looks files up by, and the export + # that has to compute it to name a mod instead of shipping it. + FlameFingerprint.h + FlameFingerprint.cpp + FlamePackExportTask.h + FlamePackExportTask.cpp +) diff --git a/launcher/modplatform/flame/FlamePackExportTask.cpp b/launcher/modplatform/flame/FlamePackExportTask.cpp index 7a4324621..e497aaf6f 100644 --- a/launcher/modplatform/flame/FlamePackExportTask.cpp +++ b/launcher/modplatform/flame/FlamePackExportTask.cpp @@ -32,7 +32,7 @@ #include #include -#include "archive/ExportToZipTask.h" +#include "MMCZip.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" #include "minecraft/mod/ModMetadataIndex.h" diff --git a/launcher/modplatform/legacy_ftb/CMakeLists.txt b/launcher/modplatform/legacy_ftb/CMakeLists.txt new file mode 100644 index 000000000..198825261 --- /dev/null +++ b/launcher/modplatform/legacy_ftb/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(MeshMC_logic PRIVATE + PackFetchTask.h + PackFetchTask.cpp + PackInstallTask.h + PackInstallTask.cpp + PrivatePackManager.h + PrivatePackManager.cpp + + PackHelpers.h +) diff --git a/launcher/modplatform/modpacksch/CMakeLists.txt b/launcher/modplatform/modpacksch/CMakeLists.txt new file mode 100644 index 000000000..b8b81a947 --- /dev/null +++ b/launcher/modplatform/modpacksch/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(MeshMC_logic PRIVATE + FTBPackInstallTask.h + FTBPackInstallTask.cpp + FTBPackManifest.h + FTBPackManifest.cpp +) diff --git a/launcher/modplatform/modrinth/CMakeLists.txt b/launcher/modplatform/modrinth/CMakeLists.txt new file mode 100644 index 000000000..8ea80b13e --- /dev/null +++ b/launcher/modplatform/modrinth/CMakeLists.txt @@ -0,0 +1,12 @@ +target_sources(MeshMC_logic PRIVATE + ModrinthPackIndex.cpp + ModrinthPackIndex.h + ModrinthPackManifest.cpp + ModrinthPackManifest.h + ModrinthContentModel.h + ModrinthContentModel.cpp + ModrinthApi.h + ModrinthApi.cpp + ModrinthPackExportTask.h + ModrinthPackExportTask.cpp +) diff --git a/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp b/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp index 84e7df2a6..6af9d1812 100644 --- a/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp @@ -36,7 +36,7 @@ #include #include "Application.h" -#include "archive/ExportToZipTask.h" +#include "MMCZip.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" #include "minecraft/mod/ModMetadataIndex.h" diff --git a/launcher/modplatform/technic/CMakeLists.txt b/launcher/modplatform/technic/CMakeLists.txt new file mode 100644 index 000000000..eeea81fd6 --- /dev/null +++ b/launcher/modplatform/technic/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(MeshMC_logic PRIVATE + SingleZipPackInstallTask.h + SingleZipPackInstallTask.cpp + SolderPackInstallTask.h + SolderPackInstallTask.cpp + TechnicPackProcessor.h + TechnicPackProcessor.cpp +) diff --git a/launcher/mojang/CMakeLists.txt b/launcher/mojang/CMakeLists.txt new file mode 100644 index 000000000..f53ef3ccd --- /dev/null +++ b/launcher/mojang/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(MeshMC_logic PRIVATE + PackageManifest.h + PackageManifest.cpp +) diff --git a/launcher/net/CMakeLists.txt b/launcher/net/CMakeLists.txt new file mode 100644 index 000000000..6a7ac2a80 --- /dev/null +++ b/launcher/net/CMakeLists.txt @@ -0,0 +1,29 @@ +target_sources(MeshMC_logic PRIVATE + # network stuffs + ByteArraySink.h + ChecksumValidator.h + Download.cpp + Download.h + FileSink.cpp + FileSink.h + HttpMetaCache.cpp + HttpMetaCache.h + MetaCacheSink.cpp + MetaCacheSink.h + NetAction.h + NetJob.cpp + NetJob.h + # The one API question that does not fit in a URL, and so cannot be a + # Net::Download. See JsonPost.h. + JsonPost.cpp + JsonPost.h + PasteUpload.cpp + PasteUpload.h + Sink.h + Validator.h +) + +add_unit_test(FileSink + SOURCES FileSink_test.cpp + LIBS MeshMC_logic + ) \ No newline at end of file diff --git a/launcher/news/CMakeLists.txt b/launcher/news/CMakeLists.txt new file mode 100644 index 000000000..3367ac327 --- /dev/null +++ b/launcher/news/CMakeLists.txt @@ -0,0 +1,8 @@ +# Backend for the news bar... there's usually no news. +target_sources(MeshMC_logic PRIVATE + # News System + NewsChecker.h + NewsChecker.cpp + NewsEntry.h + NewsEntry.cpp +) diff --git a/launcher/notifications/CMakeLists.txt b/launcher/notifications/CMakeLists.txt new file mode 100644 index 000000000..17e4ee543 --- /dev/null +++ b/launcher/notifications/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(MeshMC_logic PRIVATE + # Notifications - short warning messages + NotificationChecker.h + NotificationChecker.cpp +) diff --git a/launcher/pathmatcher/CMakeLists.txt b/launcher/pathmatcher/CMakeLists.txt new file mode 100644 index 000000000..6dd81b5f5 --- /dev/null +++ b/launcher/pathmatcher/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(MeshMC_logic PRIVATE + # Path matchers + FSTreeMatcher.h + IPathMatcher.h + MultiMatcher.h + RegexpMatcher.h +) diff --git a/launcher/plugin/CMakeLists.txt b/launcher/plugin/CMakeLists.txt new file mode 100644 index 000000000..3aa9fd905 --- /dev/null +++ b/launcher/plugin/CMakeLists.txt @@ -0,0 +1,18 @@ +target_sources(MeshMC_logic PRIVATE + # MMCO Plugin System + MMCOFormat.h + PluginHooks.h + PluginAPI.h + PluginMetadata.h + CoreSupersededPlugins.h + PluginLoader.h + PluginLoader.cpp + PluginManager.h + PluginManager.cpp + PluginHookTask.h + PluginHookTask.cpp + PluginSignature.h + PluginSignature.cpp + PluginDependencyResolver.h + PluginDependencyResolver.cpp +) diff --git a/launcher/resources/CMakeLists.txt b/launcher/resources/CMakeLists.txt new file mode 100644 index 000000000..065578214 --- /dev/null +++ b/launcher/resources/CMakeLists.txt @@ -0,0 +1,18 @@ +target_sources(MeshMC_logic PRIVATE + # Bundled resources + backgrounds/backgrounds.qrc + multimc/multimc.qrc + pe_dark/pe_dark.qrc + pe_light/pe_light.qrc + pe_colored/pe_colored.qrc + pe_blue/pe_blue.qrc + OSX/OSX.qrc + iOS/iOS.qrc + flat/flat.qrc + flat_white/flat_white.qrc + documents/documents.qrc + breeze_dark/breeze_dark.qrc + breeze_light/breeze_light.qrc + shaders/shaders.qrc + meshmc/meshmc.qrc +) diff --git a/launcher/screenshots/CMakeLists.txt b/launcher/screenshots/CMakeLists.txt new file mode 100644 index 000000000..92a76106f --- /dev/null +++ b/launcher/screenshots/CMakeLists.txt @@ -0,0 +1,8 @@ +# the screenshots feature +target_sources(MeshMC_logic PRIVATE + Screenshot.h + ImgurUpload.h + ImgurUpload.cpp + ImgurAlbumCreation.h + ImgurAlbumCreation.cpp +) diff --git a/launcher/settings/CMakeLists.txt b/launcher/settings/CMakeLists.txt new file mode 100644 index 000000000..930b3c3fa --- /dev/null +++ b/launcher/settings/CMakeLists.txt @@ -0,0 +1,15 @@ +target_sources(MeshMC_logic PRIVATE + # Settings + INIFile.cpp + INIFile.h + INISettingsObject.cpp + INISettingsObject.h + OverrideSetting.cpp + OverrideSetting.h + PassthroughSetting.cpp + PassthroughSetting.h + Setting.cpp + Setting.h + SettingsObject.cpp + SettingsObject.h +) diff --git a/launcher/tasks/CMakeLists.txt b/launcher/tasks/CMakeLists.txt new file mode 100644 index 000000000..9a978c30d --- /dev/null +++ b/launcher/tasks/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(MeshMC_logic PRIVATE + # Tasks + Task.h + Task.cpp + ConcurrentTask.h + ConcurrentTask.cpp + SequentialTask.h + SequentialTask.cpp +) diff --git a/launcher/tools/CMakeLists.txt b/launcher/tools/CMakeLists.txt new file mode 100644 index 000000000..e04aa5b74 --- /dev/null +++ b/launcher/tools/CMakeLists.txt @@ -0,0 +1,13 @@ +target_sources(MeshMC_logic PRIVATE + # Tools + BaseExternalTool.cpp + BaseExternalTool.h + BaseProfiler.cpp + BaseProfiler.h + JProfiler.cpp + JProfiler.h + JVisualVM.cpp + JVisualVM.h + MCEditTool.cpp + MCEditTool.h +) diff --git a/launcher/translations/CMakeLists.txt b/launcher/translations/CMakeLists.txt new file mode 100644 index 000000000..9c2f0eeec --- /dev/null +++ b/launcher/translations/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(MeshMC_logic PRIVATE + TranslationsModel.h + TranslationsModel.cpp + POTranslator.h + POTranslator.cpp +) diff --git a/launcher/ui/CMakeLists.txt b/launcher/ui/CMakeLists.txt new file mode 100644 index 000000000..2c5df3164 --- /dev/null +++ b/launcher/ui/CMakeLists.txt @@ -0,0 +1,23 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - windows + GuiUtil.h + GuiUtil.cpp + ColorCache.h + ColorCache.cpp + MainWindow.h + MainWindow.cpp + MainWindow.ui + MacMenuBar.h + MacMenuBar.cpp + InstanceWindow.h + InstanceWindow.cpp +) + +add_subdirectory(setupwizard) +add_subdirectory(themes) +add_subdirectory(pagedialog) +add_subdirectory(pages) +add_subdirectory(dialogs) +add_subdirectory(widgets) +add_subdirectory(instanceview) + diff --git a/launcher/ui/dialogs/CMakeLists.txt b/launcher/ui/dialogs/CMakeLists.txt new file mode 100644 index 000000000..c04677e8c --- /dev/null +++ b/launcher/ui/dialogs/CMakeLists.txt @@ -0,0 +1,84 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - dialogs + AboutDialog.cpp + AboutDialog.h + AboutDialog.ui + BlockedModsDialog.cpp + BlockedModsDialog.h + ProfileSelectDialog.cpp + ProfileSelectDialog.h + ProfileSelectDialog.ui + ProfileSetupDialog.cpp + ProfileSetupDialog.h + ProfileSetupDialog.ui + CopyInstanceDialog.cpp + CopyInstanceDialog.h + CopyInstanceDialog.ui + CreateShortcutDialog.cpp + CreateShortcutDialog.h + CreateShortcutDialog.ui + CustomMessageBox.cpp + CustomMessageBox.h + EditAccountDialog.cpp + EditAccountDialog.h + EditAccountDialog.ui + ExportInstanceDialog.cpp + ExportInstanceDialog.h + ExportInstanceDialog.ui + ExportPackDialog.cpp + ExportPackDialog.h + ExportPackDialog.ui + IconPickerDialog.cpp + IconPickerDialog.h + IconPickerDialog.ui + InstallLoaderDialog.cpp + InstallLoaderDialog.h + MSALoginDialog.cpp + MSALoginDialog.h + MSALoginDialog.ui + NewComponentDialog.cpp + NewComponentDialog.h + NewComponentDialog.ui + NewInstanceDialog.cpp + NewInstanceDialog.h + NewInstanceDialog.ui + NewsViewerDialog.cpp + NewsViewerDialog.h + NotificationDialog.cpp + NotificationDialog.h + NotificationDialog.ui + PluginsDialog.cpp + PluginsDialog.h + PluginsDialog.ui + ProgressDialog.cpp + ProgressDialog.h + ProgressDialog.ui + UpdateAvailableDialog.cpp + UpdateAvailableDialog.h + UpdateAvailableDialog.ui + VersionSelectDialog.cpp + VersionSelectDialog.h + DownloadContentDialog.cpp + DownloadContentDialog.h + DownloadSummaryDialog.cpp + DownloadSummaryDialog.h + ModUpdateDialog.cpp + ModUpdateDialog.h + ExportListDialog.cpp + ExportListDialog.h + MeshMCLogsDialog.cpp + MeshMCLogsDialog.h + MeshMCLogsDialog.ui + UntrustedModsDialog.cpp + UntrustedModsDialog.h + UntrustedModsDialog.ui +) + +if(NOT MeshMC_DISABLE_JAVA_DOWNLOADER) + target_sources(MeshMC_logic PRIVATE + JavaDownloadDialog.cpp + JavaDownloadDialog.h + ) +endif() + +add_subdirectory(skins) diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp index 8ad974098..b3ca880c2 100644 --- a/launcher/ui/dialogs/ExportInstanceDialog.cpp +++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp @@ -40,7 +40,6 @@ #include "Application.h" #include "FileIgnoreProxy.h" -#include "archive/ExportToZipTask.h" #include "ui/dialogs/CustomMessageBox.h" #include "ui/dialogs/ProgressDialog.h" diff --git a/launcher/ui/dialogs/skins/CMakeLists.txt b/launcher/ui/dialogs/skins/CMakeLists.txt new file mode 100644 index 000000000..a96cab3e4 --- /dev/null +++ b/launcher/ui/dialogs/skins/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(MeshMC_logic PRIVATE + SkinManageDialog.cpp + SkinManageDialog.h + SkinManageDialog.ui +) + +add_subdirectory(render) diff --git a/launcher/ui/dialogs/skins/render/CMakeLists.txt b/launcher/ui/dialogs/skins/render/CMakeLists.txt new file mode 100644 index 000000000..fdb4846b3 --- /dev/null +++ b/launcher/ui/dialogs/skins/render/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(MeshMC_logic PRIVATE + CubeMesh.cpp + CubeMesh.h + PlayerScene.cpp + PlayerScene.h + SkinPreviewSurface.cpp + SkinPreviewSurface.h +) diff --git a/launcher/ui/instanceview/CMakeLists.txt b/launcher/ui/instanceview/CMakeLists.txt new file mode 100644 index 000000000..28141d2bb --- /dev/null +++ b/launcher/ui/instanceview/CMakeLists.txt @@ -0,0 +1,14 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - instance group view + InstanceProxyModel.cpp + InstanceProxyModel.h + AccessibleInstanceView.cpp + AccessibleInstanceView.h + AccessibleInstanceView_p.h + InstanceView.cpp + InstanceView.h + InstanceDelegate.cpp + InstanceDelegate.h + VisualGroup.cpp + VisualGroup.h +) diff --git a/launcher/ui/pagedialog/CMakeLists.txt b/launcher/ui/pagedialog/CMakeLists.txt new file mode 100644 index 000000000..ef5ce4909 --- /dev/null +++ b/launcher/ui/pagedialog/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(MeshMC_logic PRIVATE + PageDialog.cpp + PageDialog.h +) diff --git a/launcher/ui/pages/CMakeLists.txt b/launcher/ui/pages/CMakeLists.txt new file mode 100644 index 000000000..1866cc848 --- /dev/null +++ b/launcher/ui/pages/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - paged dialog base + BasePage.h + BasePageContainer.h + BasePageProvider.h +) + +add_subdirectory(global) +add_subdirectory(instance) +add_subdirectory(modplatform) diff --git a/launcher/ui/pages/global/CMakeLists.txt b/launcher/ui/pages/global/CMakeLists.txt new file mode 100644 index 000000000..2567fba29 --- /dev/null +++ b/launcher/ui/pages/global/CMakeLists.txt @@ -0,0 +1,31 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - global settings pages + AccountListPage.cpp + AccountListPage.h + AccountListPage.ui + AppearancePage.cpp + AppearancePage.h + AppearancePage.ui + CustomCommandsPage.cpp + CustomCommandsPage.h + ExternalToolsPage.cpp + ExternalToolsPage.h + ExternalToolsPage.ui + JavaPage.cpp + JavaPage.h + JavaPage.ui + LanguagePage.cpp + LanguagePage.h + MinecraftPage.cpp + MinecraftPage.h + MinecraftPage.ui + MeshMCPage.cpp + MeshMCPage.h + MeshMCPage.ui + ProxyPage.cpp + ProxyPage.h + ProxyPage.ui + PasteEEPage.cpp + PasteEEPage.h + PasteEEPage.ui +) diff --git a/launcher/ui/pages/instance/CMakeLists.txt b/launcher/ui/pages/instance/CMakeLists.txt new file mode 100644 index 000000000..ae4a58495 --- /dev/null +++ b/launcher/ui/pages/instance/CMakeLists.txt @@ -0,0 +1,47 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - instance pages + BackupPage.cpp + BackupPage.h + BackupPage.ui + GameOptionsPage.cpp + GameOptionsPage.h + GameOptionsPage.ui + VersionPage.cpp + VersionPage.h + VersionPage.ui + TexturePackPage.h + ResourcePackPage.h + ShaderPackPage.h + DataPackPage.h + DataPackPage.cpp + ModFolderPage.cpp + ModFolderPage.h + ModFolderPage.ui + NotesPage.cpp + NotesPage.h + NotesPage.ui + LogPage.cpp + LogPage.h + LogPage.ui + InstanceSettingsPage.cpp + InstanceSettingsPage.h + InstanceSettingsPage.ui + ScreenshotsPage.cpp + ScreenshotsPage.h + ScreenshotsPage.ui + OtherLogsPage.cpp + OtherLogsPage.h + OtherLogsPage.ui + ServersPage.cpp + ServersPage.h + ServersPage.ui + LegacyUpgradePage.cpp + LegacyUpgradePage.h + LegacyUpgradePage.ui + ManagedPackPage.cpp + ManagedPackPage.h + ManagedPackPage.ui + WorldListPage.cpp + WorldListPage.h + WorldListPage.ui +) diff --git a/launcher/ui/pages/modplatform/CMakeLists.txt b/launcher/ui/pages/modplatform/CMakeLists.txt new file mode 100644 index 000000000..417633332 --- /dev/null +++ b/launcher/ui/pages/modplatform/CMakeLists.txt @@ -0,0 +1,21 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - platform pages + VanillaPage.cpp + VanillaPage.h + VanillaPage.ui + + ContentProviderPage.cpp + ContentProviderPage.h + ContentProviderPage.ui + + ImportPage.cpp + ImportPage.h + ImportPage.ui +) + +add_subdirectory(atlauncher) +add_subdirectory(flame) +add_subdirectory(ftb) +add_subdirectory(legacy_ftb) +add_subdirectory(modrinth) +add_subdirectory(technic) diff --git a/launcher/ui/pages/modplatform/atlauncher/CMakeLists.txt b/launcher/ui/pages/modplatform/atlauncher/CMakeLists.txt new file mode 100644 index 000000000..e33ee37aa --- /dev/null +++ b/launcher/ui/pages/modplatform/atlauncher/CMakeLists.txt @@ -0,0 +1,12 @@ +target_sources(MeshMC_logic PRIVATE + AtlFilterModel.cpp + AtlFilterModel.h + AtlListModel.cpp + AtlListModel.h + AtlOptionalModDialog.cpp + AtlOptionalModDialog.h + AtlOptionalModDialog.ui + AtlPage.cpp + AtlPage.h + AtlPage.ui +) diff --git a/launcher/ui/pages/modplatform/flame/CMakeLists.txt b/launcher/ui/pages/modplatform/flame/CMakeLists.txt new file mode 100644 index 000000000..7381289b6 --- /dev/null +++ b/launcher/ui/pages/modplatform/flame/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(MeshMC_logic PRIVATE + FlameModel.cpp + FlameModel.h + FlamePage.cpp + FlamePage.h + FlamePage.ui +) diff --git a/launcher/ui/pages/modplatform/ftb/CMakeLists.txt b/launcher/ui/pages/modplatform/ftb/CMakeLists.txt new file mode 100644 index 000000000..434e9573d --- /dev/null +++ b/launcher/ui/pages/modplatform/ftb/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(MeshMC_logic PRIVATE + FtbFilterModel.cpp + FtbFilterModel.h + FtbListModel.cpp + FtbListModel.h + FtbPage.cpp + FtbPage.h + FtbPage.ui +) diff --git a/launcher/ui/pages/modplatform/legacy_ftb/CMakeLists.txt b/launcher/ui/pages/modplatform/legacy_ftb/CMakeLists.txt new file mode 100644 index 000000000..4ab4c10a5 --- /dev/null +++ b/launcher/ui/pages/modplatform/legacy_ftb/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(MeshMC_logic PRIVATE + Page.cpp + Page.h + Page.ui + ListModel.h + ListModel.cpp +) diff --git a/launcher/ui/pages/modplatform/modrinth/CMakeLists.txt b/launcher/ui/pages/modplatform/modrinth/CMakeLists.txt new file mode 100644 index 000000000..238e6313b --- /dev/null +++ b/launcher/ui/pages/modplatform/modrinth/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(MeshMC_logic PRIVATE + ModrinthModel.cpp + ModrinthModel.h + ModrinthPage.cpp + ModrinthPage.h + ModrinthPage.ui +) diff --git a/launcher/ui/pages/modplatform/technic/CMakeLists.txt b/launcher/ui/pages/modplatform/technic/CMakeLists.txt new file mode 100644 index 000000000..ff10edb51 --- /dev/null +++ b/launcher/ui/pages/modplatform/technic/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(MeshMC_logic PRIVATE + TechnicModel.cpp + TechnicModel.h + TechnicPage.cpp + TechnicPage.h + TechnicPage.ui +) diff --git a/launcher/ui/setupwizard/CMakeLists.txt b/launcher/ui/setupwizard/CMakeLists.txt new file mode 100644 index 000000000..c33ee28e7 --- /dev/null +++ b/launcher/ui/setupwizard/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - setup wizard + SetupWizard.h + SetupWizard.cpp + BaseWizardPage.h + JavaWizardPage.cpp + JavaWizardPage.h + LanguageWizardPage.cpp + LanguageWizardPage.h +) diff --git a/launcher/ui/themes/CMakeLists.txt b/launcher/ui/themes/CMakeLists.txt new file mode 100644 index 000000000..6c508af40 --- /dev/null +++ b/launcher/ui/themes/CMakeLists.txt @@ -0,0 +1,29 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - themes + FusionTheme.cpp + FusionTheme.h + BrightTheme.cpp + BrightTheme.h + GreenDarkTheme.cpp + GreenDarkTheme.h + GreenLightTheme.cpp + GreenLightTheme.h + CustomTheme.cpp + CustomTheme.h + DarkTheme.cpp + DarkTheme.h + ITheme.cpp + ITheme.h + SystemTheme.cpp + SystemTheme.h + ThemeManager.cpp + ThemeManager.h + CatPack.cpp + CatPack.h +) + +if (APPLE) + target_sources(MeshMC_logic PRIVATE + ThemeManager.mm + ) +endif() diff --git a/launcher/ui/widgets/CMakeLists.txt b/launcher/ui/widgets/CMakeLists.txt new file mode 100644 index 000000000..1469258e9 --- /dev/null +++ b/launcher/ui/widgets/CMakeLists.txt @@ -0,0 +1,55 @@ +target_sources(MeshMC_logic PRIVATE + # GUI - widgets + Common.cpp + Common.h + CustomCommands.cpp + CustomCommands.h + CustomCommands.ui + DropLabel.cpp + DropLabel.h + ErrorFrame.cpp + ErrorFrame.h + ErrorFrame.ui + FocusLineEdit.cpp + FocusLineEdit.h + IconLabel.cpp + IconLabel.h + JavaSettingsWidget.cpp + JavaSettingsWidget.h + LabeledToolButton.cpp + LabeledToolButton.h + LanguageSelectionWidget.cpp + LanguageSelectionWidget.h + LineSeparator.cpp + LineSeparator.h + LogView.cpp + LogView.h + InstanceCardWidget.ui + MCModInfoFrame.cpp + MCModInfoFrame.h + MCModInfoFrame.ui + ModListView.cpp + ModListView.h + PageContainer.cpp + PageContainer.h + PageContainer_p.h + VersionListView.cpp + VersionListView.h + VersionSelectWidget.cpp + VersionSelectWidget.h + ProgressWidget.h + ProgressWidget.cpp + ProjectItemDelegate.h + ProjectItemDelegate.cpp + ProjectDescriptionPage.h + ProjectDescriptionPage.cpp + ContentFilterWidget.h + ContentFilterWidget.cpp + CheckComboBox.h + CheckComboBox.cpp + TaskStepProgressBar.h + TaskStepProgressBar.cpp + TaskStepProgressBar.ui + WideBar.h + WideBar.cpp +) diff --git a/launcher/updater/CMakeLists.txt b/launcher/updater/CMakeLists.txt new file mode 100644 index 000000000..ad0d91c7a --- /dev/null +++ b/launcher/updater/CMakeLists.txt @@ -0,0 +1,19 @@ +target_sources(MeshMC_logic PRIVATE + ExternalUpdater.h + UpdateLockFile.h + UpdateLockFile.cpp +) + +if(APPLE) + if(MeshMC_SPARKLE_ENABLED) + target_sources(MeshMC_logic PRIVATE + MacSparkleUpdater.h + MacSparkleUpdater.mm + ) + endif() +else() + target_sources(MeshMC_logic PRIVATE + MeshMCExternalUpdater.h + MeshMCExternalUpdater.cpp + ) +endif()