#include #include #include #include #include #include "desktop_list_page.h" int main(int argc, char** argv) { QApplication app(argc, argv); app.setOrganizationName("vdi-preview"); app.setApplicationName("desktop-selection"); const QStringList args = app.arguments(); if (args.size() < 5) return 2; QSettings().setValue("appearance/light", args[4] == "light"); vdi::DesktopListPage page; page.resize(args[2].toInt(), args[3].toInt()); page.setCurrentUser(QStringLiteral("云终端")); if (!args.contains("empty")) { std::vector desktops; for (const QString& os : {QStringLiteral("Windows"), QStringLiteral("Ubuntu"), QStringLiteral("麒麟")}) { vdi::DesktopInfo d; d.id = os; d.name = os + QStringLiteral(" 云桌面"); d.os = os; d.state = vdi::DesktopState::kAvailable; if (args.contains("states") && os == "Ubuntu") d.state = vdi::DesktopState::kPending; if (args.contains("states") && os == QStringLiteral("麒麟")) d.state = vdi::DesktopState::kUnassigned; desktops.push_back(d); } page.setDesktops(desktops); } if (args.contains("error")) page.setStatus(QStringLiteral("连接失败:管理平台暂不可用;正在自动重试,无需重启盒子"), true); if (args.contains("busy")) { page.setBusy(true); page.setStatus(QStringLiteral("正在连接,请稍候…")); } page.show(); QTimer::singleShot(150, [&] { app.exit(page.grab().save(args[1]) ? 0 : 1); }); return app.exec(); }