Cleanup: Use Correct Naming for Private Members.

Rename inconsistently named private members introduced in #3923.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2023-06-13 15:32:27 +12:00 committed by bstoeger
parent b0d5b23227
commit bceb367dc3

View file

@ -99,31 +99,19 @@ void GasTypeComboBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemMod
QStyledItemDelegate::setModelData(editor, model, index); QStyledItemDelegate::setModelData(editor, model, index);
} }
class DiveComputerEntry struct DiveComputerEntry {
{ QString vendor;
public: QString product;
DiveComputerEntry(QString vendor, QString product, unsigned int transport, bool fwUpgradePossible) : unsigned int transport;
vendorInt(vendor), productInt(product), transportInt(transport), fwUpgradePossibleInt(fwUpgradePossible) {} bool fwUpgradePossible;
QString vendor() const { return vendorInt; }
QString product() const { return productInt; }
unsigned int transport() const { return transportInt; }
bool fwUpgradePossible() const { return fwUpgradePossibleInt; }
private:
QString vendorInt;
QString productInt;
unsigned int transportInt;
bool fwUpgradePossibleInt;
}; };
static std::array<DiveComputerEntry, 4> supportedDiveComputers = { static std::array<struct DiveComputerEntry, 4> supportedDiveComputers = {{
DiveComputerEntry("Heinrichs Weikamp", "OSTC 2N", DC_TRANSPORT_SERIAL, true), { "Heinrichs Weikamp", "OSTC 2N", DC_TRANSPORT_SERIAL, true },
DiveComputerEntry("Heinrichs Weikamp", "OSTC Plus", DC_TRANSPORT_BLUETOOTH, true), { "Heinrichs Weikamp", "OSTC Plus", DC_TRANSPORT_BLUETOOTH, true },
DiveComputerEntry("Heinrichs Weikamp", "OSTC 4", DC_TRANSPORT_BLUETOOTH, true), { "Heinrichs Weikamp", "OSTC 4", DC_TRANSPORT_BLUETOOTH, true },
DiveComputerEntry("Suunto", "Vyper", DC_TRANSPORT_SERIAL, false), { "Suunto", "Vyper", DC_TRANSPORT_SERIAL, false },
}; }};
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent), ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent),
config(0), config(0),
@ -161,8 +149,8 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
unsigned int selectedDiveComputerIndex = 0; unsigned int selectedDiveComputerIndex = 0;
for (unsigned i = 0; i < supportedDiveComputers.size(); ++i) { for (unsigned i = 0; i < supportedDiveComputers.size(); ++i) {
if (supportedDiveComputers[i].vendor() == qPrefDiveComputer::vendor() && if (supportedDiveComputers[i].vendor == qPrefDiveComputer::vendor() &&
supportedDiveComputers[i].product() == qPrefDiveComputer::product()) { supportedDiveComputers[i].product == qPrefDiveComputer::product()) {
selectedDiveComputerIndex = i; selectedDiveComputerIndex = i;
break; break;
@ -960,8 +948,8 @@ void ConfigureDiveComputerDialog::getDeviceData()
device_data.devname = copy_qstring(device); device_data.devname = copy_qstring(device);
unsigned int selectedDiveComputerIndex = ui.DiveComputerList->currentRow(); unsigned int selectedDiveComputerIndex = ui.DiveComputerList->currentRow();
QString vendor = supportedDiveComputers[selectedDiveComputerIndex].vendor(); QString vendor = supportedDiveComputers[selectedDiveComputerIndex].vendor;
QString product = supportedDiveComputers[selectedDiveComputerIndex].product(); QString product = supportedDiveComputers[selectedDiveComputerIndex].product;
device_data.vendor = copy_qstring(vendor); device_data.vendor = copy_qstring(vendor);
device_data.product = copy_qstring(product); device_data.product = copy_qstring(product);
device_data.descriptor = descriptorLookup.value(vendor.toLower() + product.toLower()); device_data.descriptor = descriptorLookup.value(vendor.toLower() + product.toLower());
@ -1473,7 +1461,7 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int currentRow) void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int currentRow)
{ {
unsigned int transport = supportedDiveComputers[currentRow].transport(); unsigned int transport = supportedDiveComputers[currentRow].transport;
if (transport != DC_TRANSPORT_BLUETOOTH) if (transport != DC_TRANSPORT_BLUETOOTH)
ui.connectBluetoothButton->setEnabled(false); ui.connectBluetoothButton->setEnabled(false);
@ -1548,8 +1536,8 @@ void ConfigureDiveComputerDialog::dc_open()
ui.logToFile->setEnabled(false); ui.logToFile->setEnabled(false);
unsigned int selectedDiveComputerIndex = ui.DiveComputerList->currentRow(); unsigned int selectedDiveComputerIndex = ui.DiveComputerList->currentRow();
ui.updateFirmwareButton->setEnabled(supportedDiveComputers[selectedDiveComputerIndex].fwUpgradePossible()); ui.updateFirmwareButton->setEnabled(supportedDiveComputers[selectedDiveComputerIndex].fwUpgradePossible);
ui.forceUpdateFirmware->setEnabled(supportedDiveComputers[selectedDiveComputerIndex].product() == "OSTC 4"); ui.forceUpdateFirmware->setEnabled(supportedDiveComputers[selectedDiveComputerIndex].product == "OSTC 4");
ui.progressBar->setFormat(tr("Connected to device")); ui.progressBar->setFormat(tr("Connected to device"));