From 5c8ee91a76601a97dc3220ae316315f687ec5901 Mon Sep 17 00:00:00 2001 From: shenmo Date: Thu, 25 Jun 2020 18:43:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E8=BD=BD=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deepin-community-store.pro.user | 326 -------------------------------- downloadlist.cpp | 13 ++ downloadlist.h | 2 +- downloadlist.ui | 140 ++++++++++---- widget.cpp | 17 +- widget.ui | 8 +- 6 files changed, 132 insertions(+), 374 deletions(-) delete mode 100644 deepin-community-store.pro.user diff --git a/deepin-community-store.pro.user b/deepin-community-store.pro.user deleted file mode 100644 index 02ce2ca..0000000 --- a/deepin-community-store.pro.user +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - EnvironmentId - {964ed9bf-1dd7-4af2-8a95-0a12891624cd} - - - 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 - - 桌面 - 桌面 - {10c1a6c8-39fd-4308-b111-0e790b25d916} - 0 - 0 - 0 - - /home/vsesm/Desktop/新建文件夹/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/vsesm/Desktop/新建文件夹/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/vsesm/Desktop/新建文件夹/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/vsesm/Desktop/新建文件夹/deepin-community-store/deepin-community-store.pro - deepin-community-store.pro - - 3768 - false - true - true - false - false - true - - /home/vsesm/Desktop/新建文件夹/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 cd99c5b..cbada26 100644 --- a/downloadlist.cpp +++ b/downloadlist.cpp @@ -1,6 +1,8 @@ #include "downloadlist.h" #include "ui_downloadlist.h" #include +#include +#include downloadlist::downloadlist(QWidget *parent) : QWidget(parent), ui(new Ui::downloadlist) @@ -20,6 +22,10 @@ downloadlist::~downloadlist() void downloadlist::setValue(long long value) { ui->progressBar->setValue(value); + ui->label_2->setText(QString::number((double)value/100)+"%"); + if(ui->label_2->text()=="100%"){ + ui->label_2->setText("已完成,等待安装"); + } } void downloadlist::setMax(long long max) @@ -48,8 +54,10 @@ void downloadlist::choose(bool isChoosed) { if(isChoosed){ ui->label->setStyleSheet("color:#FFFFFF"); + ui->label_2->setStyleSheet("color:#FFFFFF"); }else { ui->label->setStyleSheet("color:#000000"); + ui->label_2->setStyleSheet("color:#000000"); } } @@ -58,6 +66,11 @@ void downloadlist::setFileName(QString fileName) ui->label_filename->setText(fileName); } +void downloadlist::seticon(const QPixmap icon) +{ + ui->label_3->setPixmap(icon); +} + void downloadlist::on_pushButton_clicked() { system("x-terminal-emulator -e sudo apt install -y ./"+ui->label_filename->text().toUtf8()); diff --git a/downloadlist.h b/downloadlist.h index 25fbb07..8c4307a 100644 --- a/downloadlist.h +++ b/downloadlist.h @@ -2,7 +2,6 @@ #define DOWNLOADLIST_H #include - namespace Ui { class downloadlist; } @@ -22,6 +21,7 @@ public: void choose(bool); bool free; void setFileName(QString); + void seticon(const QPixmap); public: signals: void closeDownload(); private slots: diff --git a/downloadlist.ui b/downloadlist.ui index 9a0f73f..e0b3491 100644 --- a/downloadlist.ui +++ b/downloadlist.ui @@ -6,8 +6,8 @@ 0 0 - 636 - 52 + 744 + 54 @@ -18,34 +18,22 @@ - - - - 0 - 0 - + + + Qt::Horizontal - + + QSizePolicy::Expanding + + - 350 - 0 + 40 + 20 - - - 500 - 10 - - - - 24 - - - false - - + - + @@ -64,7 +52,7 @@ - + @@ -88,7 +76,87 @@ + + + + TextLabel + + + + + + + 350 + 0 + + + + + 500 + 16777215 + + + + + 2 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 350 + 0 + + + + + 500 + 10 + + + + 24 + + + false + + + + + + + + 9 + + + + 等待开始下载 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal @@ -104,23 +172,19 @@ - - - - Qt::Horizontal - - + + + 40 - 20 + 16777215 - - - - - TextLabel + icon + + + true diff --git a/widget.cpp b/widget.cpp index 93a9184..6b1e41a 100644 --- a/widget.cpp +++ b/widget.cpp @@ -15,6 +15,7 @@ #include #include //并发 #include +#include Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) @@ -60,19 +61,19 @@ Widget::Widget(QWidget *parent) : configCanSeve=true; qDebug()<label_more->setText("");//清空详情介绍 ui->label_info->setText(""); ui->label_appname->setText(""); + ui->pushButton->setEnabled(false); ui->stackedWidget->setCurrentIndex(2); load = QtConcurrent::run([=](){ loadappinfo(arg1); @@ -159,6 +161,7 @@ void Widget::loadappinfo(QUrl arg1) QPixmap appicon; qDebug()<label_appicon->setPixmap(appicon); + ui->pushButton->setEnabled(true); //截图展示加载 get_json.start("wget "+urladdress+"screen_1.png"); get_json.waitForFinished(); @@ -239,6 +242,9 @@ void Widget::on_pushButton_clicked() urList.append(url); download_list[allDownload-1].setName(appName); download_list[allDownload-1].setFileName(fileName); + QPixmap icon; + icon.load("icon.png"); + download_list[allDownload-1].seticon(icon); if(!isBusy){ file = new QFile(fileName); if(!file->open(QIODevice::WriteOnly)){ @@ -279,8 +285,9 @@ void Widget::httpReadyRead() } void Widget::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes) { - download_list[nowDownload-1].setMax(1000); //最大值 - download_list[nowDownload-1].setValue((bytesRead*1000)/totalBytes); //当前值 + download_list[nowDownload-1].setMax(10000); //最大值 + download_list[nowDownload-1].setValue((bytesRead*10000)/totalBytes); //当前值 + // download_list[nowDownload-1].setMax(bytesRead/10); // download_list[nowDownload-1].setValue(totalBytes/10); } diff --git a/widget.ui b/widget.ui index 3ff2aed..fdeec09 100644 --- a/widget.ui +++ b/widget.ui @@ -137,7 +137,7 @@ 0 0 781 - 769 + 770 @@ -495,7 +495,7 @@ 0 0 - 535 + 547 130 @@ -687,7 +687,7 @@ color:#FFFFFF - 首页推荐 + 首页精选 @@ -1147,7 +1147,7 @@ - 工具插件 + 系统管理