Skip to content

Commit

Permalink
chore: remove unused timegates (#5361)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz authored May 25, 2024
1 parent ec6b1ef commit 491b6db
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 139 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Dev: Make printing of strings in tests easier. (#5379)
- Dev: Refactor and document `Scrollbar`. (#5334, #5393)
- Dev: Reduced the amount of scale events. (#5404, #5406)
- Dev: Removed unused timegate settings. (#5361)
- Dev: All Lua globals now show in the `c2` global in the LuaLS metadata. (#5385)

## 2.5.1
Expand Down
15 changes: 2 additions & 13 deletions src/providers/twitch/IrcMessageHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,19 +435,8 @@ std::vector<MessagePtr> parseNoticeMessage(Communi::IrcNoticeMessage *message)
// default case
std::vector<MessagePtr> builtMessages;

auto content = message->content();
if (content.startsWith(
"Your settings prevent you from sending this whisper",
Qt::CaseInsensitive) &&
getSettings()->helixTimegateWhisper.getValue() ==
HelixTimegateOverride::Timegate)
{
content = content +
" Consider setting \"Helix timegate /w behaviour\" "
"to \"Always use Helix\" in your Chatterino settings.";
}
builtMessages.emplace_back(
makeSystemMessage(content, calculateMessageTime(message).time()));
builtMessages.emplace_back(makeSystemMessage(
message->content(), calculateMessageTime(message).time()));

return builtMessages;
}
Expand Down
36 changes: 0 additions & 36 deletions src/singletons/Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ enum UsernameDisplayMode : int {
UsernameAndLocalizedName = 3, // Username (Localized name)
};

enum HelixTimegateOverride : int {
// Use the default timegated behaviour
// This means we use the old IRC command up until the migration date and
// switch over to the Helix API only after the migration date
Timegate = 1,

// Ignore timegating and always force use the IRC command
AlwaysUseIRC = 2,

// Ignore timegating and always force use the Helix API
AlwaysUseHelix = 3,
};

enum ThumbnailPreviewMode : int {
DontShow = 0,

Expand Down Expand Up @@ -538,29 +525,6 @@ class Settings
1000,
};

// Temporary time-gate-overrides
EnumSetting<HelixTimegateOverride> helixTimegateRaid = {
"/misc/twitch/helix-timegate/raid",
HelixTimegateOverride::Timegate,
};
EnumSetting<HelixTimegateOverride> helixTimegateWhisper = {
"/misc/twitch/helix-timegate/whisper",
HelixTimegateOverride::Timegate,
};
EnumSetting<HelixTimegateOverride> helixTimegateVIPs = {
"/misc/twitch/helix-timegate/vips",
HelixTimegateOverride::Timegate,
};
EnumSetting<HelixTimegateOverride> helixTimegateModerators = {
"/misc/twitch/helix-timegate/moderators",
HelixTimegateOverride::Timegate,
};

EnumSetting<HelixTimegateOverride> helixTimegateCommercial = {
"/misc/twitch/helix-timegate/commercial",
HelixTimegateOverride::Timegate,
};

EnumStringSetting<ChatSendProtocol> chatSendProtocol = {
"/misc/chatSendProtocol", ChatSendProtocol::Default};

Expand Down
90 changes: 0 additions & 90 deletions src/widgets/settingspages/GeneralPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,96 +1161,6 @@ void GeneralPage::initLayout(GeneralPageView &layout)
"@mention for the related thread. If the reply context is hidden, "
"these mentions will never be stripped.");

// Helix timegate settings
auto helixTimegateGetValue = [](auto val) {
switch (val)
{
case HelixTimegateOverride::Timegate:
return "Timegate";
case HelixTimegateOverride::AlwaysUseIRC:
return "Always use IRC";
case HelixTimegateOverride::AlwaysUseHelix:
return "Always use Helix";
default:
return "Timegate";
}
};

auto helixTimegateSetValue = [](auto args) {
const auto &v = args.value;
if (v == "Timegate")
{
return HelixTimegateOverride::Timegate;
}
if (v == "Always use IRC")
{
return HelixTimegateOverride::AlwaysUseIRC;
}
if (v == "Always use Helix")
{
return HelixTimegateOverride::AlwaysUseHelix;
}

qCDebug(chatterinoSettings) << "Unknown Helix timegate override value"
<< v << ", using default value Timegate";
return HelixTimegateOverride::Timegate;
};

auto *helixTimegateRaid =
layout.addDropdown<std::underlying_type<HelixTimegateOverride>::type>(
"Helix timegate /raid behaviour",
{"Timegate", "Always use IRC", "Always use Helix"},
s.helixTimegateRaid,
helixTimegateGetValue, //
helixTimegateSetValue, //
false);
helixTimegateRaid->setMinimumWidth(
helixTimegateRaid->minimumSizeHint().width());

auto *helixTimegateWhisper =
layout.addDropdown<std::underlying_type<HelixTimegateOverride>::type>(
"Helix timegate /w behaviour",
{"Timegate", "Always use IRC", "Always use Helix"},
s.helixTimegateWhisper,
helixTimegateGetValue, //
helixTimegateSetValue, //
false);
helixTimegateWhisper->setMinimumWidth(
helixTimegateWhisper->minimumSizeHint().width());

auto *helixTimegateVIPs =
layout.addDropdown<std::underlying_type<HelixTimegateOverride>::type>(
"Helix timegate /vips behaviour",
{"Timegate", "Always use IRC", "Always use Helix"},
s.helixTimegateVIPs,
helixTimegateGetValue, //
helixTimegateSetValue, //
false);
helixTimegateVIPs->setMinimumWidth(
helixTimegateVIPs->minimumSizeHint().width());

auto *helixTimegateCommercial =
layout.addDropdown<std::underlying_type<HelixTimegateOverride>::type>(
"Helix timegate /commercial behaviour",
{"Timegate", "Always use IRC", "Always use Helix"},
s.helixTimegateCommercial,
helixTimegateGetValue, //
helixTimegateSetValue, //
false);
helixTimegateCommercial->setMinimumWidth(
helixTimegateCommercial->minimumSizeHint().width());

auto *helixTimegateModerators =
layout.addDropdown<std::underlying_type<HelixTimegateOverride>::type>(
"Helix timegate /mods behaviour",
{"Timegate", "Always use IRC", "Always use Helix"},
s.helixTimegateModerators,
helixTimegateGetValue, //
helixTimegateSetValue, //
false);
helixTimegateModerators->setMinimumWidth(
helixTimegateModerators->minimumSizeHint().width());

layout.addDropdownEnumClass<ChatSendProtocol>(
"Chat send protocol", qmagicenum::enumNames<ChatSendProtocol>(),
s.chatSendProtocol,
Expand Down

0 comments on commit 491b6db

Please sign in to comment.