bloguetronica / cp2130-conf

CP2130 Configurator (cp2130-conf) is an application that can be used to configure CP2130 devices, including VID, PID, as well as other descriptors. Most importantly, the application allows you to configure pin functions and states.
GNU General Public License v3.0
1 stars 1 forks source link

MainWindow::on_comboBoxDevices_currentIndexChanged() should be simplified #17

Closed samuelfmlourenco closed 2 years ago

samuelfmlourenco commented 2 years ago

This function, having its implementation located at "mainwindow.cpp", lines 54 to 61, is currently written in the following manner:

void MainWindow::on_comboBoxDevices_currentIndexChanged(int index)
{
    if (index == 0) {
        ui->pushButtonOpen->setEnabled(false);
    } else {
        ui->pushButtonOpen->setEnabled(true);
    }
}

However, this could be simplified:

void MainWindow::on_comboBoxDevices_currentIndexChanged(int index)
{
    ui->pushButtonOpen->setEnabled(index != 0);
}
samuelfmlourenco commented 2 years ago

Code simplified in version 1.4.