|
|
|
|
@ -8,33 +8,39 @@
|
|
|
|
|
#include <QMimeData>
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QShortcut>
|
|
|
|
|
#include <QWindow>
|
|
|
|
|
#include <QScreen>
|
|
|
|
|
|
|
|
|
|
#include "videoform.h"
|
|
|
|
|
#include "qyuvopenglwidget.h"
|
|
|
|
|
#include "mousetap/mousetap.h"
|
|
|
|
|
#include "ui_videoform.h"
|
|
|
|
|
#include "iconhelper.h"
|
|
|
|
|
#include "toolform.h"
|
|
|
|
|
#include "device.h"
|
|
|
|
|
#include "controller.h"
|
|
|
|
|
#include "filehandler.h"
|
|
|
|
|
#include "config.h"
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#include "libavutil/frame.h"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VideoForm::VideoForm(bool skin, QWidget *parent)
|
|
|
|
|
VideoForm::VideoForm(bool framelessWindow, bool skin, QWidget *parent)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
, ui(new Ui::videoForm)
|
|
|
|
|
, m_skin(skin)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
initUI();
|
|
|
|
|
installShortcut();
|
|
|
|
|
updateShowSize(size());
|
|
|
|
|
bool vertical = size().height() > size().width();
|
|
|
|
|
if (m_skin) {
|
|
|
|
|
updateStyleSheet(vertical);
|
|
|
|
|
}
|
|
|
|
|
if (framelessWindow) {
|
|
|
|
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VideoForm::~VideoForm()
|
|
|
|
|
@ -70,13 +76,47 @@ void VideoForm::initUI()
|
|
|
|
|
ui->keepRadioWidget->setMouseTracking(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::onGrabCursor(bool grab)
|
|
|
|
|
QRect VideoForm::getGrabCursorRect()
|
|
|
|
|
{
|
|
|
|
|
#if defined(Q_OS_WIN32) || defined(Q_OS_OSX)
|
|
|
|
|
MouseTap::getInstance()->enableMouseEventTap(m_videoWidget, grab);
|
|
|
|
|
QRect rc;
|
|
|
|
|
#if defined(Q_OS_WIN32)
|
|
|
|
|
rc = QRect(m_videoWidget->mapToGlobal(m_videoWidget->pos())
|
|
|
|
|
, m_videoWidget->size());
|
|
|
|
|
// high dpi support
|
|
|
|
|
rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio());
|
|
|
|
|
rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio());
|
|
|
|
|
#elif defined(Q_OS_OSX)
|
|
|
|
|
rc = m_videoWidget->geometry();
|
|
|
|
|
rc.setTopLeft(m_videoWidget->mapToGlobal(rc.topLeft()));
|
|
|
|
|
rc.setBottomRight(m_videoWidget->mapToGlobal(rc.bottomRight()));
|
|
|
|
|
rc.setX(rc.x() + 100);
|
|
|
|
|
rc.setY(rc.y() + 30);
|
|
|
|
|
rc.setWidth(rc.width() - 180);
|
|
|
|
|
rc.setHeight(rc.height() - 60);
|
|
|
|
|
#else
|
|
|
|
|
Q_UNUSED(grab)
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QSize &VideoForm::frameSize()
|
|
|
|
|
{
|
|
|
|
|
return m_frameSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::resizeSquare()
|
|
|
|
|
{
|
|
|
|
|
QRect screenRect = getScreenRect();
|
|
|
|
|
if (screenRect.isEmpty()) {
|
|
|
|
|
qWarning() << "getScreenRect is empty";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
resize(screenRect.height(), screenRect.height());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::removeBlackRect()
|
|
|
|
|
{
|
|
|
|
|
resize(ui->keepRadioWidget->goodSize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::updateRender(const AVFrame *frame)
|
|
|
|
|
@ -98,7 +138,7 @@ void VideoForm::showToolForm(bool show)
|
|
|
|
|
{
|
|
|
|
|
if (!m_toolForm) {
|
|
|
|
|
m_toolForm = new ToolForm(this, ToolForm::AP_OUTSIDE_RIGHT);
|
|
|
|
|
connect(m_toolForm, &ToolForm::screenshot, this, &VideoForm::screenshot);
|
|
|
|
|
m_toolForm->setDevice(m_device);
|
|
|
|
|
}
|
|
|
|
|
m_toolForm->move(pos().x() + geometry().width(), pos().y() + 30);
|
|
|
|
|
m_toolForm->setVisible(show);
|
|
|
|
|
@ -106,16 +146,178 @@ void VideoForm::showToolForm(bool show)
|
|
|
|
|
|
|
|
|
|
void VideoForm::moveCenter()
|
|
|
|
|
{
|
|
|
|
|
QDesktopWidget* desktop = QApplication::desktop();
|
|
|
|
|
if (!desktop) {
|
|
|
|
|
qWarning() << "QApplication::desktop() is nullptr";
|
|
|
|
|
QRect screenRect = getScreenRect();
|
|
|
|
|
if (screenRect.isEmpty()) {
|
|
|
|
|
qWarning() << "getScreenRect is empty";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QRect screenRect = desktop->availableGeometry();
|
|
|
|
|
// 窗口居中
|
|
|
|
|
move(screenRect.center() - QRect(0, 0, size().width(), size().height()).center());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::installShortcut()
|
|
|
|
|
{
|
|
|
|
|
QShortcut *shortcut = nullptr;
|
|
|
|
|
|
|
|
|
|
// switchFullScreen
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+f"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->switchFullScreen();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// resizeSquare
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+g"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
resizeSquare();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// removeBlackRect
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+x"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
removeBlackRect();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// postGoHome
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+h"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->postGoHome();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// postGoBack
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+b"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->postGoBack();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// postAppSwitch
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+s"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->postAppSwitch();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// postGoMenu
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+m"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->postGoMenu();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// postVolumeUp
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+up"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->postVolumeUp();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// postVolumeDown
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+down"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->postVolumeDown();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// postPower
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+p"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->postPower();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// setScreenPowerMode(ControlMsg::SPM_OFF)
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+o"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->setScreenPowerMode(ControlMsg::SPM_OFF);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// expandNotificationPanel
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+n"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->expandNotificationPanel();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// collapseNotificationPanel
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+Shift+n"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->collapseNotificationPanel();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// requestDeviceClipboard
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+c"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->requestDeviceClipboard();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// clipboardPaste
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+v"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->clipboardPaste();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// setDeviceClipboard
|
|
|
|
|
shortcut = new QShortcut(QKeySequence("Ctrl+Shift+v"), this);
|
|
|
|
|
connect(shortcut, &QShortcut::activated, this, [this](){
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
emit m_device->setDeviceClipboard();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QRect VideoForm::getScreenRect()
|
|
|
|
|
{
|
|
|
|
|
QRect screenRect;
|
|
|
|
|
QWidget *win = window();
|
|
|
|
|
if (!win) {
|
|
|
|
|
return screenRect;
|
|
|
|
|
}
|
|
|
|
|
QWindow *winHandle = win->windowHandle();
|
|
|
|
|
if (!winHandle) {
|
|
|
|
|
return screenRect;
|
|
|
|
|
}
|
|
|
|
|
QScreen *screen = winHandle->screen();
|
|
|
|
|
if (!screen) {
|
|
|
|
|
return screenRect;
|
|
|
|
|
}
|
|
|
|
|
screenRect = screen->availableGeometry();
|
|
|
|
|
return screenRect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::updateStyleSheet(bool vertical)
|
|
|
|
|
{
|
|
|
|
|
if (vertical) {
|
|
|
|
|
@ -157,12 +359,11 @@ void VideoForm::updateShowSize(const QSize &newSize)
|
|
|
|
|
|
|
|
|
|
bool vertical = m_widthHeightRatio < 1.0f ? true : false;
|
|
|
|
|
QSize showSize = newSize;
|
|
|
|
|
QDesktopWidget* desktop = QApplication::desktop();
|
|
|
|
|
if (!desktop) {
|
|
|
|
|
qWarning() << "QApplication::desktop() is nullptr";
|
|
|
|
|
QRect screenRect = getScreenRect();
|
|
|
|
|
if (screenRect.isEmpty()) {
|
|
|
|
|
qWarning() << "getScreenRect is empty";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QRect screenRect = desktop->availableGeometry();
|
|
|
|
|
if (vertical) {
|
|
|
|
|
showSize.setHeight(qMin(newSize.height(), screenRect.height() - 200));
|
|
|
|
|
showSize.setWidth(showSize.height() * m_widthHeightRatio);
|
|
|
|
|
@ -171,8 +372,8 @@ void VideoForm::updateShowSize(const QSize &newSize)
|
|
|
|
|
showSize.setHeight(showSize.width() / m_widthHeightRatio);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isFullScreen()) {
|
|
|
|
|
switchFullScreen();
|
|
|
|
|
if (isFullScreen() && m_device) {
|
|
|
|
|
emit m_device->switchFullScreen();
|
|
|
|
|
}
|
|
|
|
|
if (m_skin) {
|
|
|
|
|
QMargins m = getMargins(vertical);
|
|
|
|
|
@ -190,7 +391,7 @@ void VideoForm::updateShowSize(const QSize &newSize)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::switchFullScreen()
|
|
|
|
|
void VideoForm::onSwitchFullScreen()
|
|
|
|
|
{
|
|
|
|
|
if (isFullScreen()) {
|
|
|
|
|
// 横屏全屏铺满全屏,恢复时,恢复保持宽高比
|
|
|
|
|
@ -253,39 +454,25 @@ void VideoForm::staysOnTop(bool top)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Controller *VideoForm::getController()
|
|
|
|
|
void VideoForm::setDevice(Device *device)
|
|
|
|
|
{
|
|
|
|
|
return m_controller;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::setFileHandler(FileHandler *fileHandler)
|
|
|
|
|
{
|
|
|
|
|
m_fileHandler = fileHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::setSerial(const QString &serial)
|
|
|
|
|
{
|
|
|
|
|
m_serial = serial;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QString &VideoForm::getSerial()
|
|
|
|
|
{
|
|
|
|
|
return m_serial;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::setController(Controller *controller)
|
|
|
|
|
{
|
|
|
|
|
m_controller = controller;
|
|
|
|
|
m_device = device;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->button() == Qt::MiddleButton) {
|
|
|
|
|
if (m_device) {
|
|
|
|
|
emit m_device->postGoHome();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_videoWidget->geometry().contains(event->pos())) {
|
|
|
|
|
if (!m_controller) {
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
event->setLocalPos(m_videoWidget->mapFrom(this, event->localPos().toPoint()));
|
|
|
|
|
m_controller->mouseEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
emit m_device->mouseEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
} else {
|
|
|
|
|
if (event->button() == Qt::LeftButton) {
|
|
|
|
|
m_dragPosition = event->globalPos() - frameGeometry().topLeft();
|
|
|
|
|
@ -297,7 +484,7 @@ void VideoForm::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
void VideoForm::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (m_dragPosition.isNull()) {
|
|
|
|
|
if (!m_controller) {
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
event->setLocalPos(m_videoWidget->mapFrom(this, event->localPos().toPoint()));
|
|
|
|
|
@ -316,7 +503,7 @@ void VideoForm::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
|
local.setY(m_videoWidget->height());
|
|
|
|
|
}
|
|
|
|
|
event->setLocalPos(local);
|
|
|
|
|
m_controller->mouseEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
emit m_device->mouseEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
} else {
|
|
|
|
|
m_dragPosition = QPoint(0, 0);
|
|
|
|
|
}
|
|
|
|
|
@ -325,11 +512,11 @@ void VideoForm::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
|
void VideoForm::mouseMoveEvent(QMouseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (m_videoWidget->geometry().contains(event->pos())) {
|
|
|
|
|
if (!m_controller) {
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
event->setLocalPos(m_videoWidget->mapFrom(this, event->localPos().toPoint()));
|
|
|
|
|
m_controller->mouseEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
emit m_device->mouseEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
} else if (!m_dragPosition.isNull()){
|
|
|
|
|
if (event->buttons() & Qt::LeftButton) {
|
|
|
|
|
move(event->globalPos() - m_dragPosition);
|
|
|
|
|
@ -338,10 +525,22 @@ void VideoForm::mouseMoveEvent(QMouseEvent *event)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::mouseDoubleClickEvent(QMouseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->button() == Qt::LeftButton
|
|
|
|
|
&& !m_videoWidget->geometry().contains(event->pos())) {
|
|
|
|
|
removeBlackRect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event->button() == Qt::RightButton && m_device) {
|
|
|
|
|
emit m_device->postBackOrScreenOn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::wheelEvent(QWheelEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (m_videoWidget->geometry().contains(event->pos())) {
|
|
|
|
|
if (!m_controller) {
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QPointF pos = m_videoWidget->mapFrom(this, event->pos());
|
|
|
|
|
@ -352,41 +551,30 @@ void VideoForm::wheelEvent(QWheelEvent *event)
|
|
|
|
|
*/
|
|
|
|
|
QWheelEvent wheelEvent(pos, event->globalPosF(), event->delta(),
|
|
|
|
|
event->buttons(), event->modifiers(), event->orientation());
|
|
|
|
|
m_controller->wheelEvent(&wheelEvent, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
emit m_device->wheelEvent(&wheelEvent, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::keyPressEvent(QKeyEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Qt::Key_Escape == event->key()
|
|
|
|
|
&& !event->isAutoRepeat()
|
|
|
|
|
&& isFullScreen()) {
|
|
|
|
|
switchFullScreen();
|
|
|
|
|
}
|
|
|
|
|
if (!m_controller) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (event->key() == Qt::Key_C && (event->modifiers() & Qt::ControlModifier)) {
|
|
|
|
|
m_controller->requestDeviceClipboard();
|
|
|
|
|
}
|
|
|
|
|
if (event->key() == Qt::Key_V && (event->modifiers() & Qt::ControlModifier)) {
|
|
|
|
|
if (event->modifiers() & Qt::ShiftModifier) {
|
|
|
|
|
m_controller->setDeviceClipboard();
|
|
|
|
|
} else {
|
|
|
|
|
m_controller->clipboardPaste();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
emit m_device->switchFullScreen();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_controller->keyEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
emit m_device->keyEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::keyReleaseEvent(QKeyEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!m_controller) {
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m_controller->keyEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
emit m_device->keyEvent(event, m_videoWidget->frameSize(), m_videoWidget->size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::paintEvent(QPaintEvent *paint)
|
|
|
|
|
@ -432,6 +620,15 @@ void VideoForm::resizeEvent(QResizeEvent *event)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::closeEvent(QCloseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(event)
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Config::getInstance().setRect(m_device->getSerial(), geometry());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoForm::dragEnterEvent(QDragEnterEvent *event)
|
|
|
|
|
{
|
|
|
|
|
event->acceptProposedAction();
|
|
|
|
|
@ -449,7 +646,7 @@ void VideoForm::dragLeaveEvent(QDragLeaveEvent *event)
|
|
|
|
|
|
|
|
|
|
void VideoForm::dropEvent(QDropEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!m_fileHandler) {
|
|
|
|
|
if (!m_device) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const QMimeData* qm = event->mimeData();
|
|
|
|
|
@ -462,8 +659,8 @@ void VideoForm::dropEvent(QDropEvent *event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fileInfo.isFile() && fileInfo.suffix() == "apk") {
|
|
|
|
|
m_fileHandler->installApkRequest(m_serial, file);
|
|
|
|
|
emit m_device->installApkRequest(m_device->getSerial(), file);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m_fileHandler->pushFileRequest(m_serial, file, Config::getInstance().getPushFilePath() + fileInfo.fileName());
|
|
|
|
|
emit m_device->pushFileRequest(m_device->getSerial(), file, Config::getInstance().getPushFilePath() + fileInfo.fileName());
|
|
|
|
|
}
|
|
|
|
|
|