Compare commits

...

35 Commits

Author SHA1 Message Date
shenmo
62f0dd097c update README.md. 2020-11-29 12:11:42 +08:00
b7e038bd88 Fix Bugs
Fix a bug that dirname in ~/.local/share/spark-union/ is translated into
Chinese.
2020-11-19 14:16:16 +08:00
shenmo
4f0e00ad76 修改了一个图标的名字 2020-11-18 15:17:36 +08:00
shenmo
579008e8b2 !13 更新部分语言翻译
Merge pull request !13 from 枯叶蚊/master
2020-11-14 12:17:36 +08:00
metanoia1989
ccb405c983 更新部分语言翻译 2020-11-14 11:02:50 +08:00
f5788efb47 update README.md. 2020-10-27 17:26:56 +08:00
32bc272791 update README.md. 2020-10-27 17:26:12 +08:00
c5f04b5675 update README.md. 2020-10-27 17:24:50 +08:00
cf208d0736 Roll back to old version of DAboutDialog
Roll back to old version of DAboutDialog for compability with Ubuntu.
2020-10-27 17:15:08 +08:00
fdc7cb4cb6 修改: README.md 2020-10-27 16:55:56 +08:00
8e89ce3ae3 keep old version AboutDialog
Keep old version AboutDialog to be compatible with ubuntu.
2020-10-26 23:29:41 +08:00
ee51f59874 Bump version to 2.0.2.5
Bump version to 2.0.2.5.
2020-10-26 22:50:21 +08:00
3d09a28794 main.coo改回定制,2.0.2.5版本号,改了logo配色 2020-10-26 17:47:24 +08:00
4b05758479 main.coo改回定制,2.0.2.5版本号,改了logo配色 2020-10-26 17:47:14 +08:00
74d9d0b563 main.coo改回定制,2.0.2.5版本号,改了logo配色 2020-10-26 17:44:19 +08:00
123456
f1a4f7acb5 main.cpp改回spark定制 2020-10-26 17:41:46 +08:00
93be66e871 Improve menu list on the left
Set StyleSheet of menu list on the left to
"text-align:left;padding-left:15px;" when system locale is not "zh_CN";

Update part of names in menu list and corresponding translation.
2020-10-24 20:24:31 +08:00
7b46cca1d4 Fix Bugs
Fix a Bug in updateUI(), everytime calling this method will set fonts to
system default display font and delete custom font settings, have to set
custom fonts again here.
2020-10-23 15:15:53 +08:00
c529367998 !12 卸载安装包时,将pkg转换为小写,让dpkg能够识别
Merge pull request !12 from 枯叶蚊/master
2020-10-20 09:02:27 +08:00
metanoia1989
beae3e3efa 应用下载后面换行 2020-10-19 22:44:44 +08:00
metanoia1989
9706480931 添加.vscode和build为忽略目录 2020-10-19 22:17:22 +08:00
metanoia1989
ed64eb6f5b 卸载安装包时,将pkg-name转换为小写 2020-10-19 22:16:59 +08:00
8f6e5408ae 修改: main.cpp,使用了旧式的DAboutDialog,放弃了定制,可以在ubuntu上运行了。仍然无法打开关于 2020-10-19 15:16:54 +08:00
d5783458fc update README.md. 2020-10-19 00:14:10 +08:00
6e05066dd9 update README.md. 2020-10-19 00:11:33 +08:00
58aa5a3787 update README.md. 2020-10-19 00:10:21 +08:00
6087c8a5c8 update README.md. 2020-10-18 10:13:06 +08:00
ff758946be update README.md. 2020-10-18 10:12:30 +08:00
d1cbf95447 update README.md. 2020-10-18 10:11:18 +08:00
Jerry
187ce7e277 编译说明增加一个组件 2020-10-16 15:07:18 +08:00
d3e4f75254 !11 修复中文环境无法显示通知的问题
Merge pull request !11 from lidanger/master
2020-10-15 15:12:53 +08:00
lidanger
949eb33511 修复中文环境通知,上次少加两行初始化代码 2020-10-14 22:20:55 +08:00
lidanger
3f65002dc9 修复中文环境无法显示通知的问题 2020-10-14 20:57:32 +08:00
RigoLigoRLC
cfd4c7689a RigoLigo合并随机崩溃的修复 2020-10-09 02:08:01 +08:00
RigoLigoRLC
367c8d857c 修复 加载应用程序信息时随机崩溃
这个问题就是因为在异步操作时直接修改GUI,导致事件发生时GUI与异步加载线程不同步导致程序崩溃。将所有加载操作已移至
SpkAppInfoLoaderThread,在其需要操作GUI时阻塞该工作线程并发射信号让主线程操作GUI,以解决该问题。
2020-10-09 02:06:28 +08:00
21 changed files with 2010 additions and 641 deletions

2
.gitignore vendored
View File

@@ -1 +1,3 @@
spark-store.pro.user*
build/
.vscode/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 46 KiB

350
README.md
View File

