You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.8 KiB
69 lines
1.8 KiB
#pragma once |
|
|
|
#include <QWidget> |
|
#include <cstdint> |
|
|
|
class QLabel; |
|
class QPushButton; |
|
class QComboBox; |
|
class QTimer; |
|
|
|
/* Окно звонка: состояния Outgoing (пытаемся связаться), Ringing (звоним), |
|
* Incoming (принять/отклонить), Active (идёт разговор, таймер), Ended (завершён). */ |
|
class CallWindow : public QWidget { |
|
Q_OBJECT |
|
public: |
|
enum State { Outgoing, Ringing, Incoming, Active, Ended }; |
|
|
|
explicit CallWindow(QWidget* parent = nullptr); |
|
~CallWindow() override; |
|
|
|
void setCallId(quint64 id) { m_callId = id; } |
|
quint64 callId() const { return m_callId; } |
|
|
|
void setPeerName(const QString& name); |
|
void setBgpPath(const QString& path); |
|
void setState(State s); |
|
State state() const { return m_state; } |
|
|
|
signals: |
|
void closed(quint64 callId); |
|
|
|
protected: |
|
void closeEvent(QCloseEvent* event) override; |
|
|
|
private slots: |
|
void onAccept(); |
|
void onDecline(); |
|
void onHangup(); |
|
void updateDuration(); |
|
void onMuteToggled(bool checked); |
|
void onDeviceChanged(int index); |
|
|
|
private: |
|
void updateButtons(); |
|
void populateDeviceCombo(); |
|
void postCallFn(void (*fn)(void*), uint64_t callId); |
|
|
|
quint64 m_callId = 0; |
|
State m_state = Outgoing; |
|
qint64 m_startMs = 0; |
|
|
|
QLabel* m_avatarLabel; |
|
QLabel* m_peerLabel; |
|
QLabel* m_statusLabel; |
|
QLabel* m_durationLabel; |
|
QLabel* m_bgpPathLabel; |
|
QPushButton* m_acceptBtn; |
|
QPushButton* m_declineBtn; |
|
QPushButton* m_hangupBtn; |
|
QPushButton* m_muteBtn; |
|
QComboBox* m_deviceCombo; |
|
QTimer* m_durationTimer; |
|
|
|
QWidget* m_acceptCell; |
|
QWidget* m_declineCell; |
|
QWidget* m_hangupCell; |
|
QWidget* m_muteCell; |
|
QLabel* m_muteCaption; |
|
};
|
|
|