Added clip creation support 🎬 (#2271)

You can create clips with `/clip` command, `Alt+X` keybind or `Create a clip` option in split header's context menu. This requires a new authentication scope so re-authentication will be required to use it.

Co-authored-by: Leon Richardt <leon.richardt@gmail.com>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-01-17 14:47:34 +01:00
committed by GitHub
parent 0542b81a03
commit cfcac99ae6
12 changed files with 253 additions and 8 deletions
+19 -4
View File
@@ -359,7 +359,10 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
});
#endif
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
auto *twitchChannel =
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
if (twitchChannel)
{
menu->addAction(OPEN_IN_BROWSER, this->split_, &Split::openInBrowser);
#ifndef USEWEBENGINE
@@ -375,6 +378,18 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
&Split::openWithCustomScheme);
}
auto clipButton = menu->addAction(
"Create a clip", this->split_,
[twitchChannel] {
twitchChannel->createClip();
},
QKeySequence("Alt+X"));
clipButton->setVisible(this->split_->getChannel()->isLive());
this->managedConnect(
twitchChannel->liveStatusChanged, [this, clipButton] {
clipButton->setVisible(this->split_->getChannel()->isLive());
});
if (this->split_->getChannel()->hasModRights())
{
menu->addAction(OPEN_MOD_VIEW_IN_BROWSER, this->split_,
@@ -398,7 +413,7 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
QKeySequence("Ctrl+F5"));
}
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
if (twitchChannel)
{
menu->addAction("Reload channel emotes", this,
SLOT(reloadChannelEmotes()), QKeySequence("F5"));
@@ -442,7 +457,7 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
moreMenu->addAction(action);
}
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
if (twitchChannel)
{
moreMenu->addAction("Show viewer list", this->split_,
&Split::showViewerList);
@@ -465,7 +480,7 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
moreMenu->addAction(action);
}
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
if (twitchChannel)
{
auto action = new QAction(this);
action->setText("Mute highlight sound");