@@ -1,9 +1,22 @@
# 星火商店
[![Fork me on Gitee](https://gitee.com/deepin-community-store/spark-store/widgets/widget_5.svg?color=undefined)](https://gitee.com/deepin-community-store/spark-store)
# 星火应用商店[![star](https://gitee.com/deepin-community-store/spark-store/badge/star.svg?theme=dark)](https://gitee.com/deepin-community-store/spark-store/stargazers)
众所周知国内的Linux应用比较少wine应用难以获取优质工具分散在民间各大论坛无法形成合力难以改善生态
生态构建需要的不是某一方的单打独斗,而是人人行动起来,汇聚星火,产生燎原之势
我们创建了这个应用商店广泛收录大家需要的软件包搜集优质小工具主动适配wine应用存放到储存库供大家获取
我们支持Deepin 20 ; Ubuntu 20.04 LTS ; UOS Home 20
希望看到这里的人也可以加入我们的队伍开发或者投递应用都很欢迎共同构建Linux应用生态
### [在这里投稿](http://upload.spark-app.store)
#### 介绍
星火商店商店,由深度社区爱好者维护
web页面部分正在开发当中详情请见[web仓库](https://gitee.com/deepin-community-store/DCSAPP_WEB)
#### 说明
当前服务器线路列表(项目中包含):
@@ -14,15 +27,14 @@ http://store.jerrywang.top/
http://dcstore.spark-app.store/
```
#### 参数
#### 调用参数(spk规则)
参数只有一个Url该url应当遵循这种格式`spk://<任意合法字符>/web分类/包名`
例如:
[spk://abcdefg/network/firefox-zh](spk://abcdefg/network/firefox-zh)
[spk://abcdefg/games/store.spark-app.hmcl](spk://abcdefg/games/store.spark-app.hmcl)
[spk://higklmn/network/firefox-zh](spk://higklmn/network/firefox-zh)
可选的web分类
@@ -32,29 +44,23 @@ http://dcstore.spark-app.store/
| 社交沟通 | chat |
| 音乐欣赏 | music |
| 视频播放 | video |
| 图形图像 | image_graphics |
| 图形图像 | graphics |
| 游戏娱乐 | games |
| 办公学习 | office |
| 阅读翻译 | reading |
| 编程开发 | development |
| 系统工具 | tools |
| 主题美化 | themes |
| 主题美化 | beautify |
| 其他应用 | others |
#### 目录结构
安装软件过程中产生的包,图标,截图等被储存到`/tmp/deepin-community-store/`中。
配置文件被储存到`~/.config/deepin-community-store/`中。
线路文件:新版的线路文件被放置于源服务器中,可随时刷新更新源列表
#### 如何编译
Deepin V20/UOS 系统下, 安装依赖
```shell
sudo apt install qt5-default libdtkcore-dev libdtkwidget-dev qtwebengine5-dev
sudo apt install qt5-default libdtkcore-dev libdtkwidget-dev qtwebengine5-dev libnotify-dev
```
```shell
@@ -68,6 +74,316 @@ make -j
./build文件下的spark-store即为可执行文件
#### 参与贡献
# 星火应用商店文档
1. Fork 本仓库
# 目录结构
几个目录结构
```
/
/icons 图标文件夹
/tags 首页图标
/tras 多语言翻译
```
主要的文件分析
```js
spark-store.pro Qt工程配置文件
ssinstall 调用包安装器的脚本
icons.qrc 图标资源文件
main.cpp 入口文件
widget.h widget.cpp widget.ui 主要窗口控件
downloadlist.h downloadlist.cpp downloadlist.ui 单个软件的下载安装展示控件
progressload.h progressload.cpp 网页加载显示 得在deepin上编译运行才能搞清楚
workerthreads.h workerthreads.cpp 应用信息加载线程
image_show.h image_show.cpp 应用页面截图预览控件
big_image.h big_image.cpp 大图查看控件
```
# 使用的开源库及第三方工具
* GDebi 一个 Ubuntu 软件中心的轻量级替代品 https://linux.cn/article-4982-1.html
* libnotify 系统通知 https://developer.gnome.org/libnotify/unstable/
# 源码分析
## 应用的组成部分
左侧应用分类菜单
主窗口的下拉菜单
应用列表页面
应用详情页面
应用首页,有几个链接跳转
商店设置页面
下载列表页面
## 应用初始化,及主控件加载
初始化 `DApplication` 进入事件循环。
设置关于我们弹窗 `DAboutDialog`
主控件 Widget 根据不同屏幕大小自适应。
首页打开webview页面如果传入了`spk://`参数,会打开应用详情页。
```cpp
// main.cpp
QString arg1=argv[1];
if(arg1.left(6)=="spk://"){
w.openUrl(QUrl(argv[1]));
}
// widget.cpp
void Widget::openUrl(QUrl u)
{
QString app=serverUrl + "store"+u.path()+"/app.json";
ui->webEngineView->setUrl(app); // 会触发 webEngineView 的
}
```
## Tags处理方式
**Tags处理方式**
```cpp
// widget.cpp
QString tags=json["Tags"].toString(); //Read the Tags
QStringList tagList=tags.split(";");
for (int i=0;i<tagList.size();i++) {
if(tagList[i]=="community")
ui->tag_community->show();//Tags icon shows like this
if(tagList[i]=="ubuntu")
ui->tag_ubuntu->show();
if(tagList[i]=="deepin")
ui->tag_deepin->show();
if(tagList[i]=="uos")
ui->tag_uos->show();
if(tagList[i]=="dtk5")
ui->tag_dtk5->show();
if(tagList[i]=="dwine2")
ui->tag_dwine2->show();
if(tagList[i]=="dwine5")
ui->tag_dwine5->show();
if(tagList[i]=="a2d")
ui->tag_a2d->show();
}
```
**Widget 初始化**
```cpp
void Widget::initConfig()
{
...
// 读取服务器URL并初始化菜单项的链接
QSettings readConfig(QDir::homePath()+"/.config/spark-store/config.ini",QSettings::IniFormat);
if(readConfig.value("server/choose").toString()!=""){
ui->comboBox_server->setCurrentText(readConfig.value("server/choose").toString());
appinfoLoadThread.setServer(serverUrl=readConfig.value("server/choose").toString());
}else {
appinfoLoadThread.setServer(serverUrl="http://sucdn.jerrywang.top/"); // 默认URL
}
configCanSave=true; // 防止触发保存配置信号
menuUrl[0]=serverUrl + "store/#/"; // 首页
// 下面是各个应用分类页面直接加载的webview的
// 每个连接对应一个左侧的菜单项,在构造函数用连接到 chooseLeftMenu 槽函数
menuUrl[1]=serverUrl + "store/#/network";
...
menuUrl[12]=serverUrl + "store/#/others";
...
ui->webfoot->hide();
//初始化首页
ui->webEngineView->setUrl(menuUrl[0]);
}
/**
* 菜单切换逻辑
*
*/
void Widget::chooseLeftMenu(int index)
{
nowMenu=index;
updateUI();
left_list[index]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px");
// index <=12 加载某个分类的应用列表的webviejw
// index == 13 加载下载列表页面
if(index<=12){
if(themeIsDark){
darkurl = URL
ui->webEngineView->setUrl(darkurl);
}else {
ui->webEngineView->setUrl(menuUrl[index]);
}
ui->stackedWidget->setCurrentIndex(0);
}else if (index==13) {
ui->stackedWidget->setCurrentIndex(1);
}
}
```
## 应用下载安装卸载分析
**应用详情页面加载**
```cpp
/**
* 加载单个应用的信息
*/
void Widget::on_webEngineView_urlChanged(const QUrl &arg1)
{
//分析出服务器中的分类名称
...
//如果是app.json就打开详情页
if(arg1.path().right(8)=="app.json"){
...
// 读取相应的应用信息
appinfoLoadThread.requestInterruption();
appinfoLoadThread.wait(100);
appinfoLoadThread.setUrl(arg1);
appinfoLoadThread.start();
}
}
// 设置详情页的APP信息
SpkAppInfoLoaderThread::requestSetAppInformation() -> Widget::sltAppinfoDetails()
// 设置详情页的APP图标
SpkAppInfoLoaderThread::finishedIconLoad() -> Widget::sltAppinfoIcon()
// 设置详情页的APP截图
SpkAppInfoLoaderThread::finishedScreenshotLoad() -> Widget::sltAppinfoScreenshot()
// 下载APP详情信息线程
void SpkAppInfoLoaderThread::run()
{
QProcess get_json;
get_json.start("curl -o app.json " + targetUrl.toString());
QFile app_json("app.json");
app.json
}
```
**应用下载**
Widget::on_pushButton_download_clicked() 是点击下载的安装方法。
最终使用的是 `QNetwrokAccessManager` 进行GET请求获取数据写入文件。
```cpp
void Widget::on_pushButton_download_clicked()
{
if(!isBusy){
file = new QFile(fileName);
...
nowDownload+=1;
startRequest(urList.at(nowDownload-1)); // 进行链接请求
}
}
void Widget::startRequest(QUrl url)
{
reply = manager->get(QNetworkRequest(url));
// 请求响应完成,关闭文件,清理下载队列
connect(reply,SIGNAL(finished()),this,SLOT(httpFinished()));
// 接收应用下载数据
connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead()));
// 更新应用下载进度
connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(updateDataReadProgress(qint64,qint64)));
}
```
使用 QSettings 来读取配置,更换服务源
```cpp
void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
{
appinfoLoadThread.setServer(arg1); // 服务器信息更新
if(configCanSave){
ui->label_setting1->show();
QSettings *setConfig=new QSettings(QDir::homePath()+"/.config/spark-store/config.ini",QSettings::IniFormat);
setConfig->setValue("server/choose",arg1);
}
}
```
使用 `QProcess` 来调用各种小文件下载、包安装卸载的命令。
**应用安装**
```cpp
void Widget::httpFinished() // 完成下载
{
...
download_list[nowDownload-1].readyInstall();
download_list[nowDownload-1].free=true;
if(nowDownload<allDownload){ // 如果有排队则下载下一个
...
}
}
void downloadlist::readyInstall()
{
...
ui->pushButton_install->setEnabled(true);
ui->pushButton_install->show();
ui->pushButton_2->hide();
Widget::sendNotification(tr("Finished downloading %1, awaiting to install").arg(ui->label->text()), 5000,
"/tmp/spark-store/icon_"+QString::number(num).toUtf8()+".png");
}
void downloadlist::on_pushButton_install_clicked()
{
//弹出菜单
menu_install->exec(cursor().pos());
}
downloadlist menu_install
downloadlist::install()
gdebi, dpkg, deepin-deb-installer
void downloadlist::install(int t)
{
QtConcurrent::run([=](){
QProcess installer;
installer.start("pkexec gdebi -n /tmp/spark-store/"+ui->label_filename->text().toUtf8());
installer.start("pkexec ssinstall /tmp/spark-store/"+ui->label_filename->text().toUtf8());
installer.start("deepin-deb-installer /tmp/spark-store/"+ui->label_filename->text().toUtf8());
});
}
```
**应用卸载**
```cpp
void Widget::on_pushButton_uninstall_clicked()
{
QtConcurrent::run([=](){
uninstall.start("pkexec apt purge -y "+pkgName);
});
}
```
**仓库源更新**
```cpp
// 更新源列表
void Widget::on_pushButton_updateServer_clicked()
{
QtConcurrent::run([=](){
...
QFile::remove(QDir::homePath().toUtf8()+"/.config/spark-store/server.list");
system("curl -o "+QDir::homePath().toUtf8()+"/.config/spark-store/server.list http://dcstore.shenmo.tech/store/server.list");
server.open(QDir::homePath().toUtf8()+"/.config/spark-store/server.list",std::ios::in);
...
while (getline(server,lineTmp)) {
ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
}
});
}
// 更新星火商店apt源
void Widget::on_pushButton_updateApt_clicked()
{
QtConcurrent::run([=](){
comboBox_server /tmp/spark-store/sparkstore.list
bash脚本 sparkstore.list /etc/apt/sources.list.d/
使QProcess pkexec update.sh
}):
}
```
## 发送系统通知
```cpp
#include <libnotify/notify.h>
static NotifyNotification *_notify = nullptr; // 初始化
notify_init(tr("Spark\\ Store").toLocal8Bit()); // 构造函数初始化
notify_uninit(); // 析构函数调用
void Widget::sendNotification(const QString &message, const int msTimeout, const QString &icon)
{
if(_notify == nullptr)
{
_notify = notify_notification_new(tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit());
notify_notification_set_timeout(_notify, msTimeout);
}
else
notify_notification_update(_notify, tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit());
notify_notification_show(_notify, nullptr);
}
```

View File

@@ -122,7 +122,7 @@ void downloadlist::install(int t)
ui->pushButton_install->hide();
ui->widget_spinner->show();
qDebug()<<"/tmp/spark-store/"+ui->label_filename->text().toUtf8();
ui->label_2->setText(tr("Installing..."));
ui->label_2->setText(tr("Installing"));
QtConcurrent::run([=](){
QProcess installer;
if(!reinstall){

Binary file not shown.

View File

@@ -50,7 +50,7 @@
<file>tags/community.svg</file>
<file>tags/deepin.svg</file>
<file>tags/logo_icon.svg</file>
<file>tags/uos.svg</file>
<file>tags/uos-authorize.svg</file>
<file>tags/a2d-small.png</file>
<file>tags/community-small.png</file>
<file>tags/deepin-small.png</file>
@@ -63,4 +63,7 @@
<file>tags/dwine5.svg</file>
<file>tags/dwine2-small.png</file>
</qresource>
<qresource prefix="/fonts">
<file>fonts/华康少女字体.ttf</file>
</qresource>
</RCC>

View File

@@ -18,7 +18,6 @@ image_show::image_show(QWidget *parent) : QWidget(parent)
void image_show::setImage(QPixmap image)
{
QImage screen0;
screen0=image.toImage();
// QPainter painter(&screen0);

View File

@@ -9,28 +9,46 @@ int main(int argc, char *argv[])
{
DApplication::loadDXcbPlugin(); //让bar处在标题栏中
DApplication a(argc, argv);
DAboutDialog dialog;
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
a.loadTranslator();//载入翻译
a.setAboutDialog(&dialog);
dialog.setLicense(QObject::tr("We publish this program under GPL V3"));
dialog.setVersion(DApplication::buildVersion("Version 2.0.2.3"));
dialog.setAcknowledgementVisible(true);
dialog.setAcknowledgementLink(QObject::tr("https://gitee.com/deepin-community-store/spark-store"));
a.setApplicationAcknowledgementPage(QObject::tr("https://gitee.com/deepin-community-store/spark-store"));
dialog.setProductIcon(QIcon::fromTheme("spark-store")); //设置Logo
dialog.setProductName(QLabel::tr("Spark Store"));
//dialog.setDescription(QLabel::tr("An appstore powered by deepin community\n We born for change"));
dialog.setDescription(QObject::tr(
"<span style=' font-size:10pt;font-weight:60;'>An appstore powered by deepin community</span><br/>"
"<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
"<span style=' font-size:12pt;'>Spark developers</span>"
)
);
dialog.setProductName(QLabel::tr("Spark Store"));
dialog.setCompanyLogo(QPixmap(":/Logo-Spark.png"));
dialog.setWebsiteName(QObject::tr("The Spark Project"));
dialog.setWebsiteLink("https://gitee.com/deepin-community-store");
/* Customized DAboutDialog (Can't work on other distro like Ubuntu...)
*
* DAboutDialog dialog;
* a.setAboutDialog(&dialog);
* dialog.setLicense(QObject::tr("We publish this program under GPL V3"));
* dialog.setVersion(DApplication::buildVersion("Version 2.0.2.5"));
* dialog.setProductIcon(QIcon::fromTheme("spark-store")); //设置Logo
* dialog.setProductName(QLabel::tr("Spark Store"));
* dialog.setDescription(
* QObject::tr(
* "<span style=' font-size:10pt;font-weight:60;'>An appstore powered by deepin community</span><br/>"
* "<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
* "<span style=' font-size:12pt;'>Spark developers</span>"
* )
* );
* dialog.setProductName(QLabel::tr("Spark Store"));
* dialog.setCompanyLogo(QPixmap(":/Logo-Spark.png"));
* dialog.setWebsiteName(QObject::tr("The Spark Project"));
* dialog.setWebsiteLink("https://gitee.com/deepin-community-store");
*/
a.setProductName(QLabel::tr("Spark Store"));
a.setProductIcon(QIcon::fromTheme("spark-store")); //设置Logo
a.setOrganizationName("spark-union");
a.setOrganizationDomain("https://www.deepinos.org/");
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
a.setApplicationVersion(DApplication::buildVersion("2.0.2.5"));
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
a.setApplicationDescription(
QObject::tr(
"<span style='font-size:10pt;font-weight:60;'>An appstore powered by deepin community</span><br/>"
"<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
"<span style='font-size:12pt;'>Spark developers</span><br/><br/>"
"Published under GPL V3"
)
);
Widget w;
QDesktopWidget *s=DApplication::desktop();
@@ -56,9 +74,7 @@ int main(int argc, char *argv[])
w.setMinimumHeight(760);
w.resize(1180,760);
}
// w.resize(925,650);
w.show();
QString arg1=argv[1];
if(arg1.left(6)=="spk://"){
w.openUrl(QUrl(argv[1]));
@@ -66,5 +82,7 @@ int main(int argc, char *argv[])
//让打开时界面显示在正中
Dtk::Widget::moveToCenter(&w);
w.show();
return a.exec();
}

View File

@@ -7,12 +7,9 @@
QT += core gui network concurrent webenginewidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TRANSLATIONS = ./trans/spark-store_en.ts \
./trans/spark-store_zh_CN.ts
./trans/spark-store_fr.ts\
CONFIG += link_pkgconfig
PKGCONFIG += dtkwidget
CONFIG += c++11 link_pkgconfig
PKGCONFIG += dtkwidget glib-2.0 gdk-pixbuf-2.0 libnotify
TARGET = spark-store
TEMPLATE = app
@@ -28,24 +25,21 @@ DEFINES += QT_DEPRECATED_WARNINGS
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\
widget.cpp \
downloadlist.cpp \
image_show.cpp \
big_image.cpp \
progressload.cpp
progressload.cpp \
workerthreads.cpp
HEADERS += \
widget.h \
downloadlist.h \
image_show.h \
big_image.h \
progressload.h
CONFIG += c++11
progressload.h \
workerthreads.h
FORMS += \
widget.ui \
@@ -68,3 +62,7 @@ DISTFILES += \
tags/deepin.svg \
tags/logo_icon.svg \
tags/uos.svg
TRANSLATIONS = ./trans/spark-store_en.ts \
./trans/spark-store_zh_CN.ts \
./trans/spark-store_fr.ts

View File

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

View File

@@ -4,8 +4,7 @@
<context>
<name>QLabel</name>
<message>
<location filename="../main.cpp" line="22"/>
<location filename="../main.cpp" line="30"/>
<location filename="../main.cpp" line="37"/>
<source>Spark Store</source>
<translation type="unfinished"></translation>
</message>
@@ -13,24 +12,56 @@
<context>
<name>QObject</name>
<message>
<location filename="../main.cpp" line="16"/>
<source>We publish this program under GPL V3</source>
<location filename="../main.cpp" line="45"/>
<source>&lt;span style=&apos;font-size:10pt;font-weight:60;&apos;&gt;An appstore powered by deepin community&lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos;font-size:12pt;&apos;&gt;Spark developers&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Published under GPL V3</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SpkAppInfoLoaderThread</name>
<message>
<location filename="../workerthreads.cpp" line="25"/>
<source>Failed to download app info. Please check internet connection.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.cpp" line="19"/>
<location filename="../main.cpp" line="20"/>
<source>https://gitee.com/deepin-community-store/spark-store</source>
<location filename="../workerthreads.cpp" line="53"/>
<source>PkgName: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.cpp" line="24"/>
<source>&lt;span style=&apos; font-size:10pt;font-weight:60;&apos;&gt;An appstore powered by deepin community&lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos; font-size:12pt;&apos;&gt;Spark developers&lt;/span&gt;</source>
<location filename="../workerthreads.cpp" line="54"/>
<source>Version: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.cpp" line="32"/>
<source>The Spark Project</source>
<location filename="../workerthreads.cpp" line="56"/>
<source>Author: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="60"/>
<source>Official Site: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="64"/>
<source>Contributor: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="65"/>
<source>Update Time: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="66"/>
<source>Installed Size: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="95"/>
<source>Failed to load application icon.</source>
<translation type="unfinished"></translation>
</message>
</context>
@@ -46,16 +77,6 @@
<source>background-color:#FFFFFF</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="67"/>
<source>Videos</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="74"/>
<source>Download List</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="81"/>
<source>Tools</source>
@@ -76,11 +97,6 @@
<source>Office</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="200"/>
<source>Translate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="207"/>
<source>Others</source>
@@ -91,11 +107,6 @@
<source>Games</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="248"/>
<source>Network</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="528"/>
<source>Name</source>
@@ -108,7 +119,8 @@
</message>
<message>
<location filename="../widget.ui" line="515"/>
<location filename="../widget.cpp" line="536"/>
<location filename="../widget.cpp" line="586"/>
<location filename="../widget.cpp" line="808"/>
<source>Install</source>
<translation type="unfinished"></translation>
</message>
@@ -155,11 +167,31 @@
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Capable to deepin 20&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="67"/>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="74"/>
<source>Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="173"/>
<source>Back to category</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="200"/>
<source>Reading</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="241"/>
<source>Chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="293"/>
<source>Reload</source>
@@ -217,7 +249,7 @@
<message>
<location filename="../widget.ui" line="678"/>
<source>Share</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Spk share link</translation>
</message>
<message>
<location filename="../widget.ui" line="153"/>
@@ -226,7 +258,7 @@
</message>
<message>
<location filename="../widget.ui" line="217"/>
<source>Home </source>
<source>Home</source>
<translation type="unfinished"></translation>
</message>
<message>
@@ -235,8 +267,8 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="241"/>
<source>Communication</source>
<location filename="../widget.ui" line="248"/>
<source>Network</source>
<translation type="unfinished"></translation>
</message>
<message>
@@ -290,11 +322,6 @@
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="1153"/>
<source>Take effect when restart </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="1182"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
@@ -365,135 +392,144 @@
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="1153"/>
<source>Take effect when restart</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="1293"/>
<source>0B</source>
<translation type="unfinished">0B</translation>
</message>
<message>
<location filename="../widget.cpp" line="146"/>
<location filename="../widget.cpp" line="157"/>
<source>Spark Store</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="147"/>
<location filename="../widget.cpp" line="158"/>
<source>Search or enter spk://</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="153"/>
<location filename="../widget.cpp" line="164"/>
<source>Submit App</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="154"/>
<location filename="../widget.cpp" line="165"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="245"/>
<location filename="../widget.cpp" line="264"/>
<source>Not Exist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="297"/>
<location filename="../widget.cpp" line="305"/>
<location filename="../widget.cpp" line="113"/>
<location filename="../widget.cpp" line="319"/>
<location filename="../widget.cpp" line="323"/>
<location filename="../widget.cpp" line="332"/>
<location filename="../widget.cpp" line="336"/>
<source>Spark\ Store</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="480"/>
<location filename="../widget.cpp" line="530"/>
<source>Failed to download app info. Please check internet connection.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="510"/>
<location filename="../widget.cpp" line="560"/>
<source>PkgName: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="511"/>
<location filename="../widget.cpp" line="561"/>
<source>Version: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="513"/>
<location filename="../widget.cpp" line="563"/>
<source>Author: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="517"/>
<location filename="../widget.cpp" line="567"/>
<source>Official Site: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="521"/>
<location filename="../widget.cpp" line="571"/>
<source>Contributor: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="522"/>
<location filename="../widget.cpp" line="572"/>
<source>Update Time: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="523"/>
<location filename="../widget.cpp" line="573"/>
<source>Installed Size: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="532"/>
<location filename="../widget.cpp" line="645"/>
<location filename="../widget.cpp" line="582"/>
<location filename="../widget.cpp" line="693"/>
<location filename="../widget.cpp" line="805"/>
<source>Reinstall</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="571"/>
<location filename="../widget.cpp" line="621"/>
<source>Failed to load application icon.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="620"/>
<location filename="../widget.cpp" line="668"/>
<source>Failed to get the name to the file to be downloaded.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="668"/>
<location filename="../widget.cpp" line="716"/>
<source>Spark store could only process spk:// links for now. The search feature is coming soon!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="789"/>
<location filename="../widget.cpp" line="944"/>
<source>Updating, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="842"/>
<location filename="../widget.cpp" line="997"/>
<source>Apt has reported an error. Please use apt update in terminal to locate the problem.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="848"/>
<location filename="../widget.cpp" line="1003"/>
<source>Unknown error!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="1024"/>
<location filename="../widget.cpp" line="1185"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="1024"/>
<location filename="../widget.cpp" line="1185"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="1025"/>
<location filename="../widget.cpp" line="1186"/>
<source>Information for Contributors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="1026"/>
<location filename="../widget.cpp" line="1187"/>
<source>Currently the translation contribution is limited to English,
and you will be redirected to our Gitee repository at which you are
supposed to be creating pull requests to contribute app info
@@ -504,17 +540,17 @@ Click yes to continue.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="868"/>
<location filename="../widget.cpp" line="1023"/>
<source>Uninstall succeeded</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="882"/>
<location filename="../widget.cpp" line="1037"/>
<source>Temporary cache was cleaned</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="949"/>
<location filename="../widget.cpp" line="1104"/>
<source>The URL has been copied to the clipboard</source>
<translation type="unfinished"></translation>
</message>
@@ -598,7 +634,7 @@ Click yes to continue.</source>
</message>
<message>
<location filename="../downloadlist.cpp" line="125"/>
<source>Installing...</source>
<source>Installing</source>
<translation type="unfinished"></translation>
</message>
<message>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -4,8 +4,7 @@
<context>
<name>QLabel</name>
<message>
<location filename="../main.cpp" line="22"/>
<location filename="../main.cpp" line="30"/>
<location filename="../main.cpp" line="37"/>
<source>Spark Store</source>
<translation>Spark </translation>
</message>
@@ -13,29 +12,77 @@
<context>
<name>QObject</name>
<message>
<location filename="../main.cpp" line="16"/>
<source>We publish this program under GPL V3</source>
<translation>GPL V3开源</translation>
<translation type="vanished">GPL V3开源</translation>
</message>
<message>
<source>Version 2.0+2</source>
<translation type="vanished"> 2.0+2</translation>
</message>
<message>
<location filename="../main.cpp" line="19"/>
<location filename="../main.cpp" line="20"/>
<source>https://gitee.com/deepin-community-store/spark-store</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main.cpp" line="24"/>
<source>&lt;span style=&apos; font-size:10pt;font-weight:60;&apos;&gt;An appstore powered by deepin community&lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos; font-size:12pt;&apos;&gt;Spark developers&lt;/span&gt;</source>
<translation>&lt;span style=&apos; font-size:10pt;font-weight:60;&apos;&gt;deepin &lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos; font-size:12pt;&apos;&gt;Spark developers&lt;/span&gt;</translation>
<translation type="vanished">&lt;span style=&apos; font-size:10pt;font-weight:60;&apos;&gt;deepin &lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos; font-size:12pt;&apos;&gt;Spark developers&lt;/span&gt;</translation>
</message>
<message>
<location filename="../main.cpp" line="32"/>
<source>The Spark Project</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<source>&lt;span style=&apos; font-size:10pt;font-weight:60;&apos;&gt;An appstore powered by deepin community&lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos; font-size:12pt;&apos;&gt;Spark developers&lt;/span&gt;&lt;br/&gt;We publish this program under GPL V3</source>
<translation type="vanished">&lt;span style=&apos; font-size:10pt;font-weight:60;&apos;&gt; &lt;/span&gt;&lt;br/&gt;&quot;&quot;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&quot;&quot;&lt;span style=&apos; font-size:12pt;&apos;&gt;星火开发者联盟&lt;/span&gt;&lt;br/&gt;本程序遵循 GPL V3 协议发布</translation>
</message>
<message>
<location filename="../main.cpp" line="45"/>
<source>&lt;span style=&apos;font-size:10pt;font-weight:60;&apos;&gt;An appstore powered by deepin community&lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos;font-size:12pt;&apos;&gt;Spark developers&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Published under GPL V3</source>
<translation>&lt;span style=&apos;font-size:10pt;font-weight:60;&apos;&gt; Deepin &lt;/span&gt;&lt;br/&gt;&lt;a href=&apos;https://www.spark-app.store/&apos;&gt;https://www.spark-app.store&lt;/a&gt;&lt;br/&gt;&lt;span style=&apos;font-size:12pt;&apos;&gt;星火商店开发组&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;遵循 GPL V3 协议发布</translation>
</message>
</context>
<context>
<name>SpkAppInfoLoaderThread</name>
<message>
<location filename="../workerthreads.cpp" line="25"/>
<source>Failed to download app info. Please check internet connection.</source>
<translation></translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="53"/>
<source>PkgName: </source>
<translation> </translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="54"/>
<source>Version: </source>
<translation> </translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="56"/>
<source>Author: </source>
<translation> </translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="60"/>
<source>Official Site: </source>
<translation> </translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="64"/>
<source>Contributor: </source>
<translation>稿 </translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="65"/>
<source>Update Time: </source>
<translation> </translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="66"/>
<source>Installed Size: </source>
<translation> </translation>
</message>
<message>
<location filename="../workerthreads.cpp" line="95"/>
<source>Failed to load application icon.</source>
<translation></translation>
</message>
</context>
<context>
@@ -51,14 +98,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="67"/>
<source>Videos</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.ui" line="74"/>
<source>Download List</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.ui" line="81"/>
@@ -85,9 +130,8 @@
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="200"/>
<source>Translate</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.ui" line="207"/>
@@ -119,7 +163,7 @@
<message>
<location filename="../widget.ui" line="383"/>
<source>The list is currently empty. Go and download some softwares!</source>
<translation></translation>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="415"/>
@@ -138,10 +182,31 @@
</message>
<message>
<location filename="../widget.ui" line="515"/>
<location filename="../widget.cpp" line="536"/>
<location filename="../widget.cpp" line="586"/>
<location filename="../widget.cpp" line="808"/>
<source>Install</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="67"/>
<source>Video</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="74"/>
<source>Download</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="200"/>
<source>Reading</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="241"/>
<source>Chat</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="623"/>
<source>Uninstall</source>
@@ -217,7 +282,7 @@
<message>
<location filename="../widget.ui" line="678"/>
<source>Share</source>
<translation></translation>
<translation>Spk分享链接</translation>
</message>
<message>
<location filename="../widget.ui" line="153"/>
@@ -225,9 +290,8 @@
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="217"/>
<source>Home </source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.ui" line="227"/>
@@ -235,15 +299,14 @@
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="241"/>
<source>Communication</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.ui" line="807"/>
<location filename="../widget.ui" line="810"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A deepin-wine2 app.If you are using ubuntu or other non-deepin distro,you should deploy deepin-wine2 by your self.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;deepin-wine5应使使ubuntudeepin-wine5环&lt;/p&gt;&lt;/body&gt;&lt;/html&gt; {2 ?} {2 ?}</translation>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt; deepin-wine2 使使ubuntu deepin-wine2 &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../widget.ui" line="813"/>
@@ -258,7 +321,7 @@
<message>
<location filename="../widget.ui" line="874"/>
<source>Contribute translation</source>
<translation type="unfinished"></translation>
<translation>/</translation>
</message>
<message>
<location filename="../widget.ui" line="892"/>
@@ -268,7 +331,7 @@
<message>
<location filename="../widget.ui" line="899"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;An app store developed by community enthusiasts&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../widget.ui" line="938"/>
@@ -291,9 +354,8 @@
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="1153"/>
<source>Take effect when restart </source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.ui" line="1182"/>
@@ -360,6 +422,11 @@
<source>Back to category</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="217"/>
<source>Home</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="293"/>
<source>Reload</source>
@@ -385,135 +452,144 @@
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/tags/uos-small.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.ui" line="1153"/>
<source>Take effect when restart</source>
<translation></translation>
</message>
<message>
<location filename="../widget.ui" line="1293"/>
<source>0B</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="146"/>
<location filename="../widget.cpp" line="157"/>
<source>Spark Store</source>
<translation>Spark </translation>
</message>
<message>
<location filename="../widget.cpp" line="147"/>
<location filename="../widget.cpp" line="158"/>
<source>Search or enter spk://</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="153"/>
<location filename="../widget.cpp" line="164"/>
<source>Submit App</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="154"/>
<location filename="../widget.cpp" line="165"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="245"/>
<location filename="../widget.cpp" line="264"/>
<source>Not Exist</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="297"/>
<location filename="../widget.cpp" line="305"/>
<location filename="../widget.cpp" line="113"/>
<location filename="../widget.cpp" line="319"/>
<location filename="../widget.cpp" line="323"/>
<location filename="../widget.cpp" line="332"/>
<location filename="../widget.cpp" line="336"/>
<source>Spark\ Store</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="480"/>
<location filename="../widget.cpp" line="530"/>
<source>Failed to download app info. Please check internet connection.</source>
<translation></translation>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="510"/>
<location filename="../widget.cpp" line="560"/>
<source>PkgName: </source>
<translation></translation>
<translation> </translation>
</message>
<message>
<location filename="../widget.cpp" line="511"/>
<location filename="../widget.cpp" line="561"/>
<source>Version: </source>
<translation></translation>
<translation> </translation>
</message>
<message>
<location filename="../widget.cpp" line="513"/>
<location filename="../widget.cpp" line="563"/>
<source>Author: </source>
<translation></translation>
<translation> </translation>
</message>
<message>
<location filename="../widget.cpp" line="517"/>
<location filename="../widget.cpp" line="567"/>
<source>Official Site: </source>
<translation></translation>
<translation> </translation>
</message>
<message>
<location filename="../widget.cpp" line="521"/>
<location filename="../widget.cpp" line="571"/>
<source>Contributor: </source>
<translation>稿</translation>
<translation>稿 </translation>
</message>
<message>
<location filename="../widget.cpp" line="522"/>
<location filename="../widget.cpp" line="572"/>
<source>Update Time: </source>
<translation></translation>
<translation> </translation>
</message>
<message>
<location filename="../widget.cpp" line="523"/>
<location filename="../widget.cpp" line="573"/>
<source>Installed Size: </source>
<translation></translation>
<translation> </translation>
</message>
<message>
<location filename="../widget.cpp" line="532"/>
<location filename="../widget.cpp" line="645"/>
<location filename="../widget.cpp" line="582"/>
<location filename="../widget.cpp" line="693"/>
<location filename="../widget.cpp" line="805"/>
<source>Reinstall</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="571"/>
<location filename="../widget.cpp" line="621"/>
<source>Failed to load application icon.</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="620"/>
<source>Failed to get the name to the file to be downloaded.</source>
<translation></translation>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="668"/>
<source>Failed to get the name to the file to be downloaded.</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="716"/>
<source>Spark store could only process spk:// links for now. The search feature is coming soon!</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="789"/>
<location filename="../widget.cpp" line="944"/>
<source>Updating, please wait...</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="842"/>
<location filename="../widget.cpp" line="997"/>
<source>Apt has reported an error. Please use apt update in terminal to locate the problem.</source>
<translation>使apt update来查看错误原因</translation>
<translation>使apt update来查看错误原因</translation>
</message>
<message>
<location filename="../widget.cpp" line="848"/>
<location filename="../widget.cpp" line="1003"/>
<source>Unknown error!</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="1024"/>
<location filename="../widget.cpp" line="1185"/>
<source>Yes</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="1024"/>
<location filename="../widget.cpp" line="1185"/>
<source>No</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="1025"/>
<location filename="../widget.cpp" line="1186"/>
<source>Information for Contributors</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="1026"/>
<location filename="../widget.cpp" line="1187"/>
<source>Currently the translation contribution is limited to English,
and you will be redirected to our Gitee repository at which you are
supposed to be creating pull requests to contribute app info
@@ -521,13 +597,13 @@ translations.
Tips:You can simply click the file to edit to create a flat pull request without create a full pull request
Tips:You can use github account to login to Gitee
Click yes to continue.</source>
<translation type="unfinished">
<translation>
Gitee
Pull Request
pr
使github账户直接登陆Gitee
.</translation>
</translation>
</message>
<message>
<source>Currently the translation contribution is limited to English,
@@ -549,17 +625,17 @@ Click yes to continue.</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../widget.cpp" line="868"/>
<location filename="../widget.cpp" line="1023"/>
<source>Uninstall succeeded</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="882"/>
<location filename="../widget.cpp" line="1037"/>
<source>Temporary cache was cleaned</source>
<translation></translation>
</message>
<message>
<location filename="../widget.cpp" line="949"/>
<location filename="../widget.cpp" line="1104"/>
<source>The URL has been copied to the clipboard</source>
<translation></translation>
</message>
@@ -643,9 +719,13 @@ Click yes to continue.</source>
</message>
<message>
<location filename="../downloadlist.cpp" line="125"/>
<source>Installing...</source>
<source>Installing</source>
<translation></translation>
</message>
<message>
<source>Installing...</source>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../downloadlist.cpp" line="172"/>
<source>Finish</source>

View File

@@ -1,3 +1,4 @@
#include <libnotify/notify.h>
#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
@@ -27,7 +28,7 @@
#include <QClipboard>
#include <DApplication>
#include <DGuiApplicationHelper>
#include <DPushButton>
#include <QPushButton>
DWIDGET_USE_NAMESPACE
Widget::Widget(DBlurEffectWidget *parent) :
@@ -41,22 +42,29 @@ Widget::Widget(DBlurEffectWidget *parent) :
m_loadweb=ui->progressload;
m_loadweb->show();
connect(ui->menu_main,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(0);});
connect(ui->menu_network,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(1);});
connect(ui->menu_chat,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(2);});
connect(ui->menu_music,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(3);});
connect(ui->menu_video,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(4);});
connect(ui->menu_photo,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(5);});
connect(ui->menu_game,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(6);});
connect(ui->menu_office,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(7);});
connect(ui->menu_read,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(8);});
connect(ui->menu_dev,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(9);});
connect(ui->menu_system,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(10);});
connect(ui->menu_theme,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(11);});
connect(ui->menu_other,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(12);});
connect(ui->menu_download,&DPushButton::clicked,[=](){Widget::chooseLeftMenu(13);});
connect(ui->menu_main,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(0);});
connect(ui->menu_network,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(1);});
connect(ui->menu_chat,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(2);});
connect(ui->menu_music,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(3);});
connect(ui->menu_video,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(4);});
connect(ui->menu_photo,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(5);});
connect(ui->menu_game,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(6);});
connect(ui->menu_office,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(7);});
connect(ui->menu_read,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(8);});
connect(ui->menu_dev,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(9);});
connect(ui->menu_system,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(10);});
connect(ui->menu_theme,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(11);});
connect(ui->menu_other,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(12);});
connect(ui->menu_download,&QPushButton::clicked,[=](){Widget::chooseLeftMenu(13);});
// connect((ui->titlebar))
connect(&appinfoLoadThread, SIGNAL(requestResetUi()), this, SLOT(sltAppinfoResetUi()), Qt::ConnectionType::BlockingQueuedConnection);
connect(&appinfoLoadThread, &SpkAppInfoLoaderThread::requestSetTags, this, &Widget::sltAppinfoTags, Qt::ConnectionType::BlockingQueuedConnection);
connect(&appinfoLoadThread, &SpkAppInfoLoaderThread::requestSetAppInformation, this, &Widget::sltAppinfoDetails, Qt::ConnectionType::BlockingQueuedConnection);
connect(&appinfoLoadThread, &SpkAppInfoLoaderThread::finishedIconLoad, this, &Widget::sltAppinfoIcon, Qt::ConnectionType::BlockingQueuedConnection);
connect(&appinfoLoadThread, &SpkAppInfoLoaderThread::finishedScreenshotLoad, this, &Widget::sltAppinfoScreenshot, Qt::ConnectionType::BlockingQueuedConnection);
connect(&appinfoLoadThread, &SpkAppInfoLoaderThread::finishAllLoading, this, &Widget::sltAppinfoFinish, Qt::ConnectionType::BlockingQueuedConnection);
// 搜索事件
connect(searchEdit,&DSearchEdit::editingFinished,this,[=](){
QString searchtext=searchEdit->text();
@@ -65,7 +73,6 @@ Widget::Widget(DBlurEffectWidget *parent) :
searchApp(searchtext);
}
searchEdit->clearEdit();
});
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, [=](DGuiApplicationHelper::ColorType themeType) {
@@ -103,11 +110,13 @@ Widget::Widget(DBlurEffectWidget *parent) :
}
});
notify_init(tr("Spark\\ Store").toLocal8Bit());
}
Widget::~Widget()
{
notify_uninit();
delete ui;
qDebug()<<"exit";
DApplication::quit();
@@ -126,6 +135,8 @@ void Widget::initUI()
ui->icon->setPixmap(QIcon::fromTheme("spark-store").pixmap(36,36));
ui->titlebar->setFixedHeight(50);
label_screen << ui->screen_0 << ui->screen_1 << ui->screen_2 << ui->screen_3 << ui->screen_4;
// 初始化分界线
QGraphicsOpacityEffect *opacityEffect_1=new QGraphicsOpacityEffect;
opacityEffect_1->setOpacity(0.1);
@@ -158,9 +169,19 @@ void Widget::initUI()
menu->addAction(setting);
menu->addAction(actionSubmission);
titlebar->setMenu(menu);
connect(actionSubmission, &QAction::triggered, this,
[=](){QDesktopServices::openUrl(QUrl("https://upload.spark-app.store/"));});
connect(setting,&QAction::triggered,this,&Widget::opensetting);
connect(actionSubmission, &QAction::triggered, this, [ = ] () {
QDesktopServices::openUrl(QUrl("https://upload.spark-app.store/"));
});
connect(setting, &QAction::triggered, this, &Widget::opensetting);
// 载入自定义字体
int loadedFontID = QFontDatabase::addApplicationFont(":/fonts/fonts/华康少女字体.ttf");
QStringList loadedFontFamilies = QFontDatabase::applicationFontFamilies(loadedFontID);
if(!loadedFontFamilies.isEmpty())
font = loadedFontFamilies.at(0);
/* 全局字体设置
* DApplication::setFont(font);
*/
// 初始化菜单数组
left_list[0]=ui->menu_main;
@@ -178,9 +199,7 @@ void Widget::initUI()
left_list[12]=ui->menu_other;
left_list[13]=ui->menu_download;
ui->label_show->hide();
}
void Widget::initConfig()
@@ -201,9 +220,9 @@ void Widget::initConfig()
QSettings readConfig(QDir::homePath()+"/.config/spark-store/config.ini",QSettings::IniFormat);
if(readConfig.value("server/choose").toString()!=""){
ui->comboBox_server->setCurrentText(readConfig.value("server/choose").toString());
serverUrl=readConfig.value("server/choose").toString();
appinfoLoadThread.setServer(serverUrl=readConfig.value("server/choose").toString());
}else {
serverUrl="http://sucdn.jerrywang.top/"; // 默认URL
appinfoLoadThread.setServer(serverUrl="http://sucdn.jerrywang.top/"); // 默认URL
}
configCanSave=true; // 防止触发保存配置信号
menuUrl[0]=serverUrl + "store/#/";
@@ -223,13 +242,13 @@ void Widget::initConfig()
//web控件初始化
// ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); //用来激活接受linkClicked信号
// ui->webView->page()->settings()->setAttribute(QWebSettings::JavascriptEnabled,true);
// ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); //用来激活接受linkClicked信号
// ui->webView->page()->settings()->setAttribute(QWebSettings::JavascriptEnabled,true);
ui->webfoot->hide();
//初始化首页
ui->webEngineView->setUrl(menuUrl[0]);
// ui->webEngineView->setUrl(menuUrl[1]);
// ui->webEngineView->setUrl(menuUrl[1]);
//给下载列表赋值到数组,方便调用
for (int i =0; i<LIST_MAX;i++){
@@ -261,7 +280,7 @@ void Widget::setTheme(bool isDark,QColor color)
ui->btn_openDir->setStyleSheet("color:#8B91A1;background-color:#2E2F30;border:0px");
ui->webfoot->setStyleSheet("background-color:#252525");
ui->label->setStyleSheet("background-color:#252525");
// ui->scrollArea->setStyleSheet("background-color:#252525");
// ui->scrollArea->setStyleSheet("background-color:#252525");
ui->label_show->setStyleSheet("background-color:#252525");
ui->pushButton_return->setIcon(QIcon(":/icons/icons/category_active_dark.svg"));
ui->pushButton_refresh->setIcon(QIcon(":/icons/icons/refresh-page-dark.svg"));
@@ -272,7 +291,7 @@ void Widget::setTheme(bool isDark,QColor color)
ui->webfoot->setStyleSheet("background-color:#FFFFFF");
ui->btn_openDir->setStyleSheet("color:#505050;background-color:#FBFBFB;border:0px");
ui->label->setStyleSheet("background-color:#FFFFFF");
// ui->scrollArea->setStyleSheet("background-color:#F8F8F8");
// ui->scrollArea->setStyleSheet("background-color:#F8F8F8");
ui->label_show->setStyleSheet("background-color:#F8F8F8");
ui->pushButton_return->setIcon(QIcon(":/icons/icons/category_active.svg"));
ui->pushButton_refresh->setIcon(QIcon(":/icons/icons/refresh-page.svg"));
@@ -288,23 +307,35 @@ void Widget::setTheme(bool isDark,QColor color)
DTitlebar* Widget::getTitlebar()
{
return ui->titlebar;
return ui->titlebar;
}
static NotifyNotification *_notify = nullptr;
void Widget::sendNotification(const QString &message, const int msTimeout, const QString &icon)
{
system((QString("notify-send --icon=%1 --expire-time=%2 --app-name=").arg(icon).arg(msTimeout) +
tr("Spark\\ Store") +
" '" + message + "'"
).toUtf8());
if(_notify == nullptr)
{
_notify = notify_notification_new(tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit());
notify_notification_set_timeout(_notify, msTimeout);
}
else
notify_notification_update(_notify, tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit());
notify_notification_show(_notify, nullptr);
}
void Widget::sendNotification(const char *message, const int msTimeout, const QString &icon)
{
system((QString("notify-send --icon=%1 --expire-time=%2 --app-name=").arg(icon).arg(msTimeout) +
tr("Spark\\ Store") +
" '" + message + "'"
).toUtf8());
if(_notify == nullptr)
{
_notify = notify_notification_new(tr("Spark\\ Store").toLocal8Bit(), message, icon.toLocal8Bit());
notify_notification_set_timeout(_notify, msTimeout);
}
else
notify_notification_update(_notify, tr("Spark\\ Store").toLocal8Bit(), message, icon.toLocal8Bit());
notify_notification_show(_notify, nullptr);
}
void Widget::updateUI()
@@ -341,16 +372,32 @@ void Widget::updateUI()
left_list[13]->setIcon(QIcon(":/icons/icons/downloads-symbolic.svg"));
}
for (int i=0;i<14;i++) {
left_list[i]->setFont(QFont("",11));
/* 设置左侧菜单字体
* QFont temp = font;
* temp.setPixelSize(15);
* left_list[i]->setFont(temp);
*/
left_list[i]->setFixedHeight(38);
if(themeIsDark){
left_list[i]->setStyleSheet("color:#FFFFFF;border:0px");
// 中文环境菜单文字居中,其他则左对齐
if(QLocale::system().name() == "zh_CN")
left_list[i]->setStyleSheet("color:#FFFFFF;border:0px;");
else
left_list[i]->setStyleSheet("color:#FFFFFF;border:0px;text-align:left;padding-left:15px;");
}else {
left_list[i]->setStyleSheet("color:#252525;border:0px");
if(QLocale::system().name() == "zh_CN")
left_list[i]->setStyleSheet("color:#252525;border:0px;");
else
left_list[i]->setStyleSheet("color:#252525;border:0px;text-align:left;padding-left:15px;");
}
}
left_list[nowMenu]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px");
if(QLocale::system().name() == "zh_CN")
left_list[nowMenu]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px;");
else
left_list[nowMenu]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px;text-align:left;padding-left:15px;");
switch (nowMenu) {
case 0:
left_list[0]->setIcon(QIcon(":/icons/icons/homepage_dark.svg"));
@@ -403,7 +450,10 @@ void Widget::chooseLeftMenu(int index)
nowMenu=index;
updateUI();
left_list[index]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px");
if(QLocale::system().name() == "zh_CN")
left_list[index]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px;");
else
left_list[index]->setStyleSheet("color:#FFFFFF;background-color:"+main_color.name()+";border-radius:8;border:0px;text-align:left;padding-left:15px;");
if(index<=12){
if(themeIsDark){
QString darkurl=menuUrl[index].toString();
@@ -477,7 +527,7 @@ int Widget::loadappinfo(QUrl arg1)
get_json.waitForFinished();
if(get_json.exitCode())
{
sendNotification(tr("Failed to download app info. Please check internet connection."));
sendNotification(tr("Failed to download app info. Please check internet connection."));
}
QFile app_json("app.json");
@@ -560,25 +610,21 @@ int Widget::loadappinfo(QUrl arg1)
get_json.start("curl -o icon.png "+urladdress+"icon.png");
get_json.waitForFinished();
if(!get_json.exitCode()) {
QPixmap appicon(QString::fromUtf8(TMP_PATH)+"/icon.png");
ui->label_appicon->setPixmap(appicon);
ui->pushButton_download->setEnabled(true);
ui->pushButton->setEnabled(true);
ui->pushButton_translate->setEnabled(true);
ui->pushButton_website->setEnabled(true);
QPixmap appicon(QString::fromUtf8(TMP_PATH)+"/icon.png");
ui->label_appicon->setPixmap(appicon);
ui->pushButton_download->setEnabled(true);
ui->pushButton->setEnabled(true);
ui->pushButton_translate->setEnabled(true);
ui->pushButton_website->setEnabled(true);
}
else
sendNotification(tr("Failed to load application icon."));
sendNotification(tr("Failed to load application icon."));
// 截图展示加载
image_show *label_screen[5];
label_screen[0]=ui->screen_0;
label_screen[1]=ui->screen_1;
label_screen[2]=ui->screen_2;
label_screen[3]=ui->screen_3;
label_screen[4]=ui->screen_4;
for (int i=0;i<5;i++) {
QList<image_show*> label_screen;
label_screen << ui->screen_0 << ui->screen_1 << ui->screen_2 << ui->screen_3 << ui->screen_4;
for (int i = 0; i < 5; i++) {
QString cmd = "curl -o screen_"+QString::number(i+1)+".png "+urladdress+"screen_"+QString::number(i+1)+".png";
get_json.terminate();
get_json.start(cmd);
@@ -587,6 +633,7 @@ int Widget::loadappinfo(QUrl arg1)
if(s){
label_screen[i]->setImage(screen[i]);
label_screen[i]->show();
/*
switch(i){ // 故意为之,为了清除多余截图
case 0:
label_screen[1]->hide();
@@ -596,7 +643,8 @@ int Widget::loadappinfo(QUrl arg1)
label_screen[3]->hide();
case 3:
label_screen[4]->hide();
}
}*/
}else{
QFile::remove("screen_"+QString::number(i+1)+".png");
break;
@@ -691,6 +739,111 @@ void Widget::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
}
}
void Widget::sltAppinfoResetUi()
{
// 先隐藏详情页负责显示截图的label
ui->screen_0->hide();
ui->screen_1->hide();
ui->screen_2->hide();
ui->screen_3->hide();
ui->screen_4->hide();
ui->label_appicon->clear();
ui->tag_community->hide();
ui->tag_ubuntu->hide();
ui->tag_deepin->hide();
ui->tag_uos->hide();
ui->tag_dtk5->hide();
ui->tag_dwine2->hide();
ui->tag_dwine5->hide();
ui->tag_a2d->hide();
// 重置UI状态
ui->pushButton_uninstall->hide();
ui->pushButton_website->setEnabled(false);
ui->pushButton->setEnabled(false);
ui->pushButton_translate->setEnabled(false);
ui->label_show->setText("Loading...");
ui->label_show->show();
}
void Widget::sltAppinfoTags(QStringList *tagList)
{
foreach (const QString &tag, *tagList) {
if(tag=="community")
ui->tag_community->show();
else if(tag=="ubuntu")
ui->tag_ubuntu->show();
else if(tag=="deepin")
ui->tag_deepin->show();
else if(tag=="uos")
ui->tag_uos->show();
else if(tag=="dtk5")
ui->tag_dtk5->show();
else if(tag=="dwine2")
ui->tag_dwine2->show();
else if(tag=="dwine5")
ui->tag_dwine5->show();
else if(tag=="a2d")
ui->tag_a2d->show();
}
}
void Widget::sltAppinfoDetails(QString *name, QString *details, QString *info,
QString *website, QString *packageName, QUrl *fileUrl,
bool isInstalled)
{
ui->label_appname->setText(appName = *name);
ui->label_appname->show();
ui->label_info->setText(*details);
ui->label_info->show();
ui->label_more->setText(*info);
ui->label_more->show();
pkgName = *packageName;
url = *fileUrl;
appweb = *website;
if(isInstalled){
ui->pushButton_download->setText(tr("Reinstall"));
ui->pushButton_uninstall->show();
}else {
ui->pushButton_download->setText(tr("Install"));
}
}
void Widget::sltAppinfoIcon(QPixmap *icon)
{
ui->label_appicon->setPixmap(*icon);
ui->label_appicon->show();
ui->pushButton_download->setEnabled(true);
ui->pushButton->setEnabled(true);
ui->pushButton_translate->setEnabled(true);
ui->pushButton_website->setEnabled(true);
}
void Widget::sltAppinfoScreenshot(QPixmap *picture, int index)
{
if(picture != nullptr) {
screen[index] = *picture;
label_screen[index]->setImage(*picture);
label_screen[index]->show();
switch(index) { // 故意为之,为了清除多余截图
case 0:
label_screen[1]->hide();
case 1:
label_screen[2]->hide();
case 2:
label_screen[3]->hide();
case 3:
label_screen[4]->hide();
}
}
}
void Widget::sltAppinfoFinish()
{
ui->label_show->setText("");
ui->label_show->hide();
}
void Widget::httpFinished() // 完成下载
{
file->flush();
@@ -727,6 +880,7 @@ void Widget::on_pushButton_return_clicked()
// chooseLeftMenu(13);
// return;
// }
appinfoLoadThread.requestInterruption();
chooseLeftMenu(nowMenu);
// if(themeIsDark){
// QString darkurl=menuUrl[nowMenu].toString();
@@ -746,13 +900,14 @@ void Widget::on_pushButton_return_clicked()
void Widget::on_pushButton_refresh_clicked()
{
if(ui->stackedWidget->currentIndex() == 2) //如果在详情页面要重新触发UrlChanged
emit ui->webEngineView->urlChanged(ui->webEngineView->url());
emit ui->webEngineView->urlChanged(ui->webEngineView->url());
else
ui->webEngineView->reload();
ui->webEngineView->reload();
}
void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
{
appinfoLoadThread.setServer(arg1); // 服务器信息更新
if(configCanSave){
ui->label_setting1->show();
QSettings *setConfig=new QSettings(QDir::homePath()+"/.config/spark-store/config.ini",QSettings::IniFormat);
@@ -785,70 +940,70 @@ void Widget::on_pushButton_updateServer_clicked()
void Widget::on_pushButton_updateApt_clicked()
{
QtConcurrent::run([=](){
ui->pushButton_updateApt->setEnabled(false);
ui->label_aptserver->setText(tr("Updating, please wait..."));
ui->pushButton_updateApt->setEnabled(false);
ui->label_aptserver->setText(tr("Updating, please wait..."));
std::fstream sourcesList, policy, update;
QDir tmpdir("/tmp");
auto tmpPath = QString::fromUtf8(TMP_PATH).toStdString();
bool unknownError = true;
std::fstream sourcesList, policy, update;
QDir tmpdir("/tmp");
auto tmpPath = QString::fromUtf8(TMP_PATH).toStdString();
bool unknownError = true;
tmpdir.mkpath("spark-store");
sourcesList.open(tmpPath + "/sparkstore.list", std::ios::out);
//policy.open(tmpPath + "/sparkstore", std::ios::out);
// 商店已经下架会替换系统库的包优先级policy弃用
tmpdir.mkpath("spark-store");
sourcesList.open(tmpPath + "/sparkstore.list", std::ios::out);
//policy.open(tmpPath + "/sparkstore", std::ios::out);
// 商店已经下架会替换系统库的包优先级policy弃用
if(sourcesList /*&& policy*/) {
auto serverAddr = ui->comboBox_server->currentText();
if(sourcesList /*&& policy*/) {
auto serverAddr = ui->comboBox_server->currentText();
sourcesList << "deb [by-hash=force] ";
sourcesList << serverAddr.toUtf8().toStdString();
sourcesList << " /";
sourcesList.close();
sourcesList << "deb [by-hash=force] ";
sourcesList << serverAddr.toUtf8().toStdString();
sourcesList << " /";
sourcesList.close();
/*
/*
policy << "Package: *\n"
"Pin: origin *" << serverAddr.mid(serverAddr.indexOf('.')).toUtf8().toStdString() << "\n"
"Pin-Priority: 90"; // 降低星火源的优先级,防止从星火安装已存在的系统包,破坏依赖
policy.close();
*/
update.open(tmpPath + "/update.sh",std::ios::out);
if(update) {
unknownError = false;
update << "#!/bin/sh\n"
"mv " + tmpPath + "/sparkstore.list /etc/apt/sources.list.d/sparkstore.list && "
// "mv " + tmpPath + "/sparkstore /etc/apt/preferences.d/sparkstore && "
"apt update";
update.close();
update.open(tmpPath + "/update.sh",std::ios::out);
if(update) {
unknownError = false;
update << "#!/bin/sh\n"
"mv " + tmpPath + "/sparkstore.list /etc/apt/sources.list.d/sparkstore.list && "
// "mv " + tmpPath + "/sparkstore /etc/apt/preferences.d/sparkstore && "
"apt update";
update.close();
system(("chmod +x " + tmpPath + "/update.sh").c_str());
QProcess runupdate;
runupdate.start(QString::fromStdString("pkexec " + tmpPath + "/update.sh"));
runupdate.waitForFinished();
QString error = runupdate.readAllStandardError();
system(("chmod +x " + tmpPath + "/update.sh").c_str());
QProcess runupdate;
runupdate.start(QString::fromStdString("pkexec " + tmpPath + "/update.sh"));
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;
}
}
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("deb [by-hash=force] " + ui->comboBox_server->currentText().toUtf8() + " /");
} else {
ui->label_aptserver->setText(tr("Apt has reported an error. Please use apt update in terminal to locate the problem."));
}
}
}
if(!haveError) {
ui->label_aptserver->setText("deb [by-hash=force] " + ui->comboBox_server->currentText().toUtf8() + " /");
} else {
ui->label_aptserver->setText(tr("Apt has reported an error. Please use apt update in terminal to locate the problem."));
}
}
}
if(unknownError) {
ui->label_aptserver->setText(tr("Unknown error!"));
}
if(unknownError) {
ui->label_aptserver->setText(tr("Unknown error!"));
}
ui->pushButton_updateApt->setEnabled(true);
ui->pushButton_updateApt->setEnabled(true);
});
}
@@ -858,7 +1013,7 @@ void Widget::on_pushButton_uninstall_clicked()
ui->pushButton_download->setEnabled(false);
ui->pushButton_uninstall->setEnabled(false);
QProcess uninstall;
uninstall.start("pkexec apt purge -y "+pkgName);
uninstall.start("pkexec apt purge -y "+pkgName.toLower());
uninstall.waitForFinished();
ui->pushButton_download->setEnabled(true);
ui->pushButton_download->setText("Install");
@@ -983,10 +1138,16 @@ void Widget::on_webEngineView_urlChanged(const QUrl &arg1)
ui->pushButton_download->setEnabled(false);
ui->stackedWidget->setCurrentIndex(2);
qDebug()<<"https://demo-one-vert.vercel.app/"+type_name+"/"+pname;
/*
load.cancel();//打开并发加载线程前关闭正在执行的线程
load = QtConcurrent::run([=](){
int loadresult = loadappinfo(arg1);
});
*/
appinfoLoadThread.requestInterruption();
appinfoLoadThread.wait(100);
appinfoLoadThread.setUrl(arg1);
appinfoLoadThread.start();
}
}
@@ -1009,7 +1170,7 @@ void Widget::on_webEngineView_loadProgress(int progress)
void Widget::on_webEngineView_loadFinished(bool arg1)
{
if(arg1){
m_loadweb->setValue(0);
m_loadweb->setValue(0);
}else {
m_loadweb->setValue(0);
m_loaderror->show();

View File

@@ -13,6 +13,9 @@
#include <QFutureWatcher>
#include <QToolButton>
#include <QTimer>
#include <QFontDatabase>
#include <DSettings>
#include <DBlurEffectWidget>
#include <DSpinner>
@@ -21,6 +24,9 @@
#include <DTitlebar>
#include <DSearchEdit>
#include <progressload.h>
#include "workerthreads.h"
#include "image_show.h"
#define LIST_MAX 99 //一次最多下载数量
#define TMP_PATH "/tmp/spark-store"
@@ -56,6 +62,17 @@ private slots:
void httpFinished();
void httpReadyRead();
void updateDataReadProgress(qint64,qint64);
// SpkAppInfoLoaderThread的槽函数
void sltAppinfoResetUi();
void sltAppinfoTags(QStringList *tagList);
void sltAppinfoDetails(QString *name, QString *details, QString *info,
QString *website, QString *packageName,
QUrl *fileUrl, bool isInstalled);
void sltAppinfoIcon(QPixmap *icon);
void sltAppinfoScreenshot(QPixmap *picture, int index);
void sltAppinfoFinish();
void on_pushButton_download_clicked();
void on_pushButton_return_clicked();
void on_comboBox_server_currentIndexChanged(const QString &arg1);
@@ -90,7 +107,7 @@ public:
QString appweb;
bool themeIsDark;
QFont font;
private:
void initUI();
@@ -125,6 +142,9 @@ private:
DSearchEdit *searchEdit=new DSearchEdit;
DTitlebar *titlebar;
QList<image_show*> label_screen;
SpkAppInfoLoaderThread appinfoLoadThread;
};
#endif // WIDGET_H

View File

@@ -64,14 +64,14 @@
<item row="6" column="0" colspan="6">
<widget class="QPushButton" name="menu_video">
<property name="text">
<string>Videos</string>
<string>Video</string>
</property>
</widget>
</item>
<item row="16" column="0" colspan="6">
<widget class="QPushButton" name="menu_download">
<property name="text">
<string>Download List</string>
<string>Download</string>
</property>
</widget>
</item>
@@ -197,7 +197,7 @@
<item row="10" column="0" colspan="6">
<widget class="QPushButton" name="menu_read">
<property name="text">
<string>Translate</string>
<string>Reading</string>
</property>
</widget>
</item>
@@ -211,10 +211,10 @@
<item row="2" column="0" colspan="6">
<widget class="QPushButton" name="menu_main">
<property name="styleSheet">
<string notr="true"/>
<string notr="true">font: 11pt &quot;Zeniq&quot;;</string>
</property>
<property name="text">
<string>Home </string>
<string>Home</string>
</property>
<property name="flat">
<bool>false</bool>
@@ -238,7 +238,7 @@
<item row="4" column="0" colspan="6">
<widget class="QPushButton" name="menu_chat">
<property name="text">
<string>Communication</string>
<string>Chat</string>
</property>
</widget>
</item>
@@ -313,7 +313,7 @@
<number>0</number>
</property>
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_4">
@@ -457,7 +457,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>903</width>
<width>889</width>
<height>849</height>
</rect>
</property>
@@ -952,8 +952,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>869</width>
<height>325</height>
<width>851</width>
<height>326</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@@ -1082,8 +1082,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>738</width>
<height>896</height>
<width>889</width>
<height>812</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -1150,7 +1150,7 @@
</size>
</property>
<property name="text">
<string>Take effect when restart </string>
<string>Take effect when restart</string>
</property>
</widget>
</item>

152
workerthreads.cpp Normal file
View File

@@ -0,0 +1,152 @@
#include <QProcess>
#include <QDir>
#include <QFile>
#include <QJsonDocument>
#include "workerthreads.h"
#include "widget.h"
void SpkAppInfoLoaderThread::run()
{
emit requestResetUi();
QProcess get_json;
QString urladdress, deatils, more, packagename, appweb;
QDir dir("/tmp");
bool isInstalled;
dir.mkdir("spark-store");
QDir::setCurrent("/tmp/spark-store");
get_json.start("curl -o app.json " + targetUrl.toString());
if(waitDownload(get_json) == -1)
return;
if(get_json.exitCode())
{
Widget::sendNotification(tr("Failed to download app info. Please check internet connection."));
}
QFile app_json("app.json");
if(app_json.open(QIODevice::ReadOnly)){
// 成功得到json文件
QByteArray json_array = app_json.readAll();
// 将路径转化为相应源的下载路径
urladdress = targetUrl.toString().left(targetUrl.toString().length()-8);
QStringList downloadurl=urladdress.split("/");
QString deburl = serverUrl;
deburl = deburl.left(urladdress.length()-1);
urladdress = "https://cdn.jsdelivr.net/gh/Jerrywang959/jsonpng@master/"; // 使用图片专用服务器请保留这行,删除后将使用源服务器
urladdress = urladdress.left(urladdress.length()-1);
for (int i=3;i<downloadurl.size();i++) {
urladdress+="/"+downloadurl[i];
deburl+="/"+downloadurl[i];
}
// 路径转化完成
QJsonObject json= QJsonDocument::fromJson(json_array).object();
QString appName = json["Name"].toString();
QUrl fileUrl = deburl + json["Filename"].toString();
// 软件信息加载
QString details;
details = tr("PkgName: ") + json["Pkgname"].toString()+"\n";
details += tr("Version: ") + json["Version"].toString()+"\n";
if(json["Author"].toString() != "" && json["Author"].toString() != " "){
details += tr("Author: ") + json["Author"].toString() + "\n";
}
if(json["Website"].toString() != "" && json["Website"].toString() != " "){
details += tr("Official Site: ") + json["Website"].toString() + "\n";
//ui->pushButton_website->show(); move to setinfo slot
appweb=json["Website"].toString();
}
details+=tr("Contributor: ")+json["Contributor"].toString()+"\n";
details+=tr("Update Time: ")+json["Update"].toString()+"\n";
details+=tr("Installed Size: ")+json["Size"].toString()+"\n";
more = json["More"].toString();
QProcess isInstall;
packagename = json["Pkgname"].toString();
isInstall.start("dpkg -s "+json["Pkgname"].toString());
isInstall.waitForFinished();
int error=QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
if(error==0)
isInstalled = true;
else
isInstalled = false;
emit requestSetAppInformation(&appName, &details, &more, &appweb, &packagename, &fileUrl, isInstalled);
//tag加载
QString tags=json["Tags"].toString();
QStringList tagList=tags.split(";");
emit requestSetTags(&tagList);
// 图标加载
get_json.start("curl -o icon.png "+urladdress+"icon.png");
if(waitDownload(get_json) == -1)
return;
if(!get_json.exitCode()) {
QPixmap appicon("icon.png");
emit finishedIconLoad(&appicon);
}
else
Widget::sendNotification(tr("Failed to load application icon."));
// 截图展示加载
QPixmap screenshotCache[5];
for (int i = 0; i < 5; i++) {
QString cmd = "curl -o screen_"+QString::number(i+1)+".png "+urladdress+"screen_"+QString::number(i+1)+".png";
get_json.start(cmd);
if(waitDownload(get_json) == -1)
return;
bool s = screenshotCache[i].load(QString(TMP_PATH) + "/screen_"+QString::number(i+1)+".png");
if(s){
emit finishedScreenshotLoad(&screenshotCache[i], i);
}else{
emit finishedScreenshotLoad(nullptr, i);
QFile::remove("screen_"+QString::number(i+1)+".png");
break;
}
}
emit finishAllLoading();
}
}
void SpkAppInfoLoaderThread::setUrl(const QUrl &url)
{
targetUrl = url;
}
void SpkAppInfoLoaderThread::setServer(const QString &server)
{
serverUrl = server;
}
void SpkAppInfoLoaderThread::downloadFinished(int exitcode, QProcess::ExitStatus status)
{
Q_UNUSED(exitcode);
Q_UNUSED(status);
qDebug() << "Finish one download";
finishedDownload = true;
}
int SpkAppInfoLoaderThread::waitDownload(QProcess& downloader)
{
while(!downloader.waitForFinished(100))
{
if(downloader.state() == QProcess::NotRunning)
return -1;
if(this->isInterruptionRequested())
{
downloader.terminate();
downloader.waitForFinished(-1);
qDebug() << "Appinfo loader thread was forcefully terminated";
return -1;
}
}
return 0;
}

36
workerthreads.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef WORKERTHREADS_H
#define WORKERTHREADS_H
#include <QThread>
#include <QPixmap>
#include <QUrl>
#include <QProcess>
class SpkAppInfoLoaderThread Q_DECL_FINAL : public QThread
{
Q_OBJECT
public:
//explicit SpkAppInfoLoaderThread() = default;
void run() Q_DECL_OVERRIDE;
public slots:
void setUrl(const QUrl &url);
void setServer(const QString &server);
void downloadFinished(int exitcode, QProcess::ExitStatus status);
signals:
void requestResetUi();
void requestSetTags(QStringList *tagList);
void requestSetAppInformation(QString *name, QString *details, QString *info,
QString *website, QString *packageName,
QUrl *fileUrl, bool isInstalled);
void finishedIconLoad(QPixmap *icon);
void finishedScreenshotLoad(QPixmap *icon, int index); // 该信号必须以BlockingQueued方式连接
void finishAllLoading(); // 该信号必须以BlockingQueued方式连接
private:
int waitDownload(QProcess& downloader);
QUrl targetUrl;
QString serverUrl;
bool finishedDownload = false;
int downloaderRetval = 0;
};
#endif // WORKERTHREADS_H