From 2d2b431df77d1b4d18eed41fac7810bc54edfaa3 Mon Sep 17 00:00:00 2001 From: Pluto Date: Mon, 29 Aug 2022 12:53:49 +0000 Subject: [PATCH] =?UTF-8?q?!103=20feat:=20=E4=B8=8B=E8=BD=BD=E9=87=8F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=20*=20Merge=20remote-tracking=20branch=20'up?= =?UTF-8?q?stream/master'=20into=20dev=20*=20feat:=20=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=87=8F=20*=20fix:=20spk=20=E6=90=9C=E7=B4=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20*=20fix:=20=E4=BF=AE=E5=A4=8D=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20*=20feat:=20=E7=BB=9F=E8=AE=A1=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E9=87=8F=20*=20Merge=20remote-tracking=20branch=20'up?= =?UTF-8?q?stream/master'=20into=20dev=20*=20feat:=20sender-d=20*=20Merge?= =?UTF-8?q?=20remote-tracking=20branch=20'upstream/master'=20into=20dev=20?= =?UTF-8?q?*=20Merge=20remote-tracking=20branch=20'upstream/master'=20into?= =?UTF-8?q?=20dev=20*=20fix:=20enhance=20download=20speed=20*=20feat:=20?= =?UTF-8?q?=E4=BB=8E=E6=89=80=E6=9C=89=E9=95=9C=E5=83=8F=E6=BA=90=E4=B8=AD?= =?UTF-8?q?=E9=80=89=E5=8F=96=E6=9C=80=E5=BF=AB=E9=95=9C=E5=83=8F=E6=BA=90?= =?UTF-8?q?=E9=AB=98=E9=80=9F=E4=B8=8B=E8=BD=BD=20*=20Merge=20remote-track?= =?UTF-8?q?ing=20branch=20'upstream/master'=20into=20dev=20*=20fix:=20?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8http=E5=A4=B4=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=20*=20Merge=20rem?= =?UTF-8?q?ote-tracking=20branch=20'upstream/master'=20into=20dev=20*=20fe?= =?UTF-8?q?ature:=20metalink=20backhend=20*=20Merge=20remote-tracking=20br?= =?UTF-8?q?anch=20'upstream/master'=20into=20dev=20*=20Merge=20remote-trac?= =?UTF-8?q?king=20branch=20'upstream/master'=20into=20dev=20*=20fix:=20?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E7=B3=BB=E7=BB=9F=E5=8E=9F=E6=9C=89aria2?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=20*=20fix:=20waitforfinish?= =?UTF-8?q?ed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/control | 1 + src/widget.cpp | 13 ++++++++----- src/workerthreads.cpp | 20 ++++++++++++++++++++ src/workerthreads.h | 1 + 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/debian/control b/debian/control index 99992ed..b5f8340 100644 --- a/debian/control +++ b/debian/control @@ -34,6 +34,7 @@ Depends:${shlibs:Depends}, ${misc:Depends}, libdtkwidget5, libnotify4, curl, + openssl, dde-qt5integration, bubblewrap, aria2, diff --git a/src/widget.cpp b/src/widget.cpp index c89262a..da22741 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -94,7 +94,7 @@ Widget::Widget(DBlurEffectWidget *parent) : connect(searchEdit, &DSearchEdit::returnPressed, this, [=]() { qDebug() << "触发了搜索,呜啦啦啦!"; - QString searchtext = searchEdit->text(); + QString searchtext = searchEdit->text().replace("\r",""); if(!searchtext.isEmpty()) { qDebug() << searchEdit->text(); @@ -1308,13 +1308,16 @@ void Widget::on_stackedWidget_currentChanged(int arg1) void Widget::on_webEngineView_urlChanged(const QUrl &arg1) { //分析出服务器中的分类名称 - QStringList url_ = arg1.path().split("/"); + QStringList url_ = arg1.path().replace("//", "/").split("/"); QString pname; - if(url_.size() > 3) + qDebug() << "URL size:" << url_.size(); + if (url_.size() > 3) { type_name = url_[2]; pname = url_[3]; } + qDebug() << "type_name:" << type_name << ";pname" << pname; + //如果是app.json就打开详情页 if(arg1.path().right(8) == "app.json") { @@ -1328,8 +1331,8 @@ void Widget::on_webEngineView_urlChanged(const QUrl &arg1) ui->label_appname->clear(); ui->pushButton_download->setEnabled(false); ui->stackedWidget->setCurrentIndex(2); - qDebug() << "https://d.store.deepinos.org.cn/" + type_name + "/" + pname; - qDebug() << "链接地址:" << arg1; + + qDebug() << "程序跳转链接地址:" << arg1; /* load.cancel(); // 打开并发加载线程前关闭正在执行的线程 diff --git a/src/workerthreads.cpp b/src/workerthreads.cpp index c6841bf..3188b27 100644 --- a/src/workerthreads.cpp +++ b/src/workerthreads.cpp @@ -14,6 +14,25 @@ void SpkAppInfoLoaderThread::run() httpClient = new AeaQt::HttpClient; + + QString downloadTimesUrl = targetUrl.toString(); + downloadTimesUrl = downloadTimesUrl.replace("app.json","download-times.txt"); + httpClient->get(downloadTimesUrl) + .onResponse([this](QString downloadTimesFeedback) + { + qDebug() << "请求应用下载量信息 " << downloadTimesFeedback; + this->downdloadTimes = downloadTimesFeedback.replace("\n",""); + }) + .onError([this](QString errorStr) + { + qDebug() << "请求下载量失败:" << errorStr; + this->downdloadTimes = "0"; + }) + .block() + .timeout(3*1000) + .exec(); + + httpClient->get(targetUrl.toString()) .header("content-type", "application/json") .onResponse([this](QByteArray json_array) @@ -47,6 +66,7 @@ void SpkAppInfoLoaderThread::run() QString details; details = tr("PkgName: ") + json["Pkgname"].toString() + "\n"; details += tr("Version: ") + json["Version"].toString() + "\n"; + details += tr("Download Times: ") + this->downdloadTimes + "\n"; if(!json["Author"].toString().trimmed().isEmpty()) { details += tr("Author: ") + json["Author"].toString() + "\n"; diff --git a/src/workerthreads.h b/src/workerthreads.h index afe4be3..0fa69a1 100644 --- a/src/workerthreads.h +++ b/src/workerthreads.h @@ -23,6 +23,7 @@ protected: private: QUrl targetUrl; QString serverUrl; + QString downdloadTimes; bool finishedDownload = false; int downloaderRetval = 0;