- Add lib/libopus/ (opus v1.6.1 embedded source: CELT 18 .c, SILK 77 .c, SILK float 28 .c, OPUS core 14 .c) - Add lib/opus_codec.h/.c (wrapper: encoder, decoder, raw PCM int16) - Add tests/test_opus_codec.c (7 tests: silence, sine, compression, PLC, null, defaults, multi-frame) - chatgui: AudioRecorder (miniaudio capture, 48kHz mono) - chatgui: VoiceEncoder (PCM→Opus file with custom container) - chatgui: VoicePlayer (Opus→PCM playback via SoundManager) - chatgui: PTT button in InputBar, voice message send/receive in MessageList - chatgui: AudioDeviceSettingsPage (device selection, persisted in ui_state) - chatgui: MessageDelegate voice message rendering (play button + duration) - Update autotools: configure.ac, Makefile.am, src/Makefile.am, tests/Makefile.am - Update CMake: chatgui CMakeLists.txt, libutun CMakeLists.txt (link libopus_internal.a)
67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <QMainWindow>
|
|
#include <QSystemTrayIcon>
|
|
#include <QMenu>
|
|
|
|
class ChannelList;
|
|
class MessageList;
|
|
class AccountList;
|
|
class DbManager;
|
|
class UtunNode;
|
|
class AudioRecorder;
|
|
|
|
class MainWindow : public QMainWindow {
|
|
Q_OBJECT
|
|
public:
|
|
explicit MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
|
|
const QString& dbPath = QString(),
|
|
const QString& debugFile = QString(),
|
|
const QString& debugLevel = QString(),
|
|
const QString& debugCategories = QString());
|
|
~MainWindow() override;
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
private slots:
|
|
void onTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
|
void showInviteDialog(const QString& channelId);
|
|
void showJoinDialog();
|
|
void onCreateGroupRequested();
|
|
void showSettings();
|
|
|
|
public:
|
|
void onMessageReceived(const char* ch_id, int ch_id_len, uint64_t author);
|
|
void onMembersChanged(const char* ch_id);
|
|
void onAutoConnectStatus(uint8_t status, uint16_t total, uint16_t totalNodes, uint16_t connected);
|
|
void onChannelPeersOnline(const char* ch_id, int ch_id_len, uint16_t online);
|
|
void reloadChannels();
|
|
UtunNode* utunNode() const { return m_node; }
|
|
|
|
private:
|
|
void setupUi();
|
|
void setupTray();
|
|
void setupNode();
|
|
void setupMessaging();
|
|
void setupSoundFromConfig();
|
|
void setupBridgeCallbacks();
|
|
void setupConnects();
|
|
|
|
ChannelList *m_channelList;
|
|
MessageList *m_messageList;
|
|
AccountList *m_accountList;
|
|
QSystemTrayIcon *m_trayIcon;
|
|
QMenu *m_trayMenu;
|
|
DbManager *m_db;
|
|
UtunNode *m_node = nullptr;
|
|
QString m_cfgPath;
|
|
QString m_cfgDbPath;
|
|
QString m_cfgDebugFile;
|
|
QString m_cfgDebugLevel;
|
|
QString m_cfgDebugCategories;
|
|
QString m_pendingChannelSelect;
|
|
QString m_currentChannelId;
|
|
AudioRecorder *m_recorder = nullptr;
|
|
};
|