From f50c561f0267edbf3290812edaf3c9371ff6cfc4 Mon Sep 17 00:00:00 2001 From: Barry <870709864@qq.com> Date: Sun, 27 Jan 2019 14:28:11 +0800 Subject: [PATCH] =?UTF-8?q?update:=E9=99=90=E5=88=B6=E6=A8=AA=E5=B1=8F?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E6=9C=80=E5=A4=A7=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtScrcpy/decoder/decoder.cpp | 4 +++- QtScrcpy/uibase/magneticwidget.cpp | 5 +++++ QtScrcpy/uibase/magneticwidget.h | 2 ++ QtScrcpy/videoform.cpp | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/QtScrcpy/decoder/decoder.cpp b/QtScrcpy/decoder/decoder.cpp index 860a3b8..3e422d3 100644 --- a/QtScrcpy/decoder/decoder.cpp +++ b/QtScrcpy/decoder/decoder.cpp @@ -297,7 +297,9 @@ void Decoder::run() #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 0) int ret; if ((ret = avcodec_send_packet(codecCtx, &packet)) < 0) { - qCritical("Could not send video packet: %d", ret); + char errorbuf[255] = { 0 }; + av_strerror(ret, errorbuf, 254); + qCritical("Could not send video packet: %s", errorbuf); goto runQuit; } if (decodingFrame) { diff --git a/QtScrcpy/uibase/magneticwidget.cpp b/QtScrcpy/uibase/magneticwidget.cpp index c07c689..0d08b82 100644 --- a/QtScrcpy/uibase/magneticwidget.cpp +++ b/QtScrcpy/uibase/magneticwidget.cpp @@ -25,6 +25,11 @@ MagneticWidget::~MagneticWidget() } } +bool MagneticWidget::isAdsorbed() +{ + return m_adsorbed; +} + bool MagneticWidget::eventFilter(QObject *watched, QEvent *event) { if (watched != m_adsorbWidget || !event) { diff --git a/QtScrcpy/uibase/magneticwidget.h b/QtScrcpy/uibase/magneticwidget.h index 07ef267..8ed730a 100644 --- a/QtScrcpy/uibase/magneticwidget.h +++ b/QtScrcpy/uibase/magneticwidget.h @@ -31,6 +31,8 @@ public: explicit MagneticWidget(QWidget* adsorbWidget, AdsorbPositions adsorbPos = AP_ALL); ~MagneticWidget(); + bool isAdsorbed(); + protected: bool eventFilter(QObject *watched, QEvent *event) override; void moveEvent(QMoveEvent *event) override; diff --git a/QtScrcpy/videoform.cpp b/QtScrcpy/videoform.cpp index 97fa78f..e15e51b 100644 --- a/QtScrcpy/videoform.cpp +++ b/QtScrcpy/videoform.cpp @@ -225,7 +225,7 @@ void VideoForm::updateShowSize(const QSize &newSize) showSize.setHeight(qMin(newSize.height(), screenRect.height() - 200)); showSize.setWidth(showSize.height() * m_widthHeightRatio); } else { - showSize.setWidth(qMin(newSize.width(), screenRect.width())); + showSize.setWidth(qMin(newSize.width(), screenRect.width()/2)); showSize.setHeight(showSize.width() * m_widthHeightRatio); }