feat: setHighlightSounds & openSubscriptionPage split hotkeys (#5856)

This commit is contained in:
Brian
2025-03-03 14:20:09 -05:00
committed by GitHub
parent 34429671ba
commit 8dd19d2d5e
7 changed files with 92 additions and 13 deletions
+57 -5
View File
@@ -611,7 +611,7 @@ void Split::addShortcuts()
type != Channel::Type::Twitch &&
type != Channel::Type::TwitchWatching)
{
return "Cannot create clip it non-twitch channel.";
return "Cannot create clips in a non-Twitch channel.";
}
auto *twitchChannel =
@@ -651,7 +651,8 @@ void Split::addShortcuts()
[this](std::vector<QString> arguments) -> QString {
if (!this->getChannel()->isTwitchChannel())
{
return "Cannot set moderation mode in non-twitch channel.";
return "Cannot set moderation mode in a non-Twitch "
"channel.";
}
auto mode = 2;
// 0 is off
@@ -725,7 +726,7 @@ void Split::addShortcuts()
[this](std::vector<QString> arguments) -> QString {
if (!this->getChannel()->isTwitchChannel())
{
return "Cannot set channel notifications for non-twitch "
return "Cannot set channel notifications for a non-Twitch "
"channel.";
}
auto mode = 2;
@@ -807,6 +808,57 @@ void Split::addShortcuts()
}
return {};
}},
{"setHighlightSounds",
[this](std::vector<QString> arguments) -> QString {
if (!this->getChannel()->isTwitchChannel())
{
return "Cannot set highlight sounds in a non-Twitch "
"channel.";
}
auto mode = 2;
// 0 is off
// 1 is on
// 2 is toggle
if (!arguments.empty())
{
auto arg = arguments.at(0);
if (arg == "off")
{
mode = 0;
}
else if (arg == "on")
{
mode = 1;
}
}
const QString channel = this->getChannel()->getName();
switch (mode)
{
case 0:
getSettings()->mute(channel);
break;
case 1:
getSettings()->unmute(channel);
break;
default:
getSettings()->toggleMutedChannel(channel);
}
return "";
}},
{"openSubscriptionPage",
[this](const auto &) -> QString {
if (!this->getChannel()->isTwitchChannel())
{
return "Cannot subscribe to a non-Twitch "
"channel.";
}
this->openSubPage();
return "";
}},
};
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
@@ -1626,8 +1678,8 @@ void Split::drag()
auto *container = dynamic_cast<SplitContainer *>(this->parentWidget());
if (!container)
{
qCWarning(chatterinoWidget)
<< "Attempted to initiate split drag without a container parent";
qCWarning(chatterinoWidget) << "Attempted to initiate split drag "
"without a container parent";
return;
}