mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(chatform): Remove Audio dependencies from ChatForm
This commit is contained in:
parent
695abadd7c
commit
7e3ad7ba87
|
@ -386,7 +386,6 @@ void ChatForm::onAvEnd(uint32_t friendId)
|
|||
netcam->showNormal();
|
||||
}
|
||||
|
||||
Audio::getInstance().stopLoop();
|
||||
updateCallButtons();
|
||||
stopCounter();
|
||||
hideNetcam();
|
||||
|
@ -406,10 +405,11 @@ void ChatForm::showOutgoingCall(bool video)
|
|||
void ChatForm::onAnswerCallTriggered()
|
||||
{
|
||||
delete callConfirm;
|
||||
Audio::getInstance().stopLoop();
|
||||
uint32_t friendId = f->getFriendId();
|
||||
emit acceptCall(friendId);
|
||||
|
||||
updateCallButtons();
|
||||
CoreAV* av = Core::getInstance()->getAv();
|
||||
uint32_t friendId = f->getFriendId();
|
||||
if (!av->answerCall(friendId)) {
|
||||
updateCallButtons();
|
||||
stopCounter();
|
||||
|
@ -423,9 +423,7 @@ void ChatForm::onAnswerCallTriggered()
|
|||
void ChatForm::onRejectCallTriggered()
|
||||
{
|
||||
delete callConfirm;
|
||||
Audio::getInstance().stopLoop();
|
||||
CoreAV* av = Core::getInstance()->getAv();
|
||||
av->cancelCall(f->getFriendId());
|
||||
emit rejectCall(f->getFriendId());
|
||||
}
|
||||
|
||||
void ChatForm::onCallTriggered()
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
signals:
|
||||
void aliasChanged(const QString& alias);
|
||||
void incomingNotification(uint32_t friendId);
|
||||
void rejectCall(uint32_t friendId);
|
||||
void acceptCall(uint32_t friendId);
|
||||
|
||||
public slots:
|
||||
void startFileSend(ToxFile file);
|
||||
|
|
|
@ -234,6 +234,9 @@ void Widget::init()
|
|||
|
||||
const Settings& s = Settings::getInstance();
|
||||
Core* core = Nexus::getCore();
|
||||
CoreAV* av = core->getAv();
|
||||
connect(av, &CoreAV::avEnd, this, &Widget::onCallEnd);
|
||||
|
||||
connect(core, &Core::fileDownloadFinished, filesForm, &FilesForm::onFileDownloadComplete);
|
||||
connect(core, &Core::fileUploadFinished, filesForm, &FilesForm::onFileUploadComplete);
|
||||
connect(core, &Core::selfAvatarChanged, profileForm, &ProfileForm::onSelfAvatarLoaded);
|
||||
|
@ -928,6 +931,23 @@ void Widget::incomingNotification(uint32_t friendId)
|
|||
audio.playMono16Sound(Audio::getSound(Audio::Sound::IncomingCall));
|
||||
}
|
||||
|
||||
void Widget::onRejectCall(uint32_t friendId)
|
||||
{
|
||||
Audio::getInstance().stopLoop();
|
||||
CoreAV* av = Core::getInstance()->getAv();
|
||||
av->cancelCall(friendId);
|
||||
}
|
||||
|
||||
void Widget::onAcceptCall(uint32_t friendId)
|
||||
{
|
||||
Audio::getInstance().stopLoop();
|
||||
}
|
||||
|
||||
void Widget::onCallEnd(uint32_t friendId)
|
||||
{
|
||||
Audio::getInstance().stopLoop();
|
||||
}
|
||||
|
||||
void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
||||
{
|
||||
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
|
||||
|
@ -954,6 +974,8 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
|||
connect(newfriend, &Friend::nameChanged, this, &Widget::onFriendAliasChanged);
|
||||
|
||||
connect(friendForm, &ChatForm::incomingNotification, this, &Widget::incomingNotification);
|
||||
connect(friendForm, &ChatForm::rejectCall, this, &Widget::onRejectCall);
|
||||
connect(friendForm, &ChatForm::acceptCall, this, &Widget::onAcceptCall);
|
||||
|
||||
connect(widget, &FriendWidget::chatroomWidgetClicked, this, &Widget::onChatroomWidgetClicked);
|
||||
connect(widget, &FriendWidget::chatroomWidgetClicked, friendForm, &ChatForm::focusInput);
|
||||
|
|
|
@ -218,6 +218,9 @@ private slots:
|
|||
void groupInvitesClear();
|
||||
void onDialogShown(GenericChatroomWidget* widget);
|
||||
void incomingNotification(uint32_t friendId);
|
||||
void onRejectCall(uint32_t friendId);
|
||||
void onAcceptCall(uint32_t friendId);
|
||||
void onCallEnd(uint32_t friendId);
|
||||
|
||||
private:
|
||||
bool newMessageAlert(QWidget* currentWindow, bool isActive, bool sound = true, bool notify = true);
|
||||
|
|
Loading…
Reference in New Issue
Block a user