提交 6082e46c 编写于 作者: mahuifa's avatar mahuifa

Merge branch 'Dev'

......@@ -35,7 +35,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
# 定义程序版本号
VERSION = 1.0.1
VERSION = 1.0.2
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
TARGET = AVIOReading
......
......@@ -14,7 +14,7 @@ extern "C" { // 用C规则编译指定的代码
typedef struct BufferData {
uchar* ptr;
quint64 size; // 缓冲区中剩余的大小
size_t size; // 缓冲区中剩余的大小
}BufferData;
Widget::Widget(QWidget *parent)
......
......@@ -37,7 +37,7 @@ private:
AVFormatContext* m_formatContext = nullptr;
AVIOContext * m_avioContext = nullptr;
uchar * m_buffer = nullptr; // 保存打开的媒体文件的所有数据
quint64 m_bufSize = 0; // 打开的文件的总大小
size_t m_bufSize = 0; // 打开的文件的总大小
uchar * m_avioBuffer = nullptr; // 从m_buffer中一次读取的数据
int m_avioBufSize = 4096; // 从m_buffer中一次读取的数据长度
};
......
......@@ -37,7 +37,7 @@ include(./Screencap/Screencap.pri)
INCLUDEPATH += ./Screencap
# 定义程序版本号
VERSION = 1.0.2
VERSION = 1.0.3
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
contains(QT_ARCH, i386){ # 使用32位编译器
......
......@@ -6,6 +6,8 @@
#include <QTimer>
#include <QDebug>
#include <qimage.h>
#include <QFileInfo>
#include <QMessageBox>
ReadThread::ReadThread(QObject *parent) : QThread(parent)
{
......@@ -31,6 +33,12 @@ void ReadThread::setPath(const QString &path)
{
if(path.isEmpty()) return;
if(QFileInfo(path).suffix().isEmpty())
{
QMessageBox::warning(nullptr, "注意~", "输入文件没有后缀名,无法使用");
m_path.clear();
return;
}
m_path = path;
}
......@@ -78,6 +86,8 @@ void sleepMsec(int msec)
void ReadThread::run()
{
if(m_path.isEmpty()) return;
bool ret = m_videoDecode->open(m_url); // 打开网络流时会比较慢,如果放到Ui线程会卡
if(ret)
{
......
......@@ -33,7 +33,7 @@ void Widget::on_but_open_clicked()
{
if(ui->but_open->text() == "开始录屏")
{
setSavePath();
if(!setSavePath()) return;
#if defined(Q_OS_WIN)
m_readThread->open("desktop");
#elif defined(Q_OS_LINUX)
......@@ -70,18 +70,20 @@ void Widget::on_playState(ReadThread::PlayState state)
/**
* @brief 设置文件保存路径
*/
void Widget::setSavePath()
bool Widget::setSavePath()
{
QString strDefault = QString("%1/%2").arg(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation))
// 如果不指定文件后缀则在linux下默认保存的视频文件没有后缀,就无法通过后缀名推测视频保存格式
QString strDefault = QString("%1/%2.mp4").arg(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation))
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH-mm-ss"));
QString strPath = QFileDialog::getSaveFileName(this, "视频保存到~", strDefault,
"常用视频文件 (*.mp4 *.avi *.mov *.wmv *.flv *.h264 *.h265);;"
"其它文件格式 (*)");
if(strPath.isEmpty()) return;
if(strPath.isEmpty()) return false;
ui->line_path->setText(strPath);
m_readThread->setPath(strPath);
return true;
}
/**
......
......@@ -21,7 +21,7 @@ private slots:
void on_but_open_clicked();
void on_playState(ReadThread::PlayState state);
void setSavePath();
bool setSavePath();
void on_timeout();
private:
......
......@@ -10,15 +10,15 @@
#---------------------------------------------------------------------------------------
TEMPLATE = subdirs
SUBDIRS += QMWidget # qt自定义窗口
SUBDIRS += WindowRect # 使用透明窗口框选鼠标所在窗口范围
SUBDIRS += SnippingTool # Qt实现截图工具
SUBDIRS += DeviceManagement # 串口、鼠标、键盘热插拔检测模块
SUBDIRS += QLog # 自定义日志系统
SUBDIRS += QMPlayer # 视频播放器界面
SUBDIRS += NtpClient # NTP时间同步客户端(需要管理员权限/超级用户权限打开)
SUBDIRS += MouseKeyEvent # 自定义全局鼠标键盘事件监听器
win32 {
SUBDIRS += QMWidget # qt自定义窗口
SUBDIRS += QMPlayer # 视频播放器界面
SUBDIRS += TestCrashHandler # windows下Qt程序崩溃问题定位Demo(只在msvc编译下有效
}
......@@ -49,7 +49,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
# 定义程序版本号
VERSION = 1.0.1
VERSION = 1.0.2
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
contains(QT_ARCH, i386){ # 使用32位编译器
......
......@@ -202,7 +202,7 @@ void NtpClient::setDateTime(QDateTime& dateTime)
struct timeval tv;
tptr.tm_year = date.year() - 1900; // 这里必须-1900,否则设置不成功
tptr.tm_mon = date.month();
tptr.tm_mon = date.month() - 1; // 月份取值范围为[0-11]
tptr.tm_mday = date.day();
tptr.tm_hour = time.hour();
tptr.tm_min = time.minute();
......
......@@ -10,5 +10,4 @@
#---------------------------------------------------------------------------------------
TEMPLATE = subdirs
SUBDIRS += \
VideoPlay
SUBDIRS += VideoPlay
......@@ -23,6 +23,6 @@ SUBDIRS += XlsxDemo # Qt使用QXlsx读写Excel Demo
SUBDIRS += QtChartsDemo # Qt使用QtCharts绘制图表 Demo
SUBDIRS += QSqlDemo # Qt使用数据库Demo
SUBDIRS += PaintingDemo # 使用 QPainter绘制图片
SUBDIRS += Web # Qt并发编程示例
SUBDIRS += Web # Qt + web编程
SUBDIRS += ConcurrentExamples # Qt并发编程示例
#include "xyseriesiodevice.h"
#include <QLineSeries>
#include <QPointF>
#include <qdebug.h>
#include <qvalueaxis.h>
......
......@@ -15,6 +15,7 @@
#include <QChartGlobal>
#include <QVector>
#include <QElapsedTimer>
#include <QPointF>
QT_CHARTS_BEGIN_NAMESPACE
class QXYSeries;
......
#---------------------------------------------------------------------
# 模块功能: QWebEngineViewQtWebChannel使用示例
# 支持编译器:
# 开发者: mhf
# 邮箱 1603291350@qq.com
# 时间: 2023/02/03
# 错误解决:如果在linux下编译报错:-1: error: /opt/Qt5.14.2/5.14.2/gcc_64/lib/libQt5WebEngineCore.so: .dynsym local symbol at index 3 (>= sh_info of 3)
# 则执行命令sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
#---------------------------------------------------------------------
TEMPLATE = subdirs
# 只有当前系统、编译器支持webenginewidgets模块才编译下列程序MinGW没有),这里 { 不能换行
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册