- src/call/: сигналинг (call.c, call_proto.h, ETCP_RT_ID_CALL 0x36) + релей медиа + headless аудио-сокет (call_headless.c, call_audio_bind) + Opus/jitter/тоны - chat: события CHAT_EVT_CALL_* (34–40), CHAT_EVT_DM_MESSAGES (41), DM-трамплины - chatgui: call window, miniaudio I/O, audio_frame_ring, test_audio_jitter - chatgui-android: CallScreen/IncomingCallDialog, аудио-роутинг, JNI, рингтон - tests: test_call, test_call_headless
79 lines
2.5 KiB
C++
79 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
|
|
class QTextEdit;
|
|
class QPushButton;
|
|
class QLabel;
|
|
class QProgressBar;
|
|
class QTimer;
|
|
class EmojiPanel;
|
|
class AudioRecorder;
|
|
|
|
class InputBar : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit InputBar(EmojiPanel *emojiPanel, AudioRecorder *recorder,
|
|
QWidget *parent = nullptr);
|
|
|
|
void setRecordingContext(const QString& mediaDirBase, const QString& channelId);
|
|
|
|
/* Включить/выключить медиа-кнопки (PTT/attach). Для DM (text-only) — выключить. */
|
|
void setMediaEnabled(bool enabled);
|
|
|
|
signals:
|
|
void sendMessage(const QString &text);
|
|
void sendVoiceMessage(const QString& mediaSrc, const QString& mediaDest,
|
|
int durationMs, const QString& waveformStr);
|
|
void sendFileAttachment(const QString& mediaSrc, const QString& mediaDest,
|
|
const QString& displayName);
|
|
void sendVideoAttachment(const QString& mediaSrc, const QString& mediaDest,
|
|
const QString& displayName);
|
|
void sendImageAttachment(const QString& mediaSrc, const QString& mediaDest,
|
|
const QString& displayName);
|
|
|
|
protected:
|
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
|
|
private slots:
|
|
void onSendClicked();
|
|
void adjustInputHeight();
|
|
void onPttPressed();
|
|
void onPttReleased();
|
|
void onAttachClicked();
|
|
void clearPendingAttachment();
|
|
void onVideoProgressTick();
|
|
void updateRecordingUI(int ms);
|
|
void showRecordOverlay();
|
|
void hideRecordOverlay();
|
|
|
|
private:
|
|
static QString formatFileSize(qint64 bytes);
|
|
|
|
QTextEdit *m_input;
|
|
QPushButton *m_emojiBtn;
|
|
QPushButton *m_pttBtn;
|
|
QPushButton *m_attachBtn = nullptr;
|
|
EmojiPanel *m_emojiPanel;
|
|
AudioRecorder *m_recorder;
|
|
QWidget *m_recordOverlay = nullptr;
|
|
QLabel *m_recordLabel = nullptr;
|
|
QPushButton *m_cancelRecBtn = nullptr;
|
|
QProgressBar *m_levelBar = nullptr;
|
|
QWidget *m_attachPreview = nullptr;
|
|
QLabel *m_attachPreviewLabel = nullptr;
|
|
QPushButton *m_attachClearBtn = nullptr;
|
|
bool m_pttActive = false;
|
|
QString m_voiceFilePath;
|
|
QString m_mediaDirBase;
|
|
QString m_channelIdForRecord;
|
|
QString m_pendingAttachSrc;
|
|
QString m_pendingAttachDest;
|
|
QString m_pendingAttachName;
|
|
qint64 m_pendingAttachSize = 0;
|
|
bool m_pendingAttachAsVideo = false;
|
|
bool m_pendingAttachAsImage = false;
|
|
QTimer *m_videoProgressTimer = nullptr;
|
|
};
|