feat: Add Open in custom player to twitch.tv/<channel> link context menus (#6403)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
## Unversioned
|
||||
|
||||
- Minor: Added `Open in custom player` to `twitch.tv/<channel>` link context menus. (#6403)
|
||||
- Minor: Added user notes to the user info dialog (when clicking a username). (#6122, #6318)
|
||||
- Minor: Added cached emotes fallback when fetching from a provider fails. (#6125, #6229)
|
||||
- Minor: Add an option for the reduced opacity of message history. (#6121)
|
||||
|
||||
@@ -2816,13 +2816,21 @@ void ChannelView::addTwitchLinkContextMenuItems(
|
||||
this->openChannelIn.invoke(twitchUsername,
|
||||
FromTwitchLinkOpenChannelIn::Streamlink);
|
||||
});
|
||||
|
||||
if (!getSettings()->customURIScheme.getValue().isEmpty())
|
||||
{
|
||||
menu->addAction("Open in custom &player", [twitchUsername, this] {
|
||||
this->openChannelIn.invoke(
|
||||
twitchUsername, FromTwitchLinkOpenChannelIn::CustomPlayer);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelView::addCommandExecutionContextMenuItems(
|
||||
QMenu *menu, const MessageLayoutPtr &layout)
|
||||
{
|
||||
/* Get commands to be displayed in context menu;
|
||||
/* Get commands to be displayed in context menu;
|
||||
* only those that had the showInMsgContextMenu check box marked in the Commands page */
|
||||
std::vector<Command> cmds;
|
||||
for (const auto &cmd : getApp()->getCommands()->items)
|
||||
|
||||
@@ -61,6 +61,7 @@ enum class FromTwitchLinkOpenChannelIn {
|
||||
Tab,
|
||||
BrowserPlayer,
|
||||
Streamlink,
|
||||
CustomPlayer,
|
||||
};
|
||||
|
||||
using SteadyClock = std::chrono::steady_clock;
|
||||
|
||||
@@ -151,6 +151,8 @@ Split::Split(QWidget *parent)
|
||||
case FromTwitchLinkOpenChannelIn::Streamlink:
|
||||
this->openChannelInStreamlink(twitchChannel);
|
||||
break;
|
||||
case FromTwitchLinkOpenChannelIn::CustomPlayer:
|
||||
this->openChannelInCustomPlayer(twitchChannel);
|
||||
default:
|
||||
qCWarning(chatterinoWidget)
|
||||
<< "Unhandled \"FromTwitchLinkOpenChannelIn\" enum "
|
||||
@@ -804,6 +806,11 @@ void Split::openChannelInStreamlink(const QString channelName)
|
||||
}
|
||||
}
|
||||
|
||||
void Split::openChannelInCustomPlayer(const QString channelName)
|
||||
{
|
||||
openInCustomPlayer(channelName);
|
||||
}
|
||||
|
||||
IndirectChannel Split::getIndirectChannel()
|
||||
{
|
||||
return this->channel_;
|
||||
@@ -1137,10 +1144,9 @@ void Split::openInStreamlink()
|
||||
void Split::openWithCustomScheme()
|
||||
{
|
||||
auto *const channel = this->getChannel().get();
|
||||
|
||||
if (auto *const twitchChannel = dynamic_cast<TwitchChannel *>(channel))
|
||||
{
|
||||
openInCustomPlayer(twitchChannel->getName());
|
||||
this->openChannelInCustomPlayer(twitchChannel->getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,15 +123,19 @@ private:
|
||||
void addShortcuts() override;
|
||||
|
||||
/**
|
||||
* @brief Opens Twitch channel stream in a browser player (opens a formatted link)
|
||||
* @brief Opens a Twitch channel's stream in your default browser's player (opens a formatted link)
|
||||
*/
|
||||
void openChannelInBrowserPlayer(ChannelPtr channel);
|
||||
/**
|
||||
* @brief Opens Twitch channel stream in streamlink app (if stream is live and streamlink is installed)
|
||||
* @brief Opens a Twitch channel's stream in streamlink (if the stream's live, and streamlink's installed)
|
||||
*/
|
||||
void openChannelInStreamlink(const QString channelName);
|
||||
/**
|
||||
* @brief Opens Twitch channel chat in a new Chatterino tab
|
||||
* @brief Opens a Twitch channel's stream in your custom player (if the stream's live, and the custom player protocol's set)
|
||||
*/
|
||||
void openChannelInCustomPlayer(QString channelName);
|
||||
/**
|
||||
* @brief Opens a Twitch channel's chat in a new tab
|
||||
*/
|
||||
void joinChannelInNewTab(const ChannelPtr &channel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user