mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
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:
@@ -78,13 +78,11 @@ struct SrmioData : public boost::noncopyable
|
||||
static bool
|
||||
dev2path(CommPortPtr dev, QString &path, QString &err)
|
||||
{
|
||||
// Read device path out of device name. Sketchy.
|
||||
QRegExp rx("^Serial: (.+)$");
|
||||
if (!rx.exactMatch(dev->name())) {
|
||||
err = "SRM download not supported by device " + dev->name();
|
||||
if ( dev->type() == "Serial" ) {
|
||||
err = "SRM download not supported by device " + dev->id();
|
||||
return false;
|
||||
}
|
||||
path = rx.cap(1);
|
||||
path = dev->name();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user