fix(ukcc-plugin): 替换模型下载包的二进制,增加通过desktop文件打开的逻辑.
This commit is contained in:
parent
bfcefe4ce1
commit
c85cf7b729
|
@ -981,9 +981,28 @@ void Search::initAiSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Search::onGetAiModelBtnClicked() {
|
void Search::onGetAiModelBtnClicked() {
|
||||||
// if (!isModelReady) {
|
bool res(false);
|
||||||
QProcess::startDetached("kylin-model-downloader", {});
|
auto appLaunchInterface = new QDBusInterface(QStringLiteral("com.kylin.ProcessManager"),
|
||||||
// } else {
|
QStringLiteral("/com/kylin/ProcessManager/AppLauncher"),
|
||||||
// qWarning() << "Model is ready.";
|
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