From fbffe1250162e334f3ded1ca5f775e8f038058ed Mon Sep 17 00:00:00 2001 From: uniartisan Date: Thu, 8 Dec 2022 22:44:34 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=90=9C=E7=B4=A2=E4=BB=8E?= =?UTF-8?q?=E7=BD=91=E9=A1=B5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget.cpp | 73 +++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index bda886f..b7c592a 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -751,38 +751,49 @@ void Widget::searchApp(QString text) } //加载动画 - spinner->show(); - spinner->start(); +// spinner->show(); +// spinner->start(); + +// // 关键字搜索处理 +// httpClient->get("https://search.deepinos.org.cn/appinfo/search") +// .header("content-type", "application/json") +// .queryParam("keyword", text) +// .onResponse([this](QByteArray result) +// { +// auto json = QJsonDocument::fromJson(result).array(); +// if (json.empty()) +// { +// qDebug() << "相关应用未找到!"; +// sendNotification(tr("Relative apps Not Found!")); +// mutex.unlock(); +// clearSearchApp(); +// spinner->stop(); +// spinner->hide(); +// ui->stackedWidget->setCurrentIndex(0); +// ui->webEngineView->setUrl(QUrl("https://wayou.github.io/t-rex-runner")); +// return; +// } +// clearSearchApp(); +// displaySearchApp(json); }) +// .onError([this](QString errorStr) +// { +// qDebug() << "请求出错:" << errorStr; +// sendNotification(QString(tr("Request Error: %1")).arg(errorStr)); +// mutex.unlock(); +// return; }) +// .timeout(10 * 1000) +// .exec(); + + if (!themeIsDark){ + ui->webEngineView->setUrl(serverUrl + "store/#/search?keywords=" + text); + }else{ + ui->webEngineView->setUrl(serverUrl + "store/#/darksearch?keywords=" + text); + } +// spinner->stop(); +// spinner->hide(); + mutex.unlock(); + - // 关键字搜索处理 - httpClient->get("https://search.deepinos.org.cn/appinfo/search") - .header("content-type", "application/json") - .queryParam("keyword", text) - .onResponse([this](QByteArray result) - { - auto json = QJsonDocument::fromJson(result).array(); - if (json.empty()) - { - qDebug() << "相关应用未找到!"; - sendNotification(tr("Relative apps Not Found!")); - mutex.unlock(); - clearSearchApp(); - spinner->stop(); - spinner->hide(); - ui->stackedWidget->setCurrentIndex(0); - ui->webEngineView->setUrl(QUrl("https://wayou.github.io/t-rex-runner")); - return; - } - clearSearchApp(); - displaySearchApp(json); }) - .onError([this](QString errorStr) - { - qDebug() << "请求出错:" << errorStr; - sendNotification(QString(tr("Request Error: %1")).arg(errorStr)); - mutex.unlock(); - return; }) - .timeout(10 * 1000) - .exec(); } }