功能:支持按桌面配置连接参数与多种地址
变更详情:桌面连接可配置化——每卡设置、地址支持 IP/域名/VPN 隧道 - 新增 DesktopStore:~/.config/vdi-terminal/desktops.json 持久化连接参数, 首次启动生成三张默认卡(待分配),老盒子自动从 client.conf 迁移 server 地址 - 新增 DesktopSettingsDialog:按桌面编辑协议/地址/应用名/分辨率/帧率, 置顶显示避免被全屏 kiosk 遮挡 - 桌面列表每张卡增加“设置”按钮;管理菜单 Ctrl+Alt+Shift+M 增加入口 - DesktopService 改为从 store 读取;地址为空的桌面显示待分配且不可连接 - 修复:默认卡未按 endpoint 重算状态导致迁移后仍显示待分配 - 实测真机通过:Windows 自动迁移可连接、对话框显示与保存正常
This commit is contained in:
1 parent
ee6f449bf1
commit
ec1566a80e
10 files changed
+460
-44
No files matched your search
@@ -24,6 +24,7 @@
|
||||
#include <freerdp/scancode.h>
|
||||
|
||||
#include "desktop_list_page.h"
|
||||
#include "desktop_settings_dialog.h"
|
||||
#include "login_page.h"
|
||||
|
||||
namespace vdi {
|
||||
@@ -132,6 +133,7 @@ void MainWindow::setupUi() {
|
||||
stack_->addWidget(list);
|
||||
|
||||
connect(list, &DesktopListPage::desktopSelected, this, &MainWindow::onDesktopSelected);
|
||||
connect(list, &DesktopListPage::editRequested, this, &MainWindow::onEditDesktopRequested);
|
||||
connect(list, &DesktopListPage::logoutRequested, this, &MainWindow::onLogoutRequested);
|
||||
|
||||
// 会话视图
|
||||
@@ -330,6 +332,28 @@ void MainWindow::onDesktopSelected(const QString& desktopId) {
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::onEditDesktopRequested(const QString& desktopId) {
|
||||
// 桌面连接设置:编辑协议/地址/应用名/分辨率/帧率,保存后立即刷新列表。
|
||||
// 现场环境地址不同或走 VPN 隧道时,在这里改地址即可,无需改代码。
|
||||
DesktopSettingsDialog dialog(desktops_, desktopId, this);
|
||||
dialog.setStyleSheet(
|
||||
QStringLiteral("QWidget { background: #0f1420; color: #e6e9ef; }"
|
||||
"QLineEdit { background: #1a2233; border: 1px solid #2b3654; "
|
||||
"border-radius: 4px; padding: 8px; color: #e6e9ef; }"
|
||||
"QComboBox { background: #1a2233; border: 1px solid #2b3654; "
|
||||
"border-radius: 4px; padding: 8px; color: #e6e9ef; }"
|
||||
"QPushButton { background: #232d44; border: 1px solid #2b3654; "
|
||||
"border-radius: 6px; color: #e6e9ef; }"
|
||||
"QLabel { color: #e6e9ef; }"));
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
desktops_ = dialog.desktops();
|
||||
if (desktopListPage_) {
|
||||
desktopListPage_->setDesktops(desktops_);
|
||||
desktopListPage_->setStatus(QStringLiteral("连接配置已保存"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onLogoutRequested() {
|
||||
stopSessions();
|
||||
desktopService_.logout();
|
||||
@@ -546,12 +570,18 @@ void MainWindow::onMenuAction(int action) {
|
||||
break;
|
||||
default: {
|
||||
QMenu menu(this);
|
||||
QAction* settings = menu.addAction(QStringLiteral("桌面连接设置"));
|
||||
menu.addSeparator();
|
||||
QAction* reconnect = menu.addAction(QStringLiteral("重新连接当前桌面"));
|
||||
QAction* disconnect = menu.addAction(QStringLiteral("断开并返回桌面列表"));
|
||||
menu.addSeparator();
|
||||
QAction* quit = menu.addAction(QStringLiteral("退出终端"));
|
||||
QAction* chosen = menu.exec(QCursor::pos());
|
||||
if (chosen == reconnect) {
|
||||
if (chosen == settings) {
|
||||
if (fsm_.current() == State::kDesktopList || fsm_.current() == State::kConfig) {
|
||||
onEditDesktopRequested(QString());
|
||||
}
|
||||
} else if (chosen == reconnect) {
|
||||
onMenuAction(1);
|
||||
} else if (chosen == disconnect) {
|
||||
onMenuAction(2);
|
||||
|
||||
Reference in new issue
Block a user