Skip to content

Commit bea147a

Browse files
7134956bbogush
authored andcommitted
Qt: UI: Add alert "Completed."
1 parent 3934ed1 commit bea147a

File tree

6 files changed

+41
-5
lines changed

6 files changed

+41
-5
lines changed

qt/main_window.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,16 @@ void MainWindow::slotSettingsProgrammer()
646646
prog->isIncSpare())).toBool());
647647
progDialog.setHwEccEnabled((settings.value(SETTINGS_ENABLE_HW_ECC,
648648
prog->isHwEccEnabled())).toBool());
649+
progDialog.setAlertEnabled((settings.value(SETTINGS_ENABLE_ALERT,
650+
isAlertEnabled)).toBool());
649651

650652
if (progDialog.exec() == QDialog::Accepted)
651653
{
652654
settings.setValue(SETTINGS_USB_DEV_NAME, progDialog.getUsbDevName());
653655
settings.setValue(SETTINGS_SKIP_BAD_BLOCKS, progDialog.isSkipBB());
654656
settings.setValue(SETTINGS_INCLUDE_SPARE_AREA, progDialog.isIncSpare());
655657
settings.setValue(SETTINGS_ENABLE_HW_ECC, progDialog.isHwEccEnabled());
658+
settings.setValue(SETTINGS_ENABLE_ALERT, progDialog.isAlertEnabled());
656659
settings.sync();
657660

658661
updateProgSettings();
@@ -674,6 +677,8 @@ void MainWindow::updateProgSettings()
674677
}
675678
if (settings.contains(SETTINGS_ENABLE_HW_ECC))
676679
prog->setHwEccEnabled(settings.value(SETTINGS_ENABLE_HW_ECC).toBool());
680+
if (settings.contains(SETTINGS_ENABLE_ALERT))
681+
isAlertEnabled = settings.value(SETTINGS_ENABLE_ALERT).toBool();
677682
}
678683

679684
void MainWindow::slotSettingsParallelChipDb()
@@ -744,6 +749,15 @@ void MainWindow::setProgress(unsigned int progress)
744749
.arg(progress)
745750
.arg(Qtime_passed.toString("hh:mm:ss"))
746751
.arg(Qtime_total.toString("hh:mm:ss")));
752+
753+
if((progress == 100) && isAlertEnabled)
754+
{
755+
QMessageBox *msgBox = new QMessageBox(this);
756+
msgBox->setIcon(QMessageBox::Information);
757+
msgBox->setText("Completed.");
758+
msgBox->setAttribute(Qt::WA_DeleteOnClose);
759+
msgBox->open();
760+
}
747761
}
748762

749763
void MainWindow::slotProgFirmwareUpdateCompleted(int status)

qt/main_window.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class MainWindow : public QMainWindow
3636
SpiChipDb spiChipDb;
3737
ChipDb *currentChipDb;
3838
QElapsedTimer timer;
39+
bool isAlertEnabled;
3940

4041
void initBufTable();
4142
void resetBufTable();

qt/settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
#define SETTINGS_APPLICATION_NAME "NANDO"
1111

1212
#define SETTINGS_PROGRAMMER_SECTION "programmer/"
13+
#define SETTINGS_GUI_SECTION "GUI/"
1314
#define SETTINGS_USB_DEV_NAME SETTINGS_PROGRAMMER_SECTION "usb_dev_name"
1415
#define SETTINGS_SKIP_BAD_BLOCKS SETTINGS_PROGRAMMER_SECTION "skip_bad_blocks"
1516
#define SETTINGS_INCLUDE_SPARE_AREA SETTINGS_PROGRAMMER_SECTION \
1617
"include_spare_area"
1718
#define SETTINGS_ENABLE_HW_ECC SETTINGS_PROGRAMMER_SECTION \
1819
"enable_hw_ecc"
20+
#define SETTINGS_ENABLE_ALERT SETTINGS_GUI_SECTION "enable_alert"
1921

2022
#endif // SETTINGS_H

qt/settings_programmer_dialog.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,13 @@ bool SettingsProgrammerDialog::isHwEccEnabled()
5757
{
5858
return ui->enableHwEccCheckBox->isChecked();
5959
}
60+
61+
void SettingsProgrammerDialog::setAlertEnabled(bool enableAlert)
62+
{
63+
ui->enableAlertCheckBox->setChecked(enableAlert);
64+
}
65+
66+
bool SettingsProgrammerDialog::isAlertEnabled()
67+
{
68+
return ui->enableAlertCheckBox->isChecked();
69+
}

qt/settings_programmer_dialog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class SettingsProgrammerDialog : public QDialog
2727
bool isIncSpare();
2828
void setHwEccEnabled(bool enableHwEcc);
2929
bool isHwEccEnabled();
30+
void setAlertEnabled(bool enableAlert);
31+
bool isAlertEnabled();
3032

3133
private:
3234
Ui::SettingsProgrammerDialog *ui;

qt/settings_programmer_dialog.ui

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@
4949
</item>
5050
</layout>
5151
</item>
52-
<item row="4" column="0">
52+
<item row="3" column="0">
53+
<widget class="QCheckBox" name="enableHwEccCheckBox">
54+
<property name="text">
55+
<string>Enable HW ECC</string>
56+
</property>
57+
</widget>
58+
</item>
59+
<item row="5" column="0">
5360
<spacer name="verticalSpacer">
5461
<property name="orientation">
5562
<enum>Qt::Vertical</enum>
@@ -72,7 +79,7 @@
7279
</property>
7380
</widget>
7481
</item>
75-
<item row="5" column="0">
82+
<item row="6" column="0">
7683
<widget class="QDialogButtonBox" name="buttonBox">
7784
<property name="orientation">
7885
<enum>Qt::Horizontal</enum>
@@ -92,10 +99,10 @@
9299
</property>
93100
</widget>
94101
</item>
95-
<item row="3" column="0">
96-
<widget class="QCheckBox" name="enableHwEccCheckBox">
102+
<item row="4" column="0">
103+
<widget class="QCheckBox" name="enableAlertCheckBox">
97104
<property name="text">
98-
<string>Enable HW ECC</string>
105+
<string>Alert after completion</string>
99106
</property>
100107
</widget>
101108
</item>

0 commit comments

Comments
 (0)