feat: auto apply update script

This commit is contained in:
rankun 2020-05-24 11:47:51 +08:00
parent 929f21763b
commit d1fa10a2ee
2 changed files with 5 additions and 4 deletions

View file

@ -43,15 +43,15 @@ bool DeviceManage::connectDevice(Device::DeviceParams params)
connect(device, &Device::deviceDisconnect, this, &DeviceManage::onDeviceDisconnect);
connect(device, &Device::controlStateChange, this, &DeviceManage::onControlStateChange);
m_devices[params.serial] = device;
if (!m_script.isEmpty()) {
device->updateScript(m_script);
}
return true;
}
void DeviceManage::updateScript(QString script)
{
if (m_devices.isEmpty()) {
qWarning() << "no device connect!!!";
return;
}
m_script = script;
QMapIterator<QString, QPointer<Device>> i(m_devices);
while (i.hasNext()) {
i.next();

View file

@ -40,6 +40,7 @@ private:
private:
QMap<QString, QPointer<Device>> m_devices;
quint16 m_localPortStart = 27183;
QString m_script;
};
#endif // DEVICEMANAGE_H