mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-02 17:32:25 +08:00
详情页面添加翻译按钮
This commit is contained in:
parent
d027d513a3
commit
1cbabe7cc5
27
widget.cpp
27
widget.cpp
@ -18,6 +18,7 @@
|
||||
#include <QIcon>
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <DSettings>
|
||||
#include <DSettingsOption>
|
||||
#include <DSettingsDialog>
|
||||
@ -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);
|
||||
}
|
||||
|
13
widget.h
13
widget.h
@ -10,6 +10,7 @@
|
||||
#include <QJsonObject>
|
||||
#include <QProcess>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
#include <QToolButton>
|
||||
#include <QTimer>
|
||||
#include <DSettings>
|
||||
@ -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<void> load;
|
||||
QFutureWatcher<void> watchScreenshotLoad;
|
||||
QTimer download_speed;
|
||||
QString type_name;
|
||||
QColor main_color;
|
||||
|
116
widget.ui
116
widget.ui
@ -216,12 +216,15 @@
|
||||
<property name="text">
|
||||
<string>Home </string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="6">
|
||||
<widget class="QPushButton" name="menu_photo">
|
||||
<property name="text">
|
||||
<string>Graphic</string>
|
||||
<string>Graphics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -453,9 +456,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>903</width>
|
||||
<height>849</height>
|
||||
<y>-90</y>
|
||||
<width>889</width>
|
||||
<height>854</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
@ -474,6 +477,45 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Maximum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Maximum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="pushButton_download">
|
||||
<property name="text">
|
||||
<string>Install</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" colspan="2">
|
||||
<widget class="QLabel" name="label_appname">
|
||||
<property name="font">
|
||||
@ -487,7 +529,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3" rowspan="5" colspan="7">
|
||||
<item row="3" column="3" rowspan="5" colspan="8">
|
||||
<widget class="QLabel" name="label_info">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -533,7 +575,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<item row="0" column="10">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -546,45 +588,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Maximum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Maximum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="pushButton_download">
|
||||
<property name="text">
|
||||
<string>Install</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" rowspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -669,7 +672,14 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3" colspan="7">
|
||||
<item row="0" column="8">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Share</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" colspan="8">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -852,10 +862,10 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<item row="0" column="9">
|
||||
<widget class="QPushButton" name="pushButton_translate">
|
||||
<property name="text">
|
||||
<string>Share</string>
|
||||
<string>Contribute translation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -936,8 +946,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>869</width>
|
||||
<height>325</height>
|
||||
<width>851</width>
|
||||
<height>323</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
@ -1066,8 +1076,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>738</width>
|
||||
<height>896</height>
|
||||
<width>743</width>
|
||||
<height>902</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
|
Loading…
x
Reference in New Issue
Block a user