diff --git a/src/platform/desktop_notifications/desktopnotify.cpp b/src/platform/desktop_notifications/desktopnotify.cpp index ab2ddcfb3..68bcee4ab 100644 --- a/src/platform/desktop_notifications/desktopnotify.cpp +++ b/src/platform/desktop_notifications/desktopnotify.cpp @@ -46,11 +46,11 @@ void DesktopNotify::notifyMessageSimple(const MessageType type) { QString message; switch (type) { - case MSG_FRIEND: message = tr("New message"); break; - case MSG_FRIEND_FILE: message = tr("Incoming file transfer"); break; - case MSG_FRIEND_REQUEST: message = tr("Friend request received"); break; - case MSG_GROUP: message = tr("New group message"); break; - case MSG_GROUP_INVITE: message = tr("Group invite received"); break; + case MessageType::FRIEND: message = tr("New message"); break; + case MessageType::FRIEND_FILE: message = tr("Incoming file transfer"); break; + case MessageType::FRIEND_REQUEST: message = tr("Friend request received"); break; + case MessageType::GROUP: message = tr("New group message"); break; + case MessageType::GROUP_INVITE: message = tr("Group invite received"); break; default: break; } diff --git a/src/platform/desktop_notifications/desktopnotify.h b/src/platform/desktop_notifications/desktopnotify.h index 94aba3fa9..ba7b753ef 100644 --- a/src/platform/desktop_notifications/desktopnotify.h +++ b/src/platform/desktop_notifications/desktopnotify.h @@ -12,12 +12,12 @@ class DesktopNotify : public QObject public: DesktopNotify(); - enum MessageType { - MSG_FRIEND = 0, - MSG_FRIEND_FILE, - MSG_FRIEND_REQUEST, - MSG_GROUP, - MSG_GROUP_INVITE + enum class MessageType { + FRIEND, + FRIEND_FILE, + FRIEND_REQUEST, + GROUP, + GROUP_INVITE }; public slots: diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 3d71c62a8..c813d495b 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1381,9 +1381,8 @@ bool Widget::newFriendMessageAlert(const ToxPk& friendId, const QString text, bo widget->updateStatusLight(); ui->friendList->trackWidget(widget); #if DESKTOP_NOTIFICATIONS - const Settings& s = Settings::getInstance(); - if (s.getNotifyHide()) { - notifier.notifyMessageSimple(file ? DesktopNotify::MSG_FRIEND_FILE : DesktopNotify::MSG_FRIEND); + if (settings.getNotifyHide()) { + notifier.notifyMessageSimple(file ? DesktopNotify::MessageType::FRIEND_FILE : DesktopNotify::MessageType::FRIEND); } else { QString title = f->getDisplayedName(); if (file) { @@ -1430,9 +1429,8 @@ bool Widget::newGroupMessageAlert(const GroupId& groupId, const ToxPk authorPk, g->setEventFlag(true); widget->updateStatusLight(); #if DESKTOP_NOTIFICATIONS - const Settings& s = Settings::getInstance(); - if (s.getNotifyHide()) { - notifier.notifyMessageSimple(DesktopNotify::MSG_GROUP); + if (settings.getNotifyHide()) { + notifier.notifyMessageSimple(DesktopNotify::MessageType::GROUP); } else { Friend *f = FriendList::findFriend(authorPk); QString title = g->getPeerList().value(authorPk) + " (" + g->getDisplayedName() + ")"; @@ -1517,9 +1515,8 @@ void Widget::onFriendRequestReceived(const ToxPk& friendPk, const QString& messa friendRequestsUpdate(); newMessageAlert(window(), isActiveWindow(), true, true); #if DESKTOP_NOTIFICATIONS - const Settings& s = Settings::getInstance(); - if (s.getNotifyHide()) { - notifier.notifyMessageSimple(DesktopNotify::MSG_FRIEND_REQUEST); + if (settings.getNotifyHide()) { + notifier.notifyMessageSimple(DesktopNotify::MessageType::FRIEND_REQUEST); } else { notifier.notifyMessage(friendPk.toString() + tr(" sent you a friend request."), message); } @@ -1761,9 +1758,8 @@ void Widget::onGroupInviteReceived(const GroupInvite& inviteInfo) groupInvitesUpdate(); newMessageAlert(window(), isActiveWindow(), true, true); #if DESKTOP_NOTIFICATIONS - const Settings& s = Settings::getInstance(); - if (s.getNotifyHide()) { - notifier.notifyMessageSimple(DesktopNotify::MSG_GROUP_INVITE); + if (settings.getNotifyHide()) { + notifier.notifyMessageSimple(DesktopNotify::MessageType::GROUP_INVITE); } else { notifier.notifyMessagePixmap(f->getDisplayedName() + tr(" invites you to join a group."), {}, Nexus::getProfile()->loadAvatar(f->getPublicKey())); }