diff options
50 files changed, 255 insertions, 172 deletions
@@ -3,7 +3,6 @@ Thumbs.db .user .directory resources/CMakeFiles -resources/MultiMCLauncher.jar *~ *.swp html/ diff --git a/buildconfig/BuildConfig.cpp.in b/buildconfig/BuildConfig.cpp.in index 1b223b5d..40940793 100644 --- a/buildconfig/BuildConfig.cpp.in +++ b/buildconfig/BuildConfig.cpp.in @@ -5,6 +5,16 @@ const Config BuildConfig; Config::Config() { + // Name and copyright + LAUNCHER_NAME = "@Launcher_Name@"; + LAUNCHER_DISPLAYNAME = "@Launcher_DisplayName@"; + LAUNCHER_COPYRIGHT = "@Launcher_Copyright@"; + LAUNCHER_DOMAIN = "@Launcher_Domain@"; + LAUNCHER_CONFIGFILE = "@Launcher_ConfigFile@"; + + USER_AGENT = "@Launcher_UserAgent@"; + USER_AGENT_UNCACHED = USER_AGENT + " (Uncached)"; + // Version information VERSION_MAJOR = @Launcher_VERSION_MAJOR@; VERSION_MINOR = @Launcher_VERSION_MINOR@; diff --git a/buildconfig/BuildConfig.h b/buildconfig/BuildConfig.h index 95f3ef22..641bd602 100644 --- a/buildconfig/BuildConfig.h +++ b/buildconfig/BuildConfig.h @@ -8,6 +8,12 @@ class Config { public: Config(); + QString LAUNCHER_NAME; + QString LAUNCHER_DISPLAYNAME; + QString LAUNCHER_COPYRIGHT; + QString LAUNCHER_DOMAIN; + QString LAUNCHER_CONFIGFILE; + /// The major version number. int VERSION_MAJOR; /// The minor version number. @@ -31,10 +37,13 @@ public: /// URL for the updater's channel QString UPDATER_BASE; + /// User-Agent to use. - QString USER_AGENT = "MultiMC/5.0"; + QString USER_AGENT; + /// User-Agent to use for uncached requests. - QString USER_AGENT_UNCACHED = "MultiMC/5.0 (Uncached)"; + QString USER_AGENT_UNCACHED; + /// Google analytics ID QString ANALYTICS_ID; @@ -71,7 +80,7 @@ public: QString IMGUR_CLIENT_ID; /** - * MultiMC Metadata repository URL prefix + * Metadata repository URL prefix */ QString META_URL; diff --git a/cmake/UnitTest/TestUtil.h b/cmake/UnitTest/TestUtil.h index a478bdde..ebe3c662 100644 --- a/cmake/UnitTest/TestUtil.h +++ b/cmake/UnitTest/TestUtil.h @@ -23,6 +23,6 @@ public: } }; -#define MULTIMC_GET_TEST_FILE(file) TestsInternal::readFile(QFINDTESTDATA(file)) -#define MULTIMC_GET_TEST_FILE_UTF8(file) TestsInternal::readFileUtf8(QFINDTESTDATA(file)) +#define GET_TEST_FILE(file) TestsInternal::readFile(QFINDTESTDATA(file)) +#define GET_TEST_FILE_UTF8(file) TestsInternal::readFileUtf8(QFINDTESTDATA(file)) diff --git a/cmake/UnitTest/test.manifest b/cmake/UnitTest/test.manifest index 8b4dbb98..dc5f9d8f 100644 --- a/cmake/UnitTest/test.manifest +++ b/cmake/UnitTest/test.manifest @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> - <assemblyIdentity name="MultiMC.Test.0" type="win32" version="5.0.0.0" /> + <assemblyIdentity name="Launcher.Test.0" type="win32" version="5.0.0.0" /> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> @@ -24,4 +24,4 @@ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> </application> </compatibility> -</assembly>
\ No newline at end of file +</assembly> diff --git a/cmake/UnitTest/test.rc b/cmake/UnitTest/test.rc index a288dba6..9fe4147e 100644 --- a/cmake/UnitTest/test.rc +++ b/cmake/UnitTest/test.rc @@ -17,7 +17,7 @@ BEGIN VALUE "CompanyName", "MultiMC Contributors" VALUE "FileDescription", "Testcase" VALUE "FileVersion", "1.0.0.0" - VALUE "ProductName", "MultiMC Testcase" + VALUE "ProductName", "Launcher Testcase" VALUE "ProductVersion", "5" END END diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp index 46b45827..374d4a29 100644 --- a/launcher/BaseInstance.cpp +++ b/launcher/BaseInstance.cpp @@ -25,6 +25,7 @@ #include "FileSystem.h" #include "Commandline.h" +#include "BuildConfig.h" BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir) : QObject() @@ -260,7 +261,7 @@ QString BaseInstance::name() const QString BaseInstance::windowTitle() const { - return "MultiMC: " + name().replace(QRegExp("[ \n\r\t]+"), " "); + return BuildConfig.LAUNCHER_NAME + ": " + name().replace(QRegExp("[ \n\r\t]+"), " "); } // FIXME: why is this here? move it to MinecraftInstance!!! diff --git a/launcher/BaseInstance.h b/launcher/BaseInstance.h index 51258933..253d2130 100644 --- a/launcher/BaseInstance.h +++ b/launcher/BaseInstance.h @@ -71,7 +71,7 @@ public: virtual void saveNow() = 0; /*** - * the instance has been invalidated - it is no longer tracked by MultiMC for some reason, + * the instance has been invalidated - it is no longer tracked by the launcher for some reason, * but it has not necessarily been deleted. * * Happens when the instance folder changes to some other location, or the instance is removed by external means. diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index eb49b6d9..5c45273b 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -555,7 +555,7 @@ set(LOGIC_SOURCES ${ATLAUNCHER_SOURCES} ) -SET(MULTIMC_SOURCES +SET(LAUNCHER_SOURCES # Application base Launcher.h Launcher.cpp @@ -812,7 +812,7 @@ SET(MULTIMC_SOURCES ) ######## UIs ######## -SET(MULTIMC_UIS +SET(LAUNCHER_UIS # Instance pages pages/instance/GameOptionsPage.ui pages/instance/VersionPage.ui @@ -868,7 +868,7 @@ SET(MULTIMC_UIS widgets/MCModInfoFrame.ui ) -set(MULTIMC_QRCS +set(LAUNCHER_QRCS resources/backgrounds/backgrounds.qrc resources/multimc/multimc.qrc resources/pe_dark/pe_dark.qrc @@ -879,19 +879,20 @@ set(MULTIMC_QRCS resources/iOS/iOS.qrc resources/flat/flat.qrc resources/documents/documents.qrc + ../${Launcher_Branding_LogoQRC} ) ######## Windows resource files ######## if(WIN32) - set(MULTIMC_RCS ../${Launcher_Branding_WindowsRC}) + set(LAUNCHER_RCS ../${Launcher_Branding_WindowsRC}) endif() # Qt 5 stuff -qt5_wrap_ui(MULTIMC_UI ${MULTIMC_UIS}) -qt5_add_resources(MULTIMC_RESOURCES ${MULTIMC_QRCS}) +qt5_wrap_ui(LAUNCHER_UI ${LAUNCHER_UIS}) +qt5_add_resources(LAUNCHER_RESOURCES ${LAUNCHER_QRCS}) # Add executable -add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${MULTIMC_SOURCES} ${MULTIMC_UI} ${MULTIMC_RESOURCES}) +add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${LAUNCHER_UI} ${LAUNCHER_RESOURCES}) target_link_libraries(Launcher_logic systeminfo Launcher_quazip @@ -921,7 +922,7 @@ target_link_libraries(Launcher_logic target_link_libraries(Launcher_logic secrets) -add_executable(${Launcher_Name} MACOSX_BUNDLE WIN32 main.cpp ${MULTIMC_RCS}) +add_executable(${Launcher_Name} MACOSX_BUNDLE WIN32 main.cpp ${LAUNCHER_RCS}) target_link_libraries(${Launcher_Name} Launcher_logic) if(DEFINED Launcher_APP_BINARY_NAME) diff --git a/launcher/ColorCache.h b/launcher/ColorCache.h index 6ae633b9..a840664d 100644 --- a/launcher/ColorCache.h +++ b/launcher/ColorCache.h @@ -91,7 +91,7 @@ public: LogColorCache(QColor front, QColor back) : ColorCache(front, back, 1.0) { - addColor((int)MessageLevel::MultiMC, QColor("purple")); + addColor((int)MessageLevel::Launcher, QColor("purple")); addColor((int)MessageLevel::Debug, QColor("green")); addColor((int)MessageLevel::Warning, QColor("orange")); addColor((int)MessageLevel::Error, QColor("red")); diff --git a/launcher/FileSystem_test.cpp b/launcher/FileSystem_test.cpp index df653ea1..90ddc499 100644 --- a/launcher/FileSystem_test.cpp +++ b/launcher/FileSystem_test.cpp @@ -135,7 +135,7 @@ slots: << "asdf" << QString() #if defined(Q_OS_LINUX) - << MULTIMC_GET_TEST_FILE("data/FileSystem-test_createShortcut-unix") + << GET_TEST_FILE("data/FileSystem-test_createShortcut-unix") #elif defined(Q_OS_WIN) << QByteArray() #endif diff --git a/launcher/InstanceList.cpp b/launcher/InstanceList.cpp index 42b2ae1a..ae905414 100644 --- a/launcher/InstanceList.cpp +++ b/launcher/InstanceList.cpp @@ -259,7 +259,7 @@ void InstanceList::deleteInstance(const InstanceId& id) return; } - qDebug() << "Instance" << id << "has been deleted by MultiMC."; + qDebug() << "Instance" << id << "has been deleted by the launcher."; } static QMap<InstanceId, InstanceLocator> getIdMapping(const QList<InstancePtr> &list) @@ -799,7 +799,7 @@ private slots: private: /* * WHY: the whole reason why this uses an exponential backoff retry scheme is antivirus on Windows. - * Basically, it starts messing things up while MultiMC is extracting/creating instances + * Basically, it starts messing things up while the launcher is extracting/creating instances * and causes that horrible failure that is NTFS to lock files in place because they are open. */ ExponentialSeries backoff; diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index 15972923..a865caab 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -47,7 +47,7 @@ void LaunchController::login() { m_parentWidget, tr("No Accounts"), tr("In order to play Minecraft, you must have at least one Mojang or Minecraft " - "account logged in to MultiMC." + "account logged in." "Would you like to open the account manager to add an account now?"), QMessageBox::Information, QMessageBox::Yes | QMessageBox::No @@ -286,7 +286,7 @@ void LaunchController::launchInstance() } resolved_servers = resolved_servers + "]\n\n"; } - m_launcher->prependStep(new TextPrint(m_launcher.get(), resolved_servers, MessageLevel::MultiMC)); + m_launcher->prependStep(new TextPrint(m_launcher.get(), resolved_servers, MessageLevel::Launcher)); } else { online_mode = "offline"; } @@ -298,10 +298,10 @@ void LaunchController::launchInstance() auth_server_status = "offline"; } - m_launcher->prependStep(new TextPrint(m_launcher.get(), "Launched instance in " + online_mode + " mode\nAuthentication server is " + auth_server_status + "\n", MessageLevel::MultiMC)); + m_launcher->prependStep(new TextPrint(m_launcher.get(), "Launched instance in " + online_mode + " mode\nAuthentication server is " + auth_server_status + "\n", MessageLevel::Launcher)); // Prepend Version - m_launcher->prependStep(new TextPrint(m_launcher.get(), "MultiMC version: " + BuildConfig.printableVersionString() + "\n\n", MessageLevel::MultiMC)); + m_launcher->prependStep(new TextPrint(m_launcher.get(), BuildConfig.LAUNCHER_NAME + " version: " + BuildConfig.printableVersionString() + "\n\n", MessageLevel::Launcher)); m_launcher->start(); } diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp index ab74a324..9a1d1ca3 100644 --- a/launcher/Launcher.cpp +++ b/launcher/Launcher.cpp @@ -87,7 +87,7 @@ static const QLatin1String liveCheckFile("live.check"); using namespace Commandline; -#define MACOS_HINT "If you are on macOS Sierra, you might have to move MultiMC.app to your /Applications or ~/Applications folder. "\ +#define MACOS_HINT "If you are on macOS Sierra, you might have to move the app to your /Applications or ~/Applications folder. "\ "This usually fixes the problem and you can move the application elsewhere afterwards.\n"\ "\n" @@ -179,10 +179,10 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) consoleAttached = true; } #endif - setOrganizationName("MultiMC"); - setOrganizationDomain("multimc.org"); - setApplicationName("MultiMC5"); - setApplicationDisplayName("MultiMC 5"); + setOrganizationName(BuildConfig.LAUNCHER_NAME); + setOrganizationDomain(BuildConfig.LAUNCHER_DOMAIN); + setApplicationName(BuildConfig.LAUNCHER_NAME); + setApplicationDisplayName(BuildConfig.LAUNCHER_DISPLAYNAME); setApplicationVersion(BuildConfig.printableVersionString()); startTime = QDateTime::currentDateTime(); @@ -200,7 +200,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) showFatalErrorMessage( "Unsupported system detected!", "Linux-on-Windows distributions are not supported.\n\n" - "Please use the Windows MultiMC binary when playing on Windows." + "Please use the Windows binary when playing on Windows." ); return; } @@ -227,7 +227,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) // --dir parser.addOption("dir"); parser.addShortOpt("dir", 'd'); - parser.addDocumentation("dir", "Use the supplied folder as MultiMC root instead of " + parser.addDocumentation("dir", "Use the supplied folder as application root instead of " "the binary location (use '.' for current)"); // --launch parser.addOption("launch"); @@ -240,7 +240,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) "(only valid in combination with --launch)"); // --alive parser.addSwitch("alive"); - parser.addDocumentation("alive", "Write a small '" + liveCheckFile + "' file after MultiMC starts"); + parser.addDocumentation("alive", "Write a small '" + liveCheckFile + "' file after the launcher starts"); // --import parser.addOption("import"); parser.addShortOpt("import", 'I'); @@ -255,7 +255,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) { std::cerr << "CommandLineError: " << e.what() << std::endl; if(argc > 0) - std::cerr << "Try '" << argv[0] << " -h' to get help on MultiMC's command line parameters." + std::cerr << "Try '" << argv[0] << " -h' to get help on command line parameters." << std::endl; m_status = Launcher::Failed; return; @@ -298,13 +298,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) } else { -#ifdef MULTIMC_LINUX_DATADIR - QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); - if (xdgDataHome.isEmpty()) - xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); - dataPath = xdgDataHome + "/multimc"; - adjustedBy += "XDG standard " + dataPath; -#elif defined(Q_OS_MAC) +#if defined(Q_OS_MAC) QDir foo(FS::PathCombine(applicationDirPath(), "../../Data")); dataPath = foo.absolutePath(); adjustedBy += "Fallback to special Mac location " + dataPath; @@ -317,30 +311,30 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) if (!FS::ensureFolderPathExists(dataPath)) { showFatalErrorMessage( - "MultiMC data folder could not be created.", - "MultiMC data folder could not be created.\n" + "The launcher data folder could not be created.", + "The launcher data folder could not be created.\n" "\n" #if defined(Q_OS_MAC) MACOS_HINT #endif - "Make sure you have the right permissions to the MultiMC data folder and any folder needed to access it.\n" + "Make sure you have the right permissions to the launcher data folder and any folder needed to access it.\n" "\n" - "MultiMC cannot continue until you fix this problem." + "The launcher cannot continue until you fix this problem." ); return; } if (!QDir::setCurrent(dataPath)) { showFatalErrorMessage( - "MultiMC data folder could not be opened.", - "MultiMC data folder could not be opened.\n" + "The launcher data folder could not be opened.", + "The launcher data folder could not be opened.\n" "\n" #if defined(Q_OS_MAC) MACOS_HINT #endif - "Make sure you have the right permissions to the MultiMC data folder.\n" + "Make sure you have the right permissions to the launcher data folder.\n" "\n" - "MultiMC cannot continue until you fix this problem." + "The launcher cannot continue until you fix this problem." ); return; } @@ -357,18 +351,24 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) QDir fi(applicationDirPath()); QString originalData = fi.absolutePath(); // if the config file exists in Contents/MacOS, then user data is still there and needs to moved - if (QFileInfo::exists(FS::PathCombine(originalData, "multimc.cfg"))) + if (QFileInfo::exists(FS::PathCombine(originalData, BuildConfig.LAUNCHER_CONFIGFILE))) { if (!QFileInfo::exists(FS::PathCombine(originalData, "dontmovemacdata"))) { QMessageBox::StandardButton askMoveDialogue; - askMoveDialogue = QMessageBox::question(nullptr, "MultiMC 5", "Would you like to move application data to a new data location? It will improve MultiMC's performance, but if you switch to older versions it will look like instances have disappeared. If you select no, you can migrate later in settings. You should select yes unless you're commonly switching between different versions of MultiMC (eg. develop and stable).", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); + askMoveDialogue = QMessageBox::question( + nullptr, + BuildConfig.LAUNCHER_DISPLAYNAME, + "Would you like to move application data to a new data location? It will improve the launcher's performance, but if you switch to older versions it will look like instances have disappeared. If you select no, you can migrate later in settings. You should select yes unless you're commonly switching between different versions (eg. develop and stable).", + QMessageBox::Yes | QMessageBox::No, + QMessageBox::Yes + ); if (askMoveDialogue == QMessageBox::Yes) { qDebug() << "On macOS and found config file in old location, moving user data..."; QDir dir; QStringList dataFiles { - "*.log", // MultiMC-@.log + "*.log", // Launcher log files: ${Launcher_Name}-@.log "accounts.json", "accounts", "assets", @@ -379,7 +379,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) "meta", "metacache", "mods", - "multimc.cfg", + BuildConfig.LAUNCHER_CONFIGFILE, "themes", "translations" }; @@ -451,7 +451,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) // init the logger { - static const QString logBase = "MultiMC-%0.log"; + static const QString logBase = BuildConfig.LAUNCHER_NAME + "-%0.log"; auto moveFile = [](const QString &oldName, const QString &newName) { QFile::remove(newName); @@ -468,15 +468,15 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) if(!logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { showFatalErrorMessage( - "MultiMC data folder is not writable!", - "MultiMC couldn't create a log file - the MultiMC data folder is not writable.\n" + "The launcher data folder is not writable!", + "The launcher couldn't create a log file - the data folder is not writable.\n" "\n" #if defined(Q_OS_MAC) MACOS_HINT #endif - "Make sure you have write permissions to the MultiMC data folder.\n" + "Make sure you have write permissions to the data folder.\n" "\n" - "MultiMC cannot continue until you fix this problem." + "The launcher cannot continue until you fix this problem." ); return; } @@ -503,7 +503,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) ENV.setJarsPath( TOSTRING(MULTIMC_JARS_LOCATION) ); #endif - qDebug() << "MultiMC 5, (c) 2013-2021 MultiMC Contributors"; + qDebug() << BuildConfig.LAUNCHER_DISPLAYNAME << ", (c) 2013-2021 " << BuildConfig.LAUNCHER_COPYRIGHT; qDebug() << "Version : " << BuildConfig.printableVersionString(); qDebug() << "Git commit : " << BuildConfig.GIT_COMMIT; qDebug() << "Git refspec : " << BuildConfig.GIT_REFSPEC; @@ -553,7 +553,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv) // Initialize application settings { - m_settings.reset(new INISettingsObject("multimc.cfg", this)); + m_settings.reset(new INISettingsObject(BuildConfig.LAUNCHER_CONFIGFILE, this)); // Updates m_settings->registerSetting("UpdateChannel", BuildConfig.VERSION_CHANNEL); m_settings->registerSetting("AutoUpdate", true); @@ -1164,6 +1164,9 @@ void Launcher::setIconTheme(const QString& name) QIcon Launcher::getThemedIcon(const QString& name) { + if(name == "logo") { + return QIcon(":/logo.svg"); + } return XdgIcon::fromTheme(name); } diff --git a/launcher/Launcher.h b/launcher/Launcher.h index 468f8a68..f4a20122 100644 --- a/launcher/Launcher.h +++ b/launcher/Launcher.h @@ -221,7 +221,7 @@ private: // main window, if any MainWindow * m_mainWindow = nullptr; - // peer MultiMC instance connector - used to implement single instance MultiMC and signalling + // peer launcher instance connector - used to implement single instance launcher and signalling LocalPeer * m_peerInstance = nullptr; GAnalytics * m_analytics = nullptr; diff --git a/launcher/LoggedProcess.cpp b/launcher/LoggedProcess.cpp index 822c0f04..2479f4ff 100644 --- a/launcher/LoggedProcess.cpp +++ b/launcher/LoggedProcess.cpp @@ -65,16 +65,16 @@ void LoggedProcess::on_exit(int exit_code, QProcess::ExitStatus status) if (status == QProcess::NormalExit) { //: Message displayed on instance exit - emit log({tr("Process exited with code %1.").arg(exit_code)}, MessageLevel::MultiMC); + emit log({tr("Process exited with code %1.").arg(exit_code)}, MessageLevel::Launcher); changeState(LoggedProcess::Finished); } else { //: Message displayed on instance crashed if(exit_code == -1) - emit log({tr("Process crashed.")}, MessageLevel::MultiMC); + emit log({tr("Process crashed.")}, MessageLevel::Launcher); else - emit log({tr("Process crashed with exitcode %1.").arg(exit_code)}, MessageLevel::MultiMC); + emit log({tr("Process crashed with exitcode %1.").arg(exit_code)}, MessageLevel::Launcher); changeState(LoggedProcess::Crashed); } } |
