diff --git a/src/widget.cpp b/src/widget.cpp index bf67d28..1e0e2fb 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -745,9 +745,15 @@ void Widget::searchApp(QString text) // 禁止同时进行多次搜索 if (!mutex.tryLock()) { + qDebug() << "Do not repeat searches!"; + sendNotification(tr("Do not repeat searches!")); return; } + //加载动画 + spinner->show(); + spinner->start(); + // 关键字搜索处理 httpClient->get("https://search.deepinos.org.cn/appinfo/search") .header("content-type", "application/json") @@ -760,8 +766,14 @@ void Widget::searchApp(QString text) 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) { @@ -781,9 +793,9 @@ void Widget::closeEvent(QCloseEvent *event) } /** - * @brief 展示搜索的APP信息 + * @brief 清除搜索的APP信息 */ -void Widget::displaySearchApp(QJsonArray array) +void Widget::clearSearchApp() { ui->stackedWidget->setCurrentIndex(4); @@ -798,8 +810,14 @@ void Widget::displaySearchApp(QJsonArray array) } main->removeItem(applist_grid); - spinner->show(); - spinner->start(); +} +/** + * @brief 展示搜索的APP信息 + */ +void Widget::displaySearchApp(QJsonArray array) +{ + + for(int i = 0; i < array.size(); i++) { diff --git a/src/widget.h b/src/widget.h index 9b7da59..9dedead 100644 --- a/src/widget.h +++ b/src/widget.h @@ -82,6 +82,7 @@ private slots: void sltAppinfoScreenshot(QPixmap *picture, int index); void sltAppinfoFinish(); + void clearSearchApp(); // 清除搜索的APP信息 void displaySearchApp(QJsonArray array); // 展示搜索的APP信息 void downloadIconsFinished(int arraysize); // 当前搜索列表图标是否下载完成