From d814e21f0d68b560d94cd69edb0b673a1507aa63 Mon Sep 17 00:00:00 2001 From: dada513 Date: Tue, 8 Mar 2022 18:41:23 +0100 Subject: [PATCH] add matrix button --- CMakeLists.txt | 5 +++++ buildconfig/BuildConfig.cpp.in | 1 + buildconfig/BuildConfig.h | 1 + launcher/resources/multimc/multimc.qrc | 4 ++++ launcher/resources/multimc/scalable/matrix.svg | 7 +++++++ launcher/ui/MainWindow.cpp | 18 +++++++++++++++++- launcher/ui/MainWindow.h | 2 ++ 7 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 launcher/resources/multimc/scalable/matrix.svg diff --git a/CMakeLists.txt b/CMakeLists.txt index e2545ba59..e633eb557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,9 +82,14 @@ set(Launcher_BUG_TRACKER_URL "https://github.com/PolyMC/PolyMC/issues" CACHE STR # Translations Platform URL set(Launcher_TRANSLATIONS_URL "https://hosted.weblate.org/projects/polymc/polymc/" CACHE STRING "URL for the translations platform.") +# Matrix Space +set(Launcher_MATRIX_URL "https://matrix.to/#/#polymc:polymc.org" CACHE STRING "URL to the Matrix Space") + # Discord URL set(Launcher_DISCORD_URL "https://discord.gg/Z52pwxWCHP" CACHE STRING "URL for the Discord guild.") + + # Subreddit URL set(Launcher_SUBREDDIT_URL "" CACHE STRING "URL for the subreddit.") diff --git a/buildconfig/BuildConfig.cpp.in b/buildconfig/BuildConfig.cpp.in index 80c670373..d1bd4d057 100644 --- a/buildconfig/BuildConfig.cpp.in +++ b/buildconfig/BuildConfig.cpp.in @@ -57,6 +57,7 @@ Config::Config() BUG_TRACKER_URL = "@Launcher_BUG_TRACKER_URL@"; TRANSLATIONS_URL = "@Launcher_TRANSLATIONS_URL@"; + MATRIX_URL = "@Launcher_MATRIX_URL@"; DISCORD_URL = "@Launcher_DISCORD_URL@"; SUBREDDIT_URL = "@Launcher_SUBREDDIT_URL@"; } diff --git a/buildconfig/BuildConfig.h b/buildconfig/BuildConfig.h index 956195876..cf74b39e2 100644 --- a/buildconfig/BuildConfig.h +++ b/buildconfig/BuildConfig.h @@ -95,6 +95,7 @@ public: QString BUG_TRACKER_URL; QString TRANSLATIONS_URL; + QString MATRIX_URL; QString DISCORD_URL; QString SUBREDDIT_URL; diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index ef29cf9bf..d31885b94 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -246,9 +246,13 @@ scalable/screenshot-placeholder.svg + + scalable/matrix.svg + scalable/discord.svg + 32x32/instances/chicken.png 128x128/instances/chicken.png diff --git a/launcher/resources/multimc/scalable/matrix.svg b/launcher/resources/multimc/scalable/matrix.svg new file mode 100644 index 000000000..237c55a29 --- /dev/null +++ b/launcher/resources/multimc/scalable/matrix.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index ad7227cce..2cb3c7fd3 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -235,6 +235,7 @@ public: TranslatedToolButton helpMenuButton; TranslatedAction actionReportBug; TranslatedAction actionDISCORD; + TranslatedAction actionMATRIX; TranslatedAction actionREDDIT; TranslatedAction actionAbout; @@ -343,13 +344,23 @@ public: all_actions.append(&actionReportBug); helpMenu->addAction(actionReportBug); } + + if(!BuildConfig.MATRIX_URL.isEmpty()) { + actionMATRIX = TranslatedAction(MainWindow); + actionMATRIX->setObjectName(QStringLiteral("actionMATRIX")); + actionMATRIX->setIcon(APPLICATION->getThemedIcon("matrix")); + actionMATRIX.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Matrix")); + actionMATRIX.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open %1 Matrix space")); + all_actions.append(&actionMATRIX); + helpMenu->addAction(actionMATRIX); + } if (!BuildConfig.DISCORD_URL.isEmpty()) { actionDISCORD = TranslatedAction(MainWindow); actionDISCORD->setObjectName(QStringLiteral("actionDISCORD")); actionDISCORD->setIcon(APPLICATION->getThemedIcon("discord")); actionDISCORD.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Discord")); - actionDISCORD.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open %1 discord voice chat.")); + actionDISCORD.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open %1 Discord guild.")); all_actions.append(&actionDISCORD); helpMenu->addAction(actionDISCORD); } @@ -1500,6 +1511,11 @@ void MainWindow::on_actionDISCORD_triggered() DesktopServices::openUrl(QUrl(BuildConfig.DISCORD_URL)); } +void MainWindow::on_actionMATRIX_triggered() +{ + DesktopServices::openUrl(QUrl(BuildConfig.MATRIX_URL)); +} + void MainWindow::on_actionChangeInstIcon_triggered() { if (!m_selectedInstance) diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h index f6940ab05..bdbe81aa9 100644 --- a/launcher/ui/MainWindow.h +++ b/launcher/ui/MainWindow.h @@ -73,6 +73,8 @@ private slots: void on_actionREDDIT_triggered(); + void on_actionMATRIX_triggered(); + void on_actionDISCORD_triggered(); void on_actionCopyInstance_triggered();