mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
commit
674f87b1db
BIN
audio/notification.wav
Normal file
BIN
audio/notification.wav
Normal file
Binary file not shown.
|
@ -11,6 +11,7 @@
|
||||||
#include "widget/form/groupchatform.h"
|
#include "widget/form/groupchatform.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QSound>
|
||||||
|
|
||||||
Widget *Widget::instance{nullptr};
|
Widget *Widget::instance{nullptr};
|
||||||
|
|
||||||
|
@ -347,10 +348,16 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message)
|
||||||
{
|
{
|
||||||
Friend* f2 = FriendList::findFriend(activeFriendWidget->friendId);
|
Friend* f2 = FriendList::findFriend(activeFriendWidget->friendId);
|
||||||
if ((f->friendId != f2->friendId) || isFriendWidgetActive == 0)
|
if ((f->friendId != f2->friendId) || isFriendWidgetActive == 0)
|
||||||
|
{
|
||||||
f->hasNewMessages = 1;
|
f->hasNewMessages = 1;
|
||||||
|
playMessageNotification();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
f->hasNewMessages = 1;
|
f->hasNewMessages = 1;
|
||||||
|
playMessageNotification();
|
||||||
|
}
|
||||||
|
|
||||||
updateFriendStatusLights(friendId);
|
updateFriendStatusLights(friendId);
|
||||||
}
|
}
|
||||||
|
@ -373,6 +380,11 @@ void Widget::updateFriendStatusLights(int friendId)
|
||||||
f->widget->statusPic.setPixmap(QPixmap("img/status/dot_away_notification.png"));
|
f->widget->statusPic.setPixmap(QPixmap("img/status/dot_away_notification.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::playMessageNotification()
|
||||||
|
{
|
||||||
|
QSound::play("audio/notification.wav");
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::onFriendRequestReceived(const QString& userId, const QString& message)
|
void Widget::onFriendRequestReceived(const QString& userId, const QString& message)
|
||||||
{
|
{
|
||||||
FriendRequestDialog dialog(this, userId, message);
|
FriendRequestDialog dialog(this, userId, message);
|
||||||
|
|
|
@ -84,6 +84,7 @@ private:
|
||||||
GroupWidget* activeGroupWidget;
|
GroupWidget* activeGroupWidget;
|
||||||
void updateFriendStatusLights(int friendId);
|
void updateFriendStatusLights(int friendId);
|
||||||
int isFriendWidgetActive, isGroupWidgetActive;
|
int isFriendWidgetActive, isGroupWidgetActive;
|
||||||
|
void playMessageNotification();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIDGET_H
|
#endif // WIDGET_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user