更新代码
parent
8289db89ce
commit
a6ae810eea
|
@ -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);
|
||||
//垂直表头是否可见
|
||||
|
|
|
@ -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进制
|
||||
|
|
|
@ -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[])
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
android {QT += androidextras}
|
||||
|
||||
TARGET = ffmpegdemo
|
||||
TEMPLATE = app
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
//垂直表头是否可见
|
||||
|
|
|
@ -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进制
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
||||
|
|
|
@ -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);
|
||||
//设置休眠时间
|
||||
|
|
Loading…
Reference in New Issue