From 1cbabe7cc57b4a7f32f8f4771d95d3016144d421 Mon Sep 17 00:00:00 2001 From: RigoLigoRLC Date: Sat, 3 Oct 2020 01:30:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BF=BB=E8=AF=91=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- widget.cpp | 27 +++++++++++-- widget.h | 13 ++---- widget.ui | 116 +++++++++++++++++++++++++++++------------------------ 3 files changed, 90 insertions(+), 66 deletions(-) diff --git a/widget.cpp b/widget.cpp index 08a8ab9..24119b2 100644 --- a/widget.cpp +++ b/widget.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -161,7 +162,6 @@ void Widget::initUI() [=](){QDesktopServices::openUrl(QUrl("https://upload.spark-app.store/"));}); connect(setting,&QAction::triggered,this,&Widget::opensetting); - // 初始化菜单数组 left_list[0]=ui->menu_main; left_list[1]=ui->menu_network; @@ -462,9 +462,11 @@ int Widget::loadappinfo(QUrl arg1) // 重置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(); - ui->pushButton_website->hide(); QProcess get_json; QDir dir("/tmp"); @@ -561,6 +563,9 @@ int Widget::loadappinfo(QUrl arg1) 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.")); @@ -575,9 +580,11 @@ int Widget::loadappinfo(QUrl arg1) label_screen[4]=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); get_json.waitForFinished(); - if(screen[i].load("screen_"+QString::number(i+1)+".png")){ + bool s = screen[i].load("screen_"+QString::number(i+1)+".png"); + if(s){ label_screen[i]->setImage(screen[i]); label_screen[i]->show(); switch(i){ // 故意为之,为了清除多余截图 @@ -978,7 +985,6 @@ void Widget::on_webEngineView_urlChanged(const QUrl &arg1) qDebug()<<"https://demo-one-vert.vercel.app/"+type_name+"/"+pname; load.cancel();//打开并发加载线程前关闭正在执行的线程 load = QtConcurrent::run([=](){ - int loadresult = loadappinfo(arg1); }); } @@ -1010,3 +1016,16 @@ void Widget::on_webEngineView_loadFinished(bool arg1) } } + +void Widget::on_pushButton_translate_clicked() +{ + if(QMessageBox::information(nullptr, tr("Information for Contributors"), + tr("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 " + "translations.\n\nClick yes to continue."), + QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No) + == QMessageBox::Yes) + QDesktopServices::openUrl("https://gitee.com/deepin-community-store/json/tree/master/store/" + + type_name + '/' + pkgName); +} diff --git a/widget.h b/widget.h index 45b21b6..6d100a3 100644 --- a/widget.h +++ b/widget.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -63,24 +64,17 @@ private slots: void on_pushButton_uninstall_clicked(); void on_pushButton_clear_clicked(); void on_pushButton_website_clicked(); - void on_pushButton_clicked(); - void on_btn_openDir_clicked(); - void on_stackedWidget_currentChanged(int arg1); - void on_webEngineView_urlChanged(const QUrl &arg1); - void on_webEngineView_loadStarted(); - void on_webEngineView_loadProgress(int progress); - void on_webEngineView_loadFinished(bool arg1); - void on_pushButton_refresh_clicked(); + void on_pushButton_translate_clicked(); - public: +public: QUrl url; @@ -123,6 +117,7 @@ private: long size2=0; QPixmap screen[5]; QFuture load; + QFutureWatcher watchScreenshotLoad; QTimer download_speed; QString type_name; QColor main_color; diff --git a/widget.ui b/widget.ui index d0cc4d5..9be90f5 100644 --- a/widget.ui +++ b/widget.ui @@ -216,12 +216,15 @@ Home + + false + - Graphic + Graphics @@ -453,9 +456,9 @@ 0 - 0 - 903 - 849 + -90 + 889 + 854 @@ -474,6 +477,45 @@ true + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 70 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 60 + 20 + + + + + + + + Install + + + @@ -487,7 +529,7 @@ - + @@ -533,7 +575,7 @@ - + Qt::Horizontal @@ -546,45 +588,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 60 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 70 - 20 - - - - - - - - Install - - - @@ -669,7 +672,14 @@ - + + + + Share + + + + @@ -852,10 +862,10 @@ - - + + - Share + Contribute translation @@ -936,8 +946,8 @@ 0 0 - 869 - 325 + 851 + 323 @@ -1066,8 +1076,8 @@ 0 0 - 738 - 896 + 743 + 902