Merge pull request #159 from barry-ran/dev

Dev
This commit is contained in:
Barry 2020-05-06 16:53:39 +08:00 committed by GitHub
commit 7987e080f9
5 changed files with 97 additions and 16 deletions

View file

@ -279,6 +279,7 @@ AndroidKeycode InputConvertNormal::convertKeyCode(int key, Qt::KeyboardModifiers
keyCode = AKEYCODE_0; keyCode = AKEYCODE_0;
break; break;
case Qt::Key_1: case Qt::Key_1:
case Qt::Key_Exclam:// !
keyCode = AKEYCODE_1; keyCode = AKEYCODE_1;
break; break;
case Qt::Key_2: case Qt::Key_2:
@ -288,15 +289,19 @@ AndroidKeycode InputConvertNormal::convertKeyCode(int key, Qt::KeyboardModifiers
keyCode = AKEYCODE_3; keyCode = AKEYCODE_3;
break; break;
case Qt::Key_4: case Qt::Key_4:
case Qt::Key_Dollar://$
keyCode = AKEYCODE_4; keyCode = AKEYCODE_4;
break; break;
case Qt::Key_5: case Qt::Key_5:
case Qt::Key_Percent:// %
keyCode = AKEYCODE_5; keyCode = AKEYCODE_5;
break; break;
case Qt::Key_6: case Qt::Key_6:
case Qt::Key_AsciiCircum: //^
keyCode = AKEYCODE_6; keyCode = AKEYCODE_6;
break; break;
case Qt::Key_7: case Qt::Key_7:
case Qt::Key_Ampersand: //&
keyCode = AKEYCODE_7; keyCode = AKEYCODE_7;
break; break;
case Qt::Key_8: case Qt::Key_8:
@ -308,6 +313,67 @@ AndroidKeycode InputConvertNormal::convertKeyCode(int key, Qt::KeyboardModifiers
case Qt::Key_Space: case Qt::Key_Space:
keyCode = AKEYCODE_SPACE; keyCode = AKEYCODE_SPACE;
break; break;
case Qt::Key_Comma://,
case Qt::Key_Less://<
keyCode = AKEYCODE_COMMA;
break;
case Qt::Key_Period://.
case Qt::Key_Greater://>
keyCode = AKEYCODE_PERIOD;
break;
case Qt::Key_Minus://-
case Qt::Key_Underscore: //_
keyCode = AKEYCODE_MINUS;
break;
case Qt::Key_Equal://=
keyCode = AKEYCODE_EQUALS;
break;
case Qt::Key_BracketLeft://[
case Qt::Key_BraceLeft: //{
keyCode = AKEYCODE_LEFT_BRACKET;
break;
case Qt::Key_BracketRight://]
case Qt::Key_BraceRight: //}
keyCode = AKEYCODE_RIGHT_BRACKET;
break;
case Qt::Key_Backslash:// \ ????
case Qt::Key_Bar: //|
keyCode = AKEYCODE_BACKSLASH;
break;
case Qt::Key_Semicolon://;
case Qt::Key_Colon: //:
keyCode = AKEYCODE_SEMICOLON;
break;
case Qt::Key_Apostrophe://'
case Qt::Key_QuoteDbl: //"
keyCode = AKEYCODE_APOSTROPHE;
break;
case Qt::Key_Slash:// /
case Qt::Key_Question://?
keyCode = AKEYCODE_SLASH;
break;
case Qt::Key_At://@
keyCode = AKEYCODE_AT;
break;
case Qt::Key_Plus://+
keyCode = AKEYCODE_PLUS;
break;
case Qt::Key_QuoteLeft://`
case Qt::Key_AsciiTilde://~
keyCode = AKEYCODE_GRAVE;
break;
case Qt::Key_NumberSign: //#
keyCode = AKEYCODE_POUND;
break;
case Qt::Key_ParenLeft: //(
keyCode = AKEYCODE_NUMPAD_LEFT_PAREN;
break;
case Qt::Key_ParenRight: //)
keyCode = AKEYCODE_NUMPAD_RIGHT_PAREN;
break;
case Qt::Key_Asterisk: //*
keyCode = AKEYCODE_STAR;
break;
} }
return keyCode; return keyCode;
} }

View file

@ -215,18 +215,21 @@ void Device::initSignals()
// update ui // update ui
if (m_videoForm) { if (m_videoForm) {
// must be show before updateShowSize
m_videoForm->show();
m_videoForm->setWindowTitle(deviceName); m_videoForm->setWindowTitle(deviceName);
m_videoForm->updateShowSize(size); m_videoForm->updateShowSize(size);
bool deviceVer = size.height() > size.width();
QRect rc = Config::getInstance().getRect(getSerial()); QRect rc = Config::getInstance().getRect(getSerial());
if (rc.isValid()) { bool rcVer = rc.height() > rc.width();
m_videoForm->move(rc.topLeft()); // same width/height rate
if (rc.isValid() && (deviceVer == rcVer)) {
// mark: resize is for fix setGeometry magneticwidget bug
m_videoForm->resize(rc.size()); m_videoForm->resize(rc.size());
// TODO: setGeometry magneticwidget bug m_videoForm->setGeometry(rc);
//m_videoForm->setGeometry(rc);
} }
// videoForm delay show
m_videoForm->show();
} }
// init recorder // init recorder

