mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 12:52:04 +08:00
update:添加槽函数
This commit is contained in:
@@ -266,6 +266,20 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||||||
|
|
||||||
QMessageBox::StandardButton reply = QMessageBox::question(this, "确认关闭", "正在更新,是否确认关闭窗口?", QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::StandardButton reply = QMessageBox::question(this, "确认关闭", "正在更新,是否确认关闭窗口?", QMessageBox::Yes | QMessageBox::No);
|
||||||
}
|
}
|
||||||
|
void MainWindow::handleUpdateFinished(bool success)
|
||||||
|
{
|
||||||
|
if (success) {
|
||||||
|
// 更新成功时的处理逻辑
|
||||||
|
QMessageBox::information(this, "更新完成", "软件更新已成功完成!");
|
||||||
|
} else {
|
||||||
|
// 更新失败时的处理逻辑
|
||||||
|
QMessageBox::warning(this, "更新失败", "软件更新过程中出现错误,请稍后再试。");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新应用列表
|
||||||
|
checkUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
private slots:
|
|
||||||
// ⬅️ 声明一个槽函数,它将接收来自Updater的信号
|
|
||||||
void handleUpdateFinished(bool success);
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
void checkUpdates();
|
void checkUpdates();
|
||||||
@@ -37,5 +35,8 @@ private:
|
|||||||
QListView *listView; // 声明 QListView 指针
|
QListView *listView; // 声明 QListView 指针
|
||||||
QJsonArray m_allApps; // 新增:保存所有应用数据
|
QJsonArray m_allApps; // 新增:保存所有应用数据
|
||||||
void filterAppsByKeyword(const QString &keyword); // 新增:搜索过滤函数声明
|
void filterAppsByKeyword(const QString &keyword); // 新增:搜索过滤函数声明
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleUpdateFinished(bool success); // 新增:处理更新完成的槽函数
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
Reference in New Issue
Block a user