From a6ae810eea34cec04d7f16e6374a92c192208f7e Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Thu, 29 Oct 2020 08:43:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comtool/api/quiwidget.cpp | 20 ++++++++++++++++---- comtool/api/quiwidget.h | 3 ++- dbpage/main.cpp | 1 + ffmpegdemo/ffmpeg/ffmpeg.pri | 20 ++++++++++++++++++-- ffmpegdemo/ffmpegdemo.pro | 1 + ffmpegdemo/main.cpp | 3 +++ nettool/api/quiwidget.cpp | 20 ++++++++++++++++---- nettool/api/quiwidget.h | 3 ++- videowidget/videowidget.cpp | 35 +++++++++++++++++++++++++++++++++++ videowidget/videowidget.h | 17 +++++++++++++++++ 10 files changed, 111 insertions(+), 12 deletions(-) diff --git a/comtool/api/quiwidget.cpp b/comtool/api/quiwidget.cpp index 6431d94..9949ecb 100644 --- a/comtool/api/quiwidget.cpp +++ b/comtool/api/quiwidget.cpp @@ -2533,16 +2533,24 @@ void QUIHelper::runWithSystem(const QString &strName, const QString &strPath, bo #endif } +QString QUIHelper::getIP(const QString &url) +{ + //取出IP地址 + QRegExp regExp("((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))"); + regExp.indexIn(url); + return url.mid(url.indexOf(regExp), regExp.matchedLength()); +} + bool QUIHelper::isIP(const QString &ip) { - QRegExp RegExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); - return RegExp.exactMatch(ip); + QRegExp regExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); + return regExp.exactMatch(ip); } bool QUIHelper::isMac(const QString &mac) { - QRegExp RegExp("^[A-F0-9]{2}(-[A-F0-9]{2}){5}$"); - return RegExp.exactMatch(mac); + QRegExp regExp("^[A-F0-9]{2}(-[A-F0-9]{2}){5}$"); + return regExp.exactMatch(mac); } bool QUIHelper::isTel(const QString &tel) @@ -3503,6 +3511,10 @@ bool QUIHelper::isWebOk() void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVisible, bool edit) { + //取消自动换行 + tableView->setWordWrap(false); + //超出文本不显示省略号 + tableView->setTextElideMode(Qt::ElideNone); //奇数偶数行颜色交替 tableView->setAlternatingRowColors(false); //垂直表头是否可见 diff --git a/comtool/api/quiwidget.h b/comtool/api/quiwidget.h index 5eefa00..e660b01 100644 --- a/comtool/api/quiwidget.h +++ b/comtool/api/quiwidget.h @@ -642,6 +642,8 @@ public: //设置开机自启动 static void runWithSystem(const QString &strName, const QString &strPath, bool autoRun = true); + //从字符串获取IP地址 + static QString getIP(const QString &url); //判断是否是IP地址 static bool isIP(const QString &ip); //判断是否是MAC地址 @@ -651,7 +653,6 @@ public: //判断是否是合法的邮箱地址 static bool isEmail(const QString &email); - //16进制字符串转10进制 static int strHexToDecimal(const QString &strHex); //10进制字符串转10进制 diff --git a/dbpage/main.cpp b/dbpage/main.cpp index adf036e..ea33e42 100644 --- a/dbpage/main.cpp +++ b/dbpage/main.cpp @@ -2,6 +2,7 @@ #include "qapplication.h" #include "qtextcodec.h" #include "qsqldatabase.h" +#include "qsqlquery.h" #include "qdebug.h" int main(int argc, char *argv[]) diff --git a/ffmpegdemo/ffmpeg/ffmpeg.pri b/ffmpegdemo/ffmpeg/ffmpeg.pri index c626b0f..cfd8dfd 100644 --- a/ffmpegdemo/ffmpeg/ffmpeg.pri +++ b/ffmpegdemo/ffmpeg/ffmpeg.pri @@ -3,7 +3,7 @@ HEADERS += $$PWD/ffmpeg.h SOURCES += $$PWD/ffmpeg.cpp #如果用的是ffmpeg4内核请将ffmpeg3改成ffmpeg4,两种内核不兼容,头文件也不一样 -DEFINES += ffmpeg3 +DEFINES += ffmpeg4 #ffmpeg4则使用ffmpeg4的目录 contains(DEFINES, ffmpeg4) { @@ -28,13 +28,29 @@ contains(QT_ARCH, arm) { strInclude = include } +!android { INCLUDEPATH += $$PWD/$$strPath/$$strInclude +} win32 { LIBS += -L$$PWD/$$strPath/$$strLib/ -lavcodec -lavfilter -lavformat -lswscale -lavutil -lswresample -lavdevice } #请自行替换 -unix { +!android { +unix:!macx { LIBS += -L$$PWD/linuxlib/ -lavfilter -lavformat -lavdevice -lavcodec -lswscale -lavutil -lswresample -lavdevice -lpthread -lm -lz -lrt -ldl +}} + +#android系统 +android { +INCLUDEPATH += $$PWD/androidlib/include +LIBS += -L$$PWD/androidlib/ -lavcodec -lavfilter -lavformat -lswscale -lavutil -lswresample +#将动态库文件一起打包 +ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavcodec.so +ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavfilter.so +ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavformat.so +ANDROID_EXTRA_LIBS += $$PWD/androidlib/libavutil.so +ANDROID_EXTRA_LIBS += $$PWD/androidlib/libswresample.so +ANDROID_EXTRA_LIBS += $$PWD/androidlib/libswscale.so } diff --git a/ffmpegdemo/ffmpegdemo.pro b/ffmpegdemo/ffmpegdemo.pro index d1a2522..47256a4 100644 --- a/ffmpegdemo/ffmpegdemo.pro +++ b/ffmpegdemo/ffmpegdemo.pro @@ -1,6 +1,7 @@ QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +android {QT += androidextras} TARGET = ffmpegdemo TEMPLATE = app diff --git a/ffmpegdemo/main.cpp b/ffmpegdemo/main.cpp index a741f6c..00d6b1c 100644 --- a/ffmpegdemo/main.cpp +++ b/ffmpegdemo/main.cpp @@ -7,6 +7,9 @@ int main(int argc, char *argv[]) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif QApplication a(argc, argv); QFont font; diff --git a/nettool/api/quiwidget.cpp b/nettool/api/quiwidget.cpp index 6431d94..9949ecb 100644 --- a/nettool/api/quiwidget.cpp +++ b/nettool/api/quiwidget.cpp @@ -2533,16 +2533,24 @@ void QUIHelper::runWithSystem(const QString &strName, const QString &strPath, bo #endif } +QString QUIHelper::getIP(const QString &url) +{ + //取出IP地址 + QRegExp regExp("((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))"); + regExp.indexIn(url); + return url.mid(url.indexOf(regExp), regExp.matchedLength()); +} + bool QUIHelper::isIP(const QString &ip) { - QRegExp RegExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); - return RegExp.exactMatch(ip); + QRegExp regExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); + return regExp.exactMatch(ip); } bool QUIHelper::isMac(const QString &mac) { - QRegExp RegExp("^[A-F0-9]{2}(-[A-F0-9]{2}){5}$"); - return RegExp.exactMatch(mac); + QRegExp regExp("^[A-F0-9]{2}(-[A-F0-9]{2}){5}$"); + return regExp.exactMatch(mac); } bool QUIHelper::isTel(const QString &tel) @@ -3503,6 +3511,10 @@ bool QUIHelper::isWebOk() void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVisible, bool edit) { + //取消自动换行 + tableView->setWordWrap(false); + //超出文本不显示省略号 + tableView->setTextElideMode(Qt::ElideNone); //奇数偶数行颜色交替 tableView->setAlternatingRowColors(false); //垂直表头是否可见 diff --git a/nettool/api/quiwidget.h b/nettool/api/quiwidget.h index 5eefa00..e660b01 100644 --- a/nettool/api/quiwidget.h +++ b/nettool/api/quiwidget.h @@ -642,6 +642,8 @@ public: //设置开机自启动 static void runWithSystem(const QString &strName, const QString &strPath, bool autoRun = true); + //从字符串获取IP地址 + static QString getIP(const QString &url); //判断是否是IP地址 static bool isIP(const QString &ip); //判断是否是MAC地址 @@ -651,7 +653,6 @@ public: //判断是否是合法的邮箱地址 static bool isEmail(const QString &email); - //16进制字符串转10进制 static int strHexToDecimal(const QString &strHex); //10进制字符串转10进制 diff --git a/videowidget/videowidget.cpp b/videowidget/videowidget.cpp index 654f244..62c27e4 100644 --- a/videowidget/videowidget.cpp +++ b/videowidget/videowidget.cpp @@ -553,6 +553,41 @@ void VideoWidget::btnClicked() emit btnClicked(btn->objectName()); } +uint VideoWidget::getLength() +{ + return 0; +} + +uint VideoWidget::getPosition() +{ + return 0; +} + +void VideoWidget::setPosition(int position) +{ + +} + +bool VideoWidget::getMute() +{ + return false; +} + +void VideoWidget::setMute(bool mute) +{ + +} + +int VideoWidget::getVolume() +{ + return 0; +} + +void VideoWidget::setVolume(int volume) +{ + +} + void VideoWidget::setInterval(int interval) { diff --git a/videowidget/videowidget.h b/videowidget/videowidget.h index afe6d4d..b99cc85 100644 --- a/videowidget/videowidget.h +++ b/videowidget/videowidget.h @@ -222,6 +222,23 @@ signals: void btnClicked(const QString &objName); public slots: + //获取长度 + uint getLength(); + //获取当前播放位置 + uint getPosition(); + //设置播放位置 + void setPosition(int position); + + //获取静音状态 + bool getMute(); + //设置静音 + void setMute(bool mute); + + //获取音量 + int getVolume(); + //设置音量 + void setVolume(int volume); + //设置显示间隔 void setInterval(int interval); //设置休眠时间