mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
新增 深度安装器安装选项
This commit is contained in:
@@ -22,8 +22,10 @@ downloadlist::downloadlist(QWidget *parent) :
|
||||
ui->widget_spinner->hide();
|
||||
action_dpkg->setText("dpkg");
|
||||
action_gdebi->setText("gdebi");
|
||||
action_deepin->setText("深度安装器");
|
||||
connect(action_dpkg,&QAction::triggered,[=](){downloadlist::install(1);});
|
||||
connect(action_gdebi,&QAction::triggered,[=](){downloadlist::install(0);});
|
||||
connect(action_deepin,&QAction::triggered,[=](){downloadlist::install(2);});
|
||||
menu_install->addAction(action_gdebi);
|
||||
//ssinstall命令存在时再加入该选项
|
||||
QFile ssinstall("/bin/ssinstall");
|
||||
@@ -31,6 +33,11 @@ downloadlist::downloadlist(QWidget *parent) :
|
||||
if(ssinstall.isOpen()){
|
||||
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("正在安装,请稍候");
|
||||
QtConcurrent::run([=](){
|
||||
QProcess installer;
|
||||
if(reinstall){
|
||||
if(t==0){
|
||||
if(!reinstall){
|
||||
switch (t) {
|
||||
case 0:
|
||||
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());
|
||||
break;
|
||||
case 2:
|
||||
installer.start("deepin-deb-installer /tmp/spark-store/"+ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
}
|
||||
|
||||
}else {
|
||||
if(t==0){
|
||||
switch (t) {
|
||||
case 0:
|
||||
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());
|
||||
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();
|
||||
out=installer.readAllStandardOutput();
|
||||
QStringList everyOut=out.split("\n");
|
||||
bool haveError=false;
|
||||
bool notRoot=false;
|
||||
for (int i=0;i<everyOut.size();i++) {
|
||||
qDebug()<<everyOut[i].left(2);
|
||||
if(everyOut[i].left(2)=="E:"){
|
||||
haveError=true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user