Send call window actions through the owned bridge API
This commit is contained in:
1 parent
4b4f48963e
commit
299c1b86f8
2 files changed
+17
-19
No files matched your search
@@ -25,8 +25,6 @@
|
||||
#include <cstring>
|
||||
|
||||
extern "C" {
|
||||
#include "call/call.h"
|
||||
#include "../../lib/mem.h"
|
||||
#include "../../lib/debug_config.h"
|
||||
}
|
||||
|
||||
@@ -311,7 +309,9 @@ CallWindow::CallWindow(QWidget* parent)
|
||||
connect(m_continueBtn, &QPushButton::clicked, this, [this] {
|
||||
if (m_state != WaitDecision) return;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "desktop caller overrides phone busy id=%016llx", (unsigned long long)m_callId);
|
||||
postCallFn(call_continue_trampoline, m_callId);
|
||||
if (gui_bridge_call_action(GUI_CALL_CONTINUE, m_callId) < 0) {
|
||||
m_statusLabel->setText(callText("Could not send the call command")); return;
|
||||
}
|
||||
setState(Outgoing);
|
||||
SoundManager::instance()->playLoop("call_connecting");
|
||||
});
|
||||
@@ -578,26 +578,22 @@ void CallWindow::applyVideo() {
|
||||
m_video->setVideo(enabled, m_camera->currentData().toByteArray(), size.width(), size.height(), m_codec->currentData().toInt(), fps ? fps : 30);
|
||||
}
|
||||
|
||||
void CallWindow::postCallFn(void (*fn)(void*), uint64_t callId) {
|
||||
struct call_id_arg* a = (struct call_id_arg*)u_malloc(sizeof(*a));
|
||||
if (!a) return;
|
||||
a->inst = gui_bridge_get_inst();
|
||||
a->call_id = callId;
|
||||
gui_bridge_post_uasync_fn(fn, a);
|
||||
}
|
||||
|
||||
void CallWindow::onAccept() {
|
||||
if (gui_bridge_call_action(GUI_CALL_ACCEPT, m_callId) < 0) {
|
||||
m_statusLabel->setText(callText("Could not send the call command")); return;
|
||||
}
|
||||
SoundManager::instance()->stopLoop();
|
||||
setState(Active);
|
||||
postCallFn(call_accept_trampoline, m_callId);
|
||||
}
|
||||
|
||||
void CallWindow::onDecline() {
|
||||
postCallFn(call_decline_trampoline, m_callId);
|
||||
if (gui_bridge_call_action(GUI_CALL_DECLINE, m_callId) < 0)
|
||||
m_statusLabel->setText(callText("Could not send the call command"));
|
||||
}
|
||||
|
||||
void CallWindow::onHangup() {
|
||||
postCallFn(call_hangup_trampoline, m_callId);
|
||||
if (gui_bridge_call_action(GUI_CALL_HANGUP, m_callId) < 0)
|
||||
m_statusLabel->setText(callText("Could not send the call command"));
|
||||
}
|
||||
|
||||
void CallWindow::onMuteToggled(bool checked) {
|
||||
@@ -615,8 +611,9 @@ void CallWindow::onDeviceChanged(int index) {
|
||||
|
||||
void CallWindow::closeEvent(QCloseEvent* event) {
|
||||
m_video->stop(); m_videoCall = 0;
|
||||
if (m_state == Outgoing || m_state == Ringing || m_state == Active || m_state == WaitDecision)
|
||||
postCallFn(call_hangup_trampoline, m_callId);
|
||||
if ((m_state == Outgoing || m_state == Ringing || m_state == Active || m_state == WaitDecision)
|
||||
&& gui_bridge_call_action(GUI_CALL_HANGUP, m_callId) < 0)
|
||||
DEBUG_WARN(DEBUG_CATEGORY_CALL, "call window closed without queued hangup id=%llu", (unsigned long long)m_callId);
|
||||
emit closed(m_callId);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user