fix(ukcc-plugin): 替换模型下载包的二进制,增加通过desktop文件打开的逻辑.
This commit is contained in:
parent
25baa9140e
commit
254a4bc9d8
|
@ -981,9 +981,28 @@ void Search::initAiSettings() {
|
|||
}
|
||||
|
||||
void Search::onGetAiModelBtnClicked() {
|
||||
// if (!isModelReady) {
|
||||
QProcess::startDetached("kylin-model-downloader", {});
|
||||
// } else {
|
||||
// qWarning() << "Model is ready.";
|
||||
// }
|
||||
bool res(false);
|
||||
auto appLaunchInterface = new QDBusInterface(QStringLiteral("com.kylin.ProcessManager"),
|
||||
QStringLiteral("/com/kylin/ProcessManager/AppLauncher"),
|
||||
QStringLiteral("com.kylin.ProcessManager.AppLauncher"),
|
||||
QDBusConnection::sessionBus());
|
||||
if(!appLaunchInterface->isValid()) {
|
||||
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
|
||||
res = false;
|
||||
} else {
|
||||
appLaunchInterface->setTimeout(10000);
|
||||
QDBusReply<void> reply = appLaunchInterface->call("LaunchApp", "/usr/share/applications/kylin-ai-model-manager.desktop");
|
||||
if(reply.isValid()) {
|
||||
res = true;
|
||||
} else {
|
||||
qWarning() << "ProcessManager dbus called failed!" << reply.error();
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
delete appLaunchInterface;
|
||||
appLaunchInterface = nullptr;
|
||||
|
||||
if (!res) {
|
||||
QProcess::startDetached("kylin-ai-model-manager", {});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue