mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-05 02:42:21 +08:00
新增 深度安装器安装选项
This commit is contained in:
parent
b82a821d01
commit
6e083f295b
@ -22,8 +22,10 @@ downloadlist::downloadlist(QWidget *parent) :
|
|||||||
ui->widget_spinner->hide();
|
ui->widget_spinner->hide();
|
||||||
action_dpkg->setText("dpkg");
|
action_dpkg->setText("dpkg");
|
||||||
action_gdebi->setText("gdebi");
|
action_gdebi->setText("gdebi");
|
||||||
|
action_deepin->setText("深度安装器");
|
||||||
connect(action_dpkg,&QAction::triggered,[=](){downloadlist::install(1);});
|
connect(action_dpkg,&QAction::triggered,[=](){downloadlist::install(1);});
|
||||||
connect(action_gdebi,&QAction::triggered,[=](){downloadlist::install(0);});
|
connect(action_gdebi,&QAction::triggered,[=](){downloadlist::install(0);});
|
||||||
|
connect(action_deepin,&QAction::triggered,[=](){downloadlist::install(2);});
|
||||||
menu_install->addAction(action_gdebi);
|
menu_install->addAction(action_gdebi);
|
||||||
//ssinstall命令存在时再加入该选项
|
//ssinstall命令存在时再加入该选项
|
||||||
QFile ssinstall("/bin/ssinstall");
|
QFile ssinstall("/bin/ssinstall");
|
||||||
@ -31,6 +33,11 @@ downloadlist::downloadlist(QWidget *parent) :
|
|||||||
if(ssinstall.isOpen()){
|
if(ssinstall.isOpen()){
|
||||||
menu_install->addAction(action_dpkg);
|
menu_install->addAction(action_dpkg);
|
||||||
}
|
}
|
||||||
|
QFile deepin("/bin/deepin-deb-installer");
|
||||||
|
deepin.open(QIODevice::ReadOnly);
|
||||||
|
if(deepin.isOpen()){
|
||||||
|
menu_install->addAction(action_deepin);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,28 +122,37 @@ void downloadlist::install(int t)
|
|||||||
ui->label_2->setText("正在安装,请稍候");
|
ui->label_2->setText("正在安装,请稍候");
|
||||||
QtConcurrent::run([=](){
|
QtConcurrent::run([=](){
|
||||||
QProcess installer;
|
QProcess installer;
|
||||||
if(reinstall){
|
if(!reinstall){
|
||||||
if(t==0){
|
switch (t) {
|
||||||
|
case 0:
|
||||||
installer.start("pkexec gdebi -n /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
installer.start("pkexec gdebi -n /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
||||||
}else {
|
break;
|
||||||
|
case 1:
|
||||||
installer.start("pkexec ssinstall /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
installer.start("pkexec ssinstall /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
installer.start("deepin-deb-installer /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
if(t==0){
|
switch (t) {
|
||||||
|
case 0:
|
||||||
installer.start("pkexec gdebi -n /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
installer.start("pkexec gdebi -n /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
||||||
}else {
|
break;
|
||||||
|
case 1:
|
||||||
installer.start("pkexec ssinstall /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
installer.start("pkexec ssinstall /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
installer.start("deepin-deb-installer /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool haveError=false;
|
||||||
|
bool notRoot=false;
|
||||||
installer.waitForFinished();
|
installer.waitForFinished();
|
||||||
out=installer.readAllStandardOutput();
|
out=installer.readAllStandardOutput();
|
||||||
QStringList everyOut=out.split("\n");
|
QStringList everyOut=out.split("\n");
|
||||||
bool haveError=false;
|
|
||||||
bool notRoot=false;
|
|
||||||
for (int i=0;i<everyOut.size();i++) {
|
for (int i=0;i<everyOut.size();i++) {
|
||||||
qDebug()<<everyOut[i].left(2);
|
|
||||||
if(everyOut[i].left(2)=="E:"){
|
if(everyOut[i].left(2)=="E:"){
|
||||||
haveError=true;
|
haveError=true;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
QMenu *menu_install=new QMenu;
|
QMenu *menu_install=new QMenu;
|
||||||
QAction *action_gdebi=new QAction;
|
QAction *action_gdebi=new QAction;
|
||||||
QAction *action_dpkg=new QAction;
|
QAction *action_dpkg=new QAction;
|
||||||
|
QAction *action_deepin=new QAction;
|
||||||
void install(int);
|
void install(int);
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_install_clicked();
|
void on_pushButton_install_clicked();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.8.2, 2020-08-28T14:38:38. -->
|
<!-- Written by QtCreator 4.8.2, 2020-08-28T15:02:50. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user