mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-22 20:44:59 +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->setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);
|
||||
initUI();
|
||||
|
||||
connect(&m_adb, &AdbProcess::adbProcessResult, this, [this](AdbProcess::ADB_EXEC_RESULT processResult){
|
||||
QString log = "";
|
||||
|
@ -58,6 +56,24 @@ Dialog::~Dialog()
|
|||
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()
|
||||
{
|
||||
if (checkAdbRun()) {
|
||||
|
@ -70,7 +86,10 @@ void Dialog::on_updateDevice_clicked()
|
|||
void Dialog::on_startServerBtn_clicked()
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
@ -148,3 +167,16 @@ void Dialog::on_getIPBtn_clicked()
|
|||
adbArgs << "wlan0";
|
||||
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_wirelessDisConnectBtn_clicked();
|
||||
|
||||
private:
|
||||
bool checkAdbRun();
|
||||
void initUI();
|
||||
|
||||
private:
|
||||
Ui::Dialog *ui;
|
||||
|
|
|
@ -6,22 +6,10 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>442</width>
|
||||
<width>564</width>
|
||||
<height>486</height>
|
||||
</rect>
|
||||
</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">
|
||||
<string>QtScrcpy</string>
|
||||
</property>
|
||||
|
@ -41,35 +29,8 @@
|
|||
<property name="title">
|
||||
<string>Wireless</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="2,1,1,0">
|
||||
<item row="2" 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">
|
||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="2,0,0,1,0">
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
|
@ -88,6 +49,40 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -97,50 +92,74 @@
|
|||
<string>USB line</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QPushButton" name="startAdbdBtn">
|
||||
<property name="text">
|
||||
<string>start device adbd</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="serialBox"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="stopServerBtn">
|
||||
<property name="text">
|
||||
<string>stop server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="updateDevice">
|
||||
<property name="text">
|
||||
<string>update device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="startServerBtn">
|
||||
<property name="text">
|
||||
<string>start server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>device serial:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="getIPBtn">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>get ip</string>
|
||||
<string>bit rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="serialBox"/>
|
||||
<item row="0" column="1">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
#include "iconhelper.h"
|
||||
#include "toolform.h"
|
||||
|
||||
VideoForm::VideoForm(const QString& serial, QWidget *parent) :
|
||||
VideoForm::VideoForm(const QString& serial, quint16 maxSize, quint32 bitRate,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::videoForm),
|
||||
m_serial(serial)
|
||||
m_serial(serial),
|
||||
m_maxSize(maxSize),
|
||||
m_bitRate(bitRate)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initUI();
|
||||
|
@ -91,15 +93,11 @@ VideoForm::VideoForm(const QString& serial, QWidget *parent) :
|
|||
|
||||
// fix: macos cant recv finished signel, timer is ok
|
||||
QTimer::singleShot(0, this, [this](){
|
||||
// support 480p 720p 1080p
|
||||
//m_server->start("P7C0218510000537", 27183, 0, 8000000, "");
|
||||
//m_server->start("P7C0218510000537", 27183, 1080, 8000000, "");
|
||||
|
||||
// max size support 480p 720p 1080p 设备原生分辨率
|
||||
// support wireless connect, example:
|
||||
//m_server->start("192.168.0.174:5555", 27183, m_maxSize, m_bitRate, "");
|
||||
// only one devices, serial can be null
|
||||
m_server->start(m_serial, 27183, 720, 8000000, "");
|
||||
|
||||
// support wireless connect
|
||||
//m_server->start("192.168.0.174:5555", 27183, 720, 8000000, "");
|
||||
m_server->start(m_serial, 27183, m_maxSize, m_bitRate, "");
|
||||
});
|
||||
|
||||
updateShowSize(size());
|
||||
|
|
|
@ -20,7 +20,7 @@ class VideoForm : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VideoForm(const QString& serial, QWidget *parent = 0);
|
||||
explicit VideoForm(const QString& serial, quint16 maxSize = 720, quint32 bitRate = 8000000, QWidget *parent = 0);
|
||||
~VideoForm();
|
||||
|
||||
private:
|
||||
|
@ -55,6 +55,8 @@ private:
|
|||
//InputConvertNormal m_inputConvert;
|
||||
InputConvertGame m_inputConvert;
|
||||
QString m_serial = "";
|
||||
quint16 m_maxSize = 720;
|
||||
quint32 m_bitRate = 8000000;
|
||||
QPoint m_dragPosition;
|
||||
float m_widthHeightRatio = 0.5f;
|
||||
QPointer<ToolForm> m_toolForm;
|
||||
|
|
Loading…
Add table
Reference in a new issue