- 登录页改为用户认证(本地演示认证,账号密码非空通过) - 新增桌面列表页:Windows/Moonlight 可连接,Ubuntu/麒麟待分配 - 新增 DesktopService 适配层(登录/桌面列表/连接票据,后续接 API) - 新增 MoonlightSession:QProcess 参数数组直启 moonlight-qt,退出回列表 - 状态机扩展 AUTHENTICATING / DESKTOP_LIST - 移除开机自动 RDP,收敛为 monitor -> kiosk-shell 单一自启链 - Monitor 按进程组结束整棵进程树,修复孤儿串流进程 - vdi-moonlight 启动器新增 vsync/frame-pacing/overlay 低延迟开关
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
// Moonlight 会话(外部进程)
|
||
//
|
||
// 以 QProcess 参数数组直启 moonlight-qt(不拼 shell 命令),
|
||
// 串流期间 moonlight-qt 独占全屏显示;进程退出后回调 MainWindow 返回桌面列表。
|
||
// 参数来自 ConnectionTicket,不再读取全局静态配置。
|
||
|
||
#ifndef KIOSK_SHELL_MOONLIGHT_SESSION_H
|
||
#define KIOSK_SHELL_MOONLIGHT_SESSION_H
|
||
|
||
#include <QProcess>
|
||
#include <QString>
|
||
#include <functional>
|
||
|
||
#include "desktop_session.h"
|
||
|
||
namespace vdi {
|
||
|
||
class MoonlightSession : public QObject {
|
||
Q_OBJECT
|
||
|
||
public:
|
||
struct Options {
|
||
// 低延迟开关(实测 A/B 后定版)
|
||
bool vsync = true;
|
||
bool framePacing = true;
|
||
bool performanceOverlay = false;
|
||
bool audioOnHost = true;
|
||
QString videoCodec = QStringLiteral("H.264");
|
||
QString decoder = QStringLiteral("software"); // RK3528 无可用 V4L2 硬解设备
|
||
};
|
||
|
||
using StateCallback = std::function<void(bool running, const QString& message)>;
|
||
|
||
explicit MoonlightSession(QObject* parent = nullptr);
|
||
~MoonlightSession() override;
|
||
|
||
void setOptions(const Options& options);
|
||
|
||
// 启动串流;成功返回 true(不代表串流已建立,仅代表进程已拉起)
|
||
bool start(const ConnectionTicket& ticket, StateCallback callback);
|
||
|
||
// 终止串流(管理菜单/退出登录时调用)
|
||
void stop();
|
||
|
||
bool isRunning() const;
|
||
|
||
private slots:
|
||
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||
void onProcessError(QProcess::ProcessError error);
|
||
|
||
private:
|
||
QProcess* process_ = nullptr;
|
||
Options options_;
|
||
StateCallback callback_;
|
||
};
|
||
|
||
} // namespace vdi
|
||
|
||
#endif // KIOSK_SHELL_MOONLIGHT_SESSION_H
|