mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-04 06:38:39 +00:00
parent
2ba002f269
commit
6fb3e1c0f3
8 changed files with 33 additions and 3 deletions
|
@ -56,6 +56,15 @@ void Controller::updateScript(QString gameScript)
|
||||||
connect(m_inputConvert, &InputConvertBase::grabCursor, this, &Controller::grabCursor);
|
connect(m_inputConvert, &InputConvertBase::grabCursor, this, &Controller::grabCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Controller::isCurrentCustomKeymap()
|
||||||
|
{
|
||||||
|
if (!m_inputConvert) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_inputConvert->isCurrentCustomKeymap();
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::onPostBackOrScreenOn()
|
void Controller::onPostBackOrScreenOn()
|
||||||
{
|
{
|
||||||
ControlMsg *controlMsg = new ControlMsg(ControlMsg::CMT_BACK_OR_SCREEN_ON);
|
ControlMsg *controlMsg = new ControlMsg(ControlMsg::CMT_BACK_OR_SCREEN_ON);
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
void test(QRect rc);
|
void test(QRect rc);
|
||||||
|
|
||||||
void updateScript(QString gameScript = "");
|
void updateScript(QString gameScript = "");
|
||||||
|
bool isCurrentCustomKeymap();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onPostGoBack();
|
void onPostGoBack();
|
||||||
|
|
|
@ -21,6 +21,10 @@ public:
|
||||||
virtual void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize) = 0;
|
virtual void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize) = 0;
|
||||||
virtual void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize) = 0;
|
virtual void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize) = 0;
|
||||||
virtual void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize) = 0;
|
virtual void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize) = 0;
|
||||||
|
virtual bool isCurrentCustomKeymap()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void grabCursor(bool grab);
|
void grabCursor(bool grab);
|
||||||
|
|
|
@ -124,6 +124,11 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize &frameSize, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InputConvertGame::isCurrentCustomKeymap()
|
||||||
|
{
|
||||||
|
return m_gameMap;
|
||||||
|
}
|
||||||
|
|
||||||
void InputConvertGame::loadKeyMap(const QString &json)
|
void InputConvertGame::loadKeyMap(const QString &json)
|
||||||
{
|
{
|
||||||
m_keyMap.loadKeyMap(json);
|
m_keyMap.loadKeyMap(json);
|
||||||
|
|
|
@ -17,6 +17,7 @@ public:
|
||||||
virtual void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize);
|
virtual void mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize);
|
||||||
virtual void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize);
|
virtual void wheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize);
|
||||||
virtual void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize);
|
virtual void keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize);
|
||||||
|
virtual bool isCurrentCustomKeymap();
|
||||||
|
|
||||||
void loadKeyMap(const QString &json);
|
void loadKeyMap(const QString &json);
|
||||||
|
|
||||||
|
|
|
@ -339,6 +339,14 @@ Device::GroupControlState Device::controlState()
|
||||||
return m_controlState;
|
return m_controlState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::isCurrentCustomKeymap()
|
||||||
|
{
|
||||||
|
if (!m_controller) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_controller->isCurrentCustomKeymap();
|
||||||
|
}
|
||||||
|
|
||||||
bool Device::saveFrame(const AVFrame *frame)
|
bool Device::saveFrame(const AVFrame *frame)
|
||||||
{
|
{
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
void updateScript(QString script);
|
void updateScript(QString script);
|
||||||
Device::GroupControlState controlState();
|
Device::GroupControlState controlState();
|
||||||
|
|
||||||
|
bool isCurrentCustomKeymap();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void deviceDisconnect(QString serial);
|
void deviceDisconnect(QString serial);
|
||||||
|
|
||||||
|
|
|
@ -501,7 +501,7 @@ void VideoForm::setDevice(Device *device)
|
||||||
void VideoForm::mousePressEvent(QMouseEvent *event)
|
void VideoForm::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::MiddleButton) {
|
if (event->button() == Qt::MiddleButton) {
|
||||||
if (m_device) {
|
if (m_device && !m_device->isCurrentCustomKeymap()) {
|
||||||
emit m_device->postGoHome();
|
emit m_device->postGoHome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,7 @@ void VideoForm::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->button() == Qt::RightButton && m_device) {
|
if (event->button() == Qt::RightButton && m_device && !m_device->isCurrentCustomKeymap()) {
|
||||||
emit m_device->postBackOrScreenOn();
|
emit m_device->postBackOrScreenOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue