mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-01 13:28:38 +00:00
feat: auto apply update script
This commit is contained in:
parent
929f21763b
commit
d1fa10a2ee
2 changed files with 5 additions and 4 deletions
|
@ -43,15 +43,15 @@ bool DeviceManage::connectDevice(Device::DeviceParams params)
|
||||||
connect(device, &Device::deviceDisconnect, this, &DeviceManage::onDeviceDisconnect);
|
connect(device, &Device::deviceDisconnect, this, &DeviceManage::onDeviceDisconnect);
|
||||||
connect(device, &Device::controlStateChange, this, &DeviceManage::onControlStateChange);
|
connect(device, &Device::controlStateChange, this, &DeviceManage::onControlStateChange);
|
||||||
m_devices[params.serial] = device;
|
m_devices[params.serial] = device;
|
||||||
|
if (!m_script.isEmpty()) {
|
||||||
|
device->updateScript(m_script);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManage::updateScript(QString script)
|
void DeviceManage::updateScript(QString script)
|
||||||
{
|
{
|
||||||
if (m_devices.isEmpty()) {
|
m_script = script;
|
||||||
qWarning() << "no device connect!!!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QMapIterator<QString, QPointer<Device>> i(m_devices);
|
QMapIterator<QString, QPointer<Device>> i(m_devices);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
|
|
|
@ -40,6 +40,7 @@ private:
|
||||||
private:
|
private:
|
||||||
QMap<QString, QPointer<Device>> m_devices;
|
QMap<QString, QPointer<Device>> m_devices;
|
||||||
quint16 m_localPortStart = 27183;
|
quint16 m_localPortStart = 27183;
|
||||||
|
QString m_script;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEVICEMANAGE_H
|
#endif // DEVICEMANAGE_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue