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