feat: remove warning on mac

This commit is contained in:
rankun 2020-04-12 12:21:24 +08:00
commit 5ed8aa24a2
11 changed files with 26 additions and 25 deletions

View file

@ -53,20 +53,20 @@ void AdbProcess::initSignals()
} else { } else {
emit adbProcessResult(AER_ERROR_START); emit adbProcessResult(AER_ERROR_START);
QString err = QString("qprocess start error:%1 %2").arg(program()).arg(arguments().join(" ")); QString err = QString("qprocess start error:%1 %2").arg(program()).arg(arguments().join(" "));
qCritical(err.toStdString().c_str()); qCritical() << err.toStdString().c_str();
} }
}); });
connect(this, &QProcess::readyReadStandardError, this, [this]() { connect(this, &QProcess::readyReadStandardError, this, [this]() {
QString tmp = QString::fromUtf8(readAllStandardError()).trimmed(); QString tmp = QString::fromUtf8(readAllStandardError()).trimmed();
m_errorOutput += tmp; m_errorOutput += tmp;
qWarning(QString("AdbProcess::error:%1").arg(tmp).toStdString().data()); qWarning() << QString("AdbProcess::error:%1").arg(tmp).toStdString().data();
}); });
connect(this, &QProcess::readyReadStandardOutput, this, [this]() { connect(this, &QProcess::readyReadStandardOutput, this, [this]() {
QString tmp = QString::fromUtf8(readAllStandardOutput()).trimmed(); QString tmp = QString::fromUtf8(readAllStandardOutput()).trimmed();
m_standardOutput += tmp; m_standardOutput += tmp;
qInfo(QString("AdbProcess::out:%1").arg(tmp).toStdString().data()); qInfo() << QString("AdbProcess::out:%1").arg(tmp).toStdString().data();
}); });
connect(this, &QProcess::started, this, [this]() { emit adbProcessResult(AER_SUCCESS_START); }); connect(this, &QProcess::started, this, [this]() { emit adbProcessResult(AER_SUCCESS_START); });

View file

