diff options
| author | glowiak <52356948+glowiak@users.noreply.github.com> | 2022-02-16 18:36:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-16 18:36:28 +0100 |
| commit | 45f89c625533b7e65b70aab1d96ae6eddcbe9051 (patch) | |
| tree | 546fcf5723ead2d0d793c490d15d53f50c4e8c9c | |
| parent | b1cf77e84780ce8b88599cde2e878a21019365d9 (diff) | |
| parent | 2cd837896dc66344b53141325d76bcb045036abf (diff) | |
| download | PrismLauncher-45f89c625533b7e65b70aab1d96ae6eddcbe9051.tar.gz PrismLauncher-45f89c625533b7e65b70aab1d96ae6eddcbe9051.tar.bz2 PrismLauncher-45f89c625533b7e65b70aab1d96ae6eddcbe9051.zip | |
Merge branch 'develop' into patch-1
38 files changed, 1336 insertions, 145 deletions
diff --git a/.github/scripts/prepare_JREs.sh b/.github/scripts/prepare_JREs.sh new file mode 100755 index 00000000..b85e9c2f --- /dev/null +++ b/.github/scripts/prepare_JREs.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +URL_JDK8="https://api.adoptium.net/v3/binary/latest/8/ga/linux/x64/jre/hotspot/normal/eclipse" +URL_JDK17="https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jre/hotspot/normal/eclipse" + +mkdir -p JREs +pushd JREs + +wget --content-disposition "$URL_JDK8" +wget --content-disposition "$URL_JDK17" + +for file in *; +do + mkdir temp + + re='(OpenJDK([[:digit:]]+)U-jre_x64_linux_hotspot_([[:digit:]]+)(.*).tar.gz)' + if [[ $file =~ $re ]]; + then + version_major=${BASH_REMATCH[2]} + version_trailing=${BASH_REMATCH[4]} + + if [ $version_major = 17 ]; + then + hyphen='-' + else + hyphen='' + fi + + version_edit=$(echo $version_trailing | sed -e 's/_/+/g' | sed -e 's/b/-b/g') + dir_name=jdk$hyphen$version_major$version_edit-jre + mkdir jre$version_major + tar -xzf $file -C temp + pushd temp/$dir_name + cp -r . ../../jre$version_major + popd + fi + + rm -rf temp +done + +popd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7eeaf1d..d2ccc59e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,13 +11,13 @@ jobs: include: - os: ubuntu-20.04 - qt_version: 5.12.8 + qt_version: 5.15.2 qt_host: linux - os: windows-2022 qt_version: 5.15.2 qt_host: windows - qt_arch: win64_mingw81 + qt_arch: win32_mingw81 - os: macos-11 qt_version: 5.12.12 @@ -27,15 +27,38 @@ jobs: runs-on: ${{ matrix.os }} env: - MACOSX_DEPLOYMENT_TARGET: ${{matrix.macosx_deployment_target}} + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }} + INSTALL_DIR: "install" + BUILD_DIR: "build" steps: + - name: Install 32bit mingw on Windows + if: runner.os == 'Windows' + uses: egor-tensin/setup-mingw@v2 + with: + platform: x86 + + - name: Install 32bit zlib via Strawberry on Windows + if: runner.os == 'Windows' + run: | + choco install strawberryperl -y --force --x86 - name: Checkout uses: actions/checkout@v2 with: submodules: 'true' + # We need to do this here because it inexplicably fails if we split the step + - name: Download and install OpenSSL libs on Windows + if: runner.os == 'Windows' + run: | + python -m pip install --upgrade pip + python -m pip install aqtinstall==2.0.5 + python -m aqt install-tool -O "${{ github.workspace }}\Qt\" windows desktop tools_openssl_x86 + mkdir ${{ env.INSTALL_DIR }} + copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x86\bin\libssl-1_1.dll" "${{ github.workspace }}\${{ env.INSTALL_DIR }}\" + copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x86\bin\libcrypto-1_1.dll" "${{ github.workspace }}\${{ env.INSTALL_DIR }}\" + - name: Install OpenJDK uses: AdoptOpenJDK/install-jdk@v1 with: @@ -46,7 +69,7 @@ jobs: uses: actions/cache@v2 with: path: "${{ github.workspace }}/Qt/" - key: ${{ runner.os }}-${{ matrix.qt_version }}-qt_cache + key: ${{ runner.os }}-${{ matrix.qt_version }}-${{ matrix.qt_arch }}-qt_cache - name: Install Qt uses: jurplel/install-qt-action@v2 @@ -60,48 +83,104 @@ jobs: - name: Install Ninja uses: urkle/action-get-ninja@v1 + - name: Download linuxdeploy family + if: runner.os == 'Linux' + run: | + wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" + wget "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage" + wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" + + - name: Download JREs for AppImage on Linux + if: runner.os == 'Linux' + shell: bash + run: | + ${{ github.workspace }}/.github/scripts/prepare_JREs.sh + - name: Configure CMake + if: runner.os != 'Linux' + run: | + cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=Debug -G Ninja + + - name: Configure CMake on Linux + if: runner.os == 'Linux' run: | - cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -G Ninja + cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DLauncher_LAYOUT=lin-system -G Ninja - name: Build run: | - cmake --build build + cmake --build ${{ env.BUILD_DIR }} - name: Install + if: runner.os != 'Linux' + run: | + cmake --install ${{ env.BUILD_DIR }} + + - name: Install for AppImage on Linux + if: runner.os == 'Linux' + run: | + DESTDIR=${{ env.INSTALL_DIR }} cmake --install ${{ env.BUILD_DIR }} + + - name: Bundle AppImage + if: runner.os == 'Linux' + shell: bash run: | - cmake --install build + export OUTPUT="PolyMC-${{ github.sha }}-x86_64.AppImage" + + chmod +x linuxdeploy-*.AppImage + + mkdir -p ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-{8,17}-openjdk + + cp -r ${{ github.workspace }}/JREs/jre8/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk + + cp -r ${{ github.workspace }}/JREs/jre17/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk + + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib" + LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk/lib/amd64/server" + LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk/lib/amd64" + LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib/server" + LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib" + + ./linuxdeploy-x86_64.AppImage --appdir ${{ env.INSTALL_DIR }} --output appimage --plugin qt -i ${{ env.INSTALL_DIR }}/usr/share/icons/hicolor/scalable/apps/org.polymc.PolyMC.svg - - name: Install OpenSSL libs + - name: Run windeployqt if: runner.os == 'Windows' run: | - python -m pip install --upgrade pip - python -m pip install aqtinstall==2.0.5 - python -m aqt install-tool -O "${{ github.workspace }}\Qt\" windows desktop tools_openssl_x64 - copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x64\bin\libssl-1_1-x64.dll" "${{ github.workspace }}\install\" - copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x64\bin\libcrypto-1_1-x64.dll" "${{ github.workspace }}\install\" + windeployqt --no-translations "${{ env.INSTALL_DIR }}/polymc.exe" + + - name: Run macdeployqt + if: runner.os == 'macOS' + run: | + cd ${{ env.INSTALL_DIR }} + macdeployqt "PolyMC.app" -executable="PolyMC.app/Contents/MacOS/polymc" -always-overwrite -use-debug-libs - name: chmod binary on macOS if: runner.os == 'macOS' run: | - chmod +x "${{ github.workspace }}/install/PolyMC.app/Contents/MacOS/polymc" + chmod +x "${{ github.workspace }}/${{ env.INSTALL_DIR }}/PolyMC.app/Contents/MacOS/polymc" - name: tar bundle on macOS if: runner.os == 'macOS' run: | - cd install + cd ${{ env.INSTALL_DIR }} tar -czf ../polymc.tar.gz * - - name: Upload package for Linux and Windows - if: runner.os != 'macOS' + - name: Upload AppImage for Linux + if: runner.os == 'Linux' + uses: actions/upload-artifact@v2 + with: + name: PolyMC-${{ github.sha }}-x86_64.AppImage + path: PolyMC-${{ github.sha }}-x86_64.AppImage + + - name: Upload package for Windows + if: runner.os == 'Windows' uses: actions/upload-artifact@v2 with: - name: polymc-${{ matrix.os }}-portable - path: install/** + name: polymc-${{ runner.os }}-${{ github.sha }}-portable + path: ${{ env.INSTALL_DIR }}/** - name: Upload package for macOS if: runner.os == 'macOS' uses: actions/upload-artifact@v2 with: - name: polymc-${{ matrix.os }}-portable + name: polymc-${{ runner.os }}-${{ github.sha }}-portable path: polymc.tar.gz @@ -20,9 +20,9 @@ git submodule update The rest of the documentation assumes you have already cloned the repository. -# Linux +# Linux and FreeBSD -Getting the project to build and run on Linux is easy if you use any modern and up-to-date linux distribution. +Getting the project to build and run on Linux is easy if you use any modern and up-to-date linux distribution. If you're using FreeBSD you should use 13.0-RELEASE or newer. ## Build dependencies - A C++ compiler capable of building C++11 code. @@ -31,6 +31,7 @@ Getting the project to build and run on Linux is easy if you use any modern and - zlib (`zlib1g-dev` on Debian-based system) - Java JDK (`openjdk-17-jdk`on Debian-based system) - GL headers (`libgl1-mesa-dev` on Debian-based system) +- games/lwjgl port if using FreeBSD You can use IDEs like KDevelop or QtCreator to open the CMake project if you want to work on the code. @@ -54,7 +55,7 @@ This is the preferred method for installation, and is suitable for packages. # configure everything cmake -S . -B build \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="/usr" \ # Use "/usr" for packages, otherwise, leave it at the default "/usr/local". + -DCMAKE_INSTALL_PREFIX="/usr" \ # Use "/usr" when building Linux packages. If building on FreeBSD or not for package, use "/usr/local" -DLauncher_LAYOUT=lin-system cd build make -j$(nproc) install # Optionally specify DESTDIR for packages (i.e. DESTDIR=${pkgdir}) @@ -72,7 +73,7 @@ makedeb -s The deb will be located in the directory the repo was cloned in. -### Building a .rpm +### Building an .rpm Build dependencies are automatically installed using `dnf`, but you do need the `rpmdevtools` package (on Fedora) in order to fetch sources and setup your tree. @@ -94,6 +95,30 @@ rpmbuild -bb polymc.spec The path to the rpm packages will be printed when the build is complete. +### Building a Slackware package + +To build a Slackware package, first install [qt5 SlackBuild](http://slackbuilds.org/repository/14.2/libraries/qt5/) (on 15.0 and newer installed by defualt), then set up a [JDK](https://codeberg.org/glowiak/SlackBuilds/raw/branch/master/tgz/adoptium-jdk8.tar.gz). + +If you're using Slackware 14.2, update cmake with these commands: + +``` +mkdir -p /tmp/SBo +cd /tmp/SBo +wget -c https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2.tar.gz +tar xzvf cmake-3.22.2.tar.gz +cd cmake-3.22.2 +./configure --prefix=/usr +make +sudo make install +``` + +Next, download the [SlackBuild](https://codeberg.org/glowiak/SlackBuilds/raw/branch/master/tgz/polymc.tar.gz), unpack it and type in extracted directory: + +``` +sudo ./polymc.SlackBuild # script will do everything, just sit up and wait +sudo /sbin/installpkg /tmp/polymc-version-arch-1_SBo.tgz # install the created package +``` + ### Building a flatpak You don't need to clone the entire PolyMC repo for this; the flatpak file handles that. @@ -273,3 +298,44 @@ Remember to replace `/path/to/Qt/` with the actual path. For newer Qt installati **Note:** The final app bundle may not run due to code signing issues, which need to be fixed with `codesign -fs -`. + +# OpenBSD + +Tested on OpenBSD 7.0-alpha i386, on older should work too + +## Build dependencies +- A C++ compiler capable of building C++11 code (included in base system) +- Qt Development tools 5.6 or newer ([meta/qt5](https://openports.se/meta/qt5)) +- cmake 3.1 or newer ([devel/cmake](https://openports.se/devel/cmake)) +- zlib (included in base system) +- Java JDK ([devel/jdk-1.8](https://openports.se/devel/jdk/1.8)) +- GL headers (included in base system) +- lwjgl ([games/lwjgl](https://openports.se/games/lwjgl) and [games/lwjgl3](https://openports.se/games/lwjgl3)) + +You can use IDEs like KDevelop or QtCreator to open the CMake project if you want to work on the code. + +### Building a portable binary + +```sh +mkdir install +# configure the project +cmake -S . -B build \ + -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake +# build +cd build +make -j$(nproc) install +``` + +### Building & Installing to the System + +This is the preferred method for installation, and is suitable for packages. + +```sh +# configure everything +cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="/usr/local" \ # /usr/local is default in OpenBSD and FreeBSD + -DLauncher_LAYOUT=lin-system -DCMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake # use linux layout and point to qt5 libs +cd build +make -j$(nproc) install # Optionally specify DESTDIR for packages (i.e. DESTDIR=${pkgdir}) +``` diff --git a/CMakeLists.txt b/CMakeLists.txt index 738a1a5a..74a63614 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,10 +45,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEPRECATED_WARNINGS=Y") ##################################### Set Application options ##################################### +######## Set URLs ######## +set(Launcher_NEWS_RSS_URL "https://polymc.github.io/feed/feed.xml" CACHE STRING "URL to fetch PolyMC's news RSS feed from.") +set(Launcher_NEWS_OPEN_URL "https://polymc.github.io/news/" CACHE STRING "URL that gets opened when the user clicks 'More News'") + ######## Set version numbers ######## set(Launcher_VERSION_MAJOR 1) set(Launcher_VERSION_MINOR 0) -set(Launcher_VERSION_HOTFIX 5) +set(Launcher_VERSION_HOTFIX 6) # Build number set(Launcher_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.") @@ -74,6 +78,9 @@ set(Launcher_MSA_CLIENT_ID "17b47edd-c884-4997-926d-9e7f9a6b4647" CACHE STRING " # Bug tracker URL set(Launcher_BUG_TRACKER_URL "https://github.com/PolyMC/PolyMC/issues" CACHE STRING "URL for the bug tracker.") +# Translations Platform URL +set(Launcher_TRANSLATIONS_URL "https://hosted.weblate.org/projects/polymc/polymc/" CACHE STRING "URL for the translations platform.") + # Discord URL set(Launcher_DISCORD_URL "https://discord.gg/Z52pwxWCHP" CACHE STRING "URL for the Discord guild.") @@ -94,6 +101,8 @@ message(STATUS "Git commit: ${Launcher_GIT_COMMIT}") message(STATUS "Git refspec: ${Launcher_GIT_REFSPEC}") set(Launcher_RELEASE_VERSION_NAME "${Launcher_VERSION_MAJOR}.${Launcher_VERSION_MINOR}.${Launcher_VERSION_HOTFIX}") +string(TIMESTAMP TODAY "%Y-%m-%d") +set(Launcher_RELEASE_TIMESTAMP "${TODAY}") #### Custom target to just print the version. add_custom_target(version echo "Version: ${Launcher_RELEASE_VERSION_NAME}") @@ -251,11 +260,9 @@ endif() include(ExternalProject) set_directory_properties(PROPERTIES EP_BASE External) -option(NBT_BUILD_SHARED "Build NBT shared library" ON) +option(NBT_BUILD_SHARED "Build NBT shared library" OFF) option(NBT_USE_ZLIB "Build NBT library with zlib support" OFF) option(NBT_BUILD_TESTS "Build NBT library tests" OFF) #FIXME: fix unit tests. -set(NBT_NAME Launcher_nbt++) -set(NBT_DEST_DIR ${LIBRARY_DEST_DIR}) add_subdirectory(libraries/libnbtplusplus) add_subdirectory(libraries/systeminfo) # system information library @@ -6,7 +6,7 @@ PolyMC is a custom launcher for Minecraft that focuses on predictability, long term stability and simplicity. -This is a **fork** of the MultiMC Launcher and not endorsed by MultiMC. The PolyMC community felt that the maintainer was not acting in the spirit of Free Software so this fork was made. Read "[Why was this fork made?](https://github.com/PolyMC/PolyMC/wiki/FAQ)" on the wiki for more details. +This is a **fork** of the MultiMC Launcher and not endorsed by MultiMC. The PolyMC community felt that the maintainer was not acting in the spirit of Free Software so this fork was made. <br> # Installation @@ -111,8 +111,6 @@ If you are too lazy to do all these steps, you can just download [a prebuild x86 MacOS currently does not have any packages. We are still working on setting up MacOS packaging. Meanwhile, you can [build](https://github.com/PolyMC/PolyMC/blob/develop/BUILD.md#macos) it for yourself. - - ## <img src="https://www.vectorlogo.zone/logos/freebsd/freebsd-icon.svg" height="20" /> FreeBSD For FreeBSD available are: @@ -172,7 +170,7 @@ In general, in order of importance: ## Translations -TODO +The translation effort for PolyMC is hosted on [Weblate](https://hosted.weblate.org/projects/polymc/polymc/) and information about translating PolyMC is available at https://github.com/PolyMC/Translations ## Forking/Redistributing/Custom builds policy diff --git a/buildconfig/BuildConfig.cpp.in b/buildconfig/BuildConfig.cpp.in index 2595f78b..0ffc9326 100644 --- a/buildconfig/BuildConfig.cpp.in +++ b/buildconfig/BuildConfig.cpp.in @@ -12,6 +12,7 @@ Config::Config() LAUNCHER_DOMAIN = "@Launcher_Domain@"; LAUNCHER_CONFIGFILE = "@Launcher_ConfigFile@"; LAUNCHER_GIT = "@Launcher_Git@"; + LAUNCHER_DESKTOPFILENAME = "@Launcher_DesktopFileName@"; USER_AGENT = "@Launcher_UserAgent@"; USER_AGENT_UNCACHED = USER_AGENT + " (Uncached)"; @@ -29,24 +30,32 @@ Config::Config() GIT_COMMIT = "@Launcher_GIT_COMMIT@"; GIT_REFSPEC = "@Launcher_GIT_REFSPEC@"; - if(GIT_REFSPEC.startsWith("refs/heads/") && !UPDATER_BASE.isEmpty() && !BUILD_PLATFORM.isEmpty() && VERSION_BUILD >= 0) + if(GIT_REFSPEC.startsWith("refs/heads/")) { VERSION_CHANNEL = GIT_REFSPEC; VERSION_CHANNEL.remove("refs/heads/"); - UPDATER_ENABLED = true; + if(!UPDATER_BASE.isEmpty() && !BUILD_PLATFORM.isEmpty() && VERSION_BUILD >= 0) { + UPDATER_ENABLED = true; + } + } + else if (!GIT_COMMIT.isEmpty()) + { + VERSION_CHANNEL = GIT_COMMIT.mid(0, 8); } else { - VERSION_CHANNEL = QObject::tr("custom"); + VERSION_CHANNEL = QObject::tr("unknown"); } VERSION_STR = "@Launcher_VERSION_STRING@"; NEWS_RSS_URL = "@Launcher_NEWS_RSS_URL@"; + NEWS_OPEN_URL = "@Launcher_NEWS_OPEN_URL@"; IMGUR_CLIENT_ID = "@Launcher_IMGUR_CLIENT_ID@"; MSA_CLIENT_ID = "@Launcher_MSA_CLIENT_ID@"; META_URL = "@Launcher_META_URL@"; BUG_TRACKER_URL = "@Launcher_BUG_TRACKER_URL@"; + TRANSLATIONS_URL = "@Launcher_TRANSLATIONS_URL@"; DISCORD_URL = "@Launcher_DISCORD_URL@"; SUBREDDIT_URL = "@Launcher_SUBREDDIT_URL@"; } diff --git a/buildconfig/BuildConfig.h b/buildconfig/BuildConfig.h index d09d5288..111381ab 100644 --- a/buildconfig/BuildConfig.h +++ b/buildconfig/BuildConfig.h @@ -14,6 +14,7 @@ public: QString LAUNCHER_DOMAIN; QString LAUNCHER_CONFIGFILE; QString LAUNCHER_GIT; + QString LAUNCHER_DESKTOPFILENAME; /// The major version number. int VERSION_MAJOR; @@ -68,6 +69,11 @@ public: QString NEWS_RSS_URL; /** + * URL that gets opened when the user clicks "More News" + */ + QString NEWS_OPEN_URL; + + /** * Client ID you can get from Imgur when you register an application */ QString IMGUR_CLIENT_ID; @@ -83,6 +89,7 @@ public: QString META_URL; QString BUG_TRACKER_URL; + QString TRANSLATIONS_URL; QString DISCORD_URL; QString SUBREDDIT_URL; @@ -91,7 +98,7 @@ public: QString AUTH_BASE = "https://authserver.mojang.com/"; QString IMGUR_BASE_URL = "https://api.imgur.com/3/"; QString FMLLIBS_BASE_URL = "https://files.multimc.org/fmllibs/"; - QString TRANSLATIONS_BASE_URL = "https://files.multimc.org/translations/"; + QString TRANSLATIONS_BASE_URL = "https://meta.polymc.org/translations/"; QString MODPACKSCH_API_BASE_URL = "https://api.modpacks.ch/"; diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 7050e5dc..a3d6216e 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -14,7 +14,7 @@ #include "ui/pages/global/ProxyPage.h" #include "ui/pages/global/ExternalToolsPage.h" #include "ui/pages/global/AccountListPage.h" -#include "ui/pages/global/PastePage.h" +#include "ui/pages/global/APIPage.h" #include "ui/pages/global/CustomCommandsPage.h" #include "ui/themes/ITheme.h" @@ -187,7 +187,9 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) setApplicationName(BuildConfig.LAUNCHER_NAME); setApplicationDisplayName(BuildConfig.LAUNCHER_DISPLAYNAME); setApplicationVersion(BuildConfig.printableVersionString()); - + #if (QT_VERSION >= QT_VERSION_CHECK(5,7,0)) + setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME); + #endif startTime = QDateTime::currentDateTime(); #ifdef Q_OS_LINUX @@ -311,7 +313,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) dataPath = xdgDataHome + "/polymc"; adjustedBy += "XDG standard " + dataPath; #elif defined(Q_OS_MAC) - QDir foo(FS::PathCombine(applicationDirPath(), "../../Data")); + QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), "..")); dataPath = foo.absolutePath(); adjustedBy += "Fallback to special Mac location " + dataPath; #else @@ -529,10 +531,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) #elif defined(Q_OS_WIN32) m_rootPath = binPath; #elif defined(Q_OS_MAC) - QDir foo(FS::PathCombine(binPath, "../..")); + QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), "..")); m_rootPath = foo.absolutePath(); - // on macOS, touch the root to force Finder to reload the .app metadata (and fix any icon change issues) - FS::updateTimestamp(m_rootPath); #endif #ifdef MULTIMC_JARS_LOCATION @@ -719,6 +719,9 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_settings->registerSetting("CloseAfterLaunch", false); + // Custom MSA credentials + m_settings->registerSetting("MSAClientIDOverride", ""); + // Init page provider { m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings")); @@ -730,7 +733,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_globalSettingsProvider->addPage<ProxyPage>(); m_globalSettingsProvider->addPage<ExternalToolsPage>(); m_globalSettingsProvider->addPage<AccountListPage>(); - m_globalSettingsProvider->addPage<PastePage>(); + m_globalSettingsProvider->addPage<APIPage>(); } qDebug() << "<> Settings loaded."; } @@ -1516,3 +1519,13 @@ QString Application::getJarsPath() } return m_jarsPath; } + +QString Application::getMSAClientID() +{ + QString clientIDOverride = m_settings->get("MSAClientIDOverride").toString(); + if (!clientIDOverride.isEmpty()) { + return clientIDOverride; + } + + return BuildConfig.MSA_CLIENT_ID; +} diff --git a/launcher/Application.h b/launcher/Application.h index c1cd8224..fb41d647 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -117,6 +117,8 @@ public: QString getJarsPath(); + QString getMSAClientID(); + /// this is the root of the 'installation'. Used for automatic updates const QString &root() { return m_rootPath; diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index f4c3a9bc..90149c3b 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -181,6 +181,15 @@ set(NOTIFICATIONS_SOURCES 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 +) + # Icon interface set(ICONS_SOURCES # Icons System and related code @@ -714,8 +723,8 @@ SET(LAUNCHER_SOURCES ui/pages/global/LauncherPage.h ui/pages/global/ProxyPage.cpp ui/pages/global/ProxyPage.h - ui/pages/global/PastePage.cpp - ui/pages/global/PastePage.h + ui/pages/global/APIPage.cpp + ui/pages/global/APIPage.h # GUI - platform pages ui/pages/modplatform/VanillaPage.cpp @@ -862,7 +871,7 @@ qt5_wrap_ui(LAUNCHER_UI ui/pages/global/AccountListPage.ui ui/pages/global/JavaPage.ui ui/pages/global/LauncherPage.ui - ui/pages/global/PastePage.ui + ui/pages/global/APIPage.ui ui/pages/global/ProxyPage.ui ui/pages/global/MinecraftPage.ui ui/pages/global/ExternalToolsPage.ui @@ -932,7 +941,7 @@ add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${LAUNCHE target_link_libraries(Launcher_logic systeminfo Launcher_classparser - ${NBT_NAME} + nbt++ |
