完成文件读取
This commit is contained in:
@ -19,6 +19,9 @@ set(PROJECT_SOURCES
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
global.h
|
||||
readthread.cpp
|
||||
readthread.h
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
@ -40,7 +43,7 @@ else()
|
||||
else()
|
||||
add_executable(ReadLog
|
||||
${PROJECT_SOURCES}
|
||||
qcustomplot.cpp qcustomplot.h
|
||||
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
14
ReadLog.pro
14
ReadLog.pro
@ -10,17 +10,23 @@ CONFIG += c++11
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp
|
||||
# qcustomplot.cpp
|
||||
mainwindow.cpp \
|
||||
qcustomplot.cpp \
|
||||
readthread.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h
|
||||
# qcustomplot.h
|
||||
global.h \
|
||||
mainwindow.h \
|
||||
qcustomplot.h \
|
||||
readthread.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
RC_ICONS = logo.ico
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
|
30
global.h
Normal file
30
global.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef READLOG_GLOBAL_H
|
||||
#define READLOG_GLOBAL_H
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QMap>
|
||||
#include <QFile>
|
||||
#include <QCompleter>
|
||||
|
||||
extern QVector<QMap<QString,QString>> g_param[4]; //存储4条基带的数据
|
||||
extern QMap<QString,bool> namelist; //存储数据名以及数据是否是数字
|
||||
extern QFile file; //打开文件
|
||||
extern QCompleter *completer;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //READLOG_GLOBAL_H
|
33
main.cpp
33
main.cpp
@ -1,12 +1,37 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#include <QDebug>
|
||||
#include "global.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
//初始化数据
|
||||
QVector<QMap<QString, QString>> g_param[4];
|
||||
QMap<QString, bool> namelist;
|
||||
QFile file;
|
||||
QCompleter *completer;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
//设置logo
|
||||
QApplication::setWindowIcon(QIcon("logo.ico"));
|
||||
//放大窗口
|
||||
// qputenv("QT_SCALE_FACTOR", "2.0");
|
||||
//设置使用UTF8字符集,正确显示中文
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
//运行程序
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
/* 获取分辨率
|
||||
QDesktopWidget *desktopWidget = QApplication::desktop();
|
||||
//获取可用桌面大小
|
||||
QRect deskRect = desktopWidget->availableGeometry();
|
||||
qDebug() << deskRect.width() << "x" << deskRect.height();
|
||||
//获取设备屏幕大小
|
||||
QRect screenRect = desktopWidget->screenGeometry();
|
||||
qDebug() << screenRect.width() << "x" << screenRect.height();*/
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -1,22 +1,99 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QCompleter>
|
||||
#include <QLabel>
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QListView>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QLineEdit>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow), readThread(new ReadThread) {
|
||||
ui->setupUi(this);
|
||||
// 创建版本号标签并添加到状态栏的右端
|
||||
QLabel *m_versionLabel = new QLabel(tr("v1.2.0"), this);
|
||||
ui->statusbar->addPermanentWidget(m_versionLabel);
|
||||
//隐藏进度条
|
||||
ui->progressBar->close();
|
||||
|
||||
/*信号和槽*/
|
||||
//readThread
|
||||
connect(readThread, &ReadThread::clearCombo, this, &MainWindow::clearCombo);
|
||||
connect(readThread, &ReadThread::showStatusbar, this, &MainWindow::showStatusbar);
|
||||
connect(readThread, &ReadThread::setProgressBar, this, &MainWindow::setProgressBar);
|
||||
connect(readThread, &ReadThread::setBeginTime, this, &MainWindow::setBeginTime);
|
||||
connect(readThread, &ReadThread::setEndTime, this, &MainWindow::setEndTime);
|
||||
connect(readThread, &ReadThread::addCombo, this, &MainWindow::addCombo);
|
||||
connect(readThread, &ReadThread::closeProg, this, &MainWindow::closeProg);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
MainWindow::~MainWindow() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_openFileBtn_clicked() {
|
||||
//选择文件,并获取文件名
|
||||
QString fileName = QFileDialog::getOpenFileName();
|
||||
//打开文件
|
||||
file.setFileName(fileName);
|
||||
//打开失败
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
QMessageBox::warning(this, "错误", "文件打开失败");
|
||||
ui->statusbar->clearMessage();
|
||||
clearCombo();
|
||||
return;
|
||||
}
|
||||
//获取文件大小
|
||||
qint64 fileSize = file.size();
|
||||
//设置进度条
|
||||
ui->progressBar->setMaximum((int) fileSize);
|
||||
ui->progressBar->setValue(0);
|
||||
ui->progressBar->show();
|
||||
//执行读取
|
||||
readThread->start();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_timeCustomBtn_clicked() {
|
||||
ui->progressBar->close();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_dataCustomBtn_clicked() {
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::clearCombo() {
|
||||
ui->comboBox->clear();
|
||||
}
|
||||
|
||||
void MainWindow::showStatusbar(const QString &str) {
|
||||
ui->statusbar->showMessage(str);
|
||||
}
|
||||
|
||||
void MainWindow::setProgressBar(int bytesRead) {
|
||||
ui->progressBar->setValue(bytesRead);
|
||||
}
|
||||
|
||||
void MainWindow::setBeginTime(const QDateTime &beginTime) {
|
||||
ui->beginTimeEdit->setDateTime(beginTime);
|
||||
}
|
||||
|
||||
void MainWindow::setEndTime(const QDateTime &endTime) {
|
||||
ui->endTimeEdit->setDateTime(endTime);
|
||||
}
|
||||
|
||||
void MainWindow::addCombo(const QStringList &names) {
|
||||
//设置下拉框数据
|
||||
ui->comboBox->addItems(names);
|
||||
//根据输入匹配下拉框
|
||||
completer = new QCompleter(names);
|
||||
completer->setFilterMode(Qt::MatchContains);
|
||||
ui->comboBox->setCompleter(completer);
|
||||
}
|
||||
|
||||
void MainWindow::closeProg() {
|
||||
ui->progressBar->close();
|
||||
}
|
||||
|
||||
|
49
mainwindow.h
49
mainwindow.h
@ -3,22 +3,59 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "global.h"
|
||||
#include "readthread.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
|
||||
~MainWindow() override;
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
/*打开文件*/
|
||||
void on_openFileBtn_clicked();
|
||||
|
||||
/*绘制时间图*/
|
||||
void on_timeCustomBtn_clicked();
|
||||
|
||||
/*绘制数据变化图*/
|
||||
void on_dataCustomBtn_clicked();
|
||||
|
||||
/*清空下拉框*/
|
||||
void clearCombo();
|
||||
|
||||
/*设置底部左侧状态栏文字*/
|
||||
void showStatusbar(const QString &str);
|
||||
|
||||
/*设置进度条进度*/
|
||||
void setProgressBar(int bytesRead);
|
||||
|
||||
/*设置开始时间*/
|
||||
void setBeginTime(const QDateTime &beginTime);
|
||||
|
||||
/*设置结束时间*/
|
||||
void setEndTime(const QDateTime &endTime);
|
||||
|
||||
/*设置下拉框*/
|
||||
void addCombo(const QStringList &names);
|
||||
|
||||
/*关闭进度条*/
|
||||
void closeProg();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
ReadThread *readThread;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -2,6 +2,12 @@
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -10,13 +16,16 @@
|
||||
<height>700</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>日志读取</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<item row="6" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<widget class="QGroupBox" name="groupBox_end">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
@ -28,7 +37,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<item row="0" column="0">
|
||||
<widget class="QDateTimeEdit" name="dateTimeEdit_2">
|
||||
<widget class="QDateTimeEdit" name="endTimeEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -50,16 +59,22 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<widget class="QWidget" name="progressWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<item row="0" column="0">
|
||||
<widget class="QProgressBar" name="progressBar_6">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
@ -69,7 +84,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="value">
|
||||
@ -87,7 +102,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<widget class="QGroupBox" name="groupBox_begin">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
@ -99,7 +114,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="0" column="0">
|
||||
<widget class="QDateTimeEdit" name="dateTimeEdit">
|
||||
<widget class="QDateTimeEdit" name="beginTimeEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -121,13 +136,19 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="groupBox_jd">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
@ -141,39 +162,39 @@
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_11">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>基带 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="text">
|
||||
<string>基带 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="checkBox_3">
|
||||
<widget class="QCheckBox" name="jd3">
|
||||
<property name="text">
|
||||
<string>基带 3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="jd2">
|
||||
<property name="text">
|
||||
<string>基带 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="checkBox_4">
|
||||
<widget class="QCheckBox" name="jd4">
|
||||
<property name="text">
|
||||
<string>基带 4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="jd1">
|
||||
<property name="text">
|
||||
<string>基带 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<spacer name="verticalSpacer_1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -186,7 +207,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -224,7 +245,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<widget class="QGroupBox" name="groupBox_data">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -270,7 +291,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<widget class="QPushButton" name="timeCustomBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -295,7 +316,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<widget class="QPushButton" name="dataCustomBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -320,7 +341,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
130
readthread.cpp
Normal file
130
readthread.cpp
Normal file
@ -0,0 +1,130 @@
|
||||
#include <QTextStream>
|
||||
#include "readthread.h"
|
||||
|
||||
ReadThread::ReadThread(QObject *parent)
|
||||
: QThread{parent} {
|
||||
/*正则表达式*/
|
||||
//时间
|
||||
dateTimeRegex.setPattern("([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{3})");
|
||||
//基带
|
||||
jdRegex.setPattern(R"(\[.*(\d)\])");
|
||||
//匹配数字和可选的正负号
|
||||
pattern.setPattern("^[+-]?([1-9][0-9]*|0)[.]?[0-9]*$");
|
||||
//科学计数法
|
||||
kexue.setPattern("^[0-9].[0-9]e[+-][0-9][0-9]");
|
||||
}
|
||||
|
||||
bool ReadThread::isNumeric(QString data) {
|
||||
bool flag = false;
|
||||
patternMatch = pattern.match(data);
|
||||
if (patternMatch.hasMatch()) {
|
||||
flag = true;
|
||||
}
|
||||
kexueMatch = kexue.match(data);
|
||||
if (kexueMatch.hasMatch()) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
void ReadThread::run() {
|
||||
//初始化数据
|
||||
int bytesRead = 0; //进度条数值
|
||||
for (auto &i: g_param) {
|
||||
i.clear();
|
||||
}
|
||||
QMap<QString, QString> temData;
|
||||
bool isBeginTime = true;
|
||||
//清除下拉框数据
|
||||
emit clearCombo();
|
||||
if (!namelist.empty()) {
|
||||
namelist.clear();
|
||||
completer->deleteLater();
|
||||
}
|
||||
|
||||
//设置状态栏
|
||||
emit showStatusbar("正在打开文件");
|
||||
|
||||
//读取文件
|
||||
QTextStream in(&file);
|
||||
while (!in.atEnd()) {
|
||||
//读取一行
|
||||
QString line = in.readLine();
|
||||
|
||||
//更新进度条
|
||||
bytesRead += line.size();
|
||||
emit setProgressBar(bytesRead * 2);
|
||||
|
||||
/* 匹配数据 */
|
||||
//匹配日期时间
|
||||
QMap<QString, QString> temMap;
|
||||
int JD;
|
||||
QString temtime;
|
||||
QString temjd;
|
||||
matchDateTime = dateTimeRegex.match(line);
|
||||
if (matchDateTime.hasMatch()) {
|
||||
temtime = matchDateTime.captured(1);
|
||||
temMap["时间"] = temtime;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
//匹配基带
|
||||
matchLogLevel = jdRegex.match(line);
|
||||
if (matchLogLevel.hasMatch()) {
|
||||
temjd = matchLogLevel.captured(1);
|
||||
temMap["基带"] = temjd;
|
||||
JD = temjd.toInt() - 1;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
//设置开始时间
|
||||
if (isBeginTime) {
|
||||
emit setBeginTime(QDateTime::fromString(temtime, "yyyy-MM-dd hh:mm:ss:zzz"));
|
||||
isBeginTime = false;
|
||||
}
|
||||
temData.clear();
|
||||
temData["时间"] = temtime;
|
||||
//将左右拆分
|
||||
QStringList dataParts = line.split(']');
|
||||
//判断右侧是否有数据
|
||||
if (dataParts[1].isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
//将右侧数据拆分
|
||||
QStringList data = dataParts[1].split(',');
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
//将每一条数据拆为数据名和值
|
||||
QStringList tem = data[i].split('=');
|
||||
if (tem.size() < 2) {
|
||||
continue;
|
||||
}
|
||||
if (!namelist.contains(tem[0])) {
|
||||
namelist[tem[0]] = isNumeric(tem[1]);
|
||||
if (tem[0].contains("版本号")) {
|
||||
namelist[tem[0]] = false;
|
||||
}
|
||||
}
|
||||
temData[tem[0]] = tem[1];
|
||||
}
|
||||
//记录数据
|
||||
g_param[JD].append(temData);
|
||||
|
||||
}
|
||||
|
||||
//设置结束时间
|
||||
emit setEndTime(QDateTime::fromString(temData["时间"], "yyyy-MM-dd hh:mm:ss:zzz"));
|
||||
|
||||
//设置状态栏
|
||||
emit showStatusbar("打开成功:" + file.fileName());
|
||||
|
||||
//添加下拉框数据
|
||||
emit addCombo(namelist.keys());
|
||||
|
||||
//关闭
|
||||
emit closeProg();
|
||||
file.close();
|
||||
temData.clear();
|
||||
quit();
|
||||
}
|
||||
|
49
readthread.h
Normal file
49
readthread.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef READTHREAD_H
|
||||
#define READTHREAD_H
|
||||
|
||||
#include <QThread>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QDateTime>
|
||||
#include "global.h"
|
||||
|
||||
|
||||
class ReadThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ReadThread(QObject *parent = nullptr);
|
||||
|
||||
bool isNumeric(QString data);
|
||||
|
||||
signals:
|
||||
|
||||
void clearCombo();
|
||||
|
||||
void showStatusbar(QString str);
|
||||
|
||||
void setProgressBar(int bytesRead);
|
||||
|
||||
void setBeginTime(QDateTime beginTime);
|
||||
|
||||
void setEndTime(QDateTime beginTime);
|
||||
|
||||
void addCombo(QStringList names);
|
||||
|
||||
void closeProg();
|
||||
|
||||
protected:
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QRegularExpression dateTimeRegex;
|
||||
QRegularExpressionMatch matchDateTime;
|
||||
QRegularExpression jdRegex;
|
||||
QRegularExpressionMatch matchLogLevel;
|
||||
QRegularExpression pattern;
|
||||
QRegularExpressionMatch patternMatch;
|
||||
QRegularExpression kexue;
|
||||
QRegularExpressionMatch kexueMatch;
|
||||
|
||||
};
|
||||
|
||||
#endif // READTHREAD_H
|
Reference in New Issue
Block a user