Closed samuelfmlourenco closed 2 months ago
The solution is to initialize "err_" inside ConfiguratorWindow::on_actionInformation_triggered(), as follows:
void ConfiguratorWindow::on_actionInformation_triggered()
{
if (informationDialog_.isNull()) { // If the dialog is not open (implemented in version 2.0, because the device information dialog is now modeless)
err_ = false; // Bug fix
int errcnt = 0;
QString errstr;
CP2130::SiliconVersion siversion = cp2130_.getSiliconVersion(errcnt, errstr);
opCheck(tr("device-information-retrieval-op"), errcnt, errstr); // The string "device-information-retrieval-op" should be translated to "Device information retrieval"
if (err_) { // Fix implemented in version 1.2
handleError();
} else { // If error check passes
informationDialog_ = new InformationDialog(this); // The dialog is no longer modal (version 2.0 feature);
informationDialog_->setAttribute(Qt::WA_DeleteOnClose); // It is important to delete the dialog in memory once closed, in order to force the application to retrieve information about the device if the window is opened again
informationDialog_->setWindowTitle(tr("Device Information (S/N: %1)").arg(serialstr_));
informationDialog_->setSiliconVersionValueLabelText(siversion.maj, siversion.min);
informationDialog_->show();
}
} else {
informationDialog_->showNormal(); // Required if the dialog is minimized
informationDialog_->activateWindow(); // Set focus on the previous dialog (dialog is raised and selected)
}
}
Fixed in version 3.0.
When calling Device > Information, an empty error message may be shown. This is exemplified by the image below:
At a first glance, this error is caused by the fact that bool "err_", a variable that is global to every instance of ConfiguratorWindow instance, is never initialized. This variable is declared in "configurationwindow.h", line 94:
bool err_, requiresReset_, viewEnabled_ = false;
However, where this variable is to be initialized is pending analysis. Probably, the variable should be initialized locally inside the ConfiguratorWindow::on_actionInformation_triggered(), but further studying is required.