| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #pragma once
- #include <QMutex>
- #include <QStringList>
- #include <QTimer>
- #include <QWaitCondition>
- #include <QWidget>
- #include "qobjectdefs.h"
- #include <QVector>
- #include <QPushButton>
- #include <QCheckBox>
- #include "libs/Recorder/export.h"
- class QSplitter;
- class UserProfileWidget;
- class ChatWindow;
- class RecorderWidget; // forward declaration for standalone recorder
- class AVPlayerWidget; // forward declaration for standalone player
- // Removed RecorderAudioWidget forward declaration; use QComboBox instead
- class QComboBox;
- class WebSocketClient;
- class StatsWidget;
- class AudioDeviceSelectorIcon;
- class AudioDeviceSelectorIconDecoupled;
- namespace ADS {
- class DockManager;
- class DockWidget;
- }
- class MainPanel : public QWidget
- {
- Q_OBJECT
- public:
- explicit MainPanel(QWidget *parent = nullptr);
- ~MainPanel();
- void setRole(const QStringList &roleList);
- void setPushRoomId(const QString &room);
- // 新增:独立窗口显示控制
- public slots:
- void showRecorderStandalone();
- void showPlayerStandalone();
- void showChatStandalone();
- void showChatEmbedded();
- signals:
- void logoutClicked();
- public slots:
- private:
- void setPlayerWidget(QWidget *newPlayer);
- void handleDebouncedPlay(); // 防抖处理函数
- private:
- QSplitter *splitter = nullptr;
- QWidget *playerContainer = nullptr;
- QWidget *playerWidget = nullptr;
- UserProfileWidget *userProfile = nullptr;
- ChatWindow *chatView = nullptr; // 统一的聊天窗口实例
- // 新增:独立显示的窗口
- RecorderWidget *m_recorderStandalone = nullptr;
- AVPlayerWidget *m_avPlayerStandalone = nullptr;
- QWidget *m_chatContainer = nullptr; // 聊天窗口的容器(用于嵌入式显示)
- WebSocketClient *webSocketClient = nullptr;
- StatsWidget *statsWidget = nullptr;
- bool m_isStartingPlay = false;
- QMutex m_playMutex;
- QWaitCondition m_playCond;
- QTimer *m_debounceTimer = nullptr;
- QString m_pendingRoomId;
- class PopoverButtonGroup *buttonGroup;
- AudioDeviceSelectorIcon *m_audioDeviceSelector = nullptr;
- AudioDeviceSelectorIconDecoupled *m_audioDeviceSelectorDecoupled = nullptr;
- // 音频设备选择弹层中的控件与数据缓存(改为使用基础控件 QComboBox)
- QComboBox *m_micWidget = nullptr; // 麦克风下拉框
- QComboBox *m_speakerWidget = nullptr; // 扬声器下拉框
- QVector<AMRECORDER_DEVICE> m_micDevices; // 缓存麦克风设备列表
- QVector<AMRECORDER_DEVICE> m_speakerDevices; // 缓存扬声器设备列表
- // 新增:视频编码器选择控件与缓存
- QComboBox *m_encoderWidget = nullptr; // 视频编码器下拉框
- QVector<AMRECORDER_ENCODERS> m_encoderList; // 缓存编码器列表
- int m_selectedEncoderId = -1; // 当前选择的编码器 id
- // 新增:录制控制按钮(从RecorderWidget移动过来)
- QPushButton *m_recordButton = nullptr; // 开始录制按钮
- class FunctionButton *m_streamButton = nullptr; // 开始推流按钮(独立FunctionButton)
- QPushButton *m_settingsButton = nullptr; // 设置按钮
- QCheckBox *m_drawCursorCheckBox = nullptr; // 绘制鼠标指针选项
- QCheckBox *m_syncRecordCheckBox = nullptr; // 推流时同步录制选项
- // DockManager 相关
- ADS::DockManager *m_dockManager = nullptr;
-
- // 推流状态跟踪
- bool m_isStreaming = false;
-
- private slots:
- void initAudioDeviceSelectors();
-
- // 新增:录制控制按钮的槽函数
- void onRecordButtonClicked();
- void onStreamButtonClicked();
- void onSettingsButtonClicked();
-
- // 聊天窗口关闭处理
- void onChatWindowCloseRequested();
- };
|