mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 21:02:04 +08:00
sync
This commit is contained in:
@@ -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);
|
||||||
@@ -133,7 +133,7 @@ void AppIntoPage::openUrl(const QUrl &url)
|
|||||||
bool isInstalled;
|
bool isInstalled;
|
||||||
bool isUpdated;
|
bool isUpdated;
|
||||||
QString packagename = info["Pkgname"].toString();
|
QString packagename = info["Pkgname"].toString();
|
||||||
isInstall.start("/opt/durapps/spark-store/bin/store-helper/check-is-installed", QStringList() << info["Pkgname"].toString());
|
isInstall.start("host-spawn", QStringList() << "/opt/durapps/spark-store/bin/store-helper/check-is-installed" << info["Pkgname"].toString());
|
||||||
qDebug() << info["Pkgname"].toString();
|
qDebug() << info["Pkgname"].toString();
|
||||||
isInstall.waitForFinished(180 * 1000); // 默认超时 3 分钟
|
isInstall.waitForFinished(180 * 1000); // 默认超时 3 分钟
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ void AppIntoPage::openUrl(const QUrl &url)
|
|||||||
|
|
||||||
isUpdate.start("host-spawn", QStringList() << "dpkg" << "--compare-versions" << localVersion << "ge" << info["Version"].toString());
|
isUpdate.start("host-spawn", QStringList() << "dpkg" << "--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;
|
||||||
}
|
}
|
||||||
@@ -342,10 +342,27 @@ void AppIntoPage::isDownloading(const QUrl &url)
|
|||||||
}
|
}
|
||||||
if (item->download == 3)
|
if (item->download == 3)
|
||||||
{
|
{
|
||||||
ui->downloadButton->setEnabled(true);
|
QString packageName = info["Pkgname"].toString();
|
||||||
ui->downloadButton->setText(tr("Reinstall"));
|
QProcess process;
|
||||||
ui->downloadButton->show();
|
process.start("/opt/durapps/spark-store/bin/store-helper/check-is-installed", {packageName});
|
||||||
ui->pushButton_3->show();
|
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->setText(tr("Reinstall"));
|
||||||
|
ui->downloadButton->show();
|
||||||
|
ui->pushButton_3->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->downloadButton->setEnabled(true);
|
||||||
|
ui->downloadButton->setText(tr("Download and Install"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -488,24 +505,26 @@ void AppIntoPage::on_pushButton_3_clicked()
|
|||||||
ui->pushButton_3->setEnabled(false);
|
ui->pushButton_3->setEnabled(false);
|
||||||
|
|
||||||
QProcess uninstall;
|
QProcess uninstall;
|
||||||
uninstall.start("host-spawn", QStringList() << "pkexec" << "apt" << "autopurge" << "-y" << info["Pkgname"].toString().toLower());
|
uninstall.start("host-spawn", QStringList() << "pkexec" << "apt" << "autopurge" << "-y" << info["Pkgname"].toString().toLower());
|
||||||
uninstall.waitForFinished(-1);
|
uninstall.waitForFinished(-1);
|
||||||
|
uninstall.close();
|
||||||
|
|
||||||
// QProcess check;
|
QProcess check;
|
||||||
// check.start("host-spawn", QStringList() << "dpkg" << "-s" << info["Pkgname"].toString().toLower());
|
check.start("host-spawn", QStringList() << "dpkg" << "-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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,11 +539,11 @@ void AppIntoPage::on_shareButton_clicked()
|
|||||||
void AppIntoPage::on_updateButton_clicked()
|
void AppIntoPage::on_updateButton_clicked()
|
||||||
{
|
{
|
||||||
QString feedbackSpk = "spk://store/chat/store.spark-app.feedback";
|
QString feedbackSpk = "spk://store/chat/store.spark-app.feedback";
|
||||||
QFileInfo actionSubmissionClientStatus("/opt/durapps/store.spark-app.feedback");
|
QFileInfo actionSubmissionClientStatus("/host/opt/durapps/store.spark-app.feedback");
|
||||||
if (actionSubmissionClientStatus.exists() && actionSubmissionClientStatus.isDir())
|
if (actionSubmissionClientStatus.exists() && actionSubmissionClientStatus.isDir())
|
||||||
{
|
{
|
||||||
qDebug() << "反馈器存在";
|
qDebug() << "反馈器存在";
|
||||||
QProcess::startDetached("sh", QStringList() << "/opt/durapps/store.spark-app.feedback/launch.sh");
|
QProcess::startDetached("sh", QStringList() << "/host/opt/durapps/store.spark-app.feedback/launch.sh");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -532,3 +551,4 @@ void AppIntoPage::on_updateButton_clicked()
|
|||||||
openUrl(feedbackSpk);
|
openUrl(feedbackSpk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user