feat: add "Open in custom player" to toast options (#5880)

This commit is contained in:
nerix
2025-03-05 16:29:28 +01:00
committed by GitHub
parent 54793f1496
commit 72369b1611
9 changed files with 67 additions and 11 deletions
+2
View File
@@ -10,6 +10,8 @@ inline const QString OPEN_PLAYER_IN_BROWSER =
inline const QString OPEN_MOD_VIEW_IN_BROWSER =
QStringLiteral("Open mod view in browser");
inline const QString OPEN_IN_STREAMLINK = QStringLiteral("Open in streamlink");
inline const QString OPEN_IN_CUSTOM_PLAYER =
QStringLiteral("Open in custom player");
inline const QString DONT_OPEN = QStringLiteral("Don't open");
inline const QString OPEN_WHISPERS_IN_BROWSER =
QStringLiteral("Open whispers in browser");
@@ -127,7 +127,8 @@ QComboBox *NotificationPage::createToastReactionComboBox()
{
QComboBox *toastReactionOptions = new QComboBox();
for (int i = 0; i <= static_cast<int>(ToastReaction::DontOpen); i++)
for (int i = 0; i <= static_cast<int>(ToastReaction::OpenInCustomPlayer);
i++)
{
toastReactionOptions->insertItem(
i, Toasts::findStringFromReaction(static_cast<ToastReaction>(i)));
+2 -9
View File
@@ -21,6 +21,7 @@
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
#include "util/Clipboard.hpp"
#include "util/CustomPlayer.hpp"
#include "util/Helpers.hpp"
#include "util/StreamLink.hpp"
#include "widgets/dialogs/QualityPopup.hpp"
@@ -1252,19 +1253,11 @@ void Split::openInStreamlink()
void Split::openWithCustomScheme()
{
QString scheme = getSettings()->customURIScheme.getValue();
if (scheme.isEmpty())
{
return;
}
auto *const channel = this->getChannel().get();
if (auto *const twitchChannel = dynamic_cast<TwitchChannel *>(channel))
{
QDesktopServices::openUrl(QString("%1https://twitch.tv/%2")
.arg(scheme)
.arg(twitchChannel->getName()));
openInCustomPlayer(twitchChannel->getName());
}
}