mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-23 11:32:21 +08:00
添加重新安装按钮
This commit is contained in:
parent
2d3366990a
commit
60ed4c5aff
@ -92,47 +92,49 @@ void AppIntoPage::openUrl(QUrl url)
|
|||||||
bool isInstalled;
|
bool isInstalled;
|
||||||
bool isUpdated;
|
bool isUpdated;
|
||||||
QString packagename = info["Pkgname"].toString();
|
QString packagename = info["Pkgname"].toString();
|
||||||
isInstall.start("dpkg -s " + info["Pkgname"].toString()); //todo
|
isInstall.start("dpkg -s " + info["Pkgname"].toString());
|
||||||
isInstall.waitForStarted();
|
qDebug()<<info["Pkgname"].toString();
|
||||||
isInstall.waitForFinished(-1);
|
isInstall.waitForFinished(180); // 默认超时 3 分钟
|
||||||
int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
|
int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length();
|
||||||
if(error == 0)
|
if(error == 0)
|
||||||
{
|
{
|
||||||
isInstalled = true;
|
isInstalled = true;
|
||||||
|
|
||||||
QProcess isUpdate;
|
QProcess isUpdate;
|
||||||
isUpdate.start("dpkg-query --showformat='${Version}' --show " + info["Pkgname"].toString());
|
isUpdate.start("dpkg-query --showformat='${Version}' --show " + info["Pkgname"].toString());
|
||||||
isUpdate.waitForFinished(10);
|
isUpdate.waitForFinished(180); // 默认超时 3 分钟
|
||||||
QString localVersion = isUpdate.readAllStandardOutput();
|
QString localVersion = isUpdate.readAllStandardOutput();
|
||||||
localVersion.replace("'", "");
|
localVersion.replace("'", "");
|
||||||
|
|
||||||
isUpdate.start("dpkg --compare-versions " + localVersion + " ge " + info["Version"].toString());
|
isUpdate.start("dpkg --compare-versions " + localVersion + " ge " + info["Version"].toString());
|
||||||
isUpdate.waitForFinished(10);
|
isUpdate.waitForFinished(180); // 默认超时 3 分钟
|
||||||
if(!isUpdate.exitCode())
|
if(!isUpdate.exitCode())
|
||||||
{
|
{
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isUpdated = false;
|
isUpdated = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isInstalled = false;
|
isInstalled = false;
|
||||||
isUpdated = false;
|
isUpdated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isInstalled)
|
if(isInstalled)
|
||||||
{
|
{
|
||||||
if(isUpdated)
|
if(isUpdated)
|
||||||
{
|
{
|
||||||
ui->downloadButton->setText(tr("Reinstall"));
|
ui->downloadButton->setText(tr("Reinstall"));
|
||||||
|
ui->downloadButton->show();
|
||||||
ui->pushButton_3->show();
|
ui->pushButton_3->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->downloadButton->setText(tr("Upgrade"));
|
ui->downloadButton->setText(tr("Upgrade"));
|
||||||
|
ui->downloadButton->show();
|
||||||
ui->pushButton_3->show();
|
ui->pushButton_3->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user