mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
“跟紧上游”
This commit is contained in:
196
widget.cpp
196
widget.cpp
@@ -5,8 +5,6 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QListWidgetItem>
|
||||
#include "urls.h"
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
@@ -15,6 +13,7 @@
|
||||
#include <QJsonObject>
|
||||
#include <QByteArray>
|
||||
#include <QPixmap>
|
||||
#include <QtConcurrent> //并发
|
||||
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()<<appName;
|
||||
ui->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()<<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());
|
||||
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user