mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 06:08:39 +00:00
refactor: add disconnected singal
This commit is contained in:
parent
c4fdbffbf4
commit
687b146f6d
4 changed files with 24 additions and 2 deletions
|
@ -196,11 +196,13 @@ void DeviceManage::onDeviceConnected(bool success, const QString &serial, const
|
||||||
if (!success) {
|
if (!success) {
|
||||||
removeDevice(serial);
|
removeDevice(serial);
|
||||||
}
|
}
|
||||||
|
emit deviceConnected(success, serial, deviceName, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManage::onDeviceDisconnected(QString serial)
|
void DeviceManage::onDeviceDisconnected(QString serial)
|
||||||
{
|
{
|
||||||
removeDevice(serial);
|
removeDevice(serial);
|
||||||
|
emit deviceDisconnected(serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManage::onControlStateChange(Device *device, Device::GroupControlState oldState, Device::GroupControlState newState)
|
void DeviceManage::onControlStateChange(Device *device, Device::GroupControlState oldState, Device::GroupControlState newState)
|
||||||
|
|
|
@ -14,12 +14,16 @@ public:
|
||||||
virtual ~DeviceManage();
|
virtual ~DeviceManage();
|
||||||
|
|
||||||
bool connectDevice(Device::DeviceParams params);
|
bool connectDevice(Device::DeviceParams params);
|
||||||
|
bool disconnectDevice(const QString &serial);
|
||||||
|
void disconnectAllDevice();
|
||||||
|
|
||||||
void updateScript(QString script);
|
void updateScript(QString script);
|
||||||
bool staysOnTop(const QString &serial);
|
bool staysOnTop(const QString &serial);
|
||||||
void showFPS(const QString &serial, bool show);
|
void showFPS(const QString &serial, bool show);
|
||||||
|
|
||||||
bool disconnectDevice(const QString &serial);
|
signals:
|
||||||
void disconnectAllDevice();
|
void deviceConnected(bool success, const QString& serial, const QString& deviceName, const QSize& size);
|
||||||
|
void deviceDisconnected(QString serial);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setGroupControlSignals(Device *host, Device *client, bool install);
|
void setGroupControlSignals(Device *host, Device *client, bool install);
|
||||||
|
|
|
@ -94,6 +94,9 @@ Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog)
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
});
|
});
|
||||||
connect(m_hideIcon, &QSystemTrayIcon::activated, this, &Dialog::slotActivated);
|
connect(m_hideIcon, &QSystemTrayIcon::activated, this, &Dialog::slotActivated);
|
||||||
|
|
||||||
|
connect(&m_deviceManage, &DeviceManage::deviceConnected, this, &Dialog::onDeviceConnected);
|
||||||
|
connect(&m_deviceManage, &DeviceManage::deviceDisconnected, this, &Dialog::onDeviceDisconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog::~Dialog()
|
Dialog::~Dialog()
|
||||||
|
@ -418,6 +421,16 @@ void Dialog::getIPbyIp()
|
||||||
m_adb.execute(ui->serialBox->currentText().trimmed(), adbArgs);
|
m_adb.execute(ui->serialBox->currentText().trimmed(), adbArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dialog::onDeviceConnected(bool success, const QString &serial, const QString &deviceName, const QSize &size)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::onDeviceDisconnected(QString serial)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Dialog::on_wirelessDisConnectBtn_clicked()
|
void Dialog::on_wirelessDisConnectBtn_clicked()
|
||||||
{
|
{
|
||||||
if (checkAdbRun()) {
|
if (checkAdbRun()) {
|
||||||
|
|
|
@ -31,6 +31,9 @@ public:
|
||||||
void getIPbyIp();
|
void getIPbyIp();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void onDeviceConnected(bool success, const QString& serial, const QString& deviceName, const QSize& size);
|
||||||
|
void onDeviceDisconnected(QString serial);
|
||||||
|
|
||||||
void on_updateDevice_clicked();
|
void on_updateDevice_clicked();
|
||||||
void on_startServerBtn_clicked();
|
void on_startServerBtn_clicked();
|
||||||
void on_stopServerBtn_clicked();
|
void on_stopServerBtn_clicked();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue