From 2df5363c2c86425a9d8b21989ec0c1cb728ded27 Mon Sep 17 00:00:00 2001 From: lizhiyuan Date: Thu, 1 Sep 2022 01:39:09 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=E6=98=9F=E7=81=AB=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=95=86=E5=BA=97=E6=A3=80=E6=B5=8B=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget.cpp | 31 +++---------------------------- src/widget.ui | 4 ++-- translations/spark-store_en.ts | 4 ++-- translations/spark-store_fr.ts | 10 +++++----- translations/spark-store_zh_CN.ts | 10 +++++----- 5 files changed, 17 insertions(+), 42 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index 3a40641..594315b 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1090,34 +1090,9 @@ void Widget::on_pushButton_updateApt_clicked() ui->pushButton_updateApt->setEnabled(false); ui->label_aptserver->setText(tr("Updating, please wait...")); - QProcess runupdate; - runupdate.start("pkexec" , QStringList() << "aptss" << "ssupdate"); - runupdate.waitForFinished(); - QString error = runupdate.readAllStandardError(); - - QStringList everyError = error.split("\n"); - bool haveError = false; - for(int i = 0; i < everyError.size(); i++) - { - if(everyError[i].left(2) == "E:") - { - haveError = true; - } - } - - if(!haveError) - { - ui->label_aptserver->setText(tr("Update finished")); - } - else - { - ui->label_aptserver->setText(tr("Apt has reported an error. Please use apt update in terminal to locate the problem.")); - } - - - - - + QString storeSpk = "spk://store/tools/spark-store"; + openUrl(storeSpk); + ui->label_aptserver->setText(tr("")); ui->pushButton_updateApt->setEnabled(true); }); diff --git a/src/widget.ui b/src/widget.ui index a31e9c5..b5c53c0 100644 --- a/src/widget.ui +++ b/src/widget.ui @@ -1220,7 +1220,7 @@ color:#808080 - <html><head/><body><p>The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. </p></body></html> + <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> true @@ -1237,7 +1237,7 @@ - Source Server + Spark Store Update diff --git a/translations/spark-store_en.ts b/translations/spark-store_en.ts index bde37e6..29c1e46 100644 --- a/translations/spark-store_en.ts +++ b/translations/spark-store_en.ts @@ -349,7 +349,7 @@ - <html><head/><body><p>The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. </p></body></html> + <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> @@ -359,7 +359,7 @@ - Source Server + Spark Store Update diff --git a/translations/spark-store_fr.ts b/translations/spark-store_fr.ts index 3f3caa7..4364f9a 100644 --- a/translations/spark-store_fr.ts +++ b/translations/spark-store_fr.ts @@ -370,7 +370,7 @@ Nous sommes nés pour le changement. - <html><head/><body><p>The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. </p></body></html> + <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> @@ -380,7 +380,7 @@ Nous sommes nés pour le changement. - Source Server + Spark Store Update @@ -557,15 +557,15 @@ Nous sommes nés pour le changement. Redémarrez pour prendre effet - <html><head/><body><p>源服务器的作用是保证软件更新,并且支持使用apt工具获取软件。通常我们更建议你使用第一个线路作为更新源,一般是最稳定的。</p></body></html> + <html><head/><body><p>跳转到星火应用商店主页检测更新。</p></body></html> <html><head/><body><p>Le rôle du serveur source est de s'assurer que le logiciel est mis à jour et prend en charge l'utilisation de l'outil apt pour obtenir le logiciel. Nous préférons généralement que vous utilisiez la première ligne comme source de mise à jour, qui est généralement la plus stable. </p></body></html> - 更新源 + 跳转更新 Mettre à jour la source APT - 更新源服务器: + 星火应用商店更新检测: Source APT: diff --git a/translations/spark-store_zh_CN.ts b/translations/spark-store_zh_CN.ts index 1b619df..b7db738 100644 --- a/translations/spark-store_zh_CN.ts +++ b/translations/spark-store_zh_CN.ts @@ -380,18 +380,18 @@ - <html><head/><body><p>The role of the source server is to ensure that the software is updated, and supports the use of the apt tool to get the software. We usually prefer that you use the first line as the update source, which is generally the most stable. </p></body></html> - <html><head/><body><p>源服务器的作用是保证软件更新,并且支持使用apt工具获取软件。通常我们更建议你使用第一个线路作为更新源,一般是最稳定的。</p></body></html> + <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> + <html><head/><body><p>跳转到星火应用商店主页检测更新。</p></body></html> Update - 更新源 + 跳转更新 - Source Server - 更新源服务器 + Spark Store Update + 星火应用商店更新检测 From afee0966c8fc6b02b1393028631a3f29f37ff8f9 Mon Sep 17 00:00:00 2001 From: shenmo Date: Wed, 31 Aug 2022 17:44:46 +0000 Subject: [PATCH 2/8] update src/widget.ui. Signed-off-by: shenmo --- src/widget.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget.ui b/src/widget.ui index b5c53c0..2b25684 100644 --- a/src/widget.ui +++ b/src/widget.ui @@ -1220,7 +1220,7 @@ color:#808080 - <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> + <html><head/><body><p>Check update for Spark Store. </p></body></html> true From c93c221cf18baf6d004355c54ca1bd4d25c9e32d Mon Sep 17 00:00:00 2001 From: shenmo Date: Thu, 1 Sep 2022 01:47:38 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=96=87=E6=A1=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translations/spark-store_en.ts | 28 +++++++++------------------- translations/spark-store_fr.ts | 20 +++++--------------- translations/spark-store_zh_CN.ts | 22 ++++++++++++---------- 3 files changed, 26 insertions(+), 44 deletions(-) diff --git a/translations/spark-store_en.ts b/translations/spark-store_en.ts index 29c1e46..823177f 100644 --- a/translations/spark-store_en.ts +++ b/translations/spark-store_en.ts @@ -150,7 +150,7 @@ - + Install @@ -347,11 +347,6 @@ Refresh - - - <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> - - Update @@ -427,6 +422,11 @@ Take effect when restart + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + + 0B @@ -493,12 +493,7 @@ - - Apt has reported an error. Please use apt update in terminal to locate the problem. - - - - + Uninstall succeeded @@ -513,17 +508,12 @@ - - Update finished - - - - + Temporary cache was cleaned - + The URL has been copied to the clipboard diff --git a/translations/spark-store_fr.ts b/translations/spark-store_fr.ts index 4364f9a..2529c5f 100644 --- a/translations/spark-store_fr.ts +++ b/translations/spark-store_fr.ts @@ -211,7 +211,7 @@ Nous sommes nés pour le changement. - + Install @@ -370,7 +370,7 @@ Nous sommes nés pour le changement. - <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> + <html><head/><body><p>Check update for Spark Store. </p></body></html> @@ -650,11 +650,6 @@ Nous sommes nés pour le changement. Reinstall - - - Update finished - - Failed to get the name to the file to be downloaded. @@ -681,22 +676,17 @@ Nous sommes nés pour le changement. - - Apt has reported an error. Please use apt update in terminal to locate the problem. - - - - + Uninstall succeeded - + Temporary cache was cleaned - + The URL has been copied to the clipboard diff --git a/translations/spark-store_zh_CN.ts b/translations/spark-store_zh_CN.ts index b7db738..5545f8c 100644 --- a/translations/spark-store_zh_CN.ts +++ b/translations/spark-store_zh_CN.ts @@ -205,7 +205,7 @@ - + Install 安装 @@ -379,9 +379,8 @@ 重启商店后生效 - <html><head/><body><p>Jump to the Spark app store home page to check for updates. </p></body></html> - <html><head/><body><p>跳转到星火应用商店主页检测更新。</p></body></html> + <html><head/><body><p>跳转到星火应用商店主页检测更新。</p></body></html> @@ -483,6 +482,11 @@ Take effect when restart 重启商店后生效 + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + 检查星火应用商店更新 + 0B @@ -519,9 +523,8 @@ 不存在 - Update finished - 更新完毕 + 更新完毕 @@ -604,9 +607,8 @@ 正在更新,请稍候…… - Apt has reported an error. Please use apt update in terminal to locate the problem. - 更新中发生错误,请在终端使用apt update来查看错误原因。 + 更新中发生错误,请在终端使用apt update来查看错误原因。 Unknown error! @@ -660,17 +662,17 @@ Click yes to continue. 服务器未知错误 - + Uninstall succeeded 卸载成功 - + Temporary cache was cleaned 缓存目录已清空 - + The URL has been copied to the clipboard 链接已复制到剪贴板 From 5d5fbfbad452acfac7f662bc74d74aa2d727794c Mon Sep 17 00:00:00 2001 From: lizhiyuan Date: Fri, 2 Sep 2022 19:24:45 +0800 Subject: [PATCH 4/8] =?UTF-8?q?feat:=20=E6=B8=85=E9=99=A4=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget.cpp | 10 +++++++++ src/widget.h | 1 + src/widget.ui | 61 ++++++++++++++++++++++++++++---------------------- 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index 594315b..f0bb212 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1148,6 +1148,16 @@ void Widget::on_pushButton_clear_clicked() // 清空临时缓存目录 }); } +void Widget::on_pushButton_clearWebCache_clicked() +{ + QtConcurrent::run([=]() + { + + QString dataLocal = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); + QDir cacheDir(dataLocal ); + cacheDir.removeRecursively(); }); +} + quint64 Widget::dirFileSize(const QString &path) { QDir dir(path); diff --git a/src/widget.h b/src/widget.h index 254b26c..f9faad9 100644 --- a/src/widget.h +++ b/src/widget.h @@ -91,6 +91,7 @@ private slots: void on_pushButton_updateApt_clicked(); void on_pushButton_uninstall_clicked(); void on_pushButton_clear_clicked(); + void on_pushButton_clearWebCache_clicked(); void on_pushButton_website_clicked(); void on_pushButton_clicked(); void on_btn_openDir_clicked(); diff --git a/src/widget.ui b/src/widget.ui index b5c53c0..087c66e 100644 --- a/src/widget.ui +++ b/src/widget.ui @@ -345,7 +345,7 @@ 0 - 2 + 3 @@ -489,7 +489,7 @@ 0 0 - 903 + 889 849 @@ -993,8 +993,8 @@ 0 0 - 869 - 325 + 851 + 324 @@ -1123,8 +1123,8 @@ 0 0 - 738 - 886 + 889 + 716 @@ -1285,7 +1285,31 @@ - + + + + color:#808080 + + + Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. + + + + + + + 0B + + + + + + + Location:/tmp/spark-store + + + + Qt::Horizontal @@ -1305,16 +1329,6 @@ - - - - color:#808080 - - - Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. - - - @@ -1328,17 +1342,10 @@ - - + + - 0B - - - - - - - Location:/tmp/spark-store + Clear Web Cache From 63b28adaf834d248a738ccc64156f6ec4ca6a7ab Mon Sep 17 00:00:00 2001 From: lizhiyuan Date: Tue, 20 Sep 2022 11:55:36 +0800 Subject: [PATCH 5/8] feat: enable GPU --- src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 7b29aeb..6badb00 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,6 +13,10 @@ int main(int argc, char *argv[]) DApplication::loadDXcbPlugin(); // 已废弃,但是对于非deepin桌面可以正常使用标题栏 DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持 // 程序内强制添加"-platformtheme deepin"参数喂给Qt让Qt正确使用Deepin主题修复各种奇怪样式问题 + + // 浏览器开启 GPU 支持 + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blacklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode"); + QVector fakeArgs(argc + 2); fakeArgs[0] = argv[0]; fakeArgs[1] = "-platformtheme"; From c65d7b86dfdc265f47eebb3cca690d35fe4d9ed1 Mon Sep 17 00:00:00 2001 From: lizhiyuan Date: Mon, 26 Sep 2022 23:46:25 +0800 Subject: [PATCH 6/8] fix: high CPU usage because futex is still waiting for queue after illegal exit --- src/widget.cpp | 42 ++++++++++++++++++++++-------------------- src/widget.h | 1 + 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index f0bb212..d815c36 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -18,6 +18,7 @@ #include #include #include // 并发 +#include // close event #include #include @@ -572,14 +573,14 @@ void Widget::chooseLeftMenu(int index) updateUI(); - if(index <= 12) + if (index <= 12) { - if(themeIsDark) + if (themeIsDark) { QString darkurl = menuUrl[index].toString(); QStringList list = darkurl.split("/"); darkurl.clear(); - for(int i = 0; i < list.size() - 1; i++) + for (int i = 0; i < list.size() - 1; i++) { darkurl += list[i] + "/"; } @@ -687,22 +688,18 @@ void Widget::searchApp(QString text) } else { - // sendNotification(tr("Spark store could only process spk:// links for now. The search feature is coming soon!")); - // ui->webView->setUrl(QUrl("http://www.baidu.com/s?wd="+text)); // 这东西对接百度 - // ui->stackedWidget->setCurrentIndex(0); - // 禁止同时进行多次搜索 - if(!mutex.tryLock()) + if (!mutex.tryLock()) { return; } // 关键字搜索处理 httpClient->get("https://search.deepinos.org.cn/appinfo/search") - .header("content-type", "application/json") - .queryParam("keyword", text) - .onResponse([this](QByteArray result) - { + .header("content-type", "application/json") + .queryParam("keyword", text) + .onResponse([this](QByteArray result) + { auto json = QJsonDocument::fromJson(result).array(); if (json.empty()) { @@ -711,18 +708,23 @@ void Widget::searchApp(QString text) mutex.unlock(); return; } - displaySearchApp(json); - }) - .onError([this](QString errorStr) - { + displaySearchApp(json); }) + .onError([this](QString errorStr) + { qDebug() << "请求出错:" << errorStr; sendNotification(QString(tr("Request Error: %1")).arg(errorStr)); mutex.unlock(); - return; - }) - .timeout(10 * 1000) - .exec(); + return; }) + .timeout(10 * 1000) + .exec(); } + httpClient->deleteLater(); +} + +void Widget::closeEvent(QCloseEvent *event) +{ + mutex.unlock(); + httpClient->deleteLater(); } /** diff --git a/src/widget.h b/src/widget.h index f9faad9..9ec716e 100644 --- a/src/widget.h +++ b/src/widget.h @@ -128,6 +128,7 @@ private: void setfoot(int); void updatefoot(); void updateUI(); + void closeEvent(QCloseEvent *event); quint64 dirFileSize(const QString &path); From 0ad4b6c82cf12b3048cc39c0579328d75edeb05a Mon Sep 17 00:00:00 2001 From: lizhiyuan Date: Mon, 26 Sep 2022 23:53:28 +0800 Subject: [PATCH 7/8] fix --- src/widget.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/widget.cpp b/src/widget.cpp index d815c36..8e7d2eb 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -718,7 +718,6 @@ void Widget::searchApp(QString text) .timeout(10 * 1000) .exec(); } - httpClient->deleteLater(); } void Widget::closeEvent(QCloseEvent *event) From e554aec98dd02929bc63123c6c94cffa4ae9f0b7 Mon Sep 17 00:00:00 2001 From: uniartisann Date: Sat, 8 Oct 2022 22:24:16 +0800 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20chrome=20GPU=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e0f07f8..54f042b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) // 程序内强制添加"-platformtheme deepin"参数喂给Qt让Qt正确使用Deepin主题修复各种奇怪样式问题 // 浏览器开启 GPU 支持 - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blacklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode"); + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blocklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode"); QVector fakeArgs(argc + 2); fakeArgs[0] = argv[0];