mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 03:25:02 +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);
|
||||
}
|
||||
|
||||
bool Controller::isCurrentCustomKeymap()
|
||||
{
|
||||
if (!m_inputConvert) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_inputConvert->isCurrentCustomKeymap();
|
||||
}
|
||||
|
||||
void Controller::onPostBackOrScreenOn()
|
||||
{
|
||||
ControlMsg *controlMsg = new ControlMsg(ControlMsg::CMT_BACK_OR_SCREEN_ON);
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
void test(QRect rc);
|
||||
|
||||
void updateScript(QString gameScript = "");
|
||||
bool isCurrentCustomKeymap();
|
||||
|
||||
public slots:
|
||||
void onPostGoBack();
|
||||
|
|
|
@ -21,6 +21,10 @@ public:
|
|||
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 keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize) = 0;
|
||||
virtual bool isCurrentCustomKeymap()
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
signals:
|
||||
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)
|
||||
{
|
||||
m_keyMap.loadKeyMap(json);
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
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 keyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize);
|
||||
virtual bool isCurrentCustomKeymap();
|
||||
|
||||
void loadKeyMap(const QString &json);
|
||||
|
||||
|
|
|
@ -339,6 +339,14 @@ Device::GroupControlState Device::controlState()
|
|||
return m_controlState;
|
||||
}
|
||||
|
||||
bool Device::isCurrentCustomKeymap()
|
||||
{
|
||||
if (!m_controller) {
|
||||
return false;
|
||||
}
|
||||
return m_controller->isCurrentCustomKeymap();
|
||||
}
|
||||
|
||||
bool Device::saveFrame(const AVFrame *frame)
|
||||
{
|
||||
if (!frame) {
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
void updateScript(QString script);
|
||||
Device::GroupControlState controlState();
|
||||
|
||||
bool isCurrentCustomKeymap();
|
||||
|
||||
signals:
|
||||
void deviceDisconnect(QString serial);
|
||||
|
||||
|
|
|
@ -501,7 +501,7 @@ void VideoForm::setDevice(Device *device)
|
|||
void VideoForm::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::MiddleButton) {
|
||||
if (m_device) {
|
||||
if (m_device && !m_device->isCurrentCustomKeymap()) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ void VideoForm::dropEvent(QDropEvent *event)
|
|||
const QMimeData *qm = event->mimeData();
|
||||
QList<QUrl> urls = qm->urls();
|
||||
|
||||
for (const QUrl& url : urls) {
|
||||
for (const QUrl &url : urls) {
|
||||
QString file = url.toLocalFile();
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue