chore:添加spark-update-tool代码进入pro文件

This commit is contained in:
momen 2025-07-10 00:00:52 +08:00
parent fec28e76e8
commit e603dc3fce
3 changed files with 83 additions and 7 deletions

View File

@ -79,3 +79,10 @@ INSTALLS += \
fish_completion \
polkit-1
# 暂时不添加
SUBDIRS += src/spark-update-tool
spark-update-tool.subdir = src/spark-update-tool
spark-update-tool.file = src/spark-update-tool/spark-update-tool.pro
spark-update-tool.target = spark-update-tool
spark-update-tool.depends = spark-store

View File

@ -551,13 +551,34 @@ void MainWindow::on_pushButton_14_clicked()
QFile upgradeStatus("/tmp/spark-store/upgradeStatus.txt");
if (!upgradeStatus.exists())
{
QtConcurrent::run([=]
{
auto upgradeP = new QProcess();
upgradeP->startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh", QStringList());
upgradeP->waitForStarted();
upgradeP->waitForFinished(-1);
upgradeP->deleteLater(); });
QString appPath;
// 开发环境路径(构建目录)
#ifdef QT_DEBUG
appPath = QCoreApplication::applicationDirPath() +
"/../spark-update-tool/spark-update-tool";
#else
// 安装后路径系统PATH
appPath = QStandardPaths::findExecutable("spark-update-tool");
#endif
if (appPath.isEmpty()) {
qWarning() << "spark-update-tool not found!";
return;
}
QProcess *process = new QProcess(this);
process->start(appPath, {"--silent"});
connect(process, QOverload<int>::of(&QProcess::finished),
[=](int exitCode) {
if (exitCode == 0) {
qDebug() << "Update check successful";
} else {
qDebug() << "Update check failed";
}
process->deleteLater();
});
}
}
}

View File

@ -0,0 +1,48 @@
# spark-update-tool.pro
QT += core gui widgets network concurrent
TARGET = spark-update-tool
TEMPLATE = app
# Set C++ standard to C++17
CONFIG += c++17
# Enable auto features (uic, moc, rcc)
CONFIG += qt warn_on release
QT_CONFIG += no-pkg-config
# Version info (replace with your actual version)
VERSION = 0.1.0
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
# Source files
SOURCES += \
src/main.cpp \
src/mainwindow.cpp \
src/aptssupdater.cpp \
src/appdelegate.cpp \
src/applistmodel.cpp \
src/downloadmanager.cpp
HEADERS += \
src/mainwindow.h \
src/aptssupdater.h \
src/appdelegate.h \
src/applistmodel.h \
src/downloadmanager.h
FORMS += \
src/mainwindow.ui
RESOURCES += \
src/icons.qrc
# macOS bundle properties (optional)
macx {
QMAKE_INFO_PLIST = Info.plist
ICON = resources/spark-update-tool.icns
BUNDLE_IDENTIFIER = org.spark.store.update-tool
}
# Installation paths (matches CMake install)
target.path = $$[QT_INSTALL_BINS]
INSTALLS += target