fix: not dispaly must record

This commit is contained in:
Barry 2022-04-10 11:06:54 +08:00
commit 6dbe96d3a8
3 changed files with 12 additions and 8 deletions

View file

@ -167,20 +167,19 @@ void Device::initSignals()
tipsType = tr("file transfer"); tipsType = tr("file transfer");
} }
QString tips; QString tips;
if (FileHandler::FAR_IS_RUNNING == processResult && m_videoForm) { if (FileHandler::FAR_IS_RUNNING == processResult) {
tips = tr("wait current %1 to complete").arg(tipsType); tips = tr("wait current %1 to complete").arg(tipsType);
} }
if (FileHandler::FAR_SUCCESS_EXEC == processResult && m_videoForm) { if (FileHandler::FAR_SUCCESS_EXEC == processResult) {
tips = tr("%1 complete, save in %2").arg(tipsType).arg(Config::getInstance().getPushFilePath()); tips = tr("%1 complete, save in %2").arg(tipsType).arg(Config::getInstance().getPushFilePath());
} }
if (FileHandler::FAR_ERROR_EXEC == processResult && m_videoForm) { if (FileHandler::FAR_ERROR_EXEC == processResult) {
tips = tr("%1 failed").arg(tipsType); tips = tr("%1 failed").arg(tipsType);
} }
qInfo() << tips; qInfo() << tips;
if (m_controlState == GCS_CLIENT) { if (m_controlState == GCS_CLIENT) {
return; return;
} }
//QMessageBox::information(m_videoForm, "QtScrcpy", tips, QMessageBox::Ok);
}); });
} }
@ -293,10 +292,10 @@ void Device::initSignals()
} }
} }
void Device::connectDevice() bool Device::connectDevice()
{ {
if (!m_server) { if (!m_server) {
return; return false;
} }
// fix: macos cant recv finished signel, timer is ok // fix: macos cant recv finished signel, timer is ok
@ -322,6 +321,8 @@ void Device::connectDevice()
params.stayAwake = m_params.stayAwake; params.stayAwake = m_params.stayAwake;
m_server->start(params); m_server->start(params);
}); });
return true;
} }
void Device::disconnectDevice() void Device::disconnectDevice()

View file

@ -52,7 +52,7 @@ public:
explicit Device(DeviceParams params, QObject *parent = nullptr); explicit Device(DeviceParams params, QObject *parent = nullptr);
virtual ~Device(); virtual ~Device();
void connectDevice(); bool connectDevice();
void disconnectDevice(); void disconnectDevice();
VideoForm *getVideoForm(); VideoForm *getVideoForm();

View file

@ -42,8 +42,11 @@ bool DeviceManage::connectDevice(Device::DeviceParams params)
Device *device = new Device(params); Device *device = new Device(params);
connect(device, &Device::deviceDisconnected, this, &DeviceManage::onDeviceDisconnected); connect(device, &Device::deviceDisconnected, this, &DeviceManage::onDeviceDisconnected);
connect(device, &Device::controlStateChange, this, &DeviceManage::onControlStateChange); connect(device, &Device::controlStateChange, this, &DeviceManage::onControlStateChange);
if (!device->connectDevice()) {
delete device;
return false;
}
m_devices[params.serial] = device; m_devices[params.serial] = device;
device->connectDevice();
if (!m_script.isEmpty()) { if (!m_script.isEmpty()) {
device->updateScript(m_script); device->updateScript(m_script);
} }