mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-23 19:42:21 +08:00
sync from dev
This commit is contained in:
parent
3134b8db41
commit
e407b385d0
@ -55,7 +55,7 @@ void AppIntoPage::openUrl(const QUrl &url)
|
|||||||
ui->label_2->setText(info["More"].toString());
|
ui->label_2->setText(info["More"].toString());
|
||||||
|
|
||||||
// 显示 tags
|
// 显示 tags
|
||||||
#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 15, 0, 0))
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
QStringList taglist = info["Tags"].toString().split(";", Qt::SkipEmptyParts);
|
QStringList taglist = info["Tags"].toString().split(";", Qt::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
QStringList taglist = info["Tags"].toString().split(";", QString::SkipEmptyParts);
|
QStringList taglist = info["Tags"].toString().split(";", QString::SkipEmptyParts);
|
||||||
@ -154,7 +154,7 @@ void AppIntoPage::openUrl(const QUrl &url)
|
|||||||
|
|
||||||
isUpdate.start("dpkg", QStringList() << "--compare-versions" << localVersion << "ge" << info["Version"].toString());
|
isUpdate.start("dpkg", QStringList() << "--compare-versions" << localVersion << "ge" << info["Version"].toString());
|
||||||
isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟
|
isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟
|
||||||
if (!isUpdate.exitCode())
|
if (isUpdate.exitCode() == 0 && isUpdate.exitStatus() == QProcess::NormalExit)
|
||||||
{
|
{
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
}
|
}
|
||||||
@ -341,12 +341,29 @@ void AppIntoPage::isDownloading(const QUrl &url)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (item->download == 3)
|
if (item->download == 3)
|
||||||
|
{
|
||||||
|
QString packageName = info["Pkgname"].toString();
|
||||||
|
QProcess process;
|
||||||
|
process.start("/opt/durapps/spark-store/bin/store-helper/check-is-installed", {packageName});
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
|
||||||
|
int exitCode = process.exitCode();
|
||||||
|
QProcess::ExitStatus exitStatus = process.exitStatus();
|
||||||
|
process.close();
|
||||||
|
|
||||||
|
if (exitCode == 0 && exitStatus == QProcess::NormalExit)
|
||||||
{
|
{
|
||||||
ui->downloadButton->setEnabled(true);
|
ui->downloadButton->setEnabled(true);
|
||||||
ui->downloadButton->setText(tr("Reinstall"));
|
ui->downloadButton->setText(tr("Reinstall"));
|
||||||
ui->downloadButton->show();
|
ui->downloadButton->show();
|
||||||
ui->pushButton_3->show();
|
ui->pushButton_3->show();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->downloadButton->setEnabled(true);
|
||||||
|
ui->downloadButton->setText(tr("Download and Install"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppIntoPage::setAppinfoTags(const QStringList &tagList)
|
void AppIntoPage::setAppinfoTags(const QStringList &tagList)
|
||||||
@ -398,47 +415,47 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
|
|||||||
|
|
||||||
void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport)
|
void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport)
|
||||||
{
|
{
|
||||||
// if (!SettingsPage::needUncompatibleNotification) {
|
if (!SettingsPage::needUncompatibleNotification) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// bool isDeepin = Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Deepin;
|
bool isDeepin = Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Deepin;
|
||||||
// bool isUOS = Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Uos;
|
bool isUOS = Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Uos;
|
||||||
// bool checkdeepin = (isDeepin && !deepinSupport);
|
bool checkdeepin = (isDeepin && !deepinSupport);
|
||||||
// bool checkuos = (isUOS && !uosSupport);
|
bool checkuos = (isUOS && !uosSupport);
|
||||||
// bool isUbuntu = false;
|
bool isUbuntu = false;
|
||||||
// if (!checkdeepin && !checkuos)
|
if (!checkdeepin && !checkuos)
|
||||||
// {
|
{
|
||||||
// // 检查是否为 ubuntu 系统
|
// 检查是否为 ubuntu 系统
|
||||||
// QFile lsb("/etc/lsb-release");
|
QFile lsb("/etc/lsb-release");
|
||||||
// if (!lsb.open(QIODevice::ReadOnly))
|
if (!lsb.open(QIODevice::ReadOnly))
|
||||||
// {
|
{
|
||||||
// qDebug() << "打开 /etc/lsb-release 失败";
|
qDebug() << "打开 /etc/lsb-release 失败";
|
||||||
// }
|
}
|
||||||
// else if (lsb.readAll().contains("Ubuntu"))
|
else if (lsb.readAll().contains("Ubuntu"))
|
||||||
// {
|
{
|
||||||
// isUbuntu = true;
|
isUbuntu = true;
|
||||||
// lsb.close();
|
lsb.close();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// bool checkubuntu = (isUbuntu && !ubuntuSupport);
|
bool checkubuntu = (isUbuntu && !ubuntuSupport);
|
||||||
|
|
||||||
// if (checkdeepin)
|
if (checkdeepin)
|
||||||
// {
|
{
|
||||||
// Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support deepin, there may be problems"));
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support deepin, there may be problems"));
|
||||||
// }
|
}
|
||||||
// else if (checkuos)
|
else if (checkuos)
|
||||||
// {
|
{
|
||||||
// Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support UOS, there may be problems"));
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support UOS, there may be problems"));
|
||||||
// }
|
}
|
||||||
// else if (checkubuntu)
|
else if (checkubuntu)
|
||||||
// {
|
{
|
||||||
// Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support Ubuntu, there may be problems"));
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support Ubuntu, there may be problems"));
|
||||||
// }
|
}
|
||||||
// else if (!isUbuntu && !isDeepin && !isUOS)
|
else if (!isUbuntu && !isDeepin && !isUOS)
|
||||||
// {
|
{
|
||||||
// Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support current platform, there may be problems"));
|
Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support current platform, there may be problems"));
|
||||||
// }
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -490,22 +507,24 @@ void AppIntoPage::on_pushButton_3_clicked()
|
|||||||
QProcess uninstall;
|
QProcess uninstall;
|
||||||
uninstall.start("pkexec", QStringList() << "apt" << "autopurge" << "-y" << info["Pkgname"].toString().toLower());
|
uninstall.start("pkexec", QStringList() << "apt" << "autopurge" << "-y" << info["Pkgname"].toString().toLower());
|
||||||
uninstall.waitForFinished(-1);
|
uninstall.waitForFinished(-1);
|
||||||
|
uninstall.close();
|
||||||
|
|
||||||
QProcess check;
|
QProcess check;
|
||||||
check.start("dpkg", QStringList() << "-s" << info["Pkgname"].toString().toLower());
|
check.start("dpkg", QStringList() << "-s" << info["Pkgname"].toString().toLower());
|
||||||
check.waitForFinished(10*1000);
|
check.waitForFinished(-1);
|
||||||
|
|
||||||
if (check.readAllStandardOutput().isEmpty())
|
if (check.exitCode() != 0 || check.exitStatus() != QProcess::NormalExit)
|
||||||
{
|
{
|
||||||
ui->downloadButton->setText(tr("Download and Install"));
|
ui->downloadButton->setText(tr("Download and Install"));
|
||||||
ui->pushButton_3->hide();
|
ui->pushButton_3->hide();
|
||||||
|
|
||||||
updatesEnabled();
|
|
||||||
Utils::sendNotification("spark-store",tr("Spark Store"),tr("Uninstall succeeded"));
|
Utils::sendNotification("spark-store",tr("Spark Store"),tr("Uninstall succeeded"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->downloadButton->setEnabled(true);
|
ui->downloadButton->setEnabled(true);
|
||||||
ui->pushButton_3->setEnabled(true);
|
ui->pushButton_3->setEnabled(true);
|
||||||
|
|
||||||
|
check.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,3 +551,4 @@ void AppIntoPage::on_updateButton_clicked()
|
|||||||
openUrl(feedbackSpk);
|
openUrl(feedbackSpk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user