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:
@@ -2083,6 +2083,10 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Link::CopyToClipboard: {
|
||||
crossPlatformCopy(link.value);
|
||||
}
|
||||
break;
|
||||
case Link::Reconnect: {
|
||||
this->underlyingChannel_.get()->reconnect();
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ KeyboardSettingsPage::KeyboardSettingsPage()
|
||||
form->addRow(new QLabel("F5"),
|
||||
new QLabel("Reload subscriber and channel emotes"));
|
||||
form->addRow(new QLabel("Ctrl + F5"), new QLabel("Reconnect channels"));
|
||||
form->addRow(new QLabel("Alt + X"), new QLabel("Create a clip"));
|
||||
|
||||
form->addItem(new QSpacerItem(16, 16));
|
||||
form->addRow(new QLabel("PageUp"), new QLabel("Scroll up"));
|
||||
|
||||
@@ -121,6 +121,19 @@ Split::Split(QWidget *parent)
|
||||
// CTRL+F5: reconnect
|
||||
createShortcut(this, "CTRL+F5", &Split::reconnect);
|
||||
|
||||
// Alt+X: create clip LUL
|
||||
createShortcut(this, "Alt+X", [this] {
|
||||
if (!this->getChannel()->isTwitchChannel())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto *twitchChannel =
|
||||
dynamic_cast<TwitchChannel *>(this->getChannel().get());
|
||||
|
||||
twitchChannel->createClip();
|
||||
});
|
||||
|
||||
// F10
|
||||
createShortcut(this, "F10", [] {
|
||||
auto *popup = new DebugPopup;
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user