summary refs log tree commit diff
path: root/src/CallManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/CallManager.h')
-rw-r--r--src/CallManager.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/CallManager.h b/src/CallManager.h

index 97cffbc8..1d973191 100644 --- a/src/CallManager.h +++ b/src/CallManager.h
@@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2021 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + #pragma once #include <string> @@ -25,41 +29,45 @@ class CallManager : public QObject Q_OBJECT Q_PROPERTY(bool haveCallInvite READ haveCallInvite NOTIFY newInviteState) Q_PROPERTY(bool isOnCall READ isOnCall NOTIFY newCallState) - Q_PROPERTY(bool isVideo READ isVideo NOTIFY newInviteState) - Q_PROPERTY(bool haveLocalVideo READ haveLocalVideo NOTIFY newCallState) + Q_PROPERTY(webrtc::CallType callType READ callType NOTIFY newInviteState) Q_PROPERTY(webrtc::State callState READ callState NOTIFY newCallState) Q_PROPERTY(QString callParty READ callParty NOTIFY newInviteState) Q_PROPERTY(QString callPartyAvatarUrl READ callPartyAvatarUrl NOTIFY newInviteState) Q_PROPERTY(bool isMicMuted READ isMicMuted NOTIFY micMuteChanged) - Q_PROPERTY(bool callsSupported READ callsSupported CONSTANT) + Q_PROPERTY(bool haveLocalPiP READ haveLocalPiP NOTIFY newCallState) Q_PROPERTY(QStringList mics READ mics NOTIFY devicesChanged) Q_PROPERTY(QStringList cameras READ cameras NOTIFY devicesChanged) + Q_PROPERTY(bool callsSupported READ callsSupported CONSTANT) + Q_PROPERTY(bool screenShareSupported READ screenShareSupported CONSTANT) public: CallManager(QObject *); bool haveCallInvite() const { return haveCallInvite_; } bool isOnCall() const { return session_.state() != webrtc::State::DISCONNECTED; } - bool isVideo() const { return isVideo_; } - bool haveLocalVideo() const { return session_.haveLocalVideo(); } + webrtc::CallType callType() const { return callType_; } webrtc::State callState() const { return session_.state(); } QString callParty() const { return callParty_; } QString callPartyAvatarUrl() const { return callPartyAvatarUrl_; } bool isMicMuted() const { return session_.isMicMuted(); } - bool callsSupported() const; + bool haveLocalPiP() const { return session_.haveLocalPiP(); } QStringList mics() const { return devices(false); } QStringList cameras() const { return devices(true); } void refreshTurnServer(); + static bool callsSupported(); + static bool screenShareSupported(); + public slots: - void sendInvite(const QString &roomid, bool isVideo); + void sendInvite(const QString &roomid, webrtc::CallType, unsigned int windowIndex = 0); void syncEvent(const mtx::events::collections::TimelineEvents &event); - void refreshDevices() { CallDevices::instance().refresh(); } void toggleMicMute(); - void toggleCameraView() { session_.toggleCameraView(); } + void toggleLocalPiP() { session_.toggleLocalPiP(); } void acceptInvite(); void hangUp( mtx::events::msg::CallHangUp::Reason = mtx::events::msg::CallHangUp::Reason::User); + QStringList windowList(); + void previewWindow(unsigned int windowIndex) const; signals: void newMessage(const QString &roomid, const mtx::events::msg::CallInvite &); @@ -81,17 +89,18 @@ private: QString callParty_; QString callPartyAvatarUrl_; std::string callid_; - const uint32_t timeoutms_ = 120000; - bool isVideo_ = false; - bool haveCallInvite_ = false; + const uint32_t timeoutms_ = 120000; + webrtc::CallType callType_ = webrtc::CallType::VOICE; + bool haveCallInvite_ = false; std::string inviteSDP_; std::vector<mtx::events::msg::CallCandidates::Candidate> remoteICECandidates_; std::vector<std::string> turnURIs_; QTimer turnServerTimer_; QMediaPlayer player_; + std::vector<std::pair<QString, uint32_t>> windows_; template<typename T> - bool handleEvent_(const mtx::events::collections::TimelineEvents &event); + bool handleEvent(const mtx::events::collections::TimelineEvents &event); void handleEvent(const mtx::events::RoomEvent<mtx::events::msg::CallInvite> &); void handleEvent(const mtx::events::RoomEvent<mtx::events::msg::CallCandidates> &); void handleEvent(const mtx::events::RoomEvent<mtx::events::msg::CallAnswer> &);