ignore other devices on startup when device serial specified

This commit is contained in:
Jan Käberich 2023-10-31 13:28:59 +01:00
parent 79290d0f36
commit 4c0d18b5f4

View File

@ -354,6 +354,7 @@ bool AppWindow::ConnectToDevice(QString serial, DeviceDriver *driver)
device = d; device = d;
} else { } else {
disconnect(d, nullptr, this, nullptr); disconnect(d, nullptr, this, nullptr);
UpdateDeviceList();
break; break;
} }
} }
@ -999,6 +1000,10 @@ int AppWindow::UpdateDeviceList()
DeviceEntry e; DeviceEntry e;
e.driver = driver; e.driver = driver;
e.serial = serial; e.serial = serial;
if(!parser.value("device").isEmpty() && parser.value("device") != e.serial) {
// specified device does not match, ignore
continue;
}
deviceList.push_back(e); deviceList.push_back(e);
} }
} }
@ -1014,10 +1019,6 @@ int AppWindow::UpdateDeviceList()
int available = 0; int available = 0;
bool found = false; bool found = false;
for(auto d : deviceList) { for(auto d : deviceList) {
if(!parser.value("device").isEmpty() && parser.value("device") != d.serial) {
// specified device does not match, ignore
continue;
}
auto connectAction = ui->menuConnect_to->addAction(d.toString()); auto connectAction = ui->menuConnect_to->addAction(d.toString());
connectAction->setCheckable(true); connectAction->setCheckable(true);
connectAction->setActionGroup(deviceActionGroup); connectAction->setActionGroup(deviceActionGroup);