mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-15 13:22:04 +08:00
Compare commits
35 Commits
2.0.2.3
...
3.0-alpha1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62f0dd097c | ||
| b7e038bd88 | |||
|
|
4f0e00ad76 | ||
|
|
579008e8b2 | ||
|
|
ccb405c983 | ||
| f5788efb47 | |||
| 32bc272791 | |||
| c5f04b5675 | |||
| cf208d0736 | |||
| fdc7cb4cb6 | |||
| 8e89ce3ae3 | |||
| ee51f59874 | |||
| 3d09a28794 | |||
| 4b05758479 | |||
| 74d9d0b563 | |||
|
|
f1a4f7acb5 | ||
| 93be66e871 | |||
| 7b46cca1d4 | |||
| c529367998 | |||
|
|
beae3e3efa | ||
|
|
9706480931 | ||
|
|
ed64eb6f5b | ||
| 8f6e5408ae | |||
| d5783458fc | |||
| 6e05066dd9 | |||
| 58aa5a3787 | |||
| 6087c8a5c8 | |||
| ff758946be | |||
| d1cbf95447 | |||
|
|
187ce7e277 | ||
| d3e4f75254 | |||
|
|
949eb33511 | ||
|
|
3f65002dc9 | ||
|
|
cfd4c7689a | ||
|
|
367c8d857c |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
spark-store.pro.user*
|
||||
build/
|
||||
.vscode/
|
||||
BIN
Logo-Spark.png
BIN
Logo-Spark.png
Binary file not shown.
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 46 KiB |
350
README.md
350
README.md
@@ -1,9 +1,22 @@
|
||||
# 星火商店
|
||||
[](https://gitee.com/deepin-community-store/spark-store)
|
||||
# 星火应用商店[](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);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -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){
|
||||
|
||||
BIN
fonts/华康少女字体.ttf
Normal file
BIN
fonts/华康少女字体.ttf
Normal file
Binary file not shown.
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
62
main.cpp
62
main.cpp
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
Before Width: | Height: | Size: 873 B After Width: | Height: | Size: 873 B |
Binary file not shown.
@@ -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><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</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><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></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><html><head/><body><p>Capable to deepin 20</p></body></html></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><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></source>
|
||||
@@ -365,135 +392,144 @@
|
||||
<source><html><head/><body><p><br/></p></body></html></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.
@@ -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><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></source>
|
||||
<translation><span style=' font-size:10pt;font-weight:60;'>deepin 社区驱动的一款第三方应用商店</span><br/><a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/><span style=' font-size:12pt;'>Spark developers</span></translation>
|
||||
<translation type="vanished"><span style=' font-size:10pt;font-weight:60;'>deepin 社区驱动的一款第三方应用商店</span><br/><a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/><span style=' font-size:12pt;'>Spark developers</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../main.cpp" line="32"/>
|
||||
<source>The Spark Project</source>
|
||||
<translation>星火项目组</translation>
|
||||
<translation type="vanished">星火项目组</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><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/>We publish this program under GPL V3</source>
|
||||
<translation type="vanished"><span style=' font-size:10pt;font-weight:60;'>一款由 深度社区 出品的应用商店</span><br/>""<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>""<span style=' font-size:12pt;'>星火开发者联盟</span><br/>本程序遵循 GPL V3 协议发布</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../main.cpp" line="45"/>
|
||||
<source><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</source>
|
||||
<translation><span style='font-size:10pt;font-weight:60;'>由 Deepin 社区出品的应用商店</span><br/><a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/><span style='font-size:12pt;'>星火商店开发组</span><br/><br/>遵循 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><html><head/><body><p>A deepin-wine2 app.If you are using ubuntu or other non-deepin distro,you should deploy deepin-wine2 by your self.</p></body></html></source>
|
||||
<translation type="unfinished"><html><head/><body><p>这是一款deepin-wine5应用,如果你并没有在使用深度系列发行版(比如您在使用ubuntu),你需要自行配置deepin-wine5环境</p></body></html> {2 ?} {2 ?}</translation>
|
||||
<translation><html><head/><body><p>这是一款 deepin-wine2 应用,如果你并没有在使用深度系列发行版(比如您在使用ubuntu),你需要自行配置 deepin-wine2 环境</p></body></html></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><html><head/><body><p>An app store developed by community enthusiasts</p></body></html></source>
|
||||
<translation type="unfinished"><html><head/><body><p>社区爱好者开发的一款应用商店</p></body></html></translation>
|
||||
<translation><html><head/><body><p>由社区爱好者开发的一款应用商店</p></body></html></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><html><head/><body><p><img src=":/tags/uos-small.png"/></p></body></html></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>
|
||||
|
||||
383
widget.cpp
383
widget.cpp
@@ -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();
|
||||
|
||||
22
widget.h
22
widget.h
@@ -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
|
||||
|
||||
26
widget.ui
26
widget.ui
@@ -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 "Zeniq";</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
152
workerthreads.cpp
Normal 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
36
workerthreads.h
Normal 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
|
||||
Reference in New Issue
Block a user