mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-23 11:32:21 +08:00
beta3更新
This commit is contained in:
parent
58304f2c19
commit
68269577c0
@ -3,21 +3,15 @@
|
|||||||
#### 介绍
|
#### 介绍
|
||||||
deepin社区商店,由社区维护
|
deepin社区商店,由社区维护
|
||||||
web页面部分正在开发当中,详情请见[web仓库](https://gitee.com/deepin-community-store/DCSAPP_WEB)
|
web页面部分正在开发当中,详情请见[web仓库](https://gitee.com/deepin-community-store/DCSAPP_WEB)
|
||||||
#### 编译指导
|
|
||||||
依赖:dtk2版(适用于ubuntu/15.11):qt5-default g++ libdtkcore2-dev libdtkwidget2-dev libqt5webkit5-dev libdtkgui2-dev
|
|
||||||
dtk5版(适用于20beta):qt5-default g++ libdtkwidget5-dev libdtkcore5-dev libdtkgui5-dev libqt5webkit5-dev
|
|
||||||
|
|
||||||
#### 说明
|
#### 说明
|
||||||
|
|
||||||
需要在运行目录下放置服务器线路列表`server.list`,每行一个,在末尾需要添加“/”
|
|
||||||
|
|
||||||
当前服务器线路列表(项目中包含):
|
当前服务器线路列表(项目中包含):
|
||||||
|
|
||||||
```
|
```
|
||||||
http://dcstore.shenmo.tech/
|
http://dcstore.shenmo.tech/
|
||||||
http://store.shenmo.tech/
|
http://store.shenmo.tech/
|
||||||
http://store2.shenmo.tech/
|
http://store2.shenmo.tech/
|
||||||
http://store.moshengren.xyz/
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 目录结构
|
#### 目录结构
|
||||||
@ -26,7 +20,7 @@ http://store.moshengren.xyz/
|
|||||||
|
|
||||||
配置文件被储存到`~/.config/deepin-community-store/`中。
|
配置文件被储存到`~/.config/deepin-community-store/`中。
|
||||||
|
|
||||||
线路文件:当前运行目录下的`./server.list`
|
线路文件:新版的线路文件被放置于源服务器中,可随时刷新更新源列表
|
||||||
|
|
||||||
#### 参与贡献
|
#### 参与贡献
|
||||||
|
|
||||||
|
@ -26,11 +26,13 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
SOURCES += main.cpp\
|
SOURCES += main.cpp\
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
widget.cpp \
|
widget.cpp \
|
||||||
downloadlist.cpp
|
downloadlist.cpp \
|
||||||
|
outputwindow.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
widget.h \
|
widget.h \
|
||||||
downloadlist.h
|
downloadlist.h \
|
||||||
|
outputwindow.h
|
||||||
|
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
PKGCONFIG += dtkwidget
|
PKGCONFIG += dtkwidget
|
||||||
@ -39,4 +41,5 @@ CONFIG += c++11
|
|||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
widget.ui \
|
widget.ui \
|
||||||
downloadlist.ui
|
downloadlist.ui \
|
||||||
|
outputwindow.ui
|
||||||
|
@ -16,6 +16,7 @@ downloadlist::downloadlist(QWidget *parent) :
|
|||||||
ui->progressBar->setValue(0);
|
ui->progressBar->setValue(0);
|
||||||
ui->label_filename->hide();
|
ui->label_filename->hide();
|
||||||
ui->pushButton->hide();
|
ui->pushButton->hide();
|
||||||
|
ui->pushButton_3->hide();
|
||||||
ui->label->setStyleSheet("color:#000000");
|
ui->label->setStyleSheet("color:#000000");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,9 +99,15 @@ void downloadlist::on_pushButton_clicked()
|
|||||||
ui->label_2->setText("正在安装,请稍候");
|
ui->label_2->setText("正在安装,请稍候");
|
||||||
QtConcurrent::run([=](){
|
QtConcurrent::run([=](){
|
||||||
QProcess installer;
|
QProcess installer;
|
||||||
|
if(reinstall){
|
||||||
|
installer.start("pkexec apt reinstall -y /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8());
|
||||||
|
}else {
|
||||||
installer.start("pkexec apt install -y /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8());
|
installer.start("pkexec apt install -y /tmp/deepin-community-store/"+ui->label_filename->text().toUtf8());
|
||||||
|
}
|
||||||
|
|
||||||
installer.waitForFinished();
|
installer.waitForFinished();
|
||||||
QString error=QString::fromStdString(installer.readAllStandardError().toStdString());
|
QString error=QString::fromStdString(installer.readAllStandardError().toStdString());
|
||||||
|
out=installer.readAllStandardOutput();
|
||||||
QStringList everyError=error.split("\n");
|
QStringList everyError=error.split("\n");
|
||||||
bool haveError=false;
|
bool haveError=false;
|
||||||
bool notRoot=false;
|
bool notRoot=false;
|
||||||
@ -116,15 +123,18 @@ void downloadlist::on_pushButton_clicked()
|
|||||||
if(!haveError && !notRoot){
|
if(!haveError && !notRoot){
|
||||||
ui->pushButton->hide();
|
ui->pushButton->hide();
|
||||||
ui->label_2->setText("安装完成");
|
ui->label_2->setText("安装完成");
|
||||||
|
ui->pushButton_3->show();
|
||||||
}else if(haveError){
|
}else if(haveError){
|
||||||
ui->pushButton->hide();
|
ui->pushButton->hide();
|
||||||
ui->label_2->setText("安装出现错误");
|
ui->label_2->setText("安装出现错误");
|
||||||
|
ui->pushButton_3->show();
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
ui->label_2->setText("安装被终止");
|
ui->label_2->setText("安装被终止");
|
||||||
|
ui->pushButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
isInstall=false;
|
isInstall=false;
|
||||||
});
|
});
|
||||||
// system("x-terminal-emulator -e sudo apt install -y ./"+ui->label_filename->text().toUtf8());
|
|
||||||
qDebug()<<ui->label_filename->text().toUtf8();
|
qDebug()<<ui->label_filename->text().toUtf8();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,3 +147,9 @@ void downloadlist::on_pushButton_2_clicked()
|
|||||||
ui->progressBar->hide();
|
ui->progressBar->hide();
|
||||||
close=true;
|
close=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void downloadlist::on_pushButton_3_clicked()
|
||||||
|
{
|
||||||
|
output_w.setoutput(out);
|
||||||
|
output_w.show();
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define DOWNLOADLIST_H
|
#define DOWNLOADLIST_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <outputwindow.h>
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class downloadlist;
|
class downloadlist;
|
||||||
}
|
}
|
||||||
@ -26,18 +27,23 @@ public:
|
|||||||
void setSpeed(QString);
|
void setSpeed(QString);
|
||||||
int num;
|
int num;
|
||||||
bool close=false;
|
bool close=false;
|
||||||
|
QString out;
|
||||||
|
outputwindow output_w;
|
||||||
|
bool reinstall=false;
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_clicked();
|
void on_pushButton_clicked();
|
||||||
|
|
||||||
void on_pushButton_2_clicked();
|
void on_pushButton_2_clicked();
|
||||||
|
|
||||||
|
|
||||||
|
void on_pushButton_3_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::downloadlist *ui;
|
Ui::downloadlist *ui;
|
||||||
static bool isInstall;
|
static bool isInstall;
|
||||||
QString speed;
|
QString speed;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
//bool downloadlist::isInstall=false;
|
//bool downloadlist::isInstall=false;
|
||||||
#endif // DOWNLOADLIST_H
|
#endif // DOWNLOADLIST_H
|
||||||
|
151
downloadlist.ui
151
downloadlist.ui
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>744</width>
|
<width>786</width>
|
||||||
<height>54</height>
|
<height>54</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -16,15 +16,77 @@
|
|||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>icon</string>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QLabel" name="label_filename">
|
<widget class="QLabel" name="label_filename">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>TextLabel</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4">
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>13</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>名称</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -97,7 +159,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="6">
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -113,23 +175,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="7">
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pushButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -148,47 +194,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>150</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>13</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>名称</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>icon</string>
|
|
||||||
</property>
|
|
||||||
<property name="scaledContents">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="8">
|
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -207,6 +213,25 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>详情</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
2
main.cpp
2
main.cpp
@ -11,7 +11,7 @@ int main(int argc, char *argv[])
|
|||||||
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
a.loadTranslator();
|
a.loadTranslator();
|
||||||
a.setOrganizationName("deepin");
|
a.setOrganizationName("deepin");
|
||||||
a.setApplicationVersion(DApplication::buildVersion("1.0-beta"));
|
a.setApplicationVersion(DApplication::buildVersion("1.0-beta3"));
|
||||||
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/deepin-community-store");
|
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/deepin-community-store");
|
||||||
a.setProductIcon(QIcon::fromTheme("deepin-community-store")); //设置Logo
|
a.setProductIcon(QIcon::fromTheme("deepin-community-store")); //设置Logo
|
||||||
a.setProductName("深度社区应用商店");
|
a.setProductName("深度社区应用商店");
|
||||||
|
@ -10,7 +10,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
w = new Widget;
|
w = new Widget;
|
||||||
|
|
||||||
resize(w->size()); //设置窗口大小
|
resize(w->size()); //设置窗口大小
|
||||||
setMinimumSize(900,700);
|
setMinimumSize(950,700);
|
||||||
setCentralWidget(w);
|
setCentralWidget(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class MainWindow : public DMainWindow
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
24
outputwindow.cpp
Normal file
24
outputwindow.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "outputwindow.h"
|
||||||
|
#include "ui_outputwindow.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
outputwindow::outputwindow(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::outputwindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowTitle("安装详情");
|
||||||
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
|
move((desktop->width() - width())/ 2, (desktop->height() - height()) /2);
|
||||||
|
}
|
||||||
|
|
||||||
|
outputwindow::~outputwindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void outputwindow::setoutput(QString output)
|
||||||
|
{
|
||||||
|
qDebug()<<output;
|
||||||
|
ui->textBrowser->setText(output);
|
||||||
|
}
|
22
outputwindow.h
Normal file
22
outputwindow.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef OUTPUTWINDOW_H
|
||||||
|
#define OUTPUTWINDOW_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class outputwindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class outputwindow : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit outputwindow(QWidget *parent = nullptr);
|
||||||
|
~outputwindow();
|
||||||
|
void setoutput(QString);
|
||||||
|
private:
|
||||||
|
Ui::outputwindow *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OUTPUTWINDOW_H
|
24
outputwindow.ui
Normal file
24
outputwindow.ui
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>outputwindow</class>
|
||||||
|
<widget class="QWidget" name="outputwindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>391</width>
|
||||||
|
<height>372</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTextBrowser" name="textBrowser"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
84
widget.cpp
84
widget.cpp
@ -47,8 +47,11 @@ Widget::Widget(QWidget *parent) :
|
|||||||
left_list[12]=ui->menu_btn_theme;left_menu_bg[12]=ui->menu_bg_theme;
|
left_list[12]=ui->menu_btn_theme;left_menu_bg[12]=ui->menu_bg_theme;
|
||||||
left_list[13]=ui->menu_btn_download;left_menu_bg[13]=ui->menu_bg_download;
|
left_list[13]=ui->menu_btn_download;left_menu_bg[13]=ui->menu_bg_download;
|
||||||
left_list[14]=ui->menu_btn_settings;left_menu_bg[14]=ui->menu_bg_settings;
|
left_list[14]=ui->menu_btn_settings;left_menu_bg[14]=ui->menu_bg_settings;
|
||||||
server.open(QApplication::applicationDirPath().toUtf8()+"/server.list",std::ios::in);
|
server.open(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list",std::ios::in);
|
||||||
|
// system("mkdir /etc/deepin-community-store/");
|
||||||
|
// server.open("/etc/deepin-community-store/server.list",std::ios::in);
|
||||||
std::string lineTmp;
|
std::string lineTmp;
|
||||||
|
|
||||||
if(server){
|
if(server){
|
||||||
while (getline(server,lineTmp)) {
|
while (getline(server,lineTmp)) {
|
||||||
ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
|
ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
|
||||||
@ -100,7 +103,6 @@ Widget::Widget(QWidget *parent) :
|
|||||||
QString theSpeed;
|
QString theSpeed;
|
||||||
double bspeed;
|
double bspeed;
|
||||||
bspeed=size1-size2;
|
bspeed=size1-size2;
|
||||||
qDebug()<<"run to hear"<<bspeed;
|
|
||||||
if(bspeed<1024){
|
if(bspeed<1024){
|
||||||
theSpeed=QString::number(bspeed)+"B";
|
theSpeed=QString::number(bspeed)+"B";
|
||||||
}else if (bspeed<(1024*1024)) {
|
}else if (bspeed<(1024*1024)) {
|
||||||
@ -114,6 +116,9 @@ Widget::Widget(QWidget *parent) :
|
|||||||
size2=download_size;
|
size2=download_size;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
chooseLeftMenu(0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
@ -125,17 +130,9 @@ void Widget::on_webView_loadStarted()
|
|||||||
|
|
||||||
|
|
||||||
QUrl arg1=ui->webView->page()->mainFrame()->requestedUrl().toString();
|
QUrl arg1=ui->webView->page()->mainFrame()->requestedUrl().toString();
|
||||||
qDebug()<<arg1;
|
|
||||||
//判断,如果末尾是/就直接访问,如果是app.json就打开详情页
|
//判断,如果末尾是/就直接访问,如果是app.json就打开详情页
|
||||||
if(arg1.path().right(8)=="app.json"){
|
if(arg1.path().right(8)=="app.json"){
|
||||||
load.cancel();//打开并发加载线程前关闭正在执行的线程
|
load.cancel();//打开并发加载线程前关闭正在执行的线程
|
||||||
// load.waitForFinished();
|
|
||||||
// system("rm -r /tmp/deepin-community-store/icon.png");
|
|
||||||
// system("rm -r /tmp/deepin-community-store/screen_1.png");
|
|
||||||
// system("rm -r /tmp/deepin-community-store/screen_2.png");
|
|
||||||
// system("rm -r /tmp/deepin-community-store/screen_3.png");
|
|
||||||
// system("rm -r /tmp/deepin-community-store/screen_4.png");
|
|
||||||
// system("rm -r /tmp/deepin-community-store/screen_5.png");
|
|
||||||
QPixmap pixmap_null;//一个空的图片指针,用来清空先有内容
|
QPixmap pixmap_null;//一个空的图片指针,用来清空先有内容
|
||||||
ui->label_appicon->setPixmap(pixmap_null);
|
ui->label_appicon->setPixmap(pixmap_null);
|
||||||
ui->screen_1->setPixmap(pixmap_null);
|
ui->screen_1->setPixmap(pixmap_null);
|
||||||
@ -174,16 +171,15 @@ void Widget::loadappinfo(QUrl arg1)
|
|||||||
get_json.waitForFinished();
|
get_json.waitForFinished();
|
||||||
QFile app_json("app.json");
|
QFile app_json("app.json");
|
||||||
if(app_json.open(QIODevice::ReadOnly)){
|
if(app_json.open(QIODevice::ReadOnly)){
|
||||||
// //成功得到json文件
|
// //成功得到json文件
|
||||||
//将路径转化为相应源的下载路径
|
|
||||||
QByteArray json_array=app_json.readAll();
|
QByteArray json_array=app_json.readAll();
|
||||||
|
//将路径转化为相应源的下载路径
|
||||||
urladdress=arg1.toString().left(arg1.toString().length()-8);
|
urladdress=arg1.toString().left(arg1.toString().length()-8);
|
||||||
QStringList downloadurl=urladdress.split("/");
|
QStringList downloadurl=urladdress.split("/");
|
||||||
urladdress=ui->comboBox_server->currentText();
|
urladdress=ui->comboBox_server->currentText();
|
||||||
for (int i=3;i<downloadurl.size();i++) {
|
for (int i=3;i<downloadurl.size();i++) {
|
||||||
urladdress+="/"+downloadurl[i];
|
urladdress+="/"+downloadurl[i];
|
||||||
}
|
}
|
||||||
qDebug()<<urladdress;
|
|
||||||
//路径转化完成
|
//路径转化完成
|
||||||
QJsonObject json= QJsonDocument::fromJson(json_array).object();
|
QJsonObject json= QJsonDocument::fromJson(json_array).object();
|
||||||
appName = json["Name"].toString();
|
appName = json["Name"].toString();
|
||||||
@ -213,6 +209,7 @@ void Widget::loadappinfo(QUrl arg1)
|
|||||||
int error=QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
|
int error=QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
|
||||||
if(error==0){
|
if(error==0){
|
||||||
ui->pushButton->setText("重新安装");
|
ui->pushButton->setText("重新安装");
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
ui->pushButton->setText("安装");
|
ui->pushButton->setText("安装");
|
||||||
}
|
}
|
||||||
@ -282,13 +279,12 @@ void Widget::chooseLeftMenu(int index)
|
|||||||
|
|
||||||
nowMenu=index;
|
nowMenu=index;
|
||||||
for (int i=0;i<15;i++) {
|
for (int i=0;i<15;i++) {
|
||||||
load.cancel();//打开并发加载线程前关闭正在执行的线程
|
left_list[i]->setStyleSheet("");
|
||||||
left_list[i]->setStyleSheet("color:#414D68");
|
left_list[i]->setFont(QFont("",11));
|
||||||
left_menu_bg[i]->setStyleSheet("border-radius:8");
|
left_menu_bg[i]->setStyleSheet("");
|
||||||
}
|
}
|
||||||
left_list[index]->setStyleSheet("color:#FFFFFF");
|
left_list[index]->setStyleSheet("color:#FFFFFF");
|
||||||
left_menu_bg[index]->setStyleSheet("background-color:#0081FF;border-radius:8");
|
left_menu_bg[index]->setStyleSheet("background-color:#0081FF;border-radius:8");
|
||||||
|
|
||||||
if(index<=12){
|
if(index<=12){
|
||||||
ui->webView->setUrl(menuUrl[index]);
|
ui->webView->setUrl(menuUrl[index]);
|
||||||
ui->stackedWidget->setCurrentIndex(0);
|
ui->stackedWidget->setCurrentIndex(0);
|
||||||
@ -331,6 +327,9 @@ void Widget::on_pushButton_clicked()
|
|||||||
nowDownload+=1;
|
nowDownload+=1;
|
||||||
startRequest(urList.at(nowDownload-1)); //进行链接请求
|
startRequest(urList.at(nowDownload-1)); //进行链接请求
|
||||||
}
|
}
|
||||||
|
if(ui->pushButton->text()=="重新安装"){
|
||||||
|
download_list[allDownload-1].reinstall=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::startRequest(QUrl url)
|
void Widget::startRequest(QUrl url)
|
||||||
@ -365,24 +364,22 @@ void Widget::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
|
|||||||
httpFinished();
|
httpFinished();
|
||||||
|
|
||||||
}
|
}
|
||||||
// download_list[nowDownload-1].setMax(bytesRead/10);
|
|
||||||
// download_list[nowDownload-1].setValue(totalBytes/10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::httpFinished() //完成下载
|
void Widget::httpFinished() //完成下载
|
||||||
{
|
{
|
||||||
|
|
||||||
file->flush();
|
file->flush();
|
||||||
file->close();
|
file->close();
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
delete file;
|
delete file;
|
||||||
file = nullptr;
|
file = nullptr;
|
||||||
isdownload=false;
|
isdownload=false;
|
||||||
isBusy=false;
|
isBusy=false;
|
||||||
download_list[nowDownload-1].readyInstall();
|
download_list[nowDownload-1].readyInstall();
|
||||||
download_list[nowDownload-1].free=true;
|
download_list[nowDownload-1].free=true;
|
||||||
if(nowDownload<allDownload){
|
if(nowDownload<allDownload){
|
||||||
nowDownload+=1;
|
nowDownload+=1;
|
||||||
while (download_list[nowDownload-1].close) {
|
while (download_list[nowDownload-1].close) {
|
||||||
nowDownload+=1;
|
nowDownload+=1;
|
||||||
@ -391,13 +388,12 @@ if(nowDownload<allDownload){
|
|||||||
file = new QFile(fileName);
|
file = new QFile(fileName);
|
||||||
if(!file->open(QIODevice::WriteOnly))
|
if(!file->open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
qDebug()<<"file open error";
|
|
||||||
delete file;
|
delete file;
|
||||||
file = nullptr;
|
file = nullptr;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
startRequest(urList.at(nowDownload-1));
|
startRequest(urList.at(nowDownload-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Widget::on_listWidget_currentRowChanged(int currentRow)
|
void Widget::on_listWidget_currentRowChanged(int currentRow)
|
||||||
{
|
{
|
||||||
@ -430,7 +426,7 @@ void Widget::on_menu_btn_video_clicked()//视频播放
|
|||||||
}
|
}
|
||||||
void Widget::on_menu_btn_photo_clicked()//图形图像
|
void Widget::on_menu_btn_photo_clicked()//图形图像
|
||||||
{
|
{
|
||||||
chooseLeftMenu(5);
|
chooseLeftMenu(5);
|
||||||
}
|
}
|
||||||
void Widget::on_menu_btn_game_clicked()//游戏娱乐
|
void Widget::on_menu_btn_game_clicked()//游戏娱乐
|
||||||
{
|
{
|
||||||
@ -498,3 +494,25 @@ void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Widget::on_pushButton_3_clicked()
|
||||||
|
{
|
||||||
|
QtConcurrent::run([=](){
|
||||||
|
ui->pushButton_3->setEnabled(false);
|
||||||
|
ui->comboBox_server->clear();
|
||||||
|
system(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list");
|
||||||
|
system("wget -P "+QDir::homePath().toUtf8()+"/.config/deepin-community-store http://store2.shenmo.tech/store/server.list");
|
||||||
|
std::fstream server;
|
||||||
|
server.open(QDir::homePath().toUtf8()+"/.config/deepin-community-store/server.list",std::ios::in);
|
||||||
|
std::string lineTmp;
|
||||||
|
if(server){
|
||||||
|
while (getline(server,lineTmp)) {
|
||||||
|
ui->comboBox_server->addItem(QString::fromStdString(lineTmp));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
ui->comboBox_server->addItem("http://dcstore.shenmo.tech/");
|
||||||
|
}
|
||||||
|
ui->pushButton_3->setEnabled(true);
|
||||||
|
ui->comboBox_server->setCurrentIndex(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
2
widget.h
2
widget.h
@ -83,6 +83,8 @@ private slots:
|
|||||||
|
|
||||||
void on_comboBox_server_currentIndexChanged(const QString &arg1);
|
void on_comboBox_server_currentIndexChanged(const QString &arg1);
|
||||||
|
|
||||||
|
void on_pushButton_3_clicked();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QUrl url;
|
QUrl url;
|
||||||
bool isBusy=false;
|
bool isBusy=false;
|
||||||
|
17
widget.ui
17
widget.ui
@ -38,7 +38,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
@ -123,7 +123,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">c</string>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="lineWidth">
|
<property name="lineWidth">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -135,7 +135,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-177</y>
|
<y>0</y>
|
||||||
<width>781</width>
|
<width>781</width>
|
||||||
<height>815</height>
|
<height>815</height>
|
||||||
</rect>
|
</rect>
|
||||||
@ -560,6 +560,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>刷新</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_setting1">
|
<widget class="QLabel" name="label_setting1">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -687,10 +694,10 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">color:#FFFFFF</string>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>首页精选</string>
|
<string>商店首页</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user