|
17 | 17 |
|
18 | 18 | #include "python_install_dialog.h" |
19 | 19 | #include <QMessageBox> |
| 20 | +#include <QProcess> |
| 21 | +#include <QCoreApplication> |
20 | 22 |
|
21 | 23 | PythonInstallDialog::PythonInstallDialog(QWidget *parent) |
22 | 24 | : QDialog(parent) |
@@ -187,12 +189,30 @@ void PythonInstallDialog::OnPackagesInstalled() { |
187 | 189 | progressBar->setValue(100); |
188 | 190 | statusLabel->setText(tr("Installation complete! AI Processing is now ready.")); |
189 | 191 |
|
190 | | - QMessageBox::information( |
191 | | - this, |
192 | | - tr("Success"), |
193 | | - tr("Python and all required packages have been installed successfully.\n\n" |
194 | | - "You can now use AI Processing features.") |
195 | | - ); |
| 192 | + QMessageBox msgBox(this); |
| 193 | + msgBox.setIcon(QMessageBox::Information); |
| 194 | + msgBox.setWindowTitle(tr("Installation Complete")); |
| 195 | + msgBox.setText(tr( |
| 196 | + "Python and all required packages have been installed successfully.\n\n" |
| 197 | + "A restart is required to enable AI Processing features." |
| 198 | + )); |
| 199 | + |
| 200 | + QPushButton *restartButton = |
| 201 | + msgBox.addButton(tr("Restart Now"), QMessageBox::AcceptRole); |
| 202 | + QPushButton *laterButton = |
| 203 | + msgBox.addButton(tr("Restart Later"), QMessageBox::RejectRole); |
| 204 | + |
| 205 | + msgBox.exec(); |
| 206 | + |
| 207 | + if (msgBox.clickedButton() == restartButton) { |
| 208 | + // Relaunch the application |
| 209 | + const QString program = QCoreApplication::applicationFilePath(); |
| 210 | + const QStringList arguments = QCoreApplication::arguments(); |
| 211 | + |
| 212 | + QProcess::startDetached(program, arguments); |
| 213 | + QCoreApplication::quit(); |
| 214 | + return; |
| 215 | + } |
196 | 216 |
|
197 | 217 | accept(); |
198 | 218 | } |
|
0 commit comments