meetingselectionwidget.h 1.9 KB

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