|
|
@@ -213,7 +213,6 @@ void MainWindow::onJoinMeetingRequested()
|
|
|
|
|
|
// 获取会议列表并设置到对话框
|
|
|
RoomInfo roomInfo;
|
|
|
- roomInfo.id = "";
|
|
|
QFuture<HttpResponse> getRoomListFuture = getRoomListApi(roomInfo);
|
|
|
|
|
|
// 使用QtPromise处理异步获取会议列表
|
|
|
@@ -237,7 +236,7 @@ void MainWindow::onJoinMeetingRequested()
|
|
|
meetingNames.append(room.name.value());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 设置可用的会议列表
|
|
|
joinDialog->setAvailableMeetings(meetingIds, meetingNames);
|
|
|
} else {
|
|
|
@@ -301,42 +300,63 @@ void MainWindow::onJoinMeetingRequested()
|
|
|
|
|
|
void MainWindow::onCreateMeetingRequested()
|
|
|
{
|
|
|
- // 创建创建会议对话框
|
|
|
- // CreateMeetingDialog *createDialog = new CreateMeetingDialog(this);
|
|
|
-
|
|
|
- // if (createDialog->exec() == QDialog::Accepted)
|
|
|
-
|
|
|
- {
|
|
|
- // MeetingInfo meetingInfo = createDialog->getMeetingInfo();
|
|
|
-
|
|
|
- // 这里可以添加创建会议的API调用
|
|
|
- // 例如:createMeetingApi(meetingInfo);
|
|
|
-
|
|
|
- // 创建主界面部件(用于创建会议)
|
|
|
- createMainWindow();
|
|
|
- mainWidget->setRole({"role.admin"});
|
|
|
- // 根据用户在对话框中的选择决定角色
|
|
|
- // if (meetingInfo.joinAsAdmin) {
|
|
|
- // // 用户选择以管理员身份加入,使用AvRecorder模式
|
|
|
- // QStringList adminRoles = {"role.admin"};
|
|
|
- // mainWidget->setRole(adminRoles);
|
|
|
- // } else {
|
|
|
- // // 用户选择以观看者身份加入,使用PlayWidget模式
|
|
|
- // QStringList viewerRoles = {"role.viewer"};
|
|
|
- // mainWidget->setRole(viewerRoles);
|
|
|
- // }
|
|
|
-
|
|
|
- // 显示主界面
|
|
|
- stackedWidget->setCurrentWidget(mainWidget);
|
|
|
-
|
|
|
- // 检查房间状态
|
|
|
- // checkRoom();
|
|
|
-
|
|
|
- // 这里可以添加特定的创建会议逻辑
|
|
|
- // 例如:startCreatedMeeting(meetingInfo);
|
|
|
- }
|
|
|
+ // 获取会议列表并设置到对话框
|
|
|
+ RoomInfo roomInfo;
|
|
|
+ roomInfo.ownerId = AppEvent::instance()->userId();
|
|
|
+
|
|
|
+ QFuture<HttpResponse> getRoomListFuture = getRoomListApi(roomInfo);
|
|
|
+
|
|
|
+ // 使用QtPromise处理异步获取会议列表
|
|
|
+ QtPromise::QPromise<HttpResponse> roomListPromise = QtPromise::resolve(getRoomListFuture);
|
|
|
+
|
|
|
+ roomListPromise
|
|
|
+ .then([this](const HttpResponse &response) {
|
|
|
+ qDebug() << "获取会议列表:" << response.data << response.rawData << response.message;
|
|
|
+
|
|
|
+ if (response.code == 0) {
|
|
|
+ RoomListData roomListData(response.data.toObject());
|
|
|
+ QList<RoomInfo> roomInfos = roomListData.getRooms();
|
|
|
+
|
|
|
+ QStringList meetingIds;
|
|
|
+ QStringList meetingNames;
|
|
|
+
|
|
|
+ // 提取会议ID和名称
|
|
|
+ for (const RoomInfo &room : std::as_const(roomInfos)) {
|
|
|
+ if (room.id.has_value() && room.name.has_value()) {
|
|
|
+ meetingIds.append(room.id.value());
|
|
|
+ meetingNames.append(room.name.value());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (meetingIds.size() > 0) {
|
|
|
+ checkRoom(meetingIds[0]);
|
|
|
+ }
|
|
|
|
|
|
- // createDialog->deleteLater();
|
|
|
+ } else {
|
|
|
+ qWarning() << "获取会议列表失败:" << response.message;
|
|
|
+ BubbleTip::showTip(this,
|
|
|
+ QString("获取会议列表失败: %1").arg(response.message),
|
|
|
+ BubbleTip::Top,
|
|
|
+ 3000,
|
|
|
+ BubbleTip::Type::Error);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建主界面部件(用于加入会议)
|
|
|
+ createMainWindow();
|
|
|
+
|
|
|
+ // 加入会议时,强制使用PlayWidget(观看者模式),无论用户角色如何
|
|
|
+ mainWidget->setRole({"role.admin"});
|
|
|
+
|
|
|
+ // 显示主界面
|
|
|
+ stackedWidget->setCurrentWidget(mainWidget);
|
|
|
+ })
|
|
|
+ .fail([this](const std::exception &e) {
|
|
|
+ qWarning() << "获取会议列表异常:" << e.what();
|
|
|
+ BubbleTip::showTip(this,
|
|
|
+ QString("获取会议列表失败: %1").arg(e.what()),
|
|
|
+ BubbleTip::Top,
|
|
|
+ 3000,
|
|
|
+ BubbleTip::Type::Error);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
void MainWindow::onMeetingSelectionLogout()
|