Skip to content

Commit

Permalink
v0.3 支持应用图标批量下载 优化程序图标
Browse files Browse the repository at this point in the history
v0.3
支持应用图标批量下载
1.选择批量下载模式
2.选择下载位置

增加应用标题栏图标

【关于】界面使用坚果R2背面新LOGO

程序右侧SmartisanOS背景扣除白色背景

支持批量下载已下载数量显示
  • Loading branch information
houyawei-NO1 committed Mar 7, 2021
1 parent dd0fb6f commit dc189ca
Show file tree
Hide file tree
Showing 15 changed files with 107 additions and 30 deletions.
22 changes: 0 additions & 22 deletions DtkSmartisanosLogo.pro

This file was deleted.

24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DtkSmartisanosLogo

![新建文件夹](https://github.com/houyawei-NO1/DtkSmartisanosLogo/blob/main/%E8%AE%BE%E8%AE%A1%E5%9B%BE.jpg)

v0.1(应该是0.01)
v0.1

单应用图标下载

Expand All @@ -22,10 +22,30 @@ v0.1(应该是0.01)

![v0.1下载图片](https://github.com/houyawei-NO1/DtkSmartisanosLogo/blob/main/v0.1(2).jpg)

v0.02
v0.2

多应用图标批量下载

![v0.2预览图](https://github.com/houyawei-NO1/DtkSmartisanosLogo/blob/main/v0.2.gif)

![v0.2预览图](https://s3.ax1x.com/2021/03/05/6e7LCQ.gif)


v0.3
支持应用图标批量下载
1.选择批量下载模式
2.选择下载位置

增加应用标题栏图标

【关于】界面使用坚果R2背面新LOGO

程序右侧SmartisanOS背景扣除白色背景

支持批量下载已下载数量显示

![v0.3_1预览图](https://github.com/houyawei-NO1/DtkSmartisanosLogo/blob/main/v0.3_1.jpg)

![v0.3_2预览图](https://github.com/houyawei-NO1/DtkSmartisanosLogo/blob/main/v0.3_2.jpg)

![v0.3_3预览图](https://github.com/houyawei-NO1/DtkSmartisanosLogo/blob/main/v0.3_3.jpg)
Binary file added SmartisanOS_png_21.03.07.zip
Binary file not shown.
13 changes: 13 additions & 0 deletions images/iconfinder-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/smartisan.ico
Binary file not shown.
Binary file added images/smartisan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smartisanos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/smartisanos_small.png
Binary file not shown.
4 changes: 2 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ int main(int argc, char *argv[])
DApplication a(argc, argv);
a.setOrganizationName("deepin");
a.setApplicationName("dtk_Smartisanos图标下载助手");
a.setApplicationVersion("0.02");
a.setProductIcon(QIcon(":/images/hyw.ico"));
a.setApplicationVersion("0.3");
a.setProductIcon(QIcon(":/images/smartisan.ico"));
a.setProductName("DTK_Smartisanos图标下载助手");
a.setApplicationDescription("这是一个DTK_Smartisanos图标下载助手应用");

Expand Down
3 changes: 3 additions & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
<file>images/logo.svg</file>
<file>images/hyw.ico</file>
<file>images/smartisanos.png</file>
<file>images/smartisan.ico</file>
<file>images/smartisan.png</file>
<file>images/iconfinder-icon.svg</file>
</qresource>
</RCC>
68 changes: 64 additions & 4 deletions smartisanoslogo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <DSearchEdit>
#include <DTitlebar>
#include <QNetworkAccessManager>
static int num=0;
SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)
: DMainWindow(parent)
{
Expand All @@ -11,6 +12,14 @@ SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)
moveToCenter(this);
SmartisanOsLogo::resize(900,700);
SmartisanOsLogo::setMinimumSize(900,700);

QDir currDir = QCoreApplication::applicationDirPath();
//currDir.cdUp();
QString m_savePath = currDir.path();
QString filenameText = m_savePath;
filenameText.append("/allapp.json");


QHBoxLayout *hlayout =new QHBoxLayout(w);
QVBoxLayout *v1layout = new QVBoxLayout(w);
QHBoxLayout *modelayout = new QHBoxLayout(w);
Expand All @@ -36,6 +45,8 @@ SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)
DLabel *logo = new DLabel;
logo->setText("图标预览:");
logo->setAlignment(Qt::AlignCenter);
titlebar()->setIcon(QIcon(":/images/iconfinder-icon.svg"));




Expand Down Expand Up @@ -92,6 +103,35 @@ SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)



connect(modecombobox, &DComboBox::currentTextChanged, this, [ = ] {
switch (modecombobox->currentIndex()) {

case 0:
{
mode->setText("①下载模式:");
nameLineEdit->show();
name->setText("②应用名称:");
location->setText("③下载位置:");

}
break;

case 1:
{
name->setText(" ");
nameLineEdit->hide();
location->setText("②下载位置:");

}
break;

case 2:
{
}
break;

}
});

//download button
connect(Download, &DPushButton::clicked, this, [ = ] {
Expand All @@ -115,7 +155,7 @@ SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)
case 1:
{

QFile file("allapp.json");
QFile file(filenameText);
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QString value = file.readAll();
Expand All @@ -124,15 +164,20 @@ SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)
QJsonDocument document = QJsonDocument::fromJson(value.toUtf8(), &parseJsonErr);

if (! (parseJsonErr.error == QJsonParseError::NoError)) {
QMessageBox::about(NULL, "提示", "配置文件错误!");
//QMessageBox::about(NULL, "提示", "配置文件错误!");
DDialog dlg("提示", "配置文件错误!");
dlg.addButton("好的", true, DDialog::ButtonWarning);
dlg.setIcon(QIcon(":/images/hyw.ico"));
dlg.exec();
return;
}

QJsonObject jsonObject = document.object();

QJsonObject jsonObject = document.object();
QJsonObject::Iterator it;
QString keyString="";
QString valueString="";

for(it=jsonObject.begin();it!=jsonObject.end();it++)
{
// QString value=it.value().toString();
Expand All @@ -145,14 +190,27 @@ SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)
obj.insert("package",packagename);
QJsonDocument jsonDoc(obj);
QNetworkReply* reply = accessManager->post(request, '[' + jsonDoc.toJson(QJsonDocument::Compact) + ']');
name->setText("已下载图片"+QString::number(num)+"");
if (reply->isFinished())
reply->deleteLater();
QEventLoop loop;
QTimer::singleShot(20,&loop,SLOT(quit()));
loop.exec();

}
num=0;
// keyString=keyString.left(keyString.length()-1);
// valueString=valueString.left(valueString.length()-1);

}
else {
//QMessageBox::about(NULL, "提示", "未找到文件allapp.json");
DDialog dlg("提示", "未找到文件allapp.json");
dlg.addButton("好的", true, DDialog::ButtonWarning);
dlg.setIcon(QIcon(":/images/hyw.ico"));
dlg.exec();
return;
}



Expand Down Expand Up @@ -183,6 +241,8 @@ SmartisanOsLogo::SmartisanOsLogo(DMainWindow *parent)
locationLineEdit->setText(PathName);
});



}
SmartisanOsLogo::~SmartisanOsLogo()
{
Expand All @@ -197,7 +257,7 @@ void SmartisanOsLogo::finishedSlot(QNetworkReply *reply)
QStringList urlpngList=urlpng.split(QRegExp("[\"]"));
qDebug()<<"urlpngList"<<urlpngList[9];
logoPng->setPixmap(setpnglabel(urlpngList[9]));

if(urlpngList[9].size()>20 ) num++;
QString fileName = /*"/home/houyawei/Pictures/"*/PathName + '/' + urlpngList[5] + ".png";
QString url_name= urlpngList[9]; //ui->url_text为Qline edit控件
downIURL_to_picture(url_name,fileName);//将URL地址和要保存的文件名字传给函数调用
Expand Down
3 changes: 3 additions & 0 deletions smartisanoslogo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QFileDialog>
#include <QDateTime>
#include <QJsonArray>
#include <QTimer>
DWIDGET_USE_NAMESPACE
#ifndef DTKSERIALPORT_H
#define DTKSERIALPORT_H
Expand All @@ -40,9 +41,11 @@ class SmartisanOsLogo : public DMainWindow
DPushButton *filelocation = new DPushButton();
QString PathName,current_File;
QDateTime current_File_time;

private:
QWidget *w=new QWidget;
void setTheme(DGuiApplicationHelper::ColorType);

private slots:
void finishedSlot(QNetworkReply* reply);
};
Expand Down
Binary file added v0.3_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added v0.3_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added v0.3_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dc189ca

Please sign in to comment.