mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(chatform): Remove Audio::play usage from ChatForm
This commit is contained in:
parent
28c2298ad9
commit
695abadd7c
|
@ -353,10 +353,7 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
|||
auto msg = ChatMessage::createChatInfoMessage(tr("%1 calling").arg(displayedName),
|
||||
ChatMessage::INFO, QDateTime::currentDateTime());
|
||||
insertChatMessage(msg);
|
||||
Widget::getInstance()->newFriendMessageAlert(friendId, false);
|
||||
Audio& audio = Audio::getInstance();
|
||||
audio.startLoop();
|
||||
audio.playMono16Sound(Audio::getSound(Audio::Sound::IncomingCall));
|
||||
emit incomingNotification(friendId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
|
||||
signals:
|
||||
void aliasChanged(const QString& alias);
|
||||
void incomingNotification(uint32_t friendId);
|
||||
|
||||
public slots:
|
||||
void startFileSend(ToxFile file);
|
||||
|
|
|
@ -919,6 +919,15 @@ void Widget::reloadHistory()
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::incomingNotification(uint32_t friendId)
|
||||
{
|
||||
newFriendMessageAlert(friendId, false);
|
||||
|
||||
Audio& audio = Audio::getInstance();
|
||||
audio.startLoop();
|
||||
audio.playMono16Sound(Audio::getSound(Audio::Sound::IncomingCall));
|
||||
}
|
||||
|
||||
void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
||||
{
|
||||
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
|
||||
|
@ -944,6 +953,8 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
|||
connect(newfriend, &Friend::aliasChanged, this, &Widget::onFriendAliasChanged);
|
||||
connect(newfriend, &Friend::nameChanged, this, &Widget::onFriendAliasChanged);
|
||||
|
||||
connect(friendForm, &ChatForm::incomingNotification, this, &Widget::incomingNotification);
|
||||
|
||||
connect(widget, &FriendWidget::chatroomWidgetClicked, this, &Widget::onChatroomWidgetClicked);
|
||||
connect(widget, &FriendWidget::chatroomWidgetClicked, friendForm, &ChatForm::focusInput);
|
||||
connect(widget, &FriendWidget::copyFriendIdToClipboard, this, &Widget::copyFriendIdToClipboard);
|
||||
|
|
|
@ -217,9 +217,7 @@ private slots:
|
|||
void groupInvitesUpdate();
|
||||
void groupInvitesClear();
|
||||
void onDialogShown(GenericChatroomWidget* widget);
|
||||
|
||||
private:
|
||||
int icon_size;
|
||||
void incomingNotification(uint32_t friendId);
|
||||
|
||||
private:
|
||||
bool newMessageAlert(QWidget* currentWindow, bool isActive, bool sound = true, bool notify = true);
|
||||
|
@ -287,6 +285,7 @@ private:
|
|||
QPushButton* friendRequestsButton;
|
||||
QPushButton* groupInvitesButton;
|
||||
unsigned int unreadGroupInvites;
|
||||
int icon_size;
|
||||
|
||||
QMap<int, FriendWidget*> friendWidgets;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user