mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-03-25 14:59:44 +08:00
chore:添加spark-update-tool代码进入pro文件
This commit is contained in:
@@ -79,3 +79,10 @@ INSTALLS += \
|
|||||||
fish_completion \
|
fish_completion \
|
||||||
polkit-1
|
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
|
||||||
|
|||||||
@@ -551,13 +551,34 @@ void MainWindow::on_pushButton_14_clicked()
|
|||||||
QFile upgradeStatus("/tmp/spark-store/upgradeStatus.txt");
|
QFile upgradeStatus("/tmp/spark-store/upgradeStatus.txt");
|
||||||
if (!upgradeStatus.exists())
|
if (!upgradeStatus.exists())
|
||||||
{
|
{
|
||||||
QtConcurrent::run([=]
|
QString appPath;
|
||||||
{
|
|
||||||
auto upgradeP = new QProcess();
|
// 开发环境路径(构建目录)
|
||||||
upgradeP->startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh", QStringList());
|
#ifdef QT_DEBUG
|
||||||
upgradeP->waitForStarted();
|
appPath = QCoreApplication::applicationDirPath() +
|
||||||
upgradeP->waitForFinished(-1);
|
"/../spark-update-tool/spark-update-tool";
|
||||||
upgradeP->deleteLater(); });
|
#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();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
48
src/spark-update-tool/spark-update-tool.pro
Normal file
48
src/spark-update-tool/spark-update-tool.pro
Normal 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
|
||||||
Reference in New Issue
Block a user