mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 11:35:56 +00:00
fix: stays on top
This commit is contained in:
parent
285fb030a6
commit
906f49b451
3 changed files with 20 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue