mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 14:18:45 +00:00
ui更新:增加无线连接按钮,log显示等
This commit is contained in:
parent
3b2007df1d
commit
889c4f29d6
7 changed files with 125 additions and 31 deletions
|
@ -118,6 +118,11 @@ QStringList AdbProcess::getDevicesSerialFromStdOut()
|
||||||
return serials;
|
return serials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AdbProcess::getStdOut()
|
||||||
|
{
|
||||||
|
return m_standardOutput;
|
||||||
|
}
|
||||||
|
|
||||||
void AdbProcess::forward(const QString& serial, quint16 localPort, const QString& deviceSocketName)
|
void AdbProcess::forward(const QString& serial, quint16 localPort, const QString& deviceSocketName)
|
||||||
{
|
{
|
||||||
QStringList adbArgs;
|
QStringList adbArgs;
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
bool isRuning();
|
bool isRuning();
|
||||||
void setShowTouchesEnabled(const QString& serial, bool enabled);
|
void setShowTouchesEnabled(const QString& serial, bool enabled);
|
||||||
QStringList getDevicesSerialFromStdOut();
|
QStringList getDevicesSerialFromStdOut();
|
||||||
|
QString getStdOut();
|
||||||
|
|
||||||
static const QString& getAdbPath();
|
static const QString& getAdbPath();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ void Dialog::on_updateDevice_clicked()
|
||||||
AdbProcess* adb = new AdbProcess();
|
AdbProcess* adb = new AdbProcess();
|
||||||
connect(adb, &AdbProcess::adbProcessResult, this, [this, adb](AdbProcess::ADB_EXEC_RESULT processResult){
|
connect(adb, &AdbProcess::adbProcessResult, this, [this, adb](AdbProcess::ADB_EXEC_RESULT processResult){
|
||||||
if (AdbProcess::AER_SUCCESS_EXEC == processResult) {
|
if (AdbProcess::AER_SUCCESS_EXEC == processResult) {
|
||||||
qDebug() << adb->getDevicesSerialFromStdOut().join("*");
|
ui->outEdit->append(adb->getDevicesSerialFromStdOut().join("*"));
|
||||||
}
|
}
|
||||||
if (AdbProcess::AER_SUCCESS_START != processResult) {
|
if (AdbProcess::AER_SUCCESS_START != processResult) {
|
||||||
sender()->deleteLater();
|
sender()->deleteLater();
|
||||||
|
@ -39,7 +39,7 @@ void Dialog::on_updateDevice_clicked()
|
||||||
void Dialog::on_startServerBtn_clicked()
|
void Dialog::on_startServerBtn_clicked()
|
||||||
{
|
{
|
||||||
if (!m_videoForm) {
|
if (!m_videoForm) {
|
||||||
m_videoForm = new VideoForm();
|
m_videoForm = new VideoForm(ui->serialEdt->text().trimmed());
|
||||||
}
|
}
|
||||||
m_videoForm->show();
|
m_videoForm->show();
|
||||||
}
|
}
|
||||||
|
@ -50,3 +50,22 @@ void Dialog::on_stopServerBtn_clicked()
|
||||||
m_videoForm->close();
|
m_videoForm->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dialog::on_wirelessConnectBtn_clicked()
|
||||||
|
{
|
||||||
|
AdbProcess* adb = new AdbProcess();
|
||||||
|
connect(adb, &AdbProcess::adbProcessResult, this, [this, adb](AdbProcess::ADB_EXEC_RESULT processResult){
|
||||||
|
if (AdbProcess::AER_SUCCESS_EXEC == processResult) {
|
||||||
|
ui->outEdit->append(adb->getStdOut());
|
||||||
|
}
|
||||||
|
if (AdbProcess::AER_SUCCESS_START != processResult) {
|
||||||
|
sender()->deleteLater();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//adb connect 172.16.8.197:5555
|
||||||
|
QStringList adbArgs;
|
||||||
|
adbArgs << "connect";
|
||||||
|
adbArgs << ui->deviceIpEdt->text().trimmed();
|
||||||
|
adb->execute("", adbArgs);
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ private slots:
|
||||||
|
|
||||||
void on_stopServerBtn_clicked();
|
void on_stopServerBtn_clicked();
|
||||||
|
|
||||||
|
void on_wirelessConnectBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Dialog *ui;
|
Ui::Dialog *ui;
|
||||||
|
|
||||||
|
|
|
@ -6,53 +6,118 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>354</width>
|
<width>373</width>
|
||||||
<height>81</height>
|
<height>329</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>QtScrcpy</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="topWidget" native="true">
|
<widget class="QWidget" name="topWidget" native="true">
|
||||||
<property name="minimumSize">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<size>
|
<item row="2" column="1">
|
||||||
<width>0</width>
|
|
||||||
<height>50</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>50</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="updateDevice">
|
|
||||||
<property name="text">
|
|
||||||
<string>update device</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="startServerBtn">
|
<widget class="QPushButton" name="startServerBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>start server</string>
|
<string>start server</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>device serial:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="updateDevice">
|
||||||
|
<property name="text">
|
||||||
|
<string>update device</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
<widget class="QPushButton" name="stopServerBtn">
|
<widget class="QPushButton" name="stopServerBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>stop server</string>
|
<string>stop server</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="serialEdt"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="wirelessWidget" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">ip:port</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="deviceIpEdt">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>145</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>145</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>192.168.0.1:5555</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="wirelessConnectBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>wireless connect</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="outEdit">
|
||||||
|
<property name="documentTitle">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|
|
@ -7,9 +7,10 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#pragma comment(lib, "User32.lib")
|
#pragma comment(lib, "User32.lib")
|
||||||
|
|
||||||
VideoForm::VideoForm(QWidget *parent) :
|
VideoForm::VideoForm(const QString& serial, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::videoForm)
|
ui(new Ui::videoForm),
|
||||||
|
m_serial(serial)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -81,7 +82,7 @@ VideoForm::VideoForm(QWidget *parent) :
|
||||||
//m_server->start("P7C0218510000537", 27183, 1080, 8000000, "");
|
//m_server->start("P7C0218510000537", 27183, 1080, 8000000, "");
|
||||||
|
|
||||||
// only one devices, serial can be null
|
// only one devices, serial can be null
|
||||||
m_server->start("", 27183, 720, 8000000, "");
|
m_server->start(m_serial, 27183, 720, 8000000, "");
|
||||||
|
|
||||||
// support wireless connect
|
// support wireless connect
|
||||||
//m_server->start("192.168.0.174:5555", 27183, 720, 8000000, "");
|
//m_server->start("192.168.0.174:5555", 27183, 720, 8000000, "");
|
||||||
|
|
|
@ -18,7 +18,7 @@ class VideoForm : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VideoForm(QWidget *parent = 0);
|
explicit VideoForm(const QString& serial, QWidget *parent = 0);
|
||||||
~VideoForm();
|
~VideoForm();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -40,6 +40,7 @@ private:
|
||||||
Frames m_frames;
|
Frames m_frames;
|
||||||
//InputConvertNormal m_inputConvert;
|
//InputConvertNormal m_inputConvert;
|
||||||
InputConvertGame m_inputConvert;
|
InputConvertGame m_inputConvert;
|
||||||
|
QString m_serial = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VIDEOFORM_H
|
#endif // VIDEOFORM_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue