chore: 支持从源列表文件动态获取镜像源

支持从源列表文件动态获取镜像源,获取失败时默认只使用 d.store.deepinos.org.cn 该地址;

修复之前版本中设置界面“更新源”按钮无效的问题。
This commit is contained in:
2021-06-30 14:14:06 +08:00
parent 961d174bf7
commit 51518e4e88
2 changed files with 42 additions and 3 deletions

View File

@@ -270,6 +270,14 @@ void Widget::initConfig()
{
ui->comboBox_server->model()->setData(ui->comboBox_server->model()->index(i, 0), QVariant(0), Qt::UserRole - 1);
}
if(ui->comboBox_server->itemText(i) == "镜像源 Download only")
{
for(int j = i; j < ui->comboBox_server->count(); j++)
{
ui->comboBox_server->model()->setData(ui->comboBox_server->model()->index(j, 0), QVariant(0), Qt::UserRole - 1);
}
break;
}
}
}
else
@@ -1012,7 +1020,7 @@ void Widget::on_comboBox_server_currentIndexChanged(const QString &arg1)
if(configCanSave)
{
ui->label_setting1->show();
// ui->label_setting1->show();
QSettings *setConfig = new QSettings(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
setConfig->setValue("server/choose", arg1);
}
@@ -1051,6 +1059,14 @@ void Widget::on_pushButton_updateServer_clicked()
{
ui->comboBox_server->model()->setData(ui->comboBox_server->model()->index(i, 0), QVariant(0), Qt::UserRole - 1);
}
if(ui->comboBox_server->itemText(i) == "镜像源 Download only")
{
for(int j = i; j < ui->comboBox_server->count(); j++)
{
ui->comboBox_server->model()->setData(ui->comboBox_server->model()->index(j, 0), QVariant(0), Qt::UserRole - 1);
}
break;
}
}
});
}
@@ -1101,7 +1117,7 @@ void Widget::on_pushButton_updateApt_clicked()
system(("chmod +x " + tmpPath + "/update.sh").c_str());
QProcess runupdate;
runupdate.start(QString::fromStdString("pkexec " + tmpPath + "/update.sh"), QStringList());
runupdate.start("pkexec", QStringList() << QString::fromStdString(tmpPath + "/update.sh"));
runupdate.waitForFinished();
QString error = runupdate.readAllStandardError();