Skip to content

Commit

Permalink
0.2.rev.A. UI improvements in software
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonsmartins committed Jan 16, 2024
1 parent 80cc4aa commit e22fa9f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
3 changes: 2 additions & 1 deletion software/usbflashprog/backend/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ bool Runner::sendCommand_(TRunnerCommand& cmd, int retry) {
}
if (!cmd.responseIsOk()) {
WARNING << "Response NOK."
<< "Command" << cmd.opcode.descr.c_str();
<< "Command" << cmd.opcode.descr.c_str() << ". Response"
<< "[ 0x" + QString(cmd.response.toHex()) << "]";
error_ = true;
return false;
} else {
Expand Down
8 changes: 8 additions & 0 deletions software/usbflashprog/i18n/ufprog_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,14 @@
<source>Get Byte</source>
<translation>Get Byte</translation>
</message>
<message>
<source>Device is blank</source>
<translation>Device is blank</translation>
</message>
<message>
<source>Device is not blank</source>
<translation>Device is not blank</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down
8 changes: 8 additions & 0 deletions software/usbflashprog/i18n/ufprog_pt_BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,14 @@
<source>Get Byte</source>
<translation>Ler 8 Bits</translation>
</message>
<message>
<source>Device is blank</source>
<translation>Dispositivo está vazio</translation>
</message>
<message>
<source>Device is not blank</source>
<translation>Dispositivo não está vazio</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down
37 changes: 34 additions & 3 deletions software/usbflashprog/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,17 @@ void MainWindow::on_actionDoErase_triggered(bool checked) {
if (!showActionWarningDialog_()) return;
configureDeviceFromControls_();
showDialogActionProgress_(ui_->actionDoErase->text());
device_->erase();
if (device_->erase()) {
progress_->hide();
QMessageBox::information(
this, progress_->windowTitle(),
tr("Device is blank").leftJustified(kDialogLabelMinLength));
} else {
progress_->hide();
QMessageBox::critical(
this, progress_->windowTitle(),
tr("Device is not blank").leftJustified(kDialogLabelMinLength));
}
}

void MainWindow::on_actionEraseAndBlankCheck_triggered(bool checked) {
Expand All @@ -441,15 +451,35 @@ void MainWindow::on_actionEraseAndBlankCheck_triggered(bool checked) {
if (!showActionWarningDialog_()) return;
configureDeviceFromControls_();
showDialogActionProgress_(ui_->actionEraseAndBlankCheck->text());
device_->erase(true);
if (device_->erase(true)) {
progress_->hide();
QMessageBox::information(
this, progress_->windowTitle(),
tr("Device is blank").leftJustified(kDialogLabelMinLength));
} else {
progress_->hide();
QMessageBox::critical(
this, progress_->windowTitle(),
tr("Device is not blank").leftJustified(kDialogLabelMinLength));
}
}

void MainWindow::on_actionBlankCheck_triggered(bool checked) {
if (!device_ || !device_->getInfo().capability.hasBlankCheck) return;
if (!showActionWarningDialog_()) return;
configureDeviceFromControls_();
showDialogActionProgress_(ui_->actionBlankCheck->text());
device_->blankCheck();
if (device_->blankCheck()) {
progress_->hide();
QMessageBox::information(
this, progress_->windowTitle(),
tr("Device is blank").leftJustified(kDialogLabelMinLength));
} else {
progress_->hide();
QMessageBox::critical(
this, progress_->windowTitle(),
tr("Device is not blank").leftJustified(kDialogLabelMinLength));
}
}

void MainWindow::on_actionGetID_triggered(bool checked) {
Expand All @@ -459,6 +489,7 @@ void MainWindow::on_actionGetID_triggered(bool checked) {
configureDeviceFromControls_();
showDialogActionProgress_(ui_->actionGetID->text());
if (device_->getId(deviceId)) {
progress_->hide();
QMessageBox::information(
this, progress_->windowTitle(),
tr("Manufacturer: 0x%1 (%2)")
Expand Down

0 comments on commit e22fa9f

Please sign in to comment.