fix: not dispaly must record

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

View file

@ -167,20 +167,19 @@ void Device::initSignals()
tipsType = tr("file transfer");
}
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);
}
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());
}
if (FileHandler::FAR_ERROR_EXEC == processResult && m_videoForm) {
if (FileHandler::FAR_ERROR_EXEC == processResult) {
tips = tr("%1 failed").arg(tipsType);
}
qInfo() << tips;
if (m_controlState == GCS_CLIENT) {
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) {
return;
return false;
}
// fix: macos cant recv finished signel, timer is ok
@ -322,6 +321,8 @@ void Device::connectDevice()
params.stayAwake = m_params.stayAwake;
m_server->start(params);
});
return true;
}
void Device::disconnectDevice()

View file

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

View file

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