94 lines
2.7 KiB
C++
94 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include <QImage>
|
|
#include <cstdint>
|
|
|
|
class QLabel;
|
|
class QPushButton;
|
|
class QComboBox;
|
|
class QTimer;
|
|
class QCheckBox;
|
|
class QSpinBox;
|
|
class CallVideoEngine;
|
|
class CallVideoWindow;
|
|
|
|
/* Окно звонка: состояния Outgoing (пытаемся связаться), Ringing (звоним),
|
|
* Incoming (принять/отклонить), Active (идёт разговор, таймер), Ended (завершён). */
|
|
class CallWindow : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
enum State { Outgoing, Ringing, Incoming, Active, Ended, WaitDecision };
|
|
|
|
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 setConnectionType(uint8_t type, quint64 nextHop);
|
|
void setAudioStats(int rtt, int buffer, int tempo, int dropped, int underruns, int minimum, int maximum, int reserve);
|
|
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);
|
|
void applyVideo();
|
|
void updateVideoPresentation();
|
|
CallVideoEngine* m_video;
|
|
QCheckBox* m_videoEnabled;
|
|
QComboBox *m_camera, *m_resolution, *m_codec;
|
|
QSpinBox *m_videoMin, *m_videoMax;
|
|
QLabel *m_localPreview, *m_videoStatus;
|
|
QWidget *m_videoControls, *m_panel;
|
|
CallVideoWindow* m_videoWindow;
|
|
QPushButton *m_settingsBtn, *m_showVideoBtn;
|
|
QImage m_remoteImage, m_localImage;
|
|
bool m_receivingVideo = false;
|
|
quint64 m_videoCall = 0;
|
|
bool m_videoRangeReady = false;
|
|
|
|
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;
|
|
QLabel* m_connectionLabel;
|
|
QLabel* m_statsLabel;
|
|
QPushButton* m_acceptBtn;
|
|
QPushButton* m_continueBtn; /* явное разрешение начать вызов занятого телефона */
|
|
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;
|
|
};
|