mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 14:18:45 +00:00
界面增加码率分辨率配置
This commit is contained in:
parent
3b7f28de35
commit
13a72bf2be
5 changed files with 132 additions and 78 deletions
|
@ -10,9 +10,7 @@ Dialog::Dialog(QWidget *parent) :
|
||||||
ui(new Ui::Dialog)
|
ui(new Ui::Dialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
initUI();
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);
|
|
||||||
|
|
||||||
connect(&m_adb, &AdbProcess::adbProcessResult, this, [this](AdbProcess::ADB_EXEC_RESULT processResult){
|
connect(&m_adb, &AdbProcess::adbProcessResult, this, [this](AdbProcess::ADB_EXEC_RESULT processResult){
|
||||||
QString log = "";
|
QString log = "";
|
||||||
|
@ -58,6 +56,24 @@ Dialog::~Dialog()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dialog::initUI()
|
||||||
|
{
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);
|
||||||
|
|
||||||
|
ui->bitRateBox->addItem("2000000");
|
||||||
|
ui->bitRateBox->addItem("6000000");
|
||||||
|
ui->bitRateBox->addItem("8000000");
|
||||||
|
ui->bitRateBox->addItem("10000000");
|
||||||
|
ui->bitRateBox->setCurrentIndex(2);
|
||||||
|
|
||||||
|
ui->videoSizeBox->addItem("480");
|
||||||
|
ui->videoSizeBox->addItem("720");
|
||||||
|
ui->videoSizeBox->addItem("1080");
|
||||||
|
ui->videoSizeBox->addItem("native");
|
||||||
|
ui->videoSizeBox->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
|
||||||
void Dialog::on_updateDevice_clicked()
|
void Dialog::on_updateDevice_clicked()
|
||||||
{
|
{
|
||||||
if (checkAdbRun()) {
|
if (checkAdbRun()) {
|
||||||
|
@ -70,7 +86,10 @@ 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(ui->serialBox->currentText().trimmed());
|
quint32 bitRate = ui->bitRateBox->currentText().trimmed().toUInt();
|
||||||
|
// this is ok that "native" toUshort is 0
|
||||||
|
quint16 videoSize = ui->videoSizeBox->currentText().trimmed().toUShort();
|
||||||
|
m_videoForm = new VideoForm(ui->serialBox->currentText().trimmed(), videoSize, bitRate);
|
||||||
}
|
}
|
||||||
m_videoForm->show();
|
m_videoForm->show();
|
||||||
}
|
}
|
||||||
|
@ -148,3 +167,16 @@ void Dialog::on_getIPBtn_clicked()
|
||||||
adbArgs << "wlan0";
|
adbArgs << "wlan0";
|
||||||
m_adb.execute(ui->serialBox->currentText().trimmed(), adbArgs);
|
m_adb.execute(ui->serialBox->currentText().trimmed(), adbArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dialog::on_wirelessDisConnectBtn_clicked()
|
||||||
|
{
|
||||||
|
if (checkAdbRun()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString addr = ui->deviceIpEdt->text().trimmed();
|
||||||
|
outLog("wireless disconnect...", false);
|
||||||
|
QStringList adbArgs;
|
||||||
|
adbArgs << "disconnect";
|
||||||
|
adbArgs << addr;
|
||||||
|
m_adb.execute("", adbArgs);
|
||||||
|
}
|
||||||
|
|
|
@ -35,8 +35,11 @@ private slots:
|
||||||
|
|
||||||
void on_getIPBtn_clicked();
|
void on_getIPBtn_clicked();
|
||||||
|
|
||||||
|
void on_wirelessDisConnectBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkAdbRun();
|
bool checkAdbRun();
|
||||||
|
void initUI();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Dialog *ui;
|
Ui::Dialog *ui;
|
||||||
|
|
|
@ -6,22 +6,10 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>442</width>
|
<width>564</width>
|
||||||
<height>486</height>
|
<height>486</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>442</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>442</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>QtScrcpy</string>
|
<string>QtScrcpy</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -41,35 +29,8 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Wireless</string>
|
<string>Wireless</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="2,1,1,0">
|
<layout class="QGridLayout" name="gridLayout_4" columnstretch="2,0,0,1,0">
|
||||||
<item row="2" column="2">
|
<item row="3" column="2">
|
||||||
<widget class="QLineEdit" name="devicePortEdt">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string notr="true">5555</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QPushButton" name="wirelessConnectBtn">
|
|
||||||
<property name="text">
|
|
||||||
<string>wireless connect</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLineEdit" name="deviceIpEdt">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string notr="true">192.168.0.1</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -88,6 +49,40 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="3">
|
||||||
|
<widget class="QLineEdit" name="devicePortEdt">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string notr="true">5555</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLineEdit" name="deviceIpEdt">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string notr="true">192.168.0.1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="4">
|
||||||
|
<widget class="QPushButton" name="wirelessConnectBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>wireless connect</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="4">
|
||||||
|
<widget class="QPushButton" name="wirelessDisConnectBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>wireless disconnect</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -97,50 +92,74 @@
|
||||||
<string>USB line</string>
|
<string>USB line</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="4" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QPushButton" name="startAdbdBtn">
|
<widget class="QComboBox" name="serialBox"/>
|
||||||
<property name="text">
|
|
||||||
<string>start device adbd</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="1" column="3">
|
||||||
<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="3" column="0">
|
<item row="1" column="2">
|
||||||
<widget class="QPushButton" name="updateDevice">
|
|
||||||
<property name="text">
|
|
||||||
<string>update device</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<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 row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>device serial:</string>
|
<string>device serial:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="getIPBtn">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>get ip</string>
|
<string>bit rate:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="2">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="serialBox"/>
|
<widget class="QComboBox" name="bitRateBox">
|
||||||
|
<property name="currentText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>video size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QComboBox" name="videoSizeBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="3">
|
||||||
|
<widget class="QPushButton" name="startAdbdBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>start adbd</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QPushButton" name="getIPBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>get device ip</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QPushButton" name="updateDevice">
|
||||||
|
<property name="text">
|
||||||
|
<string>update device</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -14,10 +14,12 @@
|
||||||
#include "iconhelper.h"
|
#include "iconhelper.h"
|
||||||
#include "toolform.h"
|
#include "toolform.h"
|
||||||
|
|
||||||
VideoForm::VideoForm(const QString& serial, QWidget *parent) :
|
VideoForm::VideoForm(const QString& serial, quint16 maxSize, quint32 bitRate,QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::videoForm),
|
ui(new Ui::videoForm),
|
||||||
m_serial(serial)
|
m_serial(serial),
|
||||||
|
m_maxSize(maxSize),
|
||||||
|
m_bitRate(bitRate)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
initUI();
|
initUI();
|
||||||
|
@ -91,15 +93,11 @@ VideoForm::VideoForm(const QString& serial, QWidget *parent) :
|
||||||
|
|
||||||
// fix: macos cant recv finished signel, timer is ok
|
// fix: macos cant recv finished signel, timer is ok
|
||||||
QTimer::singleShot(0, this, [this](){
|
QTimer::singleShot(0, this, [this](){
|
||||||
// support 480p 720p 1080p
|
// max size support 480p 720p 1080p 设备原生分辨率
|
||||||
//m_server->start("P7C0218510000537", 27183, 0, 8000000, "");
|
// support wireless connect, example:
|
||||||
//m_server->start("P7C0218510000537", 27183, 1080, 8000000, "");
|
//m_server->start("192.168.0.174:5555", 27183, m_maxSize, m_bitRate, "");
|
||||||
|
|
||||||
// only one devices, serial can be null
|
// only one devices, serial can be null
|
||||||
m_server->start(m_serial, 27183, 720, 8000000, "");
|
m_server->start(m_serial, 27183, m_maxSize, m_bitRate, "");
|
||||||
|
|
||||||
// support wireless connect
|
|
||||||
//m_server->start("192.168.0.174:5555", 27183, 720, 8000000, "");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
updateShowSize(size());
|
updateShowSize(size());
|
||||||
|
|
|
@ -20,7 +20,7 @@ class VideoForm : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VideoForm(const QString& serial, QWidget *parent = 0);
|
explicit VideoForm(const QString& serial, quint16 maxSize = 720, quint32 bitRate = 8000000, QWidget *parent = 0);
|
||||||
~VideoForm();
|
~VideoForm();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -55,6 +55,8 @@ private:
|
||||||
//InputConvertNormal m_inputConvert;
|
//InputConvertNormal m_inputConvert;
|
||||||
InputConvertGame m_inputConvert;
|
InputConvertGame m_inputConvert;
|
||||||
QString m_serial = "";
|
QString m_serial = "";
|
||||||
|
quint16 m_maxSize = 720;
|
||||||
|
quint32 m_bitRate = 8000000;
|
||||||
QPoint m_dragPosition;
|
QPoint m_dragPosition;
|
||||||
float m_widthHeightRatio = 0.5f;
|
float m_widthHeightRatio = 0.5f;
|
||||||
QPointer<ToolForm> m_toolForm;
|
QPointer<ToolForm> m_toolForm;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue