From e1767420ef8152277dbc2c0367af7666fb5703c8 Mon Sep 17 00:00:00 2001 From: Maicss <15033980223@163.com> Date: Thu, 18 Jun 2020 19:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=BC=A0=E9=80=92?= =?UTF-8?q?=E4=BB=8B=E8=B4=A8=E4=B8=BAjson?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + deepin-community-store.pro | 2 +- deepin-community-store.pro.user | 326 -------------------------------- downloadlist.cpp | 11 +- downloadlist.h | 1 + downloadlist.ui | 117 ++++++------ urls.h | 2 +- widget.cpp | 38 +++- widget.h | 1 + 9 files changed, 109 insertions(+), 390 deletions(-) delete mode 100644 deepin-community-store.pro.user diff --git a/README.md b/README.md index 9415420..b9b88f8 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ #### 介绍 deepin社区商店,由社区维护 +web页面部分正在开发当中 #### 参与贡献 diff --git a/deepin-community-store.pro b/deepin-community-store.pro index a823fef..f6cbaeb 100644 --- a/deepin-community-store.pro +++ b/deepin-community-store.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui webkitwidgets network concurrent +QT += core gui webkitwidgets network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets diff --git a/deepin-community-store.pro.user b/deepin-community-store.pro.user deleted file mode 100644 index 989bdb0..0000000 --- a/deepin-community-store.pro.user +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - EnvironmentId - {ff08b897-ff9f-49db-9ac7-48af5bfb9f72} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - true - - - - ProjectExplorer.Project.Target.0 - - 桌面 - 桌面 - {497b0bdb-382d-4878-b6a7-69d35c33276e} - 0 - 0 - 0 - - /home/maicss/git/build-deepin-community-store-unknown-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/maicss/git/build-deepin-community-store-unknown-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /home/maicss/git/build-deepin-community-store-unknown-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - 部署 - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy Configuration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - deepin-community-store - - Qt4ProjectManager.Qt4RunConfiguration:/home/maicss/git/deepin-community-store/deepin-community-store.pro - deepin-community-store.pro - - 3768 - false - true - true - false - false - true - - /home/maicss/git/build-deepin-community-store-unknown-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 20 - - - Version - 20 - - diff --git a/downloadlist.cpp b/downloadlist.cpp index cf54f52..60ef62e 100644 --- a/downloadlist.cpp +++ b/downloadlist.cpp @@ -1,6 +1,6 @@ #include "downloadlist.h" #include "ui_downloadlist.h" - +#include downloadlist::downloadlist(QWidget *parent) : QWidget(parent), ui(new Ui::downloadlist) @@ -8,6 +8,7 @@ downloadlist::downloadlist(QWidget *parent) : ui->setupUi(this); ui->pushButton->setEnabled(false); ui->progressBar->setValue(0); + ui->label_filename->hide(); } downloadlist::~downloadlist() @@ -50,7 +51,13 @@ void downloadlist::choose(bool isChoosed) } } +void downloadlist::setFileName(QString fileName) +{ + ui->label_filename->setText(fileName); +} + void downloadlist::on_pushButton_clicked() { - system("deepin-deb-installer "+ui->label->text().toUtf8()+"&"); + system("deepin-deb-installer "+ui->label_filename->text().toUtf8()+"&"); + qDebug()<label_filename->text().toUtf8(); } diff --git a/downloadlist.h b/downloadlist.h index 4371e6a..25fbb07 100644 --- a/downloadlist.h +++ b/downloadlist.h @@ -21,6 +21,7 @@ public: void readyInstall(); void choose(bool); bool free; + void setFileName(QString); public: signals: void closeDownload(); private slots: diff --git a/downloadlist.ui b/downloadlist.ui index aeb4b99..9a0f73f 100644 --- a/downloadlist.ui +++ b/downloadlist.ui @@ -6,7 +6,7 @@ 0 0 - 617 + 636 52 @@ -17,50 +17,7 @@ - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 安装 - - - - - - - - 150 - 0 - - - - - 16777215 - 16777215 - - - - - 13 - - - - 名称 - - - - + @@ -88,20 +45,50 @@ - - - - Qt::Horizontal - - + + + - 40 - 20 + 80 + 0 - + + + 80 + 16777215 + + + + 安装 + + - + + + + + 150 + 0 + + + + + 16777215 + 16777215 + + + + + 13 + + + + 名称 + + + + Qt::Horizontal @@ -117,6 +104,26 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + TextLabel + + + diff --git a/urls.h b/urls.h index f964b5a..dfd3ac7 100644 --- a/urls.h +++ b/urls.h @@ -1,6 +1,6 @@ #ifndef URLS_H #define URLS_H -#define URL_MAIN "https://dstore-appstore.deepin.cn/china/index/" +#define URL_MAIN "http://127.0.0.1:8000" #define URL_NETWORK "https://mirrors.huaweicloud.com/deepin/" #define URL_CHAT "https://mirrors.huaweicloud.com/deepin/" #define URL_MUSIC "https://mirrors.huaweicloud.com/deepin/" diff --git a/widget.cpp b/widget.cpp index 7eab034..e5c1d29 100644 --- a/widget.cpp +++ b/widget.cpp @@ -4,11 +4,16 @@ #include #include #include -#include //并发 #include #include #include #include "urls.h" +#include +#include +#include +#include +#include +#include Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) @@ -28,14 +33,35 @@ Widget::~Widget() void Widget::on_webView_linkClicked(const QUrl &arg1) { + + QString appName; + + //这里改成获取json后获取url并下载 if(arg1.path().right(1)=="/"){ ui->webView->setUrl(arg1); - }else if(arg1.path().right(4)==".deb"){ + }else if(arg1.path().right(5)==".json"){ + qDebug()<stackedWidget->setCurrentIndex(1); on_menu_btn_download_clicked(); allDownload+=1; - qDebug()<setSizeHint(download_list[allDownload-1].size()); ui->listWidget->setItemWidget(item,&download_list[allDownload-1]); urList.append(url); - download_list[allDownload-1].setName(fileName); + download_list[allDownload-1].setName(appName); + download_list[allDownload-1].setFileName(fileName); + if(!isBusy){ file = new QFile(fileName); if(!file->open(QIODevice::WriteOnly)) diff --git a/widget.h b/widget.h index cf48a4e..eda05c1 100644 --- a/widget.h +++ b/widget.h @@ -67,6 +67,7 @@ private: QNetworkReply *reply; QList urList; QFile *file; + }; #endif // WIDGET_H