diff --git a/QtScrcpy/device/controller/controller.cpp b/QtScrcpy/device/controller/controller.cpp
index 5940385..59e7fa4 100644
--- a/QtScrcpy/device/controller/controller.cpp
+++ b/QtScrcpy/device/controller/controller.cpp
@@ -51,6 +51,18 @@ void Controller::test(QRect rc)
postControlMsg(controlMsg);
}
+void Controller::updateScript(QString gameScript)
+{
+ if (!gameScript.isEmpty()) {
+ InputConvertGame* convertgame = new InputConvertGame(this);
+ convertgame->loadKeyMap(gameScript);
+ m_inputConvert = convertgame;
+ } else {
+ m_inputConvert = new InputConvertNormal(this);
+ }
+
+}
+
void Controller::postTurnOn()
{
ControlMsg* controlMsg = new ControlMsg(ControlMsg::CMT_BACK_OR_SCREEN_ON);
@@ -161,6 +173,12 @@ void Controller::setScreenPowerMode(ControlMsg::ScreenPowerMode mode)
postControlMsg(controlMsg);
}
+void Controller::screenShot()
+{
+ // TODO:
+ qDebug() << "screen shot";
+}
+
void Controller::mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize)
{
if (m_inputConvert) {
diff --git a/QtScrcpy/device/controller/controller.h b/QtScrcpy/device/controller/controller.h
index 6380b1e..14550ba 100644
--- a/QtScrcpy/device/controller/controller.h
+++ b/QtScrcpy/device/controller/controller.h
@@ -20,6 +20,8 @@ public:
void postControlMsg(ControlMsg* controlMsg);
void test(QRect rc);
+ void updateScript(QString gameScript = "");
+
// turn the screen on if it was off, press BACK otherwise
void postTurnOn();
void postGoHome();
@@ -36,6 +38,7 @@ public:
void clipboardPaste();
void postTextInput(QString& text);
void setScreenPowerMode(ControlMsg::ScreenPowerMode mode);
+ void screenShot();
// for input convert
void mouseEvent(const QMouseEvent* from, const QSize& frameSize, const QSize& showSize);
diff --git a/QtScrcpy/device/device.cpp b/QtScrcpy/device/device.cpp
index 5567f45..af2b816 100644
--- a/QtScrcpy/device/device.cpp
+++ b/QtScrcpy/device/device.cpp
@@ -90,6 +90,13 @@ Server *Device::getServer()
return m_server;
}
+void Device::updateScript(QString script)
+{
+ if(m_controller){
+ m_controller->updateScript(script);
+ }
+}
+
void Device::initSignals()
{
if (m_controller && m_videoForm) {
diff --git a/QtScrcpy/device/device.h b/QtScrcpy/device/device.h
index 4fff0d0..e39a528 100644
--- a/QtScrcpy/device/device.h
+++ b/QtScrcpy/device/device.h
@@ -34,6 +34,8 @@ public:
Controller *getController();
Server *getServer();
+ void updateScript(QString script);
+
signals:
void deviceDisconnect(QString serial);
diff --git a/QtScrcpy/device/ui/toolform.cpp b/QtScrcpy/device/ui/toolform.cpp
index b8190bd..b8924dd 100644
--- a/QtScrcpy/device/ui/toolform.cpp
+++ b/QtScrcpy/device/ui/toolform.cpp
@@ -40,6 +40,7 @@ void ToolForm::initStyle()
IconHelper::Instance()->SetIcon(ui->closeScreenBtn, QChar(0xf070), 15);
IconHelper::Instance()->SetIcon(ui->powerBtn, QChar(0xf011), 15);
IconHelper::Instance()->SetIcon(ui->expandNotifyBtn, QChar(0xf103), 15);
+ IconHelper::Instance()->SetIcon(ui->screenShotBtn, QChar(0xf05b), 15);
}
void ToolForm::mousePressEvent(QMouseEvent *event)
@@ -115,6 +116,13 @@ void ToolForm::on_powerBtn_clicked()
}
}
+void ToolForm::on_screenShotBtn_clicked()
+{
+ if (m_videoForm && m_videoForm->getController()) {
+ m_videoForm->getController()->screenShot();
+ }
+}
+
void ToolForm::on_volumeUpBtn_clicked()
{
if (m_videoForm && m_videoForm->getController()) {
diff --git a/QtScrcpy/device/ui/toolform.h b/QtScrcpy/device/ui/toolform.h
index 78baa82..01e18bf 100644
--- a/QtScrcpy/device/ui/toolform.h
+++ b/QtScrcpy/device/ui/toolform.h
@@ -40,6 +40,8 @@ private slots:
void on_powerBtn_clicked();
+ void on_screenShotBtn_clicked();
+
void on_volumeUpBtn_clicked();
void on_volumeDownBtn_clicked();
diff --git a/QtScrcpy/device/ui/toolform.ui b/QtScrcpy/device/ui/toolform.ui
index 865db5f..4676beb 100644
--- a/QtScrcpy/device/ui/toolform.ui
+++ b/QtScrcpy/device/ui/toolform.ui
@@ -7,7 +7,7 @@
0
0
63
- 497
+ 537
@@ -133,6 +133,16 @@
+ -
+
+
+ screen shot
+
+
+
+
+
+
diff --git a/QtScrcpy/devicemanage/devicemanage.cpp b/QtScrcpy/devicemanage/devicemanage.cpp
index 476edbf..840c7bd 100644
--- a/QtScrcpy/devicemanage/devicemanage.cpp
+++ b/QtScrcpy/devicemanage/devicemanage.cpp
@@ -47,6 +47,17 @@ bool DeviceManage::connectDevice(Device::DeviceParams params)
return true;
}
+void DeviceManage::updateScript(QString script)
+{
+ QMapIterator> i(m_devices);
+ while (i.hasNext()) {
+ i.next();
+ if (i.value()) {
+ i.value()->updateScript(script);
+ }
+ }
+}
+
bool DeviceManage::disconnectDevice(const QString &serial)
{
bool ret = false;
diff --git a/QtScrcpy/devicemanage/devicemanage.h b/QtScrcpy/devicemanage/devicemanage.h
index ddcbd1f..09b9c7e 100644
--- a/QtScrcpy/devicemanage/devicemanage.h
+++ b/QtScrcpy/devicemanage/devicemanage.h
@@ -14,6 +14,8 @@ public:
virtual ~DeviceManage();
bool connectDevice(Device::DeviceParams params);
+ void updateScript(QString script);
+
bool disconnectDevice(const QString &serial);
void disconnectAllDevice();
diff --git a/QtScrcpy/dialog.cpp b/QtScrcpy/dialog.cpp
index c8b6e69..72622c8 100644
--- a/QtScrcpy/dialog.cpp
+++ b/QtScrcpy/dialog.cpp
@@ -309,7 +309,7 @@ void Dialog::on_stopAllServerBtn_clicked()
m_deviceManage.disconnectAllDevice();
}
-void Dialog::on_updateGameScriptBtn_clicked()
+void Dialog::on_refreshGameScriptBtn_clicked()
{
ui->gameBox->clear();
QDir dir(KeyMap::getKeyMapPath());
@@ -327,9 +327,14 @@ void Dialog::on_updateGameScriptBtn_clicked()
}
}
+void Dialog::on_applyScriptBtn_clicked()
+{
+ m_deviceManage.updateScript(getGameScript(ui->gameBox->currentText()));
+}
+
void Dialog::on_gameCheck_clicked(bool checked)
{
if (checked) {
- on_updateGameScriptBtn_clicked();
+ on_refreshGameScriptBtn_clicked();
}
}
diff --git a/QtScrcpy/dialog.h b/QtScrcpy/dialog.h
index 23a471b..7f58fa8 100644
--- a/QtScrcpy/dialog.h
+++ b/QtScrcpy/dialog.h
@@ -49,7 +49,8 @@ private slots:
void on_stopAllServerBtn_clicked();
- void on_updateGameScriptBtn_clicked();
+ void on_refreshGameScriptBtn_clicked();
+ void on_applyScriptBtn_clicked();
void on_gameCheck_clicked(bool checked);
private:
diff --git a/QtScrcpy/dialog.ui b/QtScrcpy/dialog.ui
index 53d449b..cdba9d7 100644
--- a/QtScrcpy/dialog.ui
+++ b/QtScrcpy/dialog.ui
@@ -7,7 +7,7 @@
0
0
600
- 637
+ 723
@@ -101,8 +101,37 @@
Wireless
-
- -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ connect
+
+
+ false
+
+
+
+ -
+
+
+
+
+
+ 128
+
+
+ 192.168.0.1
+
+
+
+ -
@@ -121,40 +150,29 @@
- -
+
-
+
+ 6
+
5555
- -
-
-
-
-
-
- 192.168.0.1
-
-
-
- -
-
-
- wireless connect
-
-
- false
-
-
-
- -
+
-
+
+
+ 0
+ 0
+
+
- wireless disconnect
+ disconnect
false
@@ -236,23 +254,6 @@
Start Config
-
-
-
-
- bit rate:
-
-
-
- -
-
-
- not display
-
-
- false
-
-
-
-
@@ -263,28 +264,36 @@
- -
-
+
-
+
- always top
+ select path
-
+
false
- -
-
+
-
+
- use reverse
-
-
- true
+ record format:
- -
-
+
-
+
+
+ custom map
+
+
+
+ -
+
+
+
+
+
-
@@ -296,78 +305,105 @@
- -
-
+
-
+
+
+ -
+
- video size:
+ apply
- -
-
+
-
+
- close screen
+ refresh script
- -
+
-
+
+
+
+ 0
+ 0
+
+
+
+ reverse connection
+
+
+ true
+
+
+
+ -
+
+
+ bit rate:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ background
+
+
+ false
+
+
+
+ -
true
- -
-
-
-
-
-
-
- -
-
-
- select path
-
-
- false
-
-
-
- -
-
-
- record format:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
+
-
- -
-
+
-
+
- update script
+ video size:
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
- custom map
+ auto screen-off
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ always on top
+
+
+ false
@@ -378,6 +414,16 @@
+ bitRateBox
+ formatBox
+ recordPathEdt
+ selectRecordPathBtn
+ gameBox
+ refreshGameScriptBtn
+ serialBox
+ startServerBtn
+ stopServerBtn
+ stopAllServerBtn
updateDevice
getIPBtn
startAdbdBtn
@@ -387,13 +433,8 @@
wirelessDisConnectBtn
adbCommandEdt
adbCommandBtn
- formatBox
- recordPathEdt
- selectRecordPathBtn
- serialBox
- startServerBtn
- stopServerBtn
- outEdit
+ stopAdbBtn
+ clearOut
diff --git a/QtScrcpy/res/i18n/QtScrcpy_en.ts b/QtScrcpy/res/i18n/QtScrcpy_en.ts
index a5820d1..d7e1b49 100644
--- a/QtScrcpy/res/i18n/QtScrcpy_en.ts
+++ b/QtScrcpy/res/i18n/QtScrcpy_en.ts
@@ -90,8 +90,8 @@
- not display
- not display
+ background
+ background
@@ -120,8 +120,8 @@
- always top
- always top
+ always on top
+ always on top
@@ -135,8 +135,8 @@
- update script
- update script
+ refresh script
+ refresh script
diff --git a/QtScrcpy/res/i18n/QtScrcpy_zh.ts b/QtScrcpy/res/i18n/QtScrcpy_zh.ts
index 5a4fe1b..c219d46 100644
--- a/QtScrcpy/res/i18n/QtScrcpy_zh.ts
+++ b/QtScrcpy/res/i18n/QtScrcpy_zh.ts
@@ -90,7 +90,7 @@
- not display
+ background
仅后台录制
@@ -120,7 +120,7 @@
- always top
+ always on top
窗口置顶
@@ -130,13 +130,13 @@
- close screen
+ auto screen-off
自动息屏
- update script
- 更新脚本
+ refresh script
+ 刷新脚本