feat: setHighlightSounds & openSubscriptionPage split hotkeys (#5856)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
## Unversioned
|
||||
|
||||
- Minor: Add `Set highlight sounds` and `Open subscription page` split hotkeys. (#5856)
|
||||
- Minor: `/clear` messages are now stacked like timeouts. (#5806)
|
||||
- Minor: Treat all browsers starting with `firefox` as a Firefox browser. (#5805)
|
||||
- Minor: Remove incognito browser support for `opera/launcher` (this should no longer be a thing). (#5805)
|
||||
|
||||
@@ -195,6 +195,18 @@ inline const std::map<HotkeyCategory, ActionDefinitionMap> actionNames{
|
||||
},
|
||||
.argumentsPrompt = "Target popup:",
|
||||
}},
|
||||
{"setHighlightSounds",
|
||||
ActionDefinition{
|
||||
.displayName = "Set highlight sounds",
|
||||
.argumentDescription = "[on or off. default: toggle]",
|
||||
.minCountArguments = 0,
|
||||
.maxCountArguments = 1,
|
||||
.possibleArguments = HOTKEY_ARG_ON_OFF_TOGGLE,
|
||||
.argumentsPrompt = "New value:",
|
||||
.argumentsPromptHover =
|
||||
"Should highlight sounds be enabled, disabled or toggled",
|
||||
}},
|
||||
{"openSubscriptionPage", ActionDefinition{"Open subscription page"}},
|
||||
}},
|
||||
{HotkeyCategory::SplitInput,
|
||||
{
|
||||
|
||||
@@ -75,7 +75,7 @@ Qt::ShortcutContext Hotkey::getContext() const
|
||||
}
|
||||
qCDebug(chatterinoHotkeys)
|
||||
<< "Using default shortcut context for" << this->getCategory()
|
||||
<< "and hopeing for the best.";
|
||||
<< "and hoping for the best.";
|
||||
return Qt::WidgetShortcut;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,10 @@ std::optional<QString> Settings::matchNickname(const QString &usernameText)
|
||||
|
||||
void Settings::mute(const QString &channelName)
|
||||
{
|
||||
mutedChannels.append(channelName);
|
||||
if (!this->isMutedChannel(channelName))
|
||||
{
|
||||
this->mutedChannels.append(channelName);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::unmute(const QString &channelName)
|
||||
@@ -134,7 +137,7 @@ bool Settings::toggleMutedChannel(const QString &channelName)
|
||||
}
|
||||
else
|
||||
{
|
||||
mute(channelName);
|
||||
this->mutedChannels.append(channelName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,6 +678,7 @@ private:
|
||||
{"/moderation/actions"};
|
||||
ChatterinoSetting<std::vector<ChannelLog>> loggedChannelsSetting = {
|
||||
"/logging/channels"};
|
||||
SignalVector<QString> mutedChannels;
|
||||
|
||||
public:
|
||||
SignalVector<HighlightPhrase> highlightedMessages;
|
||||
@@ -685,7 +686,6 @@ public:
|
||||
SignalVector<HighlightBadge> highlightedBadges;
|
||||
SignalVector<HighlightBlacklistUser> blacklistedUsers;
|
||||
SignalVector<IgnorePhrase> ignoredMessages;
|
||||
SignalVector<QString> mutedChannels;
|
||||
SignalVector<FilterRecordPtr> filterRecords;
|
||||
SignalVector<Nickname> nicknames;
|
||||
SignalVector<ModerationAction> moderationActions;
|
||||
@@ -696,11 +696,10 @@ public:
|
||||
bool isMutedChannel(const QString &channelName);
|
||||
bool toggleMutedChannel(const QString &channelName);
|
||||
std::optional<QString> matchNickname(const QString &username);
|
||||
|
||||
private:
|
||||
void mute(const QString &channelName);
|
||||
void unmute(const QString &channelName);
|
||||
|
||||
private:
|
||||
void updateModerationActions();
|
||||
|
||||
std::unique_ptr<rapidjson::Document> snapshot_;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -537,7 +537,9 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
h->getDisplaySequence(HotkeyCategory::Split, "openViewerList"));
|
||||
}
|
||||
|
||||
moreMenu->addAction("Subscribe", this->split_, &Split::openSubPage);
|
||||
moreMenu->addAction("Subscribe", this->split_, &Split::openSubPage,
|
||||
h->getDisplaySequence(HotkeyCategory::Split,
|
||||
"openSubscriptionPage"));
|
||||
|
||||
auto *action = new QAction(this);
|
||||
action->setText("Notify when live");
|
||||
@@ -569,9 +571,19 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
if (twitchChannel)
|
||||
{
|
||||
auto *action = new QAction(this);
|
||||
action->setText("Mute highlight sound");
|
||||
action->setText("Mute highlight sounds");
|
||||
action->setCheckable(true);
|
||||
|
||||
auto notifySeq = h->getDisplaySequence(
|
||||
HotkeyCategory::Split, "setHighlightSounds", {{"toggle"}});
|
||||
if (notifySeq.isEmpty())
|
||||
{
|
||||
notifySeq = h->getDisplaySequence(HotkeyCategory::Split,
|
||||
"setHighlightSounds",
|
||||
{std::vector<QString>()});
|
||||
}
|
||||
action->setShortcut(notifySeq);
|
||||
|
||||
QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() {
|
||||
action->setChecked(getSettings()->isMutedChannel(
|
||||
this->split_->getChannel()->getName()));
|
||||
|
||||
Reference in New Issue
Block a user