Skip to content

Commit

Permalink
Tag for alpha version 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdi-cpp committed Apr 4, 2023
1 parent 0cf7afd commit 793c076
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 84 deletions.
37 changes: 7 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
# QmlScrcpy
## QmlScrcpy

This application show content android screen (video) connected via USB or over Wi-Fi.
and allows to control the device with the keyboard and the mouse of the computer. It does not require any root access. It works on Linux, Windows and macOS.
and allows to control the device with the keyboard and the mouse of the computer. It does not require any root access.
It works on Linux.

It focuses on:
[Here is a video show how qmlscrcpy work](https://qmlscrcpy.s3.ir-thr-at1.arvanstorage.ir/QmlScrcpy-V0.0.1-alpha.mp4)

### lightness: native, displays only the device screen
* performance: 30~120fps, depending on the device
* quality: 1920×1080 or above
* low latency: 35~70ms
* low startup time: ~1 second to display the first image
* non-intrusiveness: nothing is left installed on the Android device
* user benefits: no account, no ads, no internet required
* freedom: free and open source software

## Qmlscrcpy Project:

This application mirrors Android devices (video) connected via USB or Wi-Fi, and allows to control the device with the keyboard and the mouse of the computer. It does not require any root access. It works on Linux

Android Application

Qt Application

### scrcpy vs QmlScrcpy

Expand All @@ -38,14 +23,12 @@ Qt Application
* quality: 1920×1080 or above
* low latency: 35~70ms
* low startup time: ~1 second to display the first image
* non-intrusiveness: nothing is left installed on the Android device
* user benefits: no account, no ads, no internet required
* freedom: free and open source software

#### Qml Benefits

### Qml Benefits
* You can embed [scrcpy](https://github.com/Genymobile/scrcpy) inside your qml project
* Screen buffers are render by native OpenGl inside Qml, No requirement to external library similar GStreamer or LibVlc
* You Can Use Animation, Scale, Rotation
* You can use Animation, Scale, Rotation , ReSize and ... similar other qml componnets.


## Requirements
Expand Down Expand Up @@ -95,9 +78,3 @@ Add Qt5.10.1 path to cmake
</a>
</div>





## Test
* Test
41 changes: 29 additions & 12 deletions res/qml/components/MirrorApp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import QtQuick.Layouts 1.0

Rectangle {
id: root
x: 80
y: 200
width: 800
height: 400
x: 550
y: 20
width: 400
height: 600
color: "#fff"
visible: false
radius: 7
Expand Down Expand Up @@ -45,17 +45,25 @@ Rectangle {
}
}

Image {
x: 10
y: 10
source: "../../icons/usb_plug.svg"
width: 30
height: 30
}

Text {
width: 200
text: "Mirror Application"
font.pointSize: 12
color: "#444"
x: 20
x: 50
y: 15
}

Image {
x: parent.width - 40
x: root.width - 40
y: 10
source: "../../icons/close_black.svg"
width: 30
Expand All @@ -80,10 +88,10 @@ Rectangle {
Rectangle {
//no device view
id: no_device_view
width: 400
x: 200
width: 360
x: 20
y: 100
height: 100
height: 200
color: "#eee"
radius: 10
Text {
Expand All @@ -94,20 +102,29 @@ Rectangle {
y: 20
horizontalAlignment: Text.AlignHCenter
}

Text {
width: parent.width
text: "Please connect android phone by USB cable"
text: "Please connect android phone "
font.pointSize: 12
color: "#000"
y: 60
y: 75
horizontalAlignment: Text.AlignHCenter
}
Text {
width: parent.width
text: "by USB cable"
font.pointSize: 12
color: "#000"
y: 105
horizontalAlignment: Text.AlignHCenter
}
}

Rectangle {
//button
id: button_start_mirror
x: 325
x: 125
y: 100
width: 150
height: 200
Expand Down
4 changes: 2 additions & 2 deletions res/qml/components/ToolBarApps.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Item {
id: root
width: 600
height: 74
x: 600
y: 40
x: 700
y: 670
signal select(string icon)

GridLayout {
Expand Down
4 changes: 2 additions & 2 deletions res/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Item {

Music {
id: music
x: 950
y: 10
x: 1030
y: 20
ScaleAnimator {
id: animation_show
target: music
Expand Down
2 changes: 1 addition & 1 deletion ui/service/ResourceService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void ResourceService::setLandscapeSize(QSize size) {

void ResourceService::setUsbMirrorParametre() {
mirror->username = "USB Mirror";
mirror->title = "screen mirror by usb connection";
mirror->title = "screen is mirroring by USB";
mirror->bitrate = "2 Mbit";
mirror->resolution = "Full HD";
mirror->connectionType = "USB";
Expand Down
43 changes: 6 additions & 37 deletions ui/service/WebSocketService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,8 @@ void WebSocketService::onNewConnection() {
qDebug() << "WebSocket: onNewConnection:" << pSocket->peerAddress();

m_clients << pSocket;

// Send Current Status
//pSocket->sendTextMessage(resourceService->getStateJson());

}

//void WebSocketService::textMessageReceived(QString jsonString) {

// QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
// if (m_debug)
// qDebug() << "Message received:" << pClient->peerAddress();

/// clientRequest(jsonString);

// if (pClient) {
// pClient->sendTextMessage(jsonString);
// }

// for (QWebSocket *pClient : qAsConst(m_clients)) {
// pClient->sendTextMessage(resourceService->getStateJson());
// }

//emit resourceService->clientRequest(jsonString);

//resourceService->clientRequest(jsonString);
//}

//void WebSocketService::setClients(QString( jsonString)) {
//
//// QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
//// Q_UNUSED(pSender);
//
// for (QWebSocket *pClient: qAsConst(m_clients)) {
// pClient->sendTextMessage(jsonString);
// }
//}

void WebSocketService::clientRequest(QString jsonString) { //receive requests of android clients

QJsonObject jsonObject = createJsonObject(jsonString);
Expand All @@ -130,6 +95,11 @@ void WebSocketService::clientRequest(QString jsonString) { //receive requests of

} else if (clientRequest == Server::CLIENT_REQUEST::CLIENT_REQUEST_MIRROR) {

// if (resourceService->mirror->username.length() > 3) { // request is reject if if screen mirro is Active. clients must be wait
// qDebug() << "request mirror rejected";
// return;
// }

resourceService->mirror->wifiIp = jsonObject.value("wifiIp").toString();
resourceService->mirror->username = jsonObject.value("username").toString();
resourceService->mirror->title = jsonObject.value("title").toString();
Expand Down Expand Up @@ -175,7 +145,7 @@ void WebSocketService::response(int result) {
rootObject["bitrate"] = resourceService->mirror->bitrate;
rootObject["resolution"] = resourceService->mirror->resolution;
rootObject["connectionType"] = resourceService->mirror->connectionType;
} else{
} else {
rootObject["username"] = "nothing";
}
}
Expand Down Expand Up @@ -221,7 +191,6 @@ void WebSocketService::onDeviceDisconnected(QString serial) {

resourceService->clearMirrorCash();
emit resourceService->cppGenerateEvents("MIRROR_FINISHED");
//m_webSocketService->setClients(resourceService->sendCommandToClients(ResourceService::SERVER_RESPONSE::MIRROR_FINISHED));

qDebug() << "onDeviceDisconnected:" << serial;
}
Expand Down

0 comments on commit 793c076

Please sign in to comment.