mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
renamed enum ToastReactions to ToastReaction (singular)
This commit is contained in:
parent
cd1f717c36
commit
b5efe12f56
|
@ -175,7 +175,7 @@ public:
|
|||
BoolSetting notificationToast = {"/notifications/enableToast", false};
|
||||
IntSetting openFromToast = {
|
||||
"/notifications/openFromToast",
|
||||
static_cast<int>(ToastReactions::OpenInBrowser)};
|
||||
static_cast<int>(ToastReaction::OpenInBrowser)};
|
||||
|
||||
/// External tools
|
||||
// Streamlink
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
std::map<ToastReactions, QString> Toasts::reactionToString = {
|
||||
{ToastReactions::OpenInBrowser, OPEN_IN_BROWSER},
|
||||
{ToastReactions::OpenInPlayer, OPEN_PLAYER_IN_BROWSER},
|
||||
{ToastReactions::OpenInStreamlink, OPEN_IN_STREAMLINK},
|
||||
{ToastReactions::DontOpen, DONT_OPEN}};
|
||||
std::map<ToastReaction, QString> Toasts::reactionToString = {
|
||||
{ToastReaction::OpenInBrowser, OPEN_IN_BROWSER},
|
||||
{ToastReaction::OpenInPlayer, OPEN_PLAYER_IN_BROWSER},
|
||||
{ToastReaction::OpenInStreamlink, OPEN_IN_STREAMLINK},
|
||||
{ToastReaction::DontOpen, DONT_OPEN}};
|
||||
|
||||
bool Toasts::isEnabled()
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ bool Toasts::isEnabled()
|
|||
return false;
|
||||
}
|
||||
|
||||
QString Toasts::findStringFromReaction(const ToastReactions &reaction)
|
||||
QString Toasts::findStringFromReaction(const ToastReaction &reaction)
|
||||
{
|
||||
auto iterator = Toasts::reactionToString.find(reaction);
|
||||
if (iterator != Toasts::reactionToString.end())
|
||||
|
@ -59,7 +59,7 @@ QString Toasts::findStringFromReaction(
|
|||
const pajlada::Settings::Setting<int> &value)
|
||||
{
|
||||
int i = static_cast<int>(value);
|
||||
return Toasts::findStringFromReaction(static_cast<ToastReactions>(i));
|
||||
return Toasts::findStringFromReaction(static_cast<ToastReaction>(i));
|
||||
}
|
||||
|
||||
void Toasts::sendChannelNotification(const QString &channelName, Platform p)
|
||||
|
@ -114,24 +114,24 @@ public:
|
|||
void toastActivated() const
|
||||
{
|
||||
QString link;
|
||||
switch (static_cast<ToastReactions>(
|
||||
switch (static_cast<ToastReaction>(
|
||||
getSettings()->openFromToast.getValue()))
|
||||
{
|
||||
case ToastReactions::OpenInBrowser:
|
||||
case ToastReaction::OpenInBrowser:
|
||||
if (platform_ == Platform::Twitch)
|
||||
{
|
||||
link = "http://www.twitch.tv/" + channelName_;
|
||||
}
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
break;
|
||||
case ToastReactions::OpenInPlayer:
|
||||
case ToastReaction::OpenInPlayer:
|
||||
if (platform_ == Platform::Twitch)
|
||||
{
|
||||
link = "https://player.twitch.tv/?channel=" + channelName_;
|
||||
}
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
break;
|
||||
case ToastReactions::OpenInStreamlink:
|
||||
case ToastReaction::OpenInStreamlink:
|
||||
{
|
||||
openStreamlinkForChannel(channelName_);
|
||||
break;
|
||||
|
@ -163,8 +163,8 @@ void Toasts::sendWindowsNotification(const QString &channelName, Platform p)
|
|||
std::wstring widestr = std::wstring(utf8_text.begin(), utf8_text.end());
|
||||
|
||||
templ.setTextField(widestr, WinToastLib::WinToastTemplate::FirstLine);
|
||||
if (static_cast<ToastReactions>(getSettings()->openFromToast.getValue()) !=
|
||||
ToastReactions::DontOpen)
|
||||
if (static_cast<ToastReaction>(getSettings()->openFromToast.getValue()) !=
|
||||
ToastReaction::DontOpen)
|
||||
{
|
||||
QString mode =
|
||||
Toasts::findStringFromReaction(getSettings()->openFromToast);
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace chatterino {
|
|||
|
||||
enum class Platform : uint8_t;
|
||||
|
||||
enum class ToastReactions {
|
||||
enum class ToastReaction {
|
||||
OpenInBrowser = 0,
|
||||
OpenInPlayer = 1,
|
||||
OpenInStreamlink = 2,
|
||||
|
@ -18,10 +18,10 @@ class Toasts final : public Singleton
|
|||
{
|
||||
public:
|
||||
void sendChannelNotification(const QString &channelName, Platform p);
|
||||
static QString findStringFromReaction(const ToastReactions &reaction);
|
||||
static QString findStringFromReaction(const ToastReaction &reaction);
|
||||
static QString findStringFromReaction(
|
||||
const pajlada::Settings::Setting<int> &reaction);
|
||||
static std::map<ToastReactions, QString> reactionToString;
|
||||
static std::map<ToastReaction, QString> reactionToString;
|
||||
|
||||
static bool isEnabled();
|
||||
|
||||
|
|
|
@ -139,10 +139,10 @@ QComboBox *NotificationPage::createToastReactionComboBox(
|
|||
{
|
||||
QComboBox *toastReactionOptions = new QComboBox();
|
||||
|
||||
for (int i = 0; i <= static_cast<int>(ToastReactions::DontOpen); i++)
|
||||
for (int i = 0; i <= static_cast<int>(ToastReaction::DontOpen); i++)
|
||||
{
|
||||
toastReactionOptions->insertItem(
|
||||
i, Toasts::findStringFromReaction(static_cast<ToastReactions>(i)));
|
||||
i, Toasts::findStringFromReaction(static_cast<ToastReaction>(i)));
|
||||
}
|
||||
|
||||
// update when setting changes
|
||||
|
|
Loading…
Reference in a new issue