- u_async.c: process immediate_queue BEFORE epoll_wait in uasync_poll - stcp_link.c: defensive NULL etcp_conn/etcp_link in stcp_link_close - utun_instance.c: move stcp_server_list_destroy_all to Phase J (before ETCP), add deferred drain in both Phase J and L - stcp.h/c: STCP_HS_ENC_CLIENT 6→38, STCP_HS_ENC_SERVER 7→39, exchange ed25519_pubkey in both handshake directions - etcp_connections.c: copy peer_ed25519 from STCP to ETCP_CONN in etcp_link_enter_ready_tcp; guard link->etcp in tcp_link_close_cb - chat_sync.c: fix lk->conn NULL dereference for TCP links - test_stcp.c: update stcp_server_create/stcp_client_connect callsites - tools/chat_tcp_test: change transport udp→tcp
67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
|
|
class QTextEdit;
|
|
class QPushButton;
|
|
class QLabel;
|
|
class QProgressBar;
|
|
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);
|
|
|
|
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);
|
|
|
|
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 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;
|
|
};
|