diff --git a/deepin-community-store.pro b/deepin-community-store.pro index f6cbaeb..a823fef 100644 --- a/deepin-community-store.pro +++ b/deepin-community-store.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui webkitwidgets network +QT += core gui webkitwidgets network concurrent greaterThan(QT_MAJOR_VERSION, 4): QT += widgets diff --git a/downloadlist.cpp b/downloadlist.cpp index 6babe3a..2ee05c8 100644 --- a/downloadlist.cpp +++ b/downloadlist.cpp @@ -59,6 +59,6 @@ void downloadlist::setFileName(QString fileName) void downloadlist::on_pushButton_clicked() { - system("deepin-deb-installer "+ui->label_filename->text().toUtf8()+"&"); + system("deepin-terminal -e sudo dpkg -i ./"+ui->label_filename->text().toUtf8()+" && sudo apt install -f"); qDebug()<label_filename->text().toUtf8(); } diff --git a/urls.h b/urls.h index 31e1063..55233ef 100644 --- a/urls.h +++ b/urls.h @@ -1,15 +1,16 @@ #ifndef URLS_H #define URLS_H -#define URL_MAIN "http://store2.shenmo.tech/store/" -#define URL_NETWORK "http://store2.shenmo.tech/store/network/" -#define URL_CHAT "http://store2.shenmo.tech/store/chat/" -#define URL_MUSIC "http://store2.shenmo.tech/store/music" -#define URL_VIDEO "http://store2.shenmo.tech/store/video" -#define URL_PHOTO "http://store2.shenmo.tech/store/image_graphic/" -#define URL_GAME "http://store2.shenmo.tech/store/games/" -#define URL_OFFICE "http://store2.shenmo.tech/store/" -#define URL_READ "http://store2.shenmo.tech/store/reading/" -#define URL_DEV "http://store2.shenmo.tech/store/development/" -#define URL_SYSTEM "http://store2.shenmo.tech/store/tools/" -#define URL_OTHER "http://store2.shenmo.tech/store/others/" +#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/" +#define URL_VIDEO "https://mirrors.huaweicloud.com/deepin/" +#define URL_PHOTO "https://mirrors.huaweicloud.com/deepin/" +#define URL_GAME "https://mirrors.huaweicloud.com/deepin/" +#define URL_OFFICE "https://mirrors.huaweicloud.com/deepin/" +#define URL_READ "https://mirrors.huaweicloud.com/deepin/" +#define URL_DEV "https://mirrors.huaweicloud.com/deepin/" +#define URL_SYSTEM "https://mirrors.huaweicloud.com/deepin/" +#define URL_OTHER "http://store2.shenmo.tech:8000/store/tools/" +#define URL_THEME "https://mirrors.huaweicloud.com/deepin" #endif // URLS_H diff --git a/widget.cpp b/widget.cpp index b8900c3..84be019 100644 --- a/widget.cpp +++ b/widget.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include "urls.h" #include #include @@ -15,6 +13,7 @@ #include #include #include +#include //并发 Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) @@ -58,63 +57,17 @@ void Widget::on_webView_linkClicked(const QUrl &arg1) //成功得到json文件 qDebug()<<"成功得到"; QByteArray json_array=app_json.readAll(); - QString urladdress=arg1.toString().left(arg1.toString().length()-8); + urladdress=arg1.toString().left(arg1.toString().length()-8); QJsonObject json= QJsonDocument::fromJson(json_array).object(); appName = json["name"].toString(); url=urladdress + json["filename"].toString(); qDebug()<stackedWidget->setCurrentIndex(2); ui->label_appname->setText(appName); - //图标加载 - get_json.start("wget -O icon.png "+urladdress+"icon.png"); - get_json.waitForFinished(); - QPixmap appicon; - appicon.load("icon.png"); - ui->label_appicon->setPixmap(appicon); - //软件信息加载 - QString info; - info="版本号:"+json["version"].toString()+"\n"; - info+="作者:"+json["author"].toString()+"\n"; - info+="官网:"+json["website"].toString()+"\n"; - ui->label_info->setText(info); - ui->label_more->setText(json["more"].toString()); - //截图加载 - get_json.start("wget -O screen_1.png "+urladdress+"screen_1.png"); - get_json.waitForFinished(); - get_json.start("wget -O screen_2.png "+urladdress+"screen_2.png"); - get_json.waitForFinished(); - get_json.start("wget -O screen_3.png "+urladdress+"screen_3.png"); - get_json.waitForFinished(); - get_json.start("wget -O screen_4.png "+urladdress+"screen_4.png"); - get_json.waitForFinished(); - get_json.start("wget -O screen_5.png "+urladdress+"screen_5.png"); - get_json.waitForFinished(); - QPixmap screen[5]; - if(screen[0].load("screen_1.png")){ - ui->screen_1->show(); - ui->screen_1->setPixmap(screen[0]); - ui->screen_1->setScaledContents(true); - } - if(screen[1].load("screen_2.png")){ - ui->screen_2->show(); - ui->screen_2->setPixmap(screen[1]); - ui->screen_2->setScaledContents(true); - } - if(screen[2].load("screen_3.png")){ - ui->screen_3->show(); - ui->screen_3->setPixmap(screen[2]); - ui->screen_3->setScaledContents(true); - } - if(screen[3].load("screen_4.png")){ - ui->screen_4->show(); - ui->screen_4->setPixmap(screen[3]); - ui->screen_4->setScaledContents(true); - } - if(screen[4].load("screen_5.png")){ - ui->screen_5->show(); - ui->screen_5->setPixmap(screen[4]); - ui->screen_5->setScaledContents(true); - } + + QtConcurrent::run([=](){ + loadappinfo(json); + }); } @@ -139,7 +92,6 @@ void Widget::on_pushButton_clicked() urList.append(url); download_list[allDownload-1].setName(appName); download_list[allDownload-1].setFileName(fileName); - if(!isBusy){ file = new QFile(fileName); if(!file->open(QIODevice::WriteOnly)) @@ -171,6 +123,71 @@ void Widget::closeList(int) { } + +void Widget::loadappinfo(QJsonObject json) +{ + ui->label_show->setText("正在加载,请稍候"); + ui->label_show->show(); + QPixmap pixmap_null; + ui->label_appicon->setPixmap(pixmap_null); + ui->screen_1->setPixmap(pixmap_null); + ui->screen_2->setPixmap(pixmap_null); + ui->screen_3->setPixmap(pixmap_null); + ui->screen_4->setPixmap(pixmap_null); + ui->screen_5->setPixmap(pixmap_null); + QProcess get_json; + //图标加载 + get_json.start("wget -O icon.png "+urladdress+"icon.png"); + get_json.waitForFinished(); + QPixmap appicon; + qDebug()<label_appicon->setPixmap(appicon); + //软件信息加载 + QString info; + info="版本号:"+json["version"].toString()+"\n"; + info+="作者:"+json["author"].toString()+"\n"; + info+="官网:"+json["website"].toString()+"\n"; + ui->label_info->setText(info); + ui->label_more->setText(json["more"].toString()); + QPixmap screen[5]; + get_json.start("wget -O screen_1.png "+urladdress+"screen_1.png"); + get_json.waitForFinished(); + if(screen[0].load("screen_1.png")){ + ui->screen_1->show(); + ui->screen_1->setPixmap(screen[0]); + ui->screen_1->setScaledContents(true); + } + get_json.start("wget -O screen_2.png "+urladdress+"screen_2.png"); + get_json.waitForFinished(); + if(screen[1].load("screen_2.png")){ + ui->screen_2->show(); + ui->screen_2->setPixmap(screen[1]); + ui->screen_2->setScaledContents(true); + } + get_json.start("wget -O screen_3.png "+urladdress+"screen_3.png"); + get_json.waitForFinished(); + if(screen[2].load("screen_3.png")){ + ui->screen_3->show(); + ui->screen_3->setPixmap(screen[2]); + ui->screen_3->setScaledContents(true); + } + get_json.start("wget -O screen_4.png "+urladdress+"screen_4.png"); + get_json.waitForFinished(); + if(screen[3].load("screen_4.png")){ + ui->screen_4->show(); + ui->screen_4->setPixmap(screen[3]); + ui->screen_4->setScaledContents(true); + } + get_json.start("wget -O screen_5.png "+urladdress+"screen_5.png"); + get_json.waitForFinished(); + if(screen[4].load("screen_5.png")){ + ui->screen_5->show(); + ui->screen_5->setPixmap(screen[4]); + ui->screen_5->setScaledContents(true); + } + ui->label_show->setText(""); + ui->label_show->hide(); +} void Widget::httpReadyRead() { if(file) @@ -282,8 +299,8 @@ void Widget::on_menu_btn_network_clicked() //网络应用 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); - ui->stackedWidget->setCurrentIndex(0); - ui->webView->setUrl(QUrl(URL_NETWORK)); + ui->stackedWidget->setCurrentIndex(0); + ui->webView->setUrl(QUrl(URL_NETWORK)); } void Widget::on_menu_btn_chat_clicked()//社交沟通 { @@ -346,6 +363,8 @@ void Widget::on_menu_btn_music_clicked()//音乐欣赏 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_MUSIC)); } @@ -378,6 +397,8 @@ void Widget::on_menu_btn_video_clicked()//视频播放 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_VIDEO)); } @@ -410,6 +431,8 @@ void Widget::on_menu_btn_photo_clicked()//图形图像 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_PHOTO)); } @@ -442,6 +465,8 @@ void Widget::on_menu_btn_game_clicked()//游戏娱乐 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_GAME)); } @@ -474,6 +499,8 @@ void Widget::on_menu_btn_office_clicked()//办公学习 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_OFFICE)); } @@ -506,6 +533,8 @@ void Widget::on_menu_btn_read_clicked()//阅读翻译 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_READ)); } @@ -538,6 +567,8 @@ void Widget::on_menu_btn_dev_clicked()//编程开发 ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_DEV)); } @@ -570,6 +601,8 @@ void Widget::on_menu_btn_system_clicked()//系统管理 ui->menu_btn_dev->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_SYSTEM)); } @@ -602,6 +635,8 @@ void Widget::on_menu_btn_other_clicked()//其他软件 ui->menu_btn_dev->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_download->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(0); ui->webView->setUrl(QUrl(URL_OTHER)); } @@ -634,9 +669,58 @@ void Widget::on_menu_btn_download_clicked() ui->menu_btn_system->setStyleSheet(""); ui->menu_btn_main->setStyleSheet(""); ui->menu_btn_network->setStyleSheet(""); + ui->menu_btn_theme->setStyleSheet(""); + ui->menu_bg_theme->setStyleSheet("");//蓝色 ui->stackedWidget->setCurrentIndex(1); } void Widget::on_pushButton_2_clicked() { ui->stackedWidget->setCurrentIndex(0); } + +void Widget::on_webView_loadStarted() +{ + ui->label_show->setText("正在加载,请稍候"); + ui->label_show->show(); +} + +void Widget::on_webView_loadFinished(bool arg1) +{ + ui->label_show->setText(""); + ui->label_show->hide(); +} + +void Widget::on_menu_btn_theme_clicked() +{ + ui->menu_btn_theme->setStyleSheet("color:#FFFFFF"); + ui->menu_bg_theme->setStyleSheet("background-color:#0081FF;border-radius:8");//蓝色 + //取消其他样式 + ui->menu_bg_dev->setStyleSheet(""); + ui->menu_bg_chat->setStyleSheet(""); + ui->menu_bg_game->setStyleSheet(""); + ui->menu_bg_read->setStyleSheet(""); + ui->menu_bg_music->setStyleSheet(""); + ui->menu_bg_other->setStyleSheet(""); + ui->menu_bg_photo->setStyleSheet(""); + ui->menu_bg_video->setStyleSheet(""); + ui->menu_bg_office->setStyleSheet(""); + ui->menu_bg_system->setStyleSheet(""); + ui->menu_bg_main->setStyleSheet(""); + ui->menu_bg_network->setStyleSheet(""); + ui->menu_btn_dev->setStyleSheet(""); + ui->menu_btn_chat->setStyleSheet(""); + ui->menu_btn_game->setStyleSheet(""); + ui->menu_btn_read->setStyleSheet(""); + ui->menu_btn_music->setStyleSheet(""); + ui->menu_btn_other->setStyleSheet(""); + ui->menu_btn_photo->setStyleSheet(""); + ui->menu_btn_video->setStyleSheet(""); + ui->menu_btn_office->setStyleSheet(""); + ui->menu_btn_system->setStyleSheet(""); + ui->menu_btn_main->setStyleSheet(""); + ui->menu_btn_network->setStyleSheet(""); + ui->menu_bg_download->setStyleSheet(""); + ui->menu_btn_download->setStyleSheet(""); + ui->stackedWidget->setCurrentIndex(0); + ui->webView->setUrl(QUrl(URL_THEME)); +} diff --git a/widget.h b/widget.h index 11f7f35..05a6113 100644 --- a/widget.h +++ b/widget.h @@ -7,6 +7,8 @@ #include #include #include +#include +#include #define LIST_MAX 99 namespace Ui { class Widget; @@ -24,6 +26,8 @@ public: int allDownload=0; int isdownload=false; void closeList(int); + void loadappinfo(QJsonObject); + private slots: void on_webView_linkClicked(const QUrl &arg1); @@ -62,6 +66,12 @@ private slots: void on_pushButton_2_clicked(); + void on_webView_loadStarted(); + + void on_webView_loadFinished(bool arg1); + + void on_menu_btn_theme_clicked(); + private: QUrl url; bool isBusy=false; @@ -72,6 +82,8 @@ private: QList urList; QFile *file; QString appName; + QString urladdress; + }; diff --git a/widget.ui b/widget.ui index b5d6b66..f441a4a 100644 --- a/widget.ui +++ b/widget.ui @@ -6,17 +6,14 @@ 0 0 - 881 - 581 + 943 + 640 Form - - - 0 - + 0 @@ -29,7 +26,446 @@ 0 - + + + + + + + 0 + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + https://bbs.deepin.org/ + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 14 + + + + background-color:#FFFFFF + + + 当前下载列表为空 + + + Qt::AlignCenter + + + + + + + 0 + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + c + + + true + + + + + 0 + 0 + 299 + 945 + + + + + + + + 16777215 + 300 + + + + + + + + 40 + 16777215 + + + + < + + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 60 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 70 + 20 + + + + + + + + 安装 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Bitstream Charter + 22 + + + + 软件名 + + + + + + + + 128 + 128 + + + + + 128 + 128 + + + + border-radius:10px; + + + 图标 + + + + + + + <html><head/><body><p><br/></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + + 0 + 370 + + + + + 16777215 + 370 + + + + + 0 + + + + + + 14 + + + + 软件截图 + + + + + + + 0 + + + true + + + + + 0 + 0 + 376 + 325 + + + + + + + + 0 + 0 + + + + + 400 + 300 + + + + TextLabel + + + + + + + + 0 + 0 + + + + + 400 + 300 + + + + TextLabel + + + + + + + + 0 + 0 + + + + + 400 + 300 + + + + TextLabel + + + + + + + + 0 + 0 + + + + + 400 + 300 + + + + TextLabel + + + + + + + + 0 + 0 + + + + + 400 + 300 + + + + TextLabel + + + + + + + + + + + + + + + + + + 14 + + + + 详细介绍 + + + + + + + <html><head/><body><p>详细介绍</p><p>由社区爱好者开发的软件商店</p><p>1212121</p><p>12121212</p><p>121212</p><p>121212</p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + + + + + + + @@ -567,6 +1003,52 @@ + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 主题美化 + + + + + + @@ -694,443 +1176,14 @@ - - - - + + + + - - 0 + + Qt::AlignCenter - - 2 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - https://bbs.deepin.org/ - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 14 - - - - background-color:#FFFFFF - - - 当前下载列表为空 - - - Qt::AlignCenter - - - - - - - 0 - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - c - - - true - - - - - 0 - -366 - 729 - 945 - - - - - - - - 16777215 - 300 - - - - - - - - 40 - 16777215 - - - - < - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 60 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 70 - 20 - - - - - - - - 安装 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Bitstream Charter - 22 - - - - 软件名 - - - - - - - - 128 - 128 - - - - - 128 - 128 - - - - border-radius:10px; - - - 图标 - - - - - - - <html><head/><body><p>版本号:</p><p>投递者:</p><p>开发者:</p><p>二次维护者:<br/></p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - - 0 - 370 - - - - - 16777215 - 370 - - - - - 0 - - - - - - 14 - - - - 软件截图 - - - - - - - 0 - - - true - - - - - 0 - 0 - 695 - 325 - - - - - - - - 200 - 0 - - - - - 400 - 300 - - - - TextLabel - - - - - - - - 0 - 0 - - - - - 400 - 300 - - - - TextLabel - - - - - - - - 0 - 0 - - - - - 400 - 300 - - - - TextLabel - - - - - - - - 0 - 0 - - - - - 400 - 300 - - - - TextLabel - - - - - - - - 0 - 0 - - - - - 400 - 300 - - - - TextLabel - - - - - - - - - - - - - - - - - - 14 - - - - 详细介绍 - - - - - - - <html><head/><body><p>详细介绍</p><p>由社区爱好者开发的软件商店</p><p>1212121</p><p>12121212</p><p>121212</p><p>121212</p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - - - - - -