Added ability to open stream in external video player via URI scheme. (#1623)
This commit is contained in:
@@ -534,6 +534,23 @@ void Split::openInStreamlink()
|
||||
}
|
||||
}
|
||||
|
||||
void Split::openWithCustomScheme()
|
||||
{
|
||||
const auto scheme = getSettings()->customURIScheme.getValue();
|
||||
if (scheme.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
const auto channel = this->getChannel().get();
|
||||
|
||||
if (const auto twitchChannel = dynamic_cast<TwitchChannel *>(channel))
|
||||
{
|
||||
QDesktopServices::openUrl(QString("%1https://twitch.tv/%2")
|
||||
.arg(scheme)
|
||||
.arg(twitchChannel->getName()));
|
||||
}
|
||||
}
|
||||
|
||||
void Split::showViewerList()
|
||||
{
|
||||
auto viewerDock = new QDockWidget("Viewer List", this);
|
||||
|
||||
@@ -126,6 +126,7 @@ public slots:
|
||||
void openInBrowser();
|
||||
void openBrowserPlayer();
|
||||
void openInStreamlink();
|
||||
void openWithCustomScheme();
|
||||
void copyToClipboard();
|
||||
void showSearch();
|
||||
void showViewerList();
|
||||
|
||||
@@ -245,6 +245,13 @@ void SplitHeader::initializeLayout()
|
||||
}
|
||||
});
|
||||
|
||||
getSettings()->customURIScheme.connect([this] {
|
||||
if (const auto drop = this->dropdownButton_)
|
||||
{
|
||||
drop->setMenu(this->createMainMenu());
|
||||
}
|
||||
});
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
this->setLayout(layout);
|
||||
@@ -289,6 +296,12 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
#endif
|
||||
menu->addAction(OPEN_IN_STREAMLINK, this->split_,
|
||||
&Split::openInStreamlink);
|
||||
|
||||
if (!getSettings()->customURIScheme.getValue().isEmpty())
|
||||
{
|
||||
menu->addAction("Open with URI Scheme", this->split_,
|
||||
&Split::openWithCustomScheme);
|
||||
}
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user