Skip to content

Commit

Permalink
Merge pull request #159 from barry-ran/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
barry-ran authored May 6, 2020
2 parents 06e77ad + 79b4db3 commit 7987e08
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 16 deletions.
66 changes: 66 additions & 0 deletions QtScrcpy/device/controller/inputconvert/inputconvertnormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ AndroidKeycode InputConvertNormal::convertKeyCode(int key, Qt::KeyboardModifiers
keyCode = AKEYCODE_0;
break;
case Qt::Key_1:
case Qt::Key_Exclam:// !
keyCode = AKEYCODE_1;
break;
case Qt::Key_2:
Expand All @@ -288,15 +289,19 @@ AndroidKeycode InputConvertNormal::convertKeyCode(int key, Qt::KeyboardModifiers
keyCode = AKEYCODE_3;
break;
case Qt::Key_4:
case Qt::Key_Dollar://$
keyCode = AKEYCODE_4;
break;
case Qt::Key_5:
case Qt::Key_Percent:// %
keyCode = AKEYCODE_5;
break;
case Qt::Key_6:
case Qt::Key_AsciiCircum: //^
keyCode = AKEYCODE_6;
break;
case Qt::Key_7:
case Qt::Key_Ampersand: //&
keyCode = AKEYCODE_7;
break;
case Qt::Key_8:
Expand All @@ -308,6 +313,67 @@ AndroidKeycode InputConvertNormal::convertKeyCode(int key, Qt::KeyboardModifiers
case Qt::Key_Space:
keyCode = AKEYCODE_SPACE;
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;
}
Expand Down
15 changes: 9 additions & 6 deletions QtScrcpy/device/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,21 @@ void Device::initSignals()

// update ui
if (m_videoForm) {
// must be show before updateShowSize
m_videoForm->show();

m_videoForm->setWindowTitle(deviceName);
m_videoForm->updateShowSize(size);

bool deviceVer = size.height() > size.width();
QRect rc = Config::getInstance().getRect(getSerial());
if (rc.isValid()) {
m_videoForm->move(rc.topLeft());
bool rcVer = rc.height() > rc.width();
// same width/height rate
if (rc.isValid() && (deviceVer == rcVer)) {
// mark: resize is for fix setGeometry magneticwidget bug
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
Expand Down
6 changes: 3 additions & 3 deletions QtScrcpy/device/ui/videoform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ QRect VideoForm::getGrabCursorRect()
{
QRect rc;
#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
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.setTopLeft(ui->keepRadioWidget->mapToGlobal(rc.topLeft()));
rc.setBottomRight(ui->keepRadioWidget->mapToGlobal(rc.bottomRight()));
rc.setX(rc.x() + 100);
rc.setY(rc.y() + 30);
rc.setWidth(rc.width() - 180);
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,17 @@ For Windows, for simplicity, prebuilt archives with all the dependencies (includ

- [`QtScrcpy`][github-download]

or you can [build it by yourself](#Build)
or you can [build it by yourself](##Build)

### Mac OS
For Mac OS, for simplicity, prebuilt archives with all the dependencies (including adb) are available:

- [`QtScrcpy`][github-download]

or you can [build it by yourself](#Build)
or you can [build it by yourself](##Build)

### Linux
you can [build it by yourself](#Build)(just ubuntu test)
you can [build it by yourself](##Build)(just ubuntu test)


## Run
Expand Down Expand Up @@ -223,6 +223,12 @@ _²Right-click turns the screen on if it was off, presses BACK otherwise._
## DEVELOP
[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?
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
Expand All @@ -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)


## How to build
## Build
All the dependencies are provided and it is easy to compile.

### PC client
Expand Down
12 changes: 9 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Windows平台,你可以直接使用我编译好的可执行程序:
- [国内下载][gitee-download]
- [国外下载][github-download]

你也可以[自己编译](#如何编译)
你也可以[自己编译](##如何编译)

### Mac OS

Expand All @@ -117,13 +117,13 @@ Mac OS平台,你可以直接使用我编译好的可执行程序:
- [国内下载][gitee-download]
- [国外下载][github-download]

你也可以[自己编译](#如何编译)
你也可以[自己编译](##如何编译)

### Linux

目前只提供了windows和mac平台的可执行程序,如果需要linux平台的可执行程序,

您通常需要[自己编译](#如何编译)。别担心,这并不难。
您通常需要[自己编译](##如何编译)。别担心,这并不难。

目前只在ubuntu上测试过

Expand Down Expand Up @@ -222,6 +222,12 @@ Mac OS平台,你可以直接使用我编译好的可执行程序:
## 开发者
[开发者相关](docs/DEVELOP.md)

欢迎大家一起维护这个项目,贡献自己的代码,不过请遵循一下几点要求:
1. pr请提到dev分支,不要提到master分支
2. 提pr之前请先rebase dev
3. pr请以少量多次的原则提交(建议一个小的功能点提一个pr)
4. 代码风格请保持和已有风格一致

## 为什么开发QtScrcpy?
综合起来有以下几个原因,比重从大到小排列:
1. 学习Qt的过程中需要一个项目实战一下
Expand Down

0 comments on commit 7987e08

Please sign in to comment.