CommPort: keep device names seperate

CommPort::name used to prefix the actual device name/path with the actual
device type to make it unique. This is used in DownloadRideDialog to map
the device dropdown list to the actual device.

This patch seperates name + device type to make the hack in SrmDevice a
bit less ugly: srmio doesn't use the built in CommPort abstraction and
needs the unmodified device names. This is still ugly, but I can't come up
with anything better (... for now).
This commit is contained in:
Rainer Clasen
2011-07-20 21:05:14 +02:00
parent da7ae868ed
commit e1f2128e27
6 changed files with 32 additions and 13 deletions

View File

@@ -112,7 +112,7 @@ DownloadRideDialog::scanCommPorts()
QMessageBox::Ok, QMessageBox::NoButton);
}
for (int i = 0; i < devList.size(); ++i) {
portCombo->addItem(devList[i]->name());
portCombo->addItem(devList[i]->id());
// Hack: SRM PCV download cables use the PL2203 chipset. If the
// first device name contains "PL2303", then, we're probably dealing
// with an SRM, so go ahead and select the SRM device. Generalize?
@@ -144,7 +144,7 @@ DownloadRideDialog::downloadClicked()
downloadInProgress = true;
CommPortPtr dev;
for (int i = 0; i < devList.size(); ++i) {
if (devList[i]->name() == portCombo->currentText()) {
if (devList[i]->id() == portCombo->currentText()) {
dev = devList[i];
break;
}
@@ -227,7 +227,7 @@ DownloadRideDialog::eraseClicked()
downloadInProgress = true;
CommPortPtr dev;
for (int i = 0; i < devList.size(); ++i) {
if (devList[i]->name() == portCombo->currentText()) {
if (devList[i]->id() == portCombo->currentText()) {
dev = devList[i];
break;
}