1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Add sound notification on calls

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-06-30 21:14:51 +02:00
parent b547cdbaea
commit 27d5293d90
3 changed files with 27 additions and 2 deletions

View File

@ -371,6 +371,14 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
videoButton->style()->polish(videoButton);
connect(callButton, SIGNAL(clicked()), this, SLOT(onAnswerCallTriggered()));
}
Widget* w = Widget::getInstance();
if (!w->isFriendWidgetCurActiveWidget(f))
{
w->newMessageAlert();
f->hasNewMessages=true;
w->updateFriendStatusLights(f->friendId);
}
}
void ChatForm::onAvStart(int FriendId, int CallId, bool video)

View File

@ -543,3 +543,18 @@ void Widget::onEmptyGroupCreated(int groupId)
{
createGroup(groupId);
}
bool Widget::isFriendWidgetCurActiveWidget(Friend* f)
{
if (!f)
return false;
if (activeFriendWidget != nullptr)
{
Friend* f2 = FriendList::findFriend(activeFriendWidget->friendId);
if ((f->friendId != f2->friendId) || isFriendWidgetActive == 0)
return false;
}
else
return false;
return true;
}

View File

@ -18,6 +18,7 @@ class AddFriendForm;
class SettingsForm;
class FriendWidget;
class Group;
class Friend;
class Widget : public QWidget
{
@ -30,6 +31,9 @@ public:
Camera* getCamera();
static Widget* getInstance();
void showTestCamview();
void newMessageAlert();
bool isFriendWidgetCurActiveWidget(Friend* f);
void updateFriendStatusLights(int friendId);
~Widget();
signals:
@ -76,8 +80,6 @@ private slots:
private:
void hideMainForms();
Group* createGroup(int groupId);
void newMessageAlert();
void updateFriendStatusLights(int friendId);
private:
Ui::Widget *ui;