View file

@ -88,14 +88,14 @@ QRect VideoForm::getGrabCursorRect()
{ {
QRect rc; QRect rc;
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
rc = QRect(m_videoWidget->mapToGlobal(m_videoWidget->pos()), m_videoWidget->size()); rc = QRect(ui->keepRadioWidget->mapToGlobal(m_videoWidget->pos()), m_videoWidget->size());
// high dpi support // high dpi support
rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio()); rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio());
rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio()); rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio());
#elif defined(Q_OS_OSX) #elif defined(Q_OS_OSX)
rc = m_videoWidget->geometry(); rc = m_videoWidget->geometry();
rc.setTopLeft(m_videoWidget->mapToGlobal(rc.topLeft())); rc.setTopLeft(ui->keepRadioWidget->mapToGlobal(rc.topLeft()));
rc.setBottomRight(m_videoWidget->mapToGlobal(rc.bottomRight())); rc.setBottomRight(ui->keepRadioWidget->mapToGlobal(rc.bottomRight()));
rc.setX(rc.x() + 100); rc.setX(rc.x() + 100);
rc.setY(rc.y() + 30); rc.setY(rc.y() + 30);
rc.setWidth(rc.width() - 180); rc.setWidth(rc.width() - 180);

View file

@ -110,17 +110,17 @@ For Windows, for simplicity, prebuilt archives with all the dependencies (includ
- [`QtScrcpy`][github-download] - [`QtScrcpy`][github-download]
or you can [build it by yourself](#Build) or you can [build it by yourself](##Build)
### Mac OS ### Mac OS
For Mac OS, for simplicity, prebuilt archives with all the dependencies (including adb) are available: For Mac OS, for simplicity, prebuilt archives with all the dependencies (including adb) are available:
- [`QtScrcpy`][github-download] - [`QtScrcpy`][github-download]
or you can [build it by yourself](#Build) or you can [build it by yourself](##Build)
### Linux ### Linux
you can [build it by yourself](#Build)(just ubuntu test) you can [build it by yourself](##Build)(just ubuntu test)
## Run ## Run
@ -223,6 +223,12 @@ _²Right-click turns the screen on if it was off, presses BACK otherwise._
## DEVELOP ## DEVELOP
[DEVELOP](docs/DEVELOP.md) [DEVELOP](docs/DEVELOP.md)
Everyone is welcome to maintain this project and contribute your own code, but please follow these requirements:
1. pr please mention the dev branch, not the master branch
2. Please rebase dev before mentioning pr
3. pr please submit on the principle of a small number of times (a small function point is recommended to mention a pr)
4. Please keep the code style consistent with the existing style
## Why develop QtScrcpy? ## Why develop QtScrcpy?
There are several reasons listed as below according to importance (high to low). There are several reasons listed as below according to importance (high to low).
1. In the process of learning Qt, I need a real project to try 1. In the process of learning Qt, I need a real project to try
@ -231,7 +237,7 @@ There are several reasons listed as below according to importance (high to low).
4. I found scrcpy and decided to re-make it with the new technology stack (C++ + Qt + Opengl + ffmpeg) 4. I found scrcpy and decided to re-make it with the new technology stack (C++ + Qt + Opengl + ffmpeg)
## How to build ## Build
All the dependencies are provided and it is easy to compile. All the dependencies are provided and it is easy to compile.
### PC client ### PC client

View file

@ -108,7 +108,7 @@ Windows平台你可以直接使用我编译好的可执行程序:
- [国内下载][gitee-download] - [国内下载][gitee-download]
- [国外下载][github-download] - [国外下载][github-download]
你也可以[自己编译](#如何编译) 你也可以[自己编译](##如何编译)
### Mac OS ### Mac OS
@ -117,13 +117,13 @@ Mac OS平台你可以直接使用我编译好的可执行程序:
- [国内下载][gitee-download] - [国内下载][gitee-download]
- [国外下载][github-download] - [国外下载][github-download]
你也可以[自己编译](#如何编译) 你也可以[自己编译](##如何编译)
### Linux ### Linux
目前只提供了windows和mac平台的可执行程序如果需要linux平台的可执行程序 目前只提供了windows和mac平台的可执行程序如果需要linux平台的可执行程序
您通常需要[自己编译](#如何编译)。别担心,这并不难。 您通常需要[自己编译](##如何编译)。别担心,这并不难。
目前只在ubuntu上测试过 目前只在ubuntu上测试过
@ -222,6 +222,12 @@ Mac OS平台你可以直接使用我编译好的可执行程序:
## 开发者 ## 开发者
[开发者相关](docs/DEVELOP.md) [开发者相关](docs/DEVELOP.md)
欢迎大家一起维护这个项目,贡献自己的代码,不过请遵循一下几点要求:
1. pr请提到dev分支不要提到master分支
2. 提pr之前请先rebase dev
3. pr请以少量多次的原则提交建议一个小的功能点提一个pr
4. 代码风格请保持和已有风格一致
## 为什么开发QtScrcpy ## 为什么开发QtScrcpy
综合起来有以下几个原因,比重从大到小排列: 综合起来有以下几个原因,比重从大到小排列:
1. 学习Qt的过程中需要一个项目实战一下 1. 学习Qt的过程中需要一个项目实战一下