dlink 多线程,修正回放线程
This commit is contained in:
@@ -29,10 +29,77 @@ void Parse::run()
|
||||
time.start();
|
||||
qDebug() << "parse thread:" << QThread::currentThreadId();
|
||||
|
||||
union{uint8_t B[8];qint16 h[4];quint16 H[4]; qint32 i[2];quint32 I[2];qint64 q;quint64 Q;}src;
|
||||
|
||||
QByteArray header;
|
||||
header[0] = 0x55;
|
||||
header[1] = 0xAA;
|
||||
|
||||
|
||||
all = datagram.size();
|
||||
|
||||
while (datagram.size() > 0) {
|
||||
|
||||
#if 0
|
||||
while (datagram.size() > 0) {
|
||||
|
||||
int index = datagram.indexOf(header);
|
||||
|
||||
if(index >= 0)
|
||||
{
|
||||
|
||||
uint8_t id = datagram.at(index + 2);
|
||||
|
||||
uint32_t len = 0;
|
||||
|
||||
len = ((uint32_t)datagram.at(index + 3)) << 0;
|
||||
len |= ((uint32_t)datagram.at(index + 4)) << 8;
|
||||
len |= ((uint32_t)datagram.at(index + 5)) << 16;
|
||||
len |= ((uint32_t)datagram.at(index + 6)) << 24;
|
||||
|
||||
uint8_t sum = 0;
|
||||
|
||||
QByteArray frame = datagram.mid(index + 7,len);
|
||||
|
||||
sum = std::accumulate(frame.begin(),frame.end(),0);
|
||||
|
||||
if(sum == datagram.at(index + 7 + len))
|
||||
{
|
||||
//ok
|
||||
//qDebug() << "ok" << id << len << sum << datagram.size();
|
||||
|
||||
|
||||
uint8_t raw_index = 16;
|
||||
|
||||
src.B[0] = frame.at(raw_index++);
|
||||
src.B[1] = frame.at(raw_index++);
|
||||
src.B[2] = frame.at(raw_index++);
|
||||
src.B[3] = frame.at(raw_index++);
|
||||
quint32 ip = src.I[0];
|
||||
|
||||
|
||||
src.B[0] = frame.at(raw_index++);
|
||||
src.B[1] = frame.at(raw_index++);
|
||||
quint16 port =src.H[0];
|
||||
|
||||
current = all - datagram.size();
|
||||
|
||||
emit frameok(ip,port,frame);
|
||||
|
||||
emit progress(all,current);
|
||||
|
||||
}
|
||||
|
||||
datagram = datagram.mid(index + 7 + len + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
datagram.clear();
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
|
||||
for (QByteArray::const_iterator i = datagram.cbegin(); i != datagram.cend(); ++i)
|
||||
{
|
||||
current ++;
|
||||
@@ -46,6 +113,7 @@ void Parse::run()
|
||||
|
||||
uint32_t index = 0;
|
||||
|
||||
/*
|
||||
src.B[0] = parser.buff[index++];
|
||||
src.B[1] = parser.buff[index++];
|
||||
src.B[2] = parser.buff[index++];
|
||||
@@ -67,6 +135,9 @@ void Parse::run()
|
||||
src.B[6] = parser.buff[index++];
|
||||
src.B[7] = parser.buff[index++];
|
||||
qint64 save_count =src.Q;
|
||||
*/
|
||||
|
||||
index += 16;
|
||||
|
||||
src.B[0] = parser.buff[index++];
|
||||
src.B[1] = parser.buff[index++];
|
||||
@@ -86,7 +157,7 @@ void Parse::run()
|
||||
{
|
||||
frame.append((const char)parser.buff[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
if(port_data.contains(port))//包含
|
||||
{
|
||||
QList<QByteArray> frame_list = port_data.value(port);
|
||||
@@ -99,20 +170,24 @@ void Parse::run()
|
||||
frame_list.append(frame);
|
||||
port_data.insert(port,frame_list);
|
||||
}
|
||||
*/
|
||||
|
||||
frame_data.append(frame);
|
||||
|
||||
emit frameok(ip,port,frame);
|
||||
|
||||
emit progress(all,current);
|
||||
//emit progress(all,current);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:{
|
||||
|
||||
break;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
emit frameList(frame_data);
|
||||
emit frameport(port_data);
|
||||
|
||||
@@ -122,7 +197,7 @@ void Parse::run()
|
||||
break;//退出,结束线程
|
||||
}
|
||||
|
||||
qDebug() << "thread finished, time: " << time.nsecsElapsed() << "ns";
|
||||
qDebug() << "thread finished, time: " << time.nsecsElapsed()/1000000.0 << "ms";
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +205,7 @@ void Parse::run()
|
||||
//每次读取一个缓存大小的数据
|
||||
void Parse::parseData(const QString filename)
|
||||
{
|
||||
qDebug() << "current thread is:" << QThread::currentThreadId();
|
||||
qDebug() << "Parse data:" << QThread::currentThreadId();
|
||||
|
||||
if(filename.size() <= 0)
|
||||
{
|
||||
|
||||
+60
-36
@@ -1,4 +1,5 @@
|
||||
#include "PlayThread.h"
|
||||
#include "QApplication"
|
||||
|
||||
|
||||
PlayThread::PlayThread(QObject *parent) : QObject(parent)
|
||||
@@ -38,13 +39,11 @@ void PlayThread::run()
|
||||
|
||||
while(play_control)
|
||||
{
|
||||
while (FrameData.size() > 0) {
|
||||
while (play_start) {
|
||||
//for 不允许自加,需要后面逻辑判断增加
|
||||
for (QList<QByteArray>::iterator i = FrameData.begin(); i != FrameData.end();)
|
||||
{
|
||||
//记录一下运行到延迟之前用了多少时间,需要减掉这部分时间
|
||||
|
||||
|
||||
elapstimer.start();
|
||||
|
||||
CurrentProgress = FrameData.indexOf(*i);
|
||||
@@ -100,19 +99,25 @@ void PlayThread::run()
|
||||
frame.clear();
|
||||
frame.append(data.mid(index));
|
||||
|
||||
qint64 time_gap = time.toMSecsSinceEpoch() - time_tick;
|
||||
|
||||
while((QDateTime::currentMSecsSinceEpoch() - currentTick) < (time_gap/times))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
emit transmit(QHostAddress(ip),port,frame);
|
||||
|
||||
//延迟处理
|
||||
qint64 time_gap = time.toMSecsSinceEpoch() - time_tick - (qint64)(elapstimer.nsecsElapsed()/ 1000000.0);
|
||||
|
||||
time_tick = time.toMSecsSinceEpoch();
|
||||
|
||||
if(time_gap > 0)
|
||||
{
|
||||
while((QDateTime::currentMSecsSinceEpoch() - currentTick) < (time_gap/times))
|
||||
{
|
||||
//等
|
||||
QApplication::processEvents();
|
||||
}
|
||||
}
|
||||
currentTick = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
|
||||
//中断播放,一般只有要播放新的文件才会出现这种情况
|
||||
if(play_state == 0)
|
||||
{
|
||||
@@ -120,7 +125,8 @@ void PlayThread::run()
|
||||
}
|
||||
else if(play_state == 1)//正常播放
|
||||
{
|
||||
if(time_gap != 0)
|
||||
/*
|
||||
if(time_gap > 0)
|
||||
{
|
||||
qint64 time_count = time_gap/times;//ms
|
||||
|
||||
@@ -170,18 +176,19 @@ void PlayThread::run()
|
||||
{
|
||||
emit delaytime(time_gap/times,0);
|
||||
}
|
||||
*/
|
||||
|
||||
if(play_state == 1)//如果是正常计时,那么就加
|
||||
|
||||
|
||||
CurrentProgress = FrameData.indexOf(*i);
|
||||
emit progress(FrameData.size() - 1,CurrentProgress);
|
||||
++i;
|
||||
if(i == FrameData.end())
|
||||
{
|
||||
CurrentProgress = FrameData.indexOf(*i);
|
||||
emit progress(FrameData.size() - 1,CurrentProgress);
|
||||
++i;
|
||||
if(i == FrameData.end())
|
||||
{
|
||||
play_state = 0;
|
||||
break;
|
||||
}
|
||||
play_state = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if(play_state == 2)//暂停
|
||||
{
|
||||
@@ -224,27 +231,53 @@ void PlayThread::run()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//延迟处理
|
||||
qint64 time_gap = time.toMSecsSinceEpoch() - time_tick - (qint64)(elapstimer.nsecsElapsed()/ 1000000.0);
|
||||
|
||||
if(time_gap > 0)
|
||||
{
|
||||
while((QDateTime::currentMSecsSinceEpoch() - currentTick) < (time_gap/times))
|
||||
{
|
||||
emit delaytime(time_gap/times,QDateTime::currentMSecsSinceEpoch() - currentTick);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
emit transmit(QHostAddress(ip),port,frame);
|
||||
|
||||
time_tick = time.toMSecsSinceEpoch();
|
||||
|
||||
currentTick = QDateTime::currentMSecsSinceEpoch();
|
||||
*/
|
||||
|
||||
|
||||
//qDebug() << "play time:" << elapstimer.nsecsElapsed() / 1000000.0;
|
||||
}
|
||||
play_state = 0;
|
||||
isChangedPos = false;
|
||||
time_tick = 0;
|
||||
FrameData.clear();
|
||||
//FrameData.clear();
|
||||
play_start = false;
|
||||
break;//退出,结束播放
|
||||
}
|
||||
QThread::msleep(100);
|
||||
QThread::msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PlayThread::resetData()
|
||||
{
|
||||
port_data.clear();
|
||||
|
||||
FrameData.clear();
|
||||
|
||||
time_tick= 0;
|
||||
|
||||
play_start = false;
|
||||
|
||||
play_state = 0;
|
||||
}
|
||||
|
||||
@@ -268,23 +301,14 @@ void PlayThread::playData(QList<QByteArray> data,QMap<quint16,QList<QByteArray>>
|
||||
|
||||
}
|
||||
|
||||
void PlayThread::appendPlayData(QList<QByteArray> data,QMap<quint16,QList<QByteArray>> data2)
|
||||
void PlayThread::appendPlayData(quint32 ip, quint16 port, QByteArray data)
|
||||
{
|
||||
//收到数据后对数据进行分类,重新生成子线程进行解析
|
||||
//qDebug() << "PlayThread:" << QThread::currentThreadId();
|
||||
|
||||
port_data.clear();
|
||||
port_data = data2;
|
||||
|
||||
|
||||
FrameData.clear();
|
||||
FrameData = data;
|
||||
|
||||
time_tick= 0;
|
||||
|
||||
play_state = 1;
|
||||
|
||||
emit progress(FrameData.size() - 1,0);
|
||||
FrameData.append(data);
|
||||
|
||||
emit progress(size() - 1,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+18
-5
@@ -40,6 +40,8 @@ public:
|
||||
|
||||
uint8_t play_state = 0;
|
||||
|
||||
bool play_start = false;
|
||||
|
||||
|
||||
float times = 1;//倍数
|
||||
|
||||
@@ -50,19 +52,23 @@ public slots:
|
||||
|
||||
void playData(QList<QByteArray> data, QMap<quint16, QList<QByteArray> > data2);
|
||||
|
||||
void appendPlayData(QList<QByteArray> data,QMap<quint16,QList<QByteArray>> data2);
|
||||
void appendPlayData(quint32 ip, quint16 port, QByteArray data);
|
||||
|
||||
|
||||
void setNewPos(int64_t pos)
|
||||
{
|
||||
newpos = pos;
|
||||
//newpos 最后会比size还大
|
||||
isChangedPos = true;
|
||||
if(pos <= size())
|
||||
{
|
||||
newpos = pos;
|
||||
//newpos 最后会比size还大
|
||||
isChangedPos = true;
|
||||
}
|
||||
}
|
||||
|
||||
void setPlayState(uint8_t flag)
|
||||
{
|
||||
play_state = flag;
|
||||
play_start = flag;
|
||||
qDebug() << "play state" << flag;
|
||||
}
|
||||
|
||||
@@ -73,13 +79,13 @@ public slots:
|
||||
play_state = 0;
|
||||
isChangedPos = false;
|
||||
time_tick = 0;
|
||||
FrameData.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void setplay_control(bool flag)
|
||||
{
|
||||
play_control = flag;
|
||||
|
||||
}
|
||||
|
||||
void setTimes(qreal t)
|
||||
@@ -90,6 +96,13 @@ public slots:
|
||||
}
|
||||
}
|
||||
|
||||
int size()
|
||||
{
|
||||
return FrameData.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
void progress(uint64_t all,uint64_t current);
|
||||
|
||||
+21
-10
@@ -6,7 +6,7 @@ SaveThread::SaveThread(QObject *parent)
|
||||
//setAutoDelete(true);
|
||||
|
||||
Packer_init(&packer);
|
||||
Parser_init(&parser);
|
||||
//Parser_init(&parser);
|
||||
|
||||
save_count = 0;
|
||||
|
||||
@@ -18,7 +18,12 @@ SaveThread::SaveThread(QObject *parent)
|
||||
|
||||
SaveThread::~SaveThread()
|
||||
{
|
||||
|
||||
if(file)
|
||||
{
|
||||
file->close();
|
||||
delete file;
|
||||
file = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +36,8 @@ SaveThread::~SaveThread()
|
||||
|
||||
void SaveThread::setSave(const QHostAddress &ip, const uint16_t &port, QByteArray data)
|
||||
{
|
||||
QElapsedTimer elapstimer;
|
||||
elapstimer.start();
|
||||
//QElapsedTimer elapstimer;
|
||||
//elapstimer.start();
|
||||
|
||||
//qDebug() << "save re";
|
||||
|
||||
@@ -96,9 +101,10 @@ void SaveThread::setSave(const QHostAddress &ip, const uint16_t &port, QByteArra
|
||||
|
||||
//qDebug() << "save";
|
||||
|
||||
QFile file("./log/" + logname + ".bin");
|
||||
//QFile file("./log/" + logname + ".bin");
|
||||
|
||||
if(file.open(QIODevice::Append) )
|
||||
//if(file.open(QIODevice::Append) )
|
||||
if(file->isOpen())
|
||||
{
|
||||
//QByteArray msg;
|
||||
|
||||
@@ -106,7 +112,7 @@ void SaveThread::setSave(const QHostAddress &ip, const uint16_t &port, QByteArra
|
||||
//msg.append((const char *)packer.buff,tx_len);
|
||||
|
||||
|
||||
file.write((const char *)packer.buff,tx_len);
|
||||
file->write((const char *)packer.buff,tx_len);
|
||||
|
||||
/*
|
||||
QDataStream stream(&file);
|
||||
@@ -116,9 +122,14 @@ void SaveThread::setSave(const QHostAddress &ip, const uint16_t &port, QByteArra
|
||||
stream.writeBytes(msg.data(),msg.size());
|
||||
*/
|
||||
|
||||
file.flush();
|
||||
file.close();
|
||||
//qDebug() << "file size" << file->size();
|
||||
|
||||
if((file->size() - record_count) >= (1024 * 1024))
|
||||
{
|
||||
record_count = file->size();
|
||||
file->flush();
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "save time:" << elapstimer.nsecsElapsed() / 1000000.0;
|
||||
//qDebug() << "save time:" << elapstimer.nsecsElapsed() / 1000000.0;
|
||||
}
|
||||
|
||||
@@ -38,11 +38,65 @@ public:
|
||||
void setRecordState(bool state)
|
||||
{
|
||||
recordstate = state;
|
||||
|
||||
if(recordstate)//开始记录
|
||||
{
|
||||
if(file)
|
||||
{
|
||||
file->close();
|
||||
delete file;
|
||||
file = nullptr;
|
||||
}
|
||||
|
||||
file = new QFile("./log/" + logname + ".bin");
|
||||
|
||||
if(!file->open(QIODevice::Append))
|
||||
{
|
||||
//open failure
|
||||
file->close();
|
||||
delete file;
|
||||
file = nullptr;
|
||||
}
|
||||
|
||||
record_count = 0;
|
||||
}
|
||||
else//停止记录
|
||||
{
|
||||
if(file)
|
||||
{
|
||||
file->close();
|
||||
delete file;
|
||||
file = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setLogName(QString name)
|
||||
{
|
||||
logname = name;
|
||||
|
||||
if(logname == name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(file)
|
||||
{
|
||||
file->close();
|
||||
delete file;
|
||||
file = nullptr;
|
||||
}
|
||||
|
||||
file = new QFile("./log/" + logname + ".bin");
|
||||
|
||||
if(!file->open(QIODevice::Append))
|
||||
{
|
||||
//open failure
|
||||
file->close();
|
||||
delete file;
|
||||
file = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public slots:
|
||||
@@ -57,6 +111,10 @@ private:
|
||||
Packer_t packer;
|
||||
Parser_t parser;
|
||||
|
||||
quint64 record_count = 0;
|
||||
|
||||
QFile *file;
|
||||
|
||||
};
|
||||
|
||||
#endif // SAVETHREAD_H
|
||||
|
||||
+15
-10
@@ -5,7 +5,6 @@
|
||||
|
||||
DLink::DLink(QObject *parent) : QObject(parent)
|
||||
{
|
||||
qDebug() << "Dlink " << QThread::currentThreadId();
|
||||
|
||||
QTimer *Timer = new QTimer(this);
|
||||
Timer->setInterval(1000);
|
||||
@@ -80,6 +79,8 @@ DLink::~DLink()
|
||||
|
||||
void DLink::transmit(QHostAddress ip,quint16 port,QByteArray data)
|
||||
{
|
||||
//qDebug() << "dlink transmit:" << QThread::currentThreadId();
|
||||
|
||||
QElapsedTimer time;
|
||||
|
||||
time.start();
|
||||
@@ -312,7 +313,7 @@ bool DLink::setupClient(const QHostAddress &local_addr,int local_port,const QHos
|
||||
}
|
||||
|
||||
QUdpSocket *clientsock = new QUdpSocket(this);
|
||||
clientsock->setProxy(QNetworkProxy::NoProxy);//必须先设置不代理,否则连不上
|
||||
clientsock->setProxy(QNetworkProxy::DefaultProxy);//必须先设置不代理,否则连不上
|
||||
int rst = clientsock->open(QIODevice::ReadWrite);
|
||||
if(rst)
|
||||
{
|
||||
@@ -399,14 +400,17 @@ bool DLink::setup_multicast_recieve(const QHostAddress &ip, const quint16 &port,
|
||||
|
||||
|
||||
QUdpSocket *clientsock = new QUdpSocket(this);
|
||||
clientsock->setProxy(QNetworkProxy::NoProxy);//必须先设置不代理,否则连不上
|
||||
clientsock->setProxy(QNetworkProxy::DefaultProxy);//必须先设置不代理,否则连不上
|
||||
|
||||
//clientsock->open(QIODevice::ReadWrite);
|
||||
if(clientsock->bind(QHostAddress::AnyIPv4,m_port,QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint))//
|
||||
{
|
||||
if (clientsock->joinMulticastGroup(QHostAddress(m_ip)))
|
||||
{
|
||||
clientsock->setSocketOption(QAbstractSocket::ReceiveBufferSizeSocketOption,1024*1024*10);
|
||||
// clientsock->setSocketOption(QAbstractSocket::SendBufferSizeSocketOption,1024*1024*100);
|
||||
clientsock->setSocketOption (QAbstractSocket::ReceiveBufferSizeSocketOption, 1024*1024*100);
|
||||
clientsock->setSocketOption(QAbstractSocket::LowDelayOption, 1);
|
||||
clientsock->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
|
||||
//clientsock->setSocketOption(QAbstractSocket::MulticastTtlOption, 10);
|
||||
//clientsock->setSocketOption(QAbstractSocket::MulticastLoopbackOption, 0);//禁止本机接收
|
||||
|
||||
@@ -494,11 +498,12 @@ bool DLink::setup_multicast_transmit(const QHostAddress &ip,const quint16 &port,
|
||||
|
||||
|
||||
QUdpSocket *clientsock = new QUdpSocket(this);
|
||||
clientsock->setProxy(QNetworkProxy::NoProxy);//必须先设置不代理,否则连不上
|
||||
clientsock->setProxy(QNetworkProxy::DefaultProxy);//必须先设置不代理,否则连不上
|
||||
|
||||
clientsock->setSocketOption(QAbstractSocket::SendBufferSizeSocketOption,1024*1024*10);
|
||||
//clientsock->setSocketOption(QAbstractSocket::MulticastTtlOption, 10);
|
||||
//clientsock->setSocketOption(QAbstractSocket::MulticastLoopbackOption, 0);//禁止本机接收
|
||||
clientsock->setSocketOption(QAbstractSocket::SendBufferSizeSocketOption,1024);
|
||||
//clientsock->setSocketOption (QAbstractSocket::ReceiveBufferSizeSocketOption, 1024*1024*100);
|
||||
clientsock->setSocketOption(QAbstractSocket::LowDelayOption, 1);
|
||||
clientsock->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
|
||||
|
||||
clientNode node;
|
||||
node.sock = clientsock;
|
||||
@@ -607,6 +612,8 @@ void DLink::readPendingDatagramsClient(void)
|
||||
QUdpSocket *clientsock = qobject_cast<QUdpSocket *>(obj);
|
||||
if(clientsock)
|
||||
{
|
||||
//QUdpSocket::readChannelFinished()
|
||||
|
||||
while (clientsock->hasPendingDatagrams()) {
|
||||
QByteArray datagram;
|
||||
datagram.resize(clientsock->pendingDatagramSize());
|
||||
@@ -623,8 +630,6 @@ void DLink::readPendingDatagramsClient(void)
|
||||
{
|
||||
if(node.sock == clientsock)
|
||||
{
|
||||
|
||||
|
||||
//qDebug() << "dlink" << QThread::currentThread();
|
||||
|
||||
node.in.count += datagram.size();
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
#ifndef DLINK_H
|
||||
#ifndef DLINK_H
|
||||
#define DLINK_H
|
||||
|
||||
#include <QObject>
|
||||
@@ -100,11 +100,11 @@ public:
|
||||
|
||||
bool setupClient(const QHostAddress &local_addr,int local_port,const QHostAddress &remote_addr,int remote_port);
|
||||
|
||||
bool setup_multicast_recieve(const QHostAddress &ip, const quint16 &port, QHostAddress newip = QHostAddress("0,0,0,0"), quint16 newport = 0);
|
||||
Q_INVOKABLE bool setup_multicast_recieve(const QHostAddress &ip, const quint16 &port, QHostAddress newip = QHostAddress("0,0,0,0"), quint16 newport = 0);
|
||||
|
||||
bool setup_multicast_transmit(const QHostAddress &ip, const quint16 &port, QHostAddress newip = QHostAddress("0,0,0,0"), quint16 newport = 0);
|
||||
Q_INVOKABLE bool setup_multicast_transmit(const QHostAddress &ip, const quint16 &port, QHostAddress newip = QHostAddress("0,0,0,0"), quint16 newport = 0);
|
||||
|
||||
bool setup_multicast_close(const QHostAddress &ip,const quint16 &port);
|
||||
Q_INVOKABLE bool setup_multicast_close(const QHostAddress &ip,const quint16 &port);
|
||||
|
||||
bool isExportInfo = true;
|
||||
|
||||
|
||||
+163
-135
@@ -1,6 +1,8 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
@@ -20,6 +22,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
setWindowIcon(QIcon(":/img/Dark/Logo.png"));
|
||||
|
||||
qDebug() << "MainThread:" << QThread::currentThreadId();
|
||||
|
||||
|
||||
//设置表题
|
||||
bool titleflag = false;
|
||||
QString title = Config::getSetting("title",&titleflag).toString();
|
||||
@@ -42,8 +47,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
|
||||
|
||||
//dlink->moveToThread(&dlink_thread);
|
||||
//dlink_thread.start();
|
||||
dlink->moveToThread(&dlink_thread);
|
||||
dlink_thread.start();
|
||||
|
||||
|
||||
savethread->moveToThread(&save_thread);
|
||||
@@ -123,14 +128,15 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
{
|
||||
recordbtn->setText(tr("StopRecord"));
|
||||
recordstate = true;//开始记录
|
||||
savethread->setRecordState(recordstate);
|
||||
|
||||
logname = QString("%1").arg(QDateTime::currentDateTime().toString("yyyyMMddHHmmss"));
|
||||
savethread->setLogName(logname);
|
||||
savethread->setRecordState(recordstate);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//播放倍速
|
||||
combox = new QComboBox(this);
|
||||
|
||||
combox->resize(40,40);
|
||||
@@ -145,8 +151,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
combox->addItem(tr("20x"),20);
|
||||
combox->addItem(tr("50x"),50);
|
||||
combox->setCurrentIndex(3);
|
||||
|
||||
|
||||
combox->hide();
|
||||
|
||||
ui->statusbar->addPermanentWidget(combox);
|
||||
@@ -257,12 +261,24 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
QString port = item.value("port").toString();
|
||||
|
||||
//删除所有的端口,重新设置
|
||||
dlink->setup_multicast_close(QHostAddress(addr),port.toUShort());
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_close", Qt::QueuedConnection,
|
||||
Q_ARG(const QHostAddress &, QHostAddress(addr)),
|
||||
Q_ARG(const quint16 &, port.toUShort())
|
||||
);
|
||||
// dlink->setup_multicast_close(QHostAddress(addr),port.toUShort());
|
||||
|
||||
//记录模式
|
||||
bool ret;
|
||||
if(mode == 0)
|
||||
{
|
||||
if(dlink->setup_multicast_recieve(QHostAddress(addr),port.toUInt()))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_recieve", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, QHostAddress(addr)),
|
||||
Q_ARG(const quint16 &, port.toUInt() ),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_listen.png"));
|
||||
}
|
||||
@@ -273,7 +289,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
}
|
||||
else//回放模式
|
||||
{
|
||||
if(dlink->setup_multicast_transmit(QHostAddress(addr),port.toUInt()))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_transmit", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, QHostAddress(addr)),
|
||||
Q_ARG(const quint16 &, port.toUInt() ),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_send.png"));
|
||||
}
|
||||
@@ -288,8 +311,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
});
|
||||
|
||||
//初始化打包和解析结构体
|
||||
Packer_init(&packer);
|
||||
Parser_init(&parser);
|
||||
//Packer_init(&packer);
|
||||
//Parser_init(&parser);
|
||||
|
||||
logname = QString("%1").arg(QDateTime::currentDateTime().toString("yyyyMMddHHmmss"));
|
||||
|
||||
@@ -380,9 +403,17 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
table->removeCellWidget(idx,4);
|
||||
table->setCellWidget(idx,4,status);
|
||||
|
||||
bool ret;
|
||||
if(mode == 0)
|
||||
{
|
||||
if(dlink->setup_multicast_recieve(QHostAddress(ip),port.toUInt()))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_recieve", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, QHostAddress(ip) ),
|
||||
Q_ARG(const quint16 &, port.toUInt() ),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_listen.png"));
|
||||
}
|
||||
@@ -393,7 +424,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
}
|
||||
else//回放模式
|
||||
{
|
||||
if(dlink->setup_multicast_transmit(QHostAddress(ip),port.toUInt()))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_transmit", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, QHostAddress(ip) ),
|
||||
Q_ARG(const quint16 &, port.toUInt() ),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_send.png"));
|
||||
}
|
||||
@@ -475,11 +513,23 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
//记录模式
|
||||
if(mode == 0)
|
||||
{
|
||||
dlink->setup_multicast_recieve(QHostAddress(ipaddr.toString()),port.toUInt(),addr,port.toUInt());
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_recieve", Qt::QueuedConnection,
|
||||
Q_ARG(const QHostAddress &, QHostAddress(ipaddr.toString())),
|
||||
Q_ARG(const quint16 &, port.toUInt()),
|
||||
Q_ARG(QHostAddress, addr),
|
||||
Q_ARG(quint16, port.toUInt())
|
||||
);
|
||||
// dlink->setup_multicast_recieve(QHostAddress(ipaddr.toString()),port.toUInt(),addr,port.toUInt());
|
||||
}
|
||||
else//回放模式
|
||||
{
|
||||
dlink->setup_multicast_transmit(QHostAddress(ipaddr.toString()),port.toUInt(),addr,port.toUInt());
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_transmit", Qt::QueuedConnection,
|
||||
Q_ARG(const QHostAddress &, QHostAddress(ipaddr.toString())),
|
||||
Q_ARG(const quint16 &, port.toUInt()),
|
||||
Q_ARG(QHostAddress, addr),
|
||||
Q_ARG(quint16, port.toUInt())
|
||||
);
|
||||
// dlink->setup_multicast_transmit(QHostAddress(ipaddr.toString()),port.toUInt(),addr,port.toUInt());
|
||||
}
|
||||
|
||||
//更新一下端口
|
||||
@@ -506,11 +556,23 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
//记录模式
|
||||
if(mode == 0)
|
||||
{
|
||||
dlink->setup_multicast_recieve(QHostAddress(ipaddr.toString()),port.toUInt(),QHostAddress(ipaddr.toString()),newport);
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_recieve", Qt::QueuedConnection,
|
||||
Q_ARG(const QHostAddress &, QHostAddress(ipaddr.toString()) ),
|
||||
Q_ARG(const quint16 &, port.toUInt()),
|
||||
Q_ARG(QHostAddress, QHostAddress(ipaddr.toString()) ),
|
||||
Q_ARG(quint16, newport)
|
||||
);
|
||||
// dlink->setup_multicast_recieve(QHostAddress(ipaddr.toString()),port.toUInt(),QHostAddress(ipaddr.toString()),newport);
|
||||
}
|
||||
else//回放模式
|
||||
{
|
||||
dlink->setup_multicast_transmit(QHostAddress(ipaddr.toString()),port.toUInt(),QHostAddress(ipaddr.toString()),newport);
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_transmit", Qt::QueuedConnection,
|
||||
Q_ARG(const QHostAddress &, QHostAddress(ipaddr.toString()) ),
|
||||
Q_ARG(const quint16 &, port.toUInt()),
|
||||
Q_ARG(QHostAddress, QHostAddress(ipaddr.toString()) ),
|
||||
Q_ARG(quint16, newport)
|
||||
);
|
||||
// dlink->setup_multicast_transmit(QHostAddress(ipaddr.toString()),port.toUInt(),QHostAddress(ipaddr.toString()),newport);
|
||||
}
|
||||
|
||||
//更新一下端口
|
||||
@@ -547,7 +609,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
QLabel *logo = new QLabel();
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_disconnected.png"));
|
||||
logo->setAlignment(Qt::AlignHCenter);
|
||||
logo->setAlignment(Qt::AlignCenter);
|
||||
|
||||
table->removeCellWidget(idx,0);
|
||||
table->setCellWidget(idx,0,logo);
|
||||
@@ -570,9 +632,19 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
//增加连接
|
||||
//记录模式
|
||||
bool ret;
|
||||
if(mode == 0)
|
||||
{
|
||||
if(dlink->setup_multicast_recieve(addr,portnumber))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_recieve", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, addr),
|
||||
Q_ARG(const quint16 &, portnumber),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
|
||||
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_listen.png"));
|
||||
}
|
||||
@@ -583,7 +655,16 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
}
|
||||
else//回放模式
|
||||
{
|
||||
if(dlink->setup_multicast_transmit(addr,portnumber))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_transmit", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, addr),
|
||||
Q_ARG(const quint16 &, portnumber),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
|
||||
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_send.png"));
|
||||
}
|
||||
@@ -618,7 +699,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
if(Config::deleteConnet(ip,port))
|
||||
{
|
||||
//断开连接
|
||||
dlink->setup_multicast_close(QHostAddress(ip),port.toUShort());
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_close", Qt::QueuedConnection,
|
||||
Q_ARG(const QHostAddress &, QHostAddress(ip) ),
|
||||
Q_ARG(const quint16 &, port.toUShort())
|
||||
);
|
||||
// dlink->setup_multicast_close(QHostAddress(ip),port.toUShort());
|
||||
|
||||
table->removeRow(row);
|
||||
|
||||
@@ -690,6 +775,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
Q_UNUSED(column)
|
||||
|
||||
if(playthread)
|
||||
{
|
||||
playthread->resetData();
|
||||
}
|
||||
|
||||
QString key = table->item(row,0)->data(Qt::DisplayRole).toString();
|
||||
|
||||
QString path = filelist.value(key);
|
||||
@@ -699,11 +789,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
QString filename = select_file;
|
||||
|
||||
//解析开始
|
||||
Parse *parse = new Parse;
|
||||
|
||||
parse->parseData(filename);
|
||||
|
||||
connect(parse,&Parse::progress,this,[=](qint64 length,qint64 current){
|
||||
//进度条
|
||||
connect(parse,&Parse::progress,[=](qint64 length,qint64 current){
|
||||
if(progressbar)
|
||||
{
|
||||
progressbar->setRange(0,length);
|
||||
@@ -712,21 +804,21 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
});
|
||||
|
||||
|
||||
//产生的文件
|
||||
connect(parse,&Parse::frameList,this,[=](QList<QByteArray> data){
|
||||
playdata.clear();
|
||||
playdata = data;
|
||||
Q_UNUSED(data)
|
||||
|
||||
if(playthread)
|
||||
{
|
||||
playthread->resetState(true);
|
||||
//playthread->resetState(true);
|
||||
|
||||
ui->horizontalSlider->setMaximum(playthread->size() - 1);
|
||||
|
||||
ui->horizontalSlider->setValue(0);
|
||||
|
||||
ui->label_status->setText(" "+ QString::number(0) + "/" + QString::number(playthread->size() - 1) + " ");
|
||||
|
||||
}
|
||||
|
||||
ui->horizontalSlider->setMaximum(playdata.size() - 1);
|
||||
|
||||
ui->horizontalSlider->setValue(0);
|
||||
|
||||
ui->label_status->setText(" "+ QString::number(0) + "/" + QString::number(playdata.size() - 1) + " ");
|
||||
|
||||
//解析完成
|
||||
showMessage(tr("parse complete"),10000);
|
||||
|
||||
@@ -739,13 +831,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
});
|
||||
|
||||
|
||||
connect(parse,&Parse::frameport,this,[=](QMap<quint16,QList<QByteArray>> data){
|
||||
port_data.clear();
|
||||
port_data = data;
|
||||
connect(parse,&Parse::frameok,playthread,&PlayThread::appendPlayData,Qt::DirectConnection);
|
||||
|
||||
});
|
||||
|
||||
QThreadPool::globalInstance()->start(parse);
|
||||
//开始解析线程
|
||||
QThreadPool::globalInstance()->start(parse,1);
|
||||
});
|
||||
|
||||
|
||||
@@ -949,13 +1038,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
ui->pushButton_next->setStyleSheet(next_default + next_hover + next_pressed);
|
||||
|
||||
|
||||
|
||||
|
||||
//playthread = new PlayThread;
|
||||
|
||||
//playthread->playData(playdata);
|
||||
|
||||
//显示进度条
|
||||
connect(playthread,&PlayThread::progress,this,[=](uint64_t all,uint64_t current){
|
||||
|
||||
@@ -1013,6 +1095,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
});
|
||||
|
||||
//发给dlink发出去
|
||||
//connect(playthread,&PlayThread::transmit,dlink,&DLink::transmit,Qt::DirectConnection);
|
||||
connect(playthread,&PlayThread::transmit,dlink,&DLink::transmit);
|
||||
|
||||
|
||||
@@ -1025,6 +1108,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
QString port = QString::number(p_port);
|
||||
|
||||
//添加一组
|
||||
//先读取,看看是不是存在,可以得到名字
|
||||
if(Config::insertConnet(ip, ip, port))//配置文件里面已经存在
|
||||
{
|
||||
QTableWidget *table = ui->tableWidget_Socket;
|
||||
@@ -1057,9 +1141,18 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
//增加连接
|
||||
//记录模式
|
||||
bool ret;
|
||||
if(mode == 0)
|
||||
{
|
||||
if(dlink->setup_multicast_recieve(p_ip,p_port))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_recieve", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, p_ip),
|
||||
Q_ARG(const quint16 &, p_port),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_listen.png"));
|
||||
}
|
||||
@@ -1070,7 +1163,15 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
}
|
||||
else//回放模式
|
||||
{
|
||||
if(dlink->setup_multicast_transmit(p_ip,p_port))
|
||||
QMetaObject::invokeMethod(dlink, "setup_multicast_transmit", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QHostAddress &, p_ip),
|
||||
Q_ARG(const quint16 &, p_port),
|
||||
Q_ARG(QHostAddress, QHostAddress("0.0.0.0")),
|
||||
Q_ARG(quint16, 0)
|
||||
);
|
||||
|
||||
if(ret)
|
||||
{
|
||||
logo->setPixmap(QPixmap(":/img/Dark/Info_send.png"));
|
||||
}
|
||||
@@ -1098,8 +1199,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
playthread->disconnect(playthread,nullptr,nullptr,nullptr);
|
||||
|
||||
|
||||
|
||||
playthread->deleteLater();
|
||||
}
|
||||
});
|
||||
@@ -1124,7 +1223,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
});
|
||||
|
||||
|
||||
QThreadPool::globalInstance()->start(playthread);
|
||||
QThreadPool::globalInstance()->start(playthread,1);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -1160,86 +1259,6 @@ void MainWindow::showMessage(const QString &message,int TimeOut)
|
||||
ui->statusbar->showMessage(message,TimeOut);
|
||||
}
|
||||
|
||||
|
||||
//移动到其他线程
|
||||
void MainWindow::setSave(const QHostAddress &ip, const uint16_t &port, QByteArray data)
|
||||
{
|
||||
if(mode > 0)//如果目前是播放模式,那就不记录
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!recordstate)//如果不是记录打开,那么就不记录
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray frame;
|
||||
|
||||
frame.clear();
|
||||
|
||||
union{uint8_t B[8];qint16 h[4];quint16 H[4]; qint32 i[2];quint32 I[2];qint64 q;quint64 Q;}src;
|
||||
|
||||
qint64 time_t = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
src.q = time_t;
|
||||
frame.append(src.B[0]);
|
||||
frame.append(src.B[1]);
|
||||
frame.append(src.B[2]);
|
||||
frame.append(src.B[3]);
|
||||
frame.append(src.B[4]);
|
||||
frame.append(src.B[5]);
|
||||
frame.append(src.B[6]);
|
||||
frame.append(src.B[7]);
|
||||
|
||||
save_count++;
|
||||
src.Q = save_count;
|
||||
frame.append(src.B[0]);
|
||||
frame.append(src.B[1]);
|
||||
frame.append(src.B[2]);
|
||||
frame.append(src.B[3]);
|
||||
frame.append(src.B[4]);
|
||||
frame.append(src.B[5]);
|
||||
frame.append(src.B[6]);
|
||||
frame.append(src.B[7]);
|
||||
|
||||
|
||||
src.I[0] = ip.toIPv4Address();
|
||||
frame.append(src.B[0]);
|
||||
frame.append(src.B[1]);
|
||||
frame.append(src.B[2]);
|
||||
frame.append(src.B[3]);
|
||||
|
||||
src.H[0] = port;
|
||||
frame.append(src.B[0]);
|
||||
frame.append(src.B[1]);
|
||||
|
||||
frame.append(data);
|
||||
|
||||
|
||||
//长度可能太短,需要修改打包协议
|
||||
size_t tx_len = Packer_pack(&packer, 01, (uint8_t*)frame.data(), frame.size());
|
||||
|
||||
|
||||
QFile file("./log/" + logname + ".bin");
|
||||
|
||||
if(file.open(QIODevice::Append) )
|
||||
{
|
||||
QByteArray msg;
|
||||
|
||||
msg.clear();
|
||||
msg.append((const char *)packer.buff,tx_len);
|
||||
|
||||
QDataStream stream(&file);
|
||||
|
||||
stream << msg;
|
||||
|
||||
file.flush();
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_pushButton_last_clicked()
|
||||
{
|
||||
if(mode == 0)//记录模式
|
||||
@@ -1300,12 +1319,21 @@ void MainWindow::on_pushButton_play_clicked()
|
||||
}
|
||||
else if(play_state == 0x00)//没有播放,可以播放
|
||||
{
|
||||
if(playdata.size() <= 0)
|
||||
if(playthread)
|
||||
{
|
||||
showMessage(tr("please load a record file"),10000);
|
||||
if(playthread->size() <= 0)
|
||||
{
|
||||
showMessage(tr("please load a record file"),10000);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showMessage(tr("play function is inhibited, please reboot"),10000);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
QString btn_default = QString("QPushButton{border-image: url(:/img/Dark/play_run.png);}\n");
|
||||
QString btn_hover = QString("QPushButton:hover{border-image: url(:/img/Dark/play_run_enter.png);}\n");
|
||||
QString btn_pressed = QString("QPushButton:pressed{border-image: url(:/img/Dark/play_run_enter.png);}\n");
|
||||
@@ -1314,10 +1342,10 @@ void MainWindow::on_pushButton_play_clicked()
|
||||
|
||||
if(playthread)
|
||||
{
|
||||
playthread->playData(playdata,port_data);
|
||||
//playthread->playData(playdata,port_data);
|
||||
|
||||
port_data.clear();
|
||||
playdata.clear();
|
||||
//port_data.clear();
|
||||
//playdata.clear();
|
||||
play_state = 0x01;
|
||||
emit changedPlayState(play_state);
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public slots:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
|
||||
void setSave(const QHostAddress &ip, const uint16_t &port, QByteArray data);
|
||||
//void setSave(const QHostAddress &ip, const uint16_t &port, QByteArray data);
|
||||
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user