From 7ae6aa298c47d237392dd958624058ba67d00fc2 Mon Sep 17 00:00:00 2001 From: Barry <870709864@qq.com> Date: Sun, 20 Jan 2019 20:41:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0ui=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtScrcpy/dialog.cpp | 11 ++++++----- QtScrcpy/dialog.ui | 46 ++++++++++++++++++++++----------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/QtScrcpy/dialog.cpp b/QtScrcpy/dialog.cpp index 2046f38..1607247 100644 --- a/QtScrcpy/dialog.cpp +++ b/QtScrcpy/dialog.cpp @@ -34,8 +34,9 @@ Dialog::Dialog(QWidget *parent) : QStringList args = m_adb.arguments(); if (args.contains("devices")) { QStringList devices = m_adb.getDevicesSerialFromStdOut(); - if (!devices.isEmpty()) { - ui->serialEdt->setText(devices.at(0)); + ui->serialBox->clear(); + for (auto& item : devices) { + ui->serialBox->addItem(item); } } else if (args.contains("show") && args.contains("wlan0")) { QString ip = m_adb.getDeviceIPFromStdOut(); @@ -69,7 +70,7 @@ void Dialog::on_updateDevice_clicked() void Dialog::on_startServerBtn_clicked() { if (!m_videoForm) { - m_videoForm = new VideoForm(ui->serialEdt->text().trimmed()); + m_videoForm = new VideoForm(ui->serialBox->currentText().trimmed()); } m_videoForm->show(); } @@ -108,7 +109,7 @@ void Dialog::on_startAdbdBtn_clicked() QStringList adbArgs; adbArgs << "tcpip"; adbArgs << "5555"; - m_adb.execute(ui->serialEdt->text().trimmed(), adbArgs); + m_adb.execute(ui->serialBox->currentText().trimmed(), adbArgs); } void Dialog::outLog(const QString &log, bool newLine) @@ -145,5 +146,5 @@ void Dialog::on_getIPBtn_clicked() adbArgs << "addr"; adbArgs << "show"; adbArgs << "wlan0"; - m_adb.execute(ui->serialEdt->text().trimmed(), adbArgs); + m_adb.execute(ui->serialBox->currentText().trimmed(), adbArgs); } diff --git a/QtScrcpy/dialog.ui b/QtScrcpy/dialog.ui index 0a1a172..f955532 100644 --- a/QtScrcpy/dialog.ui +++ b/QtScrcpy/dialog.ui @@ -97,31 +97,14 @@ USB line - - + + - device serial: + start device adbd - - - - - - - update device - - - - - - - start server - - - - + stop server @@ -129,19 +112,36 @@ - + - start device adbd + update device + + + start server + + + + + + + device serial: + + + + get ip + + +