@ -13,7 +13,7 @@ InputConvertGame::~InputConvertGame() {}
void InputConvertGame::mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize) void InputConvertGame::mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize)
{ {
// 处理开关按键 // 处理开关按键
if (m_keyMap.isSwitchOnKeyboard() == false && m_keyMap.getSwitchKey() == from->button()) { if (m_keyMap.isSwitchOnKeyboard() == false && m_keyMap.getSwitchKey() == static_cast<int>(from->button())) {
if (from->type() != QEvent::MouseButtonPress) { if (from->type() != QEvent::MouseButtonPress) {
return; return;
} }

View file

@ -24,7 +24,7 @@ private:
void resetCounter(); void resetCounter();
private: private:
quint32 m_counterTimer = 0; qint32 m_counterTimer = 0;
quint32 m_curRendered = 0; quint32 m_curRendered = 0;
quint32 m_curSkipped = 0; quint32 m_curSkipped = 0;

View file

@ -211,7 +211,7 @@ void Device::initSignals()
connect(m_server, &Server::connectToResult, this, [this](bool success, const QString &deviceName, const QSize &size) { connect(m_server, &Server::connectToResult, this, [this](bool success, const QString &deviceName, const QSize &size) {
if (success) { if (success) {
double diff = m_startTimeCount.elapsed() / 1000.0; double diff = m_startTimeCount.elapsed() / 1000.0;
qInfo(QString("server start finish in %1s").arg(diff).toStdString().c_str()); qInfo() << QString("server start finish in %1s").arg(diff).toStdString().c_str();
// update ui // update ui
if (m_videoForm) { if (m_videoForm) {

View file

@ -102,7 +102,7 @@ bool Recorder::open(const AVCodec *inputCodec)
if (ret < 0) { if (ret < 0) {
char errorbuf[255] = { 0 }; char errorbuf[255] = { 0 };
av_strerror(ret, errorbuf, 254); av_strerror(ret, errorbuf, 254);
qCritical(QString("Failed to open output file: %1 %2").arg(errorbuf).arg(m_fileName).toUtf8().toStdString().c_str()); qCritical() << QString("Failed to open output file: %1 %2").arg(errorbuf).arg(m_fileName).toUtf8().toStdString().c_str();
// ostream will be cleaned up during context cleaning // ostream will be cleaned up during context cleaning
avformat_free_context(m_formatCtx); avformat_free_context(m_formatCtx);
m_formatCtx = Q_NULLPTR; m_formatCtx = Q_NULLPTR;
@ -118,10 +118,10 @@ void Recorder::close()
if (m_headerWritten) { if (m_headerWritten) {
int ret = av_write_trailer(m_formatCtx); int ret = av_write_trailer(m_formatCtx);
if (ret < 0) { if (ret < 0) {
qCritical(QString("Failed to write trailer to %1").arg(m_fileName).toUtf8().toStdString().c_str()); qCritical() << QString("Failed to write trailer to %1").arg(m_fileName).toUtf8().toStdString().c_str();
m_failed = true; m_failed = true;
} else { } else {
qInfo(QString("success record %1").arg(m_fileName).toStdString().c_str()); qInfo() << QString("success record %1").arg(m_fileName).toStdString().c_str();
} }
} else { } else {
// the recorded file is empty // the recorded file is empty

View file

@ -12,7 +12,7 @@ class QYUVOpenGLWidget
Q_OBJECT Q_OBJECT
public: public:
explicit QYUVOpenGLWidget(QWidget *parent = nullptr); explicit QYUVOpenGLWidget(QWidget *parent = nullptr);
virtual ~QYUVOpenGLWidget(); virtual ~QYUVOpenGLWidget() override;
QSize minimumSizeHint() const override; QSize minimumSizeHint() const override;
QSize sizeHint() const override; QSize sizeHint() const override;
@ -22,9 +22,9 @@ public:
void updateTextures(quint8 *dataY, quint8 *dataU, quint8 *dataV, quint32 linesizeY, quint32 linesizeU, quint32 linesizeV); void updateTextures(quint8 *dataY, quint8 *dataU, quint8 *dataV, quint32 linesizeY, quint32 linesizeU, quint32 linesizeV);
protected: protected:
void initializeGL(); void initializeGL() override;
void paintGL(); void paintGL() override;
void resizeGL(int width, int height); void resizeGL(int width, int height) override;
private: private:
void initShader(); void initShader();

View file

@ -255,7 +255,7 @@ bool Server::startServerByStep()
// try to connect until the server socket is listening on the device. // try to connect until the server socket is listening on the device.
m_serverSocket.setMaxPendingConnections(2); m_serverSocket.setMaxPendingConnections(2);
if (!m_serverSocket.listen(QHostAddress::LocalHost, m_params.localPort)) { if (!m_serverSocket.listen(QHostAddress::LocalHost, m_params.localPort)) {
qCritical(QString("Could not listen on port %1").arg(m_params.localPort).toStdString().c_str()); qCritical() << QString("Could not listen on port %1").arg(m_params.localPort).toStdString().c_str();
m_serverStartStep = SSS_NULL; m_serverStartStep = SSS_NULL;
if (m_tunnelForward) { if (m_tunnelForward) {
disableTunnelForward(); disableTunnelForward();

View file

@ -45,7 +45,7 @@ qint32 VideoSocket::subThreadRecvData(quint8 *buf, qint32 bufSize)
bool VideoSocket::event(QEvent *event) bool VideoSocket::event(QEvent *event)
{ {
if (event->type() == QScrcpyEvent::VideoSocket) { if (static_cast<QScrcpyEvent::Type>(event->type()) == QScrcpyEvent::VideoSocket) {
onReadyRead(); onReadyRead();
return true; return true;
} }

View file

@ -27,19 +27,18 @@ static void avLogCallback(void *avcl, int level, const char *fmt, va_list vl)
switch (level) { switch (level) {
case AV_LOG_PANIC: case AV_LOG_PANIC:
case AV_LOG_FATAL: case AV_LOG_FATAL:
qFatal(localFmt.toUtf8()); qFatal("%s", localFmt.toUtf8().data());
break;
case AV_LOG_ERROR: case AV_LOG_ERROR:
qCritical(localFmt.toUtf8()); qCritical() << localFmt.toUtf8();
break; break;
case AV_LOG_WARNING: case AV_LOG_WARNING:
qWarning(localFmt.toUtf8()); qWarning() << localFmt.toUtf8();
break; break;
case AV_LOG_INFO: case AV_LOG_INFO:
qInfo(localFmt.toUtf8()); qInfo() << localFmt.toUtf8();
break; break;
case AV_LOG_DEBUG: case AV_LOG_DEBUG:
//qDebug(localFmt.toUtf8()); // qDebug() << localFmt.toUtf8();
break; break;
} }

View file

@ -212,6 +212,7 @@ void DeviceManage::onControlStateChange(Device *device, Device::GroupControlStat
void DeviceManage::onMouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize) void DeviceManage::onMouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize)
{ {
Q_UNUSED(frameSize)
QMapIterator<QString, QPointer<Device>> i(m_devices); QMapIterator<QString, QPointer<Device>> i(m_devices);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
@ -228,6 +229,7 @@ void DeviceManage::onMouseEvent(const QMouseEvent *from, const QSize &frameSize,
void DeviceManage::onWheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize) void DeviceManage::onWheelEvent(const QWheelEvent *from, const QSize &frameSize, const QSize &showSize)
{ {
Q_UNUSED(frameSize)
QMapIterator<QString, QPointer<Device>> i(m_devices); QMapIterator<QString, QPointer<Device>> i(m_devices);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
@ -244,6 +246,7 @@ void DeviceManage::onWheelEvent(const QWheelEvent *from, const QSize &frameSize,
void DeviceManage::onKeyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize) void DeviceManage::onKeyEvent(const QKeyEvent *from, const QSize &frameSize, const QSize &showSize)
{ {
Q_UNUSED(frameSize)
QMapIterator<QString, QPointer<Device>> i(m_devices); QMapIterator<QString, QPointer<Device>> i(m_devices);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();

View file

@ -98,10 +98,9 @@ int main(int argc, char *argv[])
g_mainDlg->setWindowTitle(Config::getInstance().getTitle()); g_mainDlg->setWindowTitle(Config::getInstance().getTitle());
g_mainDlg->show(); g_mainDlg->show();
qInfo(QObject::tr("This software is completely open source and free. Strictly used for illegal purposes, or at your own risk. You can download it at the " qInfo() << QObject::tr("This software is completely open source and free. Strictly used for illegal purposes, or at your own risk. You can download it at the "
"following address:") "following address:").toUtf8();
.toUtf8()); qInfo() << QString("QtScrcpy %1 <https://github.com/barry-ran/QtScrcpy>").arg(QCoreApplication::applicationVersion()).toUtf8();
qInfo(QString("QtScrcpy %1 <https://github.com/barry-ran/QtScrcpy>").arg(QCoreApplication::applicationVersion()).toUtf8());
int ret = a.exec(); int ret = a.exec();