meetingselectionwidget.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef MEETINGSELECTIONWIDGET_H
  2. #define MEETINGSELECTIONWIDGET_H
  3. #include <QWidget>
  4. #include <QVBoxLayout>
  5. #include <QHBoxLayout>
  6. #include <QPushButton>
  7. #include <QLabel>
  8. #include <QFrame>
  9. #include <QStringList>
  10. class UserProfileWidget; // 前置声明:复用已有的用户资料组件
  11. class StatsWidget; // 前置声明:消息统计组件
  12. class WebSocketClient; // 前置声明:消息源
  13. class MeetingSelectionWidget : public QWidget
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit MeetingSelectionWidget(QWidget *parent = nullptr);
  18. ~MeetingSelectionWidget();
  19. // 设置用户角色(兼容两种输入)
  20. void setUserRoles(const QStringList &roles);
  21. void setUserRoles(const QString &roles);
  22. // 设置用户信息
  23. void setUserInfo(const QString &username, const QString &userId);
  24. // 临时:设置统计信息来源(来自 WebSocketClient 的 statsUpdate 信号)
  25. void setWebSocketClient(WebSocketClient *client);
  26. signals:
  27. // 用户选择加入会议
  28. void joinMeetingRequested();
  29. // 用户选择创建会议
  30. void createMeetingRequested();
  31. // 用户选择退出登录
  32. void logoutRequested();
  33. private slots:
  34. void onJoinMeetingClicked();
  35. void onCreateMeetingClicked();
  36. void onLogoutClicked();
  37. private:
  38. void setupUI();
  39. void updateButtonsVisibility();
  40. void applyStyles();
  41. // UI组件
  42. QVBoxLayout *m_mainLayout;
  43. QLabel *m_titleLabel;
  44. QLabel *m_welcomeLabel;
  45. UserProfileWidget *m_userProfile; // 使用已有的用户资料组件
  46. StatsWidget *m_statsWidget; // 新增:消息统计组件
  47. QFrame *m_buttonFrame;
  48. QVBoxLayout *m_buttonLayout;
  49. QPushButton *m_joinMeetingBtn;
  50. QPushButton *m_createMeetingBtn;
  51. QPushButton *m_logoutBtn;
  52. // 用户信息
  53. QStringList m_userRoles;
  54. QString m_username;
  55. QString m_userId;
  56. // 是否为管理员
  57. bool m_isAdmin;
  58. // 统计信号来源
  59. WebSocketClient *m_wsClient = nullptr;
  60. };
  61. #endif // MEETINGSELECTIONWIDGET_H