From 636d786fc2b00412bee1e37332a1fc0a9ec73e00 Mon Sep 17 00:00:00 2001 From: Andrei Paulau <7134956@gmail.com> Date: Tue, 14 Oct 2025 14:01:21 +0300 Subject: [PATCH] Add warning message box for write operation. --- qt/main_window.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/qt/main_window.cpp b/qt/main_window.cpp index 045c1b7..56360c6 100644 --- a/qt/main_window.cpp +++ b/qt/main_window.cpp @@ -560,6 +560,22 @@ void MainWindow::slotProgWrite() int index; QString chipName; + // Add confirmation dialog + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Confirm write")); + msgBox.setText(tr("Are you sure you want to write the chip?")); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Cancel); + + // If the user clicks cancel, exit the function. + if (msgBox.exec() != QMessageBox::Ok) + { + qInfo() << "User canceled the write operation"; + return; + } + + workFile.setFileName(ui->filePathLineEdit->text()); if (!workFile.open(QIODevice::ReadOnly)) {