mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(ui): apply requested changes
This commit is contained in:
parent
84e41303ce
commit
f8b54b39f3
|
@ -46,11 +46,11 @@ void DesktopNotify::notifyMessageSimple(const MessageType type)
|
||||||
{
|
{
|
||||||
QString message;
|
QString message;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MSG_FRIEND: message = tr("New message"); break;
|
case MessageType::FRIEND: message = tr("New message"); break;
|
||||||
case MSG_FRIEND_FILE: message = tr("Incoming file transfer"); break;
|
case MessageType::FRIEND_FILE: message = tr("Incoming file transfer"); break;
|
||||||
case MSG_FRIEND_REQUEST: message = tr("Friend request received"); break;
|
case MessageType::FRIEND_REQUEST: message = tr("Friend request received"); break;
|
||||||
case MSG_GROUP: message = tr("New group message"); break;
|
case MessageType::GROUP: message = tr("New group message"); break;
|
||||||
case MSG_GROUP_INVITE: message = tr("Group invite received"); break;
|
case MessageType::GROUP_INVITE: message = tr("Group invite received"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,12 @@ class DesktopNotify : public QObject
|
||||||
public:
|
public:
|
||||||
DesktopNotify();
|
DesktopNotify();
|
||||||
|
|
||||||
enum MessageType {
|
enum class MessageType {
|
||||||
MSG_FRIEND = 0,
|
FRIEND,
|
||||||
MSG_FRIEND_FILE,
|
FRIEND_FILE,
|
||||||
MSG_FRIEND_REQUEST,
|
FRIEND_REQUEST,
|
||||||
MSG_GROUP,
|
GROUP,
|
||||||
MSG_GROUP_INVITE
|
GROUP_INVITE
|
||||||
};
|
};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -1381,9 +1381,8 @@ bool Widget::newFriendMessageAlert(const ToxPk& friendId, const QString text, bo
|
||||||
widget->updateStatusLight();
|
widget->updateStatusLight();
|
||||||
ui->friendList->trackWidget(widget);
|
ui->friendList->trackWidget(widget);
|
||||||
#if DESKTOP_NOTIFICATIONS
|
#if DESKTOP_NOTIFICATIONS
|
||||||
const Settings& s = Settings::getInstance();
|
if (settings.getNotifyHide()) {
|
||||||
if (s.getNotifyHide()) {
|
notifier.notifyMessageSimple(file ? DesktopNotify::MessageType::FRIEND_FILE : DesktopNotify::MessageType::FRIEND);
|
||||||
notifier.notifyMessageSimple(file ? DesktopNotify::MSG_FRIEND_FILE : DesktopNotify::MSG_FRIEND);
|
|
||||||
} else {
|
} else {
|
||||||
QString title = f->getDisplayedName();
|
QString title = f->getDisplayedName();
|
||||||
if (file) {
|
if (file) {
|
||||||
|
@ -1430,9 +1429,8 @@ bool Widget::newGroupMessageAlert(const GroupId& groupId, const ToxPk authorPk,
|
||||||
g->setEventFlag(true);
|
g->setEventFlag(true);
|
||||||
widget->updateStatusLight();
|
widget->updateStatusLight();
|
||||||
#if DESKTOP_NOTIFICATIONS
|
#if DESKTOP_NOTIFICATIONS
|
||||||
const Settings& s = Settings::getInstance();
|
if (settings.getNotifyHide()) {
|
||||||
if (s.getNotifyHide()) {
|
notifier.notifyMessageSimple(DesktopNotify::MessageType::GROUP);
|
||||||
notifier.notifyMessageSimple(DesktopNotify::MSG_GROUP);
|
|
||||||
} else {
|
} else {
|
||||||
Friend *f = FriendList::findFriend(authorPk);
|
Friend *f = FriendList::findFriend(authorPk);
|
||||||
QString title = g->getPeerList().value(authorPk) + " (" + g->getDisplayedName() + ")";
|
QString title = g->getPeerList().value(authorPk) + " (" + g->getDisplayedName() + ")";
|
||||||
|
@ -1517,9 +1515,8 @@ void Widget::onFriendRequestReceived(const ToxPk& friendPk, const QString& messa
|
||||||
friendRequestsUpdate();
|
friendRequestsUpdate();
|
||||||
newMessageAlert(window(), isActiveWindow(), true, true);
|
newMessageAlert(window(), isActiveWindow(), true, true);
|
||||||
#if DESKTOP_NOTIFICATIONS
|
#if DESKTOP_NOTIFICATIONS
|
||||||
const Settings& s = Settings::getInstance();
|
if (settings.getNotifyHide()) {
|
||||||
if (s.getNotifyHide()) {
|
notifier.notifyMessageSimple(DesktopNotify::MessageType::FRIEND_REQUEST);
|
||||||
notifier.notifyMessageSimple(DesktopNotify::MSG_FRIEND_REQUEST);
|
|
||||||
} else {
|
} else {
|
||||||
notifier.notifyMessage(friendPk.toString() + tr(" sent you a friend request."), message);
|
notifier.notifyMessage(friendPk.toString() + tr(" sent you a friend request."), message);
|
||||||
}
|
}
|
||||||
|
@ -1761,9 +1758,8 @@ void Widget::onGroupInviteReceived(const GroupInvite& inviteInfo)
|
||||||
groupInvitesUpdate();
|
groupInvitesUpdate();
|
||||||
newMessageAlert(window(), isActiveWindow(), true, true);
|
newMessageAlert(window(), isActiveWindow(), true, true);
|
||||||
#if DESKTOP_NOTIFICATIONS
|
#if DESKTOP_NOTIFICATIONS
|
||||||
const Settings& s = Settings::getInstance();
|
if (settings.getNotifyHide()) {
|
||||||
if (s.getNotifyHide()) {
|
notifier.notifyMessageSimple(DesktopNotify::MessageType::GROUP_INVITE);
|
||||||
notifier.notifyMessageSimple(DesktopNotify::MSG_GROUP_INVITE);
|
|
||||||
} else {
|
} else {
|
||||||
notifier.notifyMessagePixmap(f->getDisplayedName() + tr(" invites you to join a group."), {}, Nexus::getProfile()->loadAvatar(f->getPublicKey()));
|
notifier.notifyMessagePixmap(f->getDisplayedName() + tr(" invites you to join a group."), {}, Nexus::getProfile()->loadAvatar(f->getPublicKey()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user