修改回放
This commit is contained in:
+49
-8
@@ -71,7 +71,9 @@ void Replay::start()
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "log file can't be fund";
|
||||
running_flag = true;
|
||||
thread->start();
|
||||
qDebug() << "thread start" << running_flag;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -167,7 +169,8 @@ void Replay::process()//线程函数
|
||||
|
||||
if((currentTimestamp - lastTimestamp) >0)
|
||||
{
|
||||
QThread::msleep(timeStamp);
|
||||
|
||||
QThread::usleep(timeStamp * multiple);
|
||||
}
|
||||
|
||||
position += (uint8_t)raw.at(raw.indexOf(0xFD)+1) + 20;
|
||||
@@ -240,11 +243,43 @@ QByteArray Replay::readAll(void)
|
||||
|
||||
void Replay::setLogfile(const QString name, float percent)
|
||||
{
|
||||
logFile = name;
|
||||
//重置各种参数
|
||||
percentage = percent;
|
||||
ispause = false;
|
||||
isplaying = false;
|
||||
if(name != logFile)
|
||||
{
|
||||
logFile = name;
|
||||
//重置各种参数
|
||||
percentage = 0;
|
||||
ispause = false;
|
||||
isplaying = false;
|
||||
|
||||
//emit currentPercentage(percentage);
|
||||
//emit readReady();
|
||||
|
||||
if(!file)
|
||||
{
|
||||
|
||||
file = new QFile();
|
||||
file->setFileName(logFile);
|
||||
if(!file->open(QIODevice::ReadOnly))
|
||||
{
|
||||
if(!logFile.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Error"),
|
||||
tr("%1").arg(file->errorString()));
|
||||
}
|
||||
delete file;
|
||||
file = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logFile = name;
|
||||
//重置各种参数
|
||||
percentage = percent;
|
||||
ispause = false;
|
||||
isplaying = false;
|
||||
}
|
||||
|
||||
qDebug() << name << percent;
|
||||
}
|
||||
@@ -290,7 +325,13 @@ void Replay::startReplay(bool flag)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Replay::setMultiple(double value)
|
||||
{
|
||||
if(value != 0)
|
||||
{
|
||||
multiple = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user