fix: stays on top

This commit is contained in:
rankun 2020-02-01 13:08:07 +08:00
parent 285fb030a6
commit 906f49b451
3 changed files with 20 additions and 5 deletions

View file

@ -2,6 +2,7 @@
#include "devicemanage.h"
#include "server.h"
#include "videoform.h"
#define DM_MAX_DEVICES_NUM 16
@ -62,6 +63,21 @@ void DeviceManage::updateScript(QString script)
}
}
bool DeviceManage::staysOnTop(const QString &serial)
{
if (!serial.isEmpty() && m_devices.contains(serial)) {
auto it = m_devices.find(serial);
if (!it->data()) {
return false;
}
if (!it->data()->getVideoForm()) {
return false;
}
it->data()->getVideoForm()->staysOnTop();
}
return true;
}
bool DeviceManage::disconnectDevice(const QString &serial)
{
bool ret = false;

View file

@ -15,6 +15,7 @@ public:
bool connectDevice(Device::DeviceParams params);
void updateScript(QString script);
bool staysOnTop(const QString &serial);
bool disconnectDevice(const QString &serial);
void disconnectAllDevice();

View file

@ -166,11 +166,9 @@ void Dialog::on_startServerBtn_clicked()
m_deviceManage.connectDevice(params);
/*
if (ui->alwaysTopCheck->isChecked() && m_device->getVideoForm()) {
m_device->getVideoForm()->staysOnTop();
}
*/
if (ui->alwaysTopCheck->isChecked()) {
m_deviceManage.staysOnTop(params.serial);
}
}
void Dialog::on_stopServerBtn_clicked()