Compare commits
10 Commits
32b6932875
...
82388559ad
Author | SHA1 | Date | |
---|---|---|---|
82388559ad | |||
98bd5fb3b0 | |||
c9e2c5a72f | |||
14d80194c5 | |||
4b64297f68 | |||
d9cdba7cb7 | |||
f4e058c009 | |||
53362d9373 | |||
19d21216e4 | |||
25a7b25256 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.idea/
|
||||
*.user
|
||||
.idea
|
||||
build_cmake/
|
||||
build_qt/
|
||||
|
@ -1,77 +1,84 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(ReadLog_7 VERSION 0.1 LANGUAGES CXX)
|
||||
project(ReadLog VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
#设置必须支持C++设定版本
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Charts)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Charts)
|
||||
set(CMAKE_PREFIX_PATH "C:/Path/Qt5.12.12/5.12.12/mingw73_64")
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
|
||||
find_package(Qt5 COMPONENTS PrintSupport REQUIRED)
|
||||
|
||||
|
||||
set(PROJECT_SOURCES
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
gloab.h
|
||||
gloab.cpp
|
||||
global.h
|
||||
readthread.cpp
|
||||
readthread.h
|
||||
customthread.h
|
||||
customthread.cpp
|
||||
qcustomplot.h
|
||||
qcustomplot.cpp
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
qt_add_executable(ReadLog_7
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
qt_add_executable(ReadLog
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
# Define target properties for Android with Qt 6 as:
|
||||
# set_property(TARGET ReadLog_7 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
||||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
||||
# Define target properties for Android with Qt 6 as:
|
||||
# set_property(TARGET ReadLog APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
||||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
||||
else()
|
||||
if(ANDROID)
|
||||
add_library(ReadLog_7 SHARED
|
||||
${PROJECT_SOURCES}
|
||||
add_library(ReadLog SHARED
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
else()
|
||||
add_executable(ReadLog_7
|
||||
${PROJECT_SOURCES}
|
||||
threadread.h threadread.cpp
|
||||
threadchart.h threadchart.cpp
|
||||
threadpoltchart.h threadpoltchart.cpp
|
||||
log7.pro
|
||||
add_executable(ReadLog
|
||||
${PROJECT_SOURCES}
|
||||
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(ReadLog_7 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Charts)
|
||||
target_link_libraries(ReadLog PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
target_link_libraries(ReadLog PRIVATE Qt5::PrintSupport)
|
||||
|
||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
||||
# If you are developing for iOS or macOS you should consider setting an
|
||||
# explicit, fixed bundle identifier manually though.
|
||||
if(${QT_VERSION} VERSION_LESS 6.1.0)
|
||||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.ReadLog_7)
|
||||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.ReadLog)
|
||||
endif()
|
||||
set_target_properties(ReadLog_7 PROPERTIES
|
||||
${BUNDLE_ID_OPTION}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
MACOSX_BUNDLE TRUE
|
||||
WIN32_EXECUTABLE TRUE
|
||||
set_target_properties(ReadLog PROPERTIES
|
||||
${BUNDLE_ID_OPTION}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
MACOSX_BUNDLE TRUE
|
||||
WIN32_EXECUTABLE TRUE
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS ReadLog_7
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
install(TARGETS ReadLog
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
if(QT_VERSION_MAJOR EQUAL 6)
|
||||
qt_finalize_executable(ReadLog_7)
|
||||
qt_finalize_executable(ReadLog)
|
||||
endif()
|
||||
|
@ -1,6 +1,6 @@
|
||||
QT += core gui charts
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
@ -9,24 +9,26 @@ CONFIG += c++11
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
gloab.cpp \
|
||||
customthread.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
threadchart.cpp \
|
||||
threadpoltchart.cpp \
|
||||
threadread.cpp
|
||||
qcustomplot.cpp \
|
||||
readthread.cpp
|
||||
|
||||
HEADERS += \
|
||||
gloab.h \
|
||||
customthread.h \
|
||||
global.h \
|
||||
mainwindow.h \
|
||||
threadchart.h \
|
||||
threadpoltchart.h \
|
||||
threadread.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
|
||||
|
69
customthread.cpp
Normal file
69
customthread.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
#include "customthread.h"
|
||||
|
||||
CustomThread::CustomThread(QObject *parent)
|
||||
: QThread{parent} {}
|
||||
|
||||
void CustomThread::setValue(QVector<int> vector, QString string) {
|
||||
this->jd = vector;
|
||||
this->dataName = string;
|
||||
}
|
||||
|
||||
void CustomThread::run() {
|
||||
m_PlotView.clear();
|
||||
rule.clear();
|
||||
|
||||
for (int var = 0; var < 5; ++var) {
|
||||
xData[var].clear();
|
||||
yData[var].clear();
|
||||
}
|
||||
//判断右侧数据是否为数字型
|
||||
bool isEnum = namelist[dataName];
|
||||
int bytesRead = 0;
|
||||
for (int i = 0; i < jd.size(); ++i) {
|
||||
int X = 0;
|
||||
QString tem = "这是一个无实际作用的标识";
|
||||
for (int j = 0; j < g_param[jd[i]].size(); j++) {
|
||||
//更新进度条
|
||||
bytesRead++;
|
||||
emit setProgressBar(bytesRead);
|
||||
|
||||
QDateTime temTime = QDateTime::fromString(g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
if (temTime >= beginTime && temTime <= endTime) {
|
||||
if (g_param[jd[i]][j].contains(dataName)) {
|
||||
tem = g_param[jd[i]][j][dataName];
|
||||
} else {
|
||||
if (!isTime) {
|
||||
continue;
|
||||
}
|
||||
if (tem == "这是一个无实际作用的标识") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (isTime) {
|
||||
xData[jd[i]].append(temTime.toMSecsSinceEpoch() / 1000.0);
|
||||
} else {
|
||||
xData[jd[i]].append(X++);
|
||||
}
|
||||
if (isEnum) {
|
||||
yData[jd[i]].append(tem.toDouble());
|
||||
} else {
|
||||
if (rule.contains(tem)) {
|
||||
yData[jd[i]].append(rule.indexOf(tem));
|
||||
} else {
|
||||
rule.append(tem);
|
||||
yData[jd[i]].append(rule.indexOf(tem));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
emit setPlotView(jd[i], isEnum, isTime);
|
||||
}
|
||||
|
||||
emit setWidget();
|
||||
quit();
|
||||
}
|
||||
|
||||
void CustomThread::setIsTime(bool IsTime) {
|
||||
CustomThread::isTime = IsTime;
|
||||
}
|
||||
|
33
customthread.h
Normal file
33
customthread.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef CUSTOMTIMETHREAD_H
|
||||
#define CUSTOMTIMETHREAD_H
|
||||
|
||||
#include <QThread>
|
||||
#include "global.h"
|
||||
|
||||
class CustomThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomThread(QObject *parent = nullptr);
|
||||
|
||||
void setValue(QVector<int> vector, QString string);
|
||||
|
||||
void setIsTime(bool IsTime);
|
||||
|
||||
signals:
|
||||
|
||||
void setProgressBar(int bytesRead);
|
||||
|
||||
void setPlotView(int jd, bool isNum, bool isTime);
|
||||
|
||||
void setWidget();
|
||||
|
||||
protected:
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
QVector<int> jd;
|
||||
QString dataName;
|
||||
bool isTime;
|
||||
};
|
||||
|
||||
#endif // CUSTOMTIMETHREAD_H
|
13
gloab.cpp
13
gloab.cpp
@ -1,13 +0,0 @@
|
||||
#include "gloab.h"
|
||||
|
||||
QString Gloab::fileName="";
|
||||
QVector<QMap<QString,QString>> Gloab::g_param[4];
|
||||
QMap<QString,QString> Gloab::temData;
|
||||
QMap<QString,bool> Gloab::namelist;
|
||||
QList<QtCharts::QChartView*> Gloab::m_chartViews;
|
||||
QWidget * Gloab::widget;
|
||||
QVector<QString> Gloab::rule;
|
||||
QFile Gloab::file;
|
||||
qint64 Gloab::fileSize;
|
||||
qint64 Gloab::bytesRead;
|
||||
QCompleter *Gloab::completer;
|
33
gloab.h
33
gloab.h
@ -1,33 +0,0 @@
|
||||
//
|
||||
// Created by Sherlock on 2024/8/12.
|
||||
//
|
||||
|
||||
#ifndef GLOAB_H
|
||||
#define GLOAB_H
|
||||
|
||||
#include <QChartView>
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QWidget>
|
||||
#include <QFile>
|
||||
#include <QLineSeries>
|
||||
#include <QCompleter>
|
||||
class Gloab{
|
||||
public:
|
||||
static QString fileName;
|
||||
static QVector<QMap<QString,QString>> g_param[4];
|
||||
static QMap<QString,QString> temData;
|
||||
static QMap<QString,bool> namelist;
|
||||
static QList<QtCharts::QChartView*> m_chartViews;
|
||||
static QWidget *widget;
|
||||
static QVector<QString> rule;
|
||||
static QFile file;
|
||||
static qint64 fileSize;
|
||||
static qint64 bytesRead;
|
||||
static QCompleter *completer;
|
||||
};
|
||||
|
||||
|
||||
#endif //GLOAB_H
|
26
global.h
Normal file
26
global.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef READLOG_GLOBAL_H
|
||||
#define READLOG_GLOBAL_H
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QMap>
|
||||
#include <QFile>
|
||||
#include <QCompleter>
|
||||
#include <QWidget>
|
||||
#include <QDateTime>
|
||||
#include "qcustomplot.h"
|
||||
|
||||
extern QVector<QMap<QString, QString>> g_param[5]; //存储4条基带的数据+其他
|
||||
extern QMap<QString, bool> namelist; //存储数据名以及数据是否是数字
|
||||
extern QFile file; //打开文件
|
||||
extern QCompleter *completer; //下拉框选项
|
||||
extern QWidget *widget; //新窗口
|
||||
extern QDateTime beginTime; //开始时间
|
||||
extern QDateTime endTime; //结束时间
|
||||
extern QVector<QCustomPlot *> m_PlotView; //custom图
|
||||
extern QVector<QString> rule; //Y轴映射
|
||||
extern QVector<double> xData[5]; //X轴数据
|
||||
extern QVector<double> yData[5]; //Y轴数据
|
||||
|
||||
|
||||
#endif //READLOG_GLOBAL_H
|
275
log7.pro.user
275
log7.pro.user
@ -1,275 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 12.0.2, 2024-09-12T17:38:37. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{212c491d-8228-40db-8cc9-f183f9b9d8d0}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="qlonglong">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
|
||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
||||
<valuemap type="QVariantMap" key="ClangTools">
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">6</value>
|
||||
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ClangdSettings">
|
||||
<value type="bool" key="blockIndexing">false</value>
|
||||
<value type="bool" key="useGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="CppEditor.QuickFix">
|
||||
<value type="bool" key="UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 5.12.0 (mingw73_64)</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 5.12.0 (mingw73_64)</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{edc54fcd-f681-4a0a-ba77-11a1a5c94a66}</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Work\CQT\Test_01\build-log7-Qt_5_12_0_mingw73_64-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Work\CQT\Test_01\build-log7-Qt_5_12_0_mingw73_64-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="int" key="QtQuickCompiler">0</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Work\CQT\Test_01\build-log7-Qt_5_12_0_mingw73_64-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="int" key="QtQuickCompiler">0</value>
|
||||
<value type="int" key="SeparateDebugInfo">0</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">部署</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="QList<int>" key="Analyzer.Valgrind.VisibleErrorKinds"></value>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">log72</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Work/QT/ReadLog/log7/log7.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Work/QT/ReadLog/log7/log7.pro</value>
|
||||
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Debug</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="qlonglong">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
35
main.cpp
35
main.cpp
@ -2,13 +2,42 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#include <QDebug>
|
||||
#include "global.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// qputenv("QT_SCALE_FACTOR", "2.0");
|
||||
|
||||
//初始化数据
|
||||
QVector<QMap<QString, QString>> g_param[5];
|
||||
QMap<QString, bool> namelist;
|
||||
QFile file;
|
||||
QCompleter *completer;
|
||||
QWidget *widget;
|
||||
QDateTime beginTime;
|
||||
QDateTime endTime;
|
||||
QVector<QCustomPlot *> m_PlotView;
|
||||
QVector<QString> rule;
|
||||
QVector<double> xData[5];
|
||||
QVector<double> yData[5];
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
//设置logo
|
||||
QApplication::setWindowIcon(QIcon("logo.ico"));
|
||||
//放大窗口
|
||||
qputenv("QT_SCALE_FACTOR", "1.0");
|
||||
//设置使用UTF8字符集,正确显示中文
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
//运行程序
|
||||
QApplication a(argc, argv);
|
||||
/* 获取分辨率
|
||||
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();
|
||||
|
504
mainwindow.cpp
504
mainwindow.cpp
@ -1,373 +1,257 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QCompleter>
|
||||
#include <QLabel>
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include "./ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow)
|
||||
, thread_read(new threadRead), thread_chart(new ThreadChart),thread_polt(new threadPoltChart){
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow), readThread(new ReadThread), customTime(new CustomThread) {
|
||||
ui->setupUi(this);
|
||||
this->setWindowTitle("日志查询工具");
|
||||
// 创建版本号标签
|
||||
m_versionLabel = new QLabel(tr("v1.1.0"), this);
|
||||
// 将标签添加到状态栏的右端
|
||||
// 创建版本号标签并添加到状态栏的右端
|
||||
QLabel *m_versionLabel = new QLabel(tr("v1.3.0"), this);
|
||||
ui->statusbar->addPermanentWidget(m_versionLabel);
|
||||
//隐藏进度条
|
||||
ui->progressBar->close();
|
||||
|
||||
connect(thread_read, &threadRead::clearCombo, this, &MainWindow::clearCombo);
|
||||
connect(thread_read, &threadRead::showStatusbar, this, &MainWindow::showStatusbar);
|
||||
connect(thread_read, &threadRead::setBeginTime, this, &MainWindow::setBeginTime);
|
||||
connect(thread_read, &threadRead::setEndTime, this, &MainWindow::setEndTime);
|
||||
connect(thread_read, &threadRead::addCombo, this, &MainWindow::addCombo);
|
||||
connect(thread_read, &threadRead::setProgressBar, this, &MainWindow::setProgressBar);
|
||||
connect(thread_read, &threadRead::closeProg, this, &MainWindow::closeProg);
|
||||
/*信号和槽*/
|
||||
//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::setTime, this, &MainWindow::setTime);
|
||||
connect(readThread, &ReadThread::addCombo, this, &MainWindow::addCombo);
|
||||
connect(readThread, &ReadThread::closeProg, this, &MainWindow::closeProg);
|
||||
|
||||
//chart
|
||||
connect(thread_chart, &ThreadChart::newCandS, this, &MainWindow::newCandS);
|
||||
connect(thread_chart, &ThreadChart::appSeries, this, &MainWindow::appSeries);
|
||||
connect(thread_chart, &ThreadChart::setChartView, this, &MainWindow::setChartView);
|
||||
connect(thread_chart, &ThreadChart::setWidget, this, &MainWindow::setWidget);
|
||||
connect(thread_chart, &ThreadChart::setProgressBar, this, &MainWindow::setProgressBar);
|
||||
//customTime
|
||||
connect(customTime, &CustomThread::setProgressBar, this, &MainWindow::setProgressBar);
|
||||
connect(customTime, &CustomThread::setPlotView, this, &MainWindow::setPlotView);
|
||||
connect(customTime, &CustomThread::setWidget, this, &MainWindow::setWidget);
|
||||
|
||||
//plot
|
||||
connect(thread_polt, &threadPoltChart::newCandS, this, &MainWindow::newPlotCandS);
|
||||
connect(thread_polt, &threadPoltChart::appSeries, this, &MainWindow::appSeries);
|
||||
connect(thread_polt, &threadPoltChart::setChartView, this, &MainWindow::setPlotChartView);
|
||||
connect(thread_polt, &threadPoltChart::setWidget, this, &MainWindow::setWidget);
|
||||
connect(thread_polt, &threadPoltChart::setProgressBar, this, &MainWindow::setProgressBar);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_openFileBtn_clicked() {
|
||||
Gloab::fileName = QFileDialog::getOpenFileName();
|
||||
//选择文件,并获取文件名
|
||||
QString fileName = QFileDialog::getOpenFileName();
|
||||
//打开文件
|
||||
Gloab::file.setFileName(Gloab::fileName);
|
||||
if (!Gloab::file.open(QIODevice::ReadOnly)) {
|
||||
// 打开失败时弹窗
|
||||
QString dlgTitle = "错误";
|
||||
QString strInfo = "文件打开失败";
|
||||
QMessageBox::warning(this, dlgTitle, strInfo);
|
||||
//退出
|
||||
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() {
|
||||
//校验数据
|
||||
if (!inspectionData()) { return; }
|
||||
|
||||
//运行线程
|
||||
customTime->setIsTime(true);
|
||||
customTime->start();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_dataCustomBtn_clicked() {
|
||||
//校验数据
|
||||
if (!inspectionData()) { return; }
|
||||
|
||||
//运行线程
|
||||
customTime->setIsTime(false);
|
||||
customTime->start();
|
||||
}
|
||||
|
||||
bool MainWindow::inspectionData() {
|
||||
//关闭打开的窗口
|
||||
if (widget) {
|
||||
widget->close();
|
||||
delete widget;
|
||||
widget = nullptr;
|
||||
}
|
||||
//判断是否已打开日志文件
|
||||
if (file.fileName().isEmpty()) {
|
||||
QMessageBox::warning(this, "警告", "请先打开一个日志");
|
||||
return false;
|
||||
}
|
||||
//获取基带id
|
||||
QVector<int> jd;
|
||||
if (ui->jd1->isChecked()) {
|
||||
jd.append(0);
|
||||
}
|
||||
if (ui->jd2->isChecked()) {
|
||||
jd.append(1);
|
||||
}
|
||||
if (ui->jd3->isChecked()) {
|
||||
jd.append(2);
|
||||
}
|
||||
if (ui->jd4->isChecked()) {
|
||||
jd.append(3);
|
||||
}
|
||||
if (ui->mainCtrl->isChecked()) {
|
||||
jd.append(4);
|
||||
}
|
||||
//判断基带是否为空
|
||||
if (jd.isEmpty()) {
|
||||
QMessageBox::warning(this, "警告", "请至少选择一个基带");
|
||||
return false;
|
||||
}
|
||||
//获取时间
|
||||
beginTime = ui->beginTimeEdit->dateTime();
|
||||
endTime = ui->endTimeEdit->dateTime();
|
||||
//判断时间是否合法
|
||||
if (beginTime > endTime) {
|
||||
QMessageBox::warning(this, "警告", "请选择正确的时间段");
|
||||
return false;
|
||||
}
|
||||
//获取参数名
|
||||
QString dataName = ui->comboBox->currentText();
|
||||
//判断参数名是否正确
|
||||
if (!namelist.keys().contains(dataName)) {
|
||||
QMessageBox::warning(this, "警告", "未找到该数据");
|
||||
return false;
|
||||
}
|
||||
//创建新窗口
|
||||
widget = new QWidget();
|
||||
widget->setWindowTitle(dataName);
|
||||
|
||||
//传入数据绘图
|
||||
customTime->setValue(jd, dataName);
|
||||
|
||||
// 获取文件大小
|
||||
int fileSize = 0;
|
||||
for (int i: jd) {
|
||||
fileSize += g_param[i].size();
|
||||
}
|
||||
|
||||
//设置进度条
|
||||
layout = new QVBoxLayout(ui->widget);
|
||||
progressBar = new QProgressBar(ui->widget);
|
||||
layout->addWidget(progressBar);
|
||||
ui->widget->show();
|
||||
|
||||
// 获取文件大小
|
||||
Gloab::fileSize = Gloab::file.size();
|
||||
Gloab::bytesRead = 0;
|
||||
|
||||
thread_read->start();
|
||||
ui->progressBar->setValue(0);
|
||||
ui->progressBar->setMaximum(fileSize);
|
||||
ui->progressBar->show();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::clearCombo() {
|
||||
ui->comboBox->clear();
|
||||
}
|
||||
|
||||
void MainWindow::showStatusbar(const QString &message) {
|
||||
ui->statusbar->showMessage(message);
|
||||
void MainWindow::showStatusbar(const QString &str) {
|
||||
ui->statusbar->showMessage(str);
|
||||
}
|
||||
|
||||
void MainWindow::setBeginTime(const QDateTime &begin) {
|
||||
ui->beginTime->setDateTime(begin);
|
||||
void MainWindow::setProgressBar(int bytesRead) {
|
||||
ui->progressBar->setValue(bytesRead);
|
||||
}
|
||||
|
||||
void MainWindow::setEndTime(const QDateTime &begin) {
|
||||
ui->endTime->setDateTime(begin);
|
||||
void MainWindow::setTime() {
|
||||
ui->beginTimeEdit->setDateTime(beginTime);
|
||||
ui->endTimeEdit->setDateTime(endTime);
|
||||
}
|
||||
|
||||
void MainWindow::addCombo(const QStringList &list) {
|
||||
ui->comboBox->addItems(list);
|
||||
void MainWindow::addCombo(const QStringList &names) {
|
||||
//设置下拉框数据
|
||||
ui->comboBox->addItems(names);
|
||||
//根据输入匹配下拉框
|
||||
Gloab::completer = new QCompleter(list);
|
||||
ui->comboBox->setCompleter(Gloab::completer);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::setProgressBar(int percent) {
|
||||
progressBar->setValue(percent);
|
||||
// qApp->processEvents(); // 更新UI
|
||||
completer = new QCompleter(names);
|
||||
completer->setFilterMode(Qt::MatchContains);
|
||||
ui->comboBox->setCompleter(completer);
|
||||
}
|
||||
|
||||
void MainWindow::closeProg() {
|
||||
layout->deleteLater();
|
||||
progressBar->deleteLater();
|
||||
ui->widget->close();
|
||||
ui->progressBar->close();
|
||||
}
|
||||
|
||||
void MainWindow::newCandS() {
|
||||
chart = new QChart;
|
||||
series = new QLineSeries;
|
||||
// series->setPointsVisible();
|
||||
}
|
||||
void MainWindow::setPlotView(int jd, bool isNum, bool isTime) {
|
||||
QCustomPlot *qCustomPlot = new QCustomPlot();
|
||||
|
||||
void MainWindow::appSeries(qreal A, qreal B) {
|
||||
series->append(A, B);
|
||||
}
|
||||
//标题
|
||||
QCPTextElement *m_title;
|
||||
qCustomPlot->plotLayout()->insertRow(0);
|
||||
if (jd==4){
|
||||
m_title = new QCPTextElement(qCustomPlot, "主控单元");
|
||||
}
|
||||
else{
|
||||
m_title = new QCPTextElement(qCustomPlot, QString("基带 %1").arg(jd + 1));
|
||||
}
|
||||
qCustomPlot->plotLayout()->addElement(0, 0, m_title);
|
||||
|
||||
void MainWindow::setChartView(int jd, bool isEnum) {
|
||||
// 设置图表标题
|
||||
chart->setTitle(QString("基带 %1").arg(jd+1));
|
||||
chart->addSeries(series);
|
||||
if (isEnum) {
|
||||
chart->createDefaultAxes();
|
||||
// 获取X轴
|
||||
QList<QAbstractAxis *> xAxes = chart->axes(Qt::Horizontal);
|
||||
// 断开所有与该轴关联的系列
|
||||
series->detachAxis(xAxes[0]);
|
||||
// 从图表中移除轴
|
||||
chart->removeAxis(xAxes[0]);
|
||||
} else {
|
||||
// 创建类别Y轴
|
||||
QCategoryAxis *axisY = new QCategoryAxis();
|
||||
for (int var = 1; var < Gloab::rule.size(); ++var) {
|
||||
axisY->append(Gloab::rule[var], var);
|
||||
}
|
||||
//刻度线和刻度的label对齐
|
||||
axisY->setLabelsPosition(QCategoryAxis::AxisLabelsPositionOnValue);
|
||||
axisY->setRange(0, Gloab::rule.size() + 1);
|
||||
chart->setAxisY(axisY, series);
|
||||
// series->attachAxis(axisY);
|
||||
// X轴
|
||||
if (isTime) {
|
||||
QSharedPointer<QCPAxisTickerDateTime> timeTicker(new QCPAxisTickerDateTime);
|
||||
timeTicker->setDateTimeFormat("hh:mm:ss");
|
||||
qCustomPlot->xAxis->setTicker(timeTicker);
|
||||
}
|
||||
|
||||
// Y轴
|
||||
if (!isNum) {
|
||||
QVector<double> ticks;
|
||||
QVector<QString> labels;
|
||||
for (int i = 0; i < rule.size(); ++i) {
|
||||
ticks.append(i);
|
||||
labels.append(rule[i]);
|
||||
}
|
||||
QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
|
||||
textTicker->addTicks(ticks, labels);
|
||||
qCustomPlot->yAxis->setTicker(textTicker);
|
||||
} else {
|
||||
// qCustomPlot->yAxis->setNumberFormat("f"); //以数字形式显示
|
||||
// qCustomPlot->yAxis->setNumberPrecision(2); //显示两位小数
|
||||
}
|
||||
|
||||
// 创建一个时间轴
|
||||
QDateTimeAxis *axisX = new QDateTimeAxis;
|
||||
axisX->setTickCount(10);
|
||||
axisX->setFormat("HH:mm"); // 设置时间格式
|
||||
chart->addAxis(axisX, Qt::AlignBottom);
|
||||
series->attachAxis(axisX);
|
||||
// 添加图形
|
||||
qCustomPlot->addGraph();
|
||||
qCustomPlot->graph(0)->setData(xData[jd], yData[jd]);
|
||||
|
||||
// 自动调整轴范围
|
||||
qCustomPlot->rescaleAxes();
|
||||
|
||||
// 创建QChartView
|
||||
QChartView *chartView = new QChartView(chart);
|
||||
chartView->setRenderHint(QPainter::Antialiasing);
|
||||
//设置鼠标拖动和滚轮
|
||||
qCustomPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
|
||||
|
||||
// 将chartView添加到容器中
|
||||
Gloab::m_chartViews.append(chartView);
|
||||
//设置X轴范围
|
||||
if (!xData[jd].empty()) {
|
||||
qCustomPlot->xAxis->setRange(xData[jd].first(), xData[jd].last());
|
||||
}
|
||||
|
||||
m_PlotView.append(qCustomPlot);
|
||||
}
|
||||
|
||||
void MainWindow::setWidget() {
|
||||
// 设置布局
|
||||
int wide = 850;
|
||||
int hight = 600;
|
||||
if (Gloab::m_chartViews.size() > 1) {
|
||||
if (m_PlotView.size() > 1) {
|
||||
wide = 1800;
|
||||
}
|
||||
QGridLayout *gridLayout = new QGridLayout(Gloab::widget);
|
||||
for (int i = 0, j = 0; i < Gloab::m_chartViews.size(); i++) {
|
||||
QGridLayout *gridLayout = new QGridLayout(widget);
|
||||
for (int i = 0, j = 0; i < m_PlotView.size(); i++) {
|
||||
if (i != 0 && i % 2 == 0) {
|
||||
j++;
|
||||
hight += 350;
|
||||
}
|
||||
gridLayout->addWidget(Gloab::m_chartViews[i], j, i - 2 * j);
|
||||
gridLayout->addWidget(m_PlotView[i], j, i - 2 * j);
|
||||
}
|
||||
Gloab::widget->resize(wide, hight);
|
||||
// Gloab::widget->setMaximumHeight(950);
|
||||
widget->resize(wide, hight);
|
||||
widget->move(70, 20);
|
||||
widget->show();
|
||||
|
||||
Gloab::widget->move(70, 20);
|
||||
Gloab::widget->show();
|
||||
|
||||
layout->deleteLater();
|
||||
progressBar->deleteLater();
|
||||
ui->widget->close();
|
||||
}
|
||||
|
||||
void MainWindow::newPlotCandS() {
|
||||
chart = new QChart;
|
||||
series = new QLineSeries;
|
||||
// series->setPointsVisible();
|
||||
}
|
||||
|
||||
void MainWindow::setPlotChartView(int jd, bool isEnum) {
|
||||
// 设置图表标题
|
||||
chart->setTitle(QString("基带 %1").arg(jd+1));
|
||||
chart->addSeries(series);
|
||||
if (isEnum) {
|
||||
chart->createDefaultAxes();
|
||||
|
||||
} else {
|
||||
//创建默认XY轴
|
||||
chart->createDefaultAxes();
|
||||
//删除Y轴
|
||||
// 获取Y轴
|
||||
QList<QAbstractAxis *> yAxes = chart->axes(Qt::Vertical);
|
||||
// 断开所有与该轴关联的系列
|
||||
series->detachAxis(yAxes[0]);
|
||||
// 从图表中移除轴
|
||||
chart->removeAxis(yAxes[0]);
|
||||
// 创建类别Y轴
|
||||
QCategoryAxis *axisY = new QCategoryAxis();
|
||||
for (int var = 1; var < Gloab::rule.size(); ++var) {
|
||||
axisY->append(Gloab::rule[var], var);
|
||||
}
|
||||
//刻度线和刻度的label对齐
|
||||
axisY->setLabelsPosition(QCategoryAxis::AxisLabelsPositionOnValue);
|
||||
axisY->setRange(0, Gloab::rule.size() + 1);
|
||||
chart->setAxisY(axisY, series);
|
||||
// plotSeries->attachAxis(axisY);
|
||||
}
|
||||
|
||||
|
||||
// 创建QChartView
|
||||
QChartView *chartView = new QChartView(chart);
|
||||
chartView->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
// 将chartView添加到容器中
|
||||
Gloab::m_chartViews.append(chartView);
|
||||
}
|
||||
|
||||
void MainWindow::on_lineChart_clicked() {
|
||||
if (Gloab::fileName.isEmpty()) {
|
||||
QMessageBox::warning(this, "警告", "请先打开一个日志");
|
||||
return;
|
||||
}
|
||||
|
||||
//关闭打开的窗口
|
||||
if (Gloab::widget) {
|
||||
Gloab::widget->close();
|
||||
delete Gloab::widget;
|
||||
Gloab::widget = nullptr;
|
||||
}
|
||||
|
||||
//获取基带id
|
||||
QVector<int> jd;
|
||||
if (ui->jd1->isChecked()) {
|
||||
jd.append(0);
|
||||
}
|
||||
if (ui->jd2->isChecked()) {
|
||||
jd.append(1);
|
||||
}
|
||||
if (ui->jd3->isChecked()) {
|
||||
jd.append(2);
|
||||
}
|
||||
if (ui->jd4->isChecked()) {
|
||||
jd.append(3);
|
||||
}
|
||||
|
||||
if (jd.isEmpty()) {
|
||||
QMessageBox::warning(this, "警告", "请至少选择一个基带");
|
||||
return;
|
||||
}
|
||||
|
||||
//获取时间
|
||||
QDateTime beginTime = ui->beginTime->dateTime();
|
||||
QDateTime endTime = ui->endTime->dateTime();
|
||||
if (beginTime>endTime) {
|
||||
QMessageBox::warning(this, "警告", "请选择正确的时间段");
|
||||
return;
|
||||
}
|
||||
//获取参数名
|
||||
QString dataName = ui->comboBox->currentText();
|
||||
if (!Gloab::namelist.keys().contains(dataName)) {
|
||||
QMessageBox::warning(this, "警告", "未找到该数据");
|
||||
return;
|
||||
}
|
||||
|
||||
//传入数据绘图
|
||||
thread_chart->setValue(jd, dataName, beginTime, endTime);
|
||||
Gloab::widget = new QWidget();
|
||||
Gloab::widget->setWindowTitle(dataName);
|
||||
|
||||
//设置进度条
|
||||
layout = new QVBoxLayout(ui->widget);
|
||||
progressBar = new QProgressBar(ui->widget);
|
||||
layout->addWidget(progressBar);
|
||||
ui->widget->show();
|
||||
|
||||
// 获取文件大小
|
||||
Gloab::fileSize=0;
|
||||
for (int i = 0; i < jd.size(); ++i) {
|
||||
Gloab::fileSize+=Gloab::g_param[jd[i]].size();
|
||||
}
|
||||
Gloab::bytesRead = 0;
|
||||
|
||||
thread_chart->start();
|
||||
|
||||
}
|
||||
|
||||
bool MainWindow::isNumeric(const QString &str) {
|
||||
// 正则表达式匹配数字和可选的正负号
|
||||
QRegularExpression pattern("^[+-]?([1-9][0-9]*|0)[.]?[0-9]*$");
|
||||
QRegularExpressionMatch patternMatch = pattern.match(str);
|
||||
// 使用std::regex_match来检查字符串是否完全匹配模式
|
||||
return patternMatch.hasMatch();
|
||||
}
|
||||
|
||||
void MainWindow::on_plotChart_clicked()
|
||||
{
|
||||
if (Gloab::fileName.isEmpty()) {
|
||||
QMessageBox::warning(this, "警告", "请先打开一个日志");
|
||||
return;
|
||||
}
|
||||
//关闭打开的窗口
|
||||
if (Gloab::widget) {
|
||||
Gloab::widget->close();
|
||||
delete Gloab::widget;
|
||||
Gloab::widget = nullptr;
|
||||
}
|
||||
|
||||
//获取基带id
|
||||
QVector<int> jd;
|
||||
if (ui->jd1->isChecked()) {
|
||||
jd.append(0);
|
||||
}
|
||||
if (ui->jd2->isChecked()) {
|
||||
jd.append(1);
|
||||
}
|
||||
if (ui->jd3->isChecked()) {
|
||||
jd.append(2);
|
||||
}
|
||||
if (ui->jd4->isChecked()) {
|
||||
jd.append(3);
|
||||
}
|
||||
if (jd.isEmpty()) {
|
||||
QMessageBox::warning(this, "警告", "请至少选择一个基带");
|
||||
return;
|
||||
}
|
||||
|
||||
//获取时间
|
||||
QDateTime beginTime = ui->beginTime->dateTime();
|
||||
QDateTime endTime = ui->endTime->dateTime();
|
||||
if (beginTime>endTime) {
|
||||
QMessageBox::warning(this, "警告", "请选择正确的时间段");
|
||||
return;
|
||||
}
|
||||
|
||||
//获取参数名
|
||||
QString dataName = ui->comboBox->currentText();
|
||||
if (!Gloab::namelist.keys().contains(dataName)) {
|
||||
QMessageBox::warning(this, "警告", "未找到该数据");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//传入数据绘图
|
||||
thread_polt->setValue(jd, dataName, beginTime, endTime);
|
||||
Gloab::widget = new QWidget();
|
||||
Gloab::widget->setWindowTitle(dataName);
|
||||
|
||||
//设置进度条
|
||||
layout = new QVBoxLayout(ui->widget);
|
||||
progressBar = new QProgressBar(ui->widget);
|
||||
layout->addWidget(progressBar);
|
||||
ui->widget->show();
|
||||
|
||||
// 获取文件大小
|
||||
Gloab::fileSize=0;
|
||||
for (int i = 0; i < jd.size(); ++i) {
|
||||
Gloab::fileSize+=Gloab::g_param[jd[i]].size();
|
||||
}
|
||||
Gloab::bytesRead = 0;
|
||||
|
||||
thread_polt->start();
|
||||
ui->progressBar->close();
|
||||
}
|
||||
|
||||
|
80
mainwindow.h
80
mainwindow.h
@ -1,68 +1,68 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#include "gloab.h"
|
||||
#include "threadread.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "threadchart.h"
|
||||
#include "threadpoltchart.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "readthread.h"
|
||||
#include "customthread.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();
|
||||
|
||||
bool inspectionData();
|
||||
|
||||
/*清空下拉框*/
|
||||
void clearCombo();
|
||||
void showStatusbar(const QString &message);
|
||||
void setBeginTime(const QDateTime &begin);
|
||||
void setEndTime(const QDateTime &begin);
|
||||
void addCombo(const QStringList &list);
|
||||
void setProgressBar(int percent);
|
||||
|
||||
/*设置底部左侧状态栏文字*/
|
||||
void showStatusbar(const QString &str);
|
||||
|
||||
/*设置进度条进度*/
|
||||
void setProgressBar(int bytesRead);
|
||||
|
||||
/*设置时间*/
|
||||
void setTime();
|
||||
|
||||
/*设置下拉框*/
|
||||
void addCombo(const QStringList &names);
|
||||
|
||||
/*关闭进度条*/
|
||||
void closeProg();
|
||||
|
||||
void newCandS();
|
||||
void appSeries(qreal A,qreal B);
|
||||
void setChartView(int jd,bool isEnum);
|
||||
void setPlotView(int jd, bool isNum, bool isTime);
|
||||
|
||||
void setWidget();
|
||||
|
||||
void newPlotCandS();
|
||||
void setPlotChartView(int jd,bool isEnum);
|
||||
|
||||
void on_lineChart_clicked();
|
||||
|
||||
bool isNumeric(const QString &str);
|
||||
|
||||
void on_plotChart_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QLabel *m_versionLabel;
|
||||
threadRead *thread_read;
|
||||
ThreadChart *thread_chart;
|
||||
threadPoltChart *thread_polt;
|
||||
|
||||
QProgressBar *progressBar;
|
||||
QVBoxLayout *layout;
|
||||
QChart *chart;
|
||||
QLineSeries *series;
|
||||
ReadThread *readThread;
|
||||
CustomThread *customTime;
|
||||
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
489
mainwindow.ui
489
mainwindow.ui
@ -2,48 +2,53 @@
|
||||
<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>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
<width>529</width>
|
||||
<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_5">
|
||||
<item row="9" column="0">
|
||||
<widget class="QPushButton" name="lineChart">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>时间图</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>开始时间</string>
|
||||
<string>结束时间</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<item row="0" column="0">
|
||||
<widget class="QDateTimeEdit" name="beginTime">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
<widget class="QDateTimeEdit" name="endTimeEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy/MM/dd HH:mm:ss</string>
|
||||
@ -54,139 +59,73 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<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="sizeHint" stdset="0">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="4">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>选择基带</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="jd1">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>基带1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="jd4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>基带4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="jd3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>基带3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="jd2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>基带2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>数据</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>结束时间</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<item row="0" column="0">
|
||||
<widget class="QDateTimeEdit" name="endTime">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_begin">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>开始时间</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="0" column="0">
|
||||
<widget class="QDateTimeEdit" name="beginTimeEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy/MM/dd HH:mm:ss</string>
|
||||
@ -196,7 +135,85 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="0">
|
||||
<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>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>选择基带</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="jd1">
|
||||
<property name="text">
|
||||
<string>基带 1</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="2">
|
||||
<widget class="QCheckBox" name="jd3">
|
||||
<property name="text">
|
||||
<string>基带 3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="jd4">
|
||||
<property name="text">
|
||||
<string>基带 4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QCheckBox" name="mainCtrl">
|
||||
<property name="text">
|
||||
<string>主控单元</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -209,14 +226,120 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QWidget" name="widget" native="true"/>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QPushButton" name="plotChart">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="openFileBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<family>宋体</family>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打开文件</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_data">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>选择数据</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_15">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QPushButton" name="timeCustomBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>时间图</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QPushButton" name="dataCustomBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>宋体</family>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -237,56 +360,8 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="openFileBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打开文件</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
35529
qcustomplot.cpp
Normal file
35529
qcustomplot.cpp
Normal file
File diff suppressed because it is too large
Load Diff
7774
qcustomplot.h
Normal file
7774
qcustomplot.h
Normal file
File diff suppressed because it is too large
Load Diff
152
readthread.cpp
Normal file
152
readthread.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
#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(const 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;
|
||||
matchDateTime = dateTimeRegex.match(line);
|
||||
if (matchDateTime.hasMatch()) {
|
||||
temtime = matchDateTime.captured(1);
|
||||
temMap["时间"] = temtime;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
// //匹配基带
|
||||
// QString temjd;
|
||||
// matchLogLevel = jdRegex.match(line);//正则表达式匹配
|
||||
// if (matchLogLevel.hasMatch()) {//是否匹配
|
||||
// temjd = matchLogLevel.captured(1);//匹配之后取第一个匹配的值
|
||||
// temMap["基带"] = temjd;
|
||||
// JD = temjd.toInt() - 1;
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//匹配基带
|
||||
if (line.contains("基带 1")){
|
||||
temMap["基带"] = "1";
|
||||
JD = 0;
|
||||
}else if(line.contains("基带 2")){
|
||||
temMap["基带"] = "2";
|
||||
JD = 1;
|
||||
}else if(line.contains("基带 3")){
|
||||
temMap["基带"] = "3";
|
||||
JD = 2;
|
||||
}else if(line.contains("基带 4")){
|
||||
temMap["基带"] = "4";
|
||||
JD = 3;
|
||||
}else if(line.contains("其他单元")){
|
||||
temMap["基带"] = "5";
|
||||
JD = 4;
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
|
||||
//获取开始时间
|
||||
if (isBeginTime) {
|
||||
beginTime = 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);
|
||||
|
||||
}
|
||||
//获取结束时间
|
||||
endTime = QDateTime::fromString(temData["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
|
||||
//设置时间
|
||||
emit setTime();
|
||||
|
||||
//设置状态栏
|
||||
emit showStatusbar("打开成功:" + file.fileName());
|
||||
|
||||
//添加下拉框数据
|
||||
emit addCombo(namelist.keys());
|
||||
|
||||
//关闭
|
||||
emit closeProg();
|
||||
file.close();
|
||||
temData.clear();
|
||||
quit();
|
||||
}
|
||||
|
47
readthread.h
Normal file
47
readthread.h
Normal file
@ -0,0 +1,47 @@
|
||||
#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(const QString &data);
|
||||
|
||||
signals:
|
||||
|
||||
void clearCombo();
|
||||
|
||||
void showStatusbar(QString str);
|
||||
|
||||
void setProgressBar(int bytesRead);
|
||||
|
||||
void setTime();
|
||||
|
||||
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
|
@ -1,82 +0,0 @@
|
||||
#include "threadchart.h"
|
||||
#include <QDebug>
|
||||
|
||||
ThreadChart::ThreadChart(QObject *parent)
|
||||
: QThread{parent} {
|
||||
}
|
||||
|
||||
void ThreadChart::setValue(QVector<int> jd, QString dataName, QDateTime beginTime, QDateTime endTime) {
|
||||
this->jd = jd;
|
||||
this->dataName = dataName;
|
||||
this->beginTime = beginTime;
|
||||
this->endTime = endTime;
|
||||
}
|
||||
|
||||
|
||||
void ThreadChart::run() {
|
||||
Gloab::m_chartViews.clear();
|
||||
Gloab::rule.clear();
|
||||
Gloab::rule.append("状态");
|
||||
//判断右侧数据是否为数字型
|
||||
bool isEnum = Gloab::namelist[dataName];
|
||||
for (int i = 0; i < jd.size(); ++i) {
|
||||
emit newCandS();
|
||||
qreal y = 114.514;
|
||||
QString tem1 = "无数据";
|
||||
// 为每个图表添加数据
|
||||
if (isEnum) {
|
||||
for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) {
|
||||
//更新进度条
|
||||
Gloab::bytesRead++;
|
||||
int percent = Gloab::bytesRead * 100 / Gloab::fileSize;
|
||||
emit setProgressBar(percent);
|
||||
|
||||
QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
if (temTime >= beginTime && temTime < endTime) {
|
||||
if (!Gloab::g_param[jd[i]][j].contains(dataName)) {
|
||||
if (y != 114.514) {
|
||||
emit appSeries(temTime.toMSecsSinceEpoch(), y);
|
||||
}
|
||||
} else {
|
||||
if (Gloab::g_param[jd[i]][j][dataName].contains(".")) {
|
||||
y = Gloab::g_param[jd[i]][j][dataName].toDouble();
|
||||
emit appSeries(temTime.toMSecsSinceEpoch(), y);
|
||||
} else {
|
||||
y = Gloab::g_param[jd[i]][j][dataName].toLongLong();
|
||||
emit appSeries(temTime.toMSecsSinceEpoch(), y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) {
|
||||
//更新进度条
|
||||
Gloab::bytesRead++;
|
||||
int percent = Gloab::bytesRead * 100 / Gloab::fileSize;
|
||||
emit setProgressBar(percent);
|
||||
|
||||
QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
if (temTime >= beginTime && temTime < endTime) {
|
||||
if (!Gloab::g_param[jd[i]][j].contains(dataName)) {
|
||||
if (tem1 != "无数据") {
|
||||
if (!Gloab::rule.contains(tem1)) {
|
||||
Gloab::rule.append(tem1);
|
||||
}
|
||||
emit appSeries(temTime.toMSecsSinceEpoch(), Gloab::rule.indexOf(tem1));
|
||||
}
|
||||
} else {
|
||||
tem1 = Gloab::g_param[jd[i]][j][dataName];
|
||||
if (!Gloab::rule.contains(tem1)) {
|
||||
Gloab::rule.append(tem1);
|
||||
}
|
||||
emit appSeries(temTime.toMSecsSinceEpoch(), Gloab::rule.indexOf(tem1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
emit setChartView(jd[i], isEnum);
|
||||
}
|
||||
|
||||
emit setWidget();
|
||||
quit();
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
#ifndef THREADCHART_H
|
||||
#define THREADCHART_H
|
||||
|
||||
#include <QThread>
|
||||
#include <QDateTime>
|
||||
#include <QDialog>
|
||||
#include <QChart>
|
||||
using namespace QtCharts;
|
||||
#include <QLineSeries>
|
||||
#include <QRegularExpression>
|
||||
#include <QCategoryAxis>
|
||||
#include <QDateTimeAxis>
|
||||
#include <QGridLayout>
|
||||
|
||||
|
||||
#include "gloab.h"
|
||||
|
||||
class ThreadChart : public QThread {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ThreadChart(QObject *parent = nullptr);
|
||||
|
||||
void setValue(QVector<int> jd, QString dataName, QDateTime beginTime, QDateTime endTime);
|
||||
|
||||
|
||||
signals:
|
||||
void newCandS();
|
||||
void appSeries(qreal A,qreal B);
|
||||
void setChartView(int jd,bool isEnum);
|
||||
void setWidget();
|
||||
void setProgressBar(int percent);
|
||||
|
||||
protected:
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
QVector<int> jd;
|
||||
QDateTime beginTime;
|
||||
QDateTime endTime;
|
||||
QString dataName;
|
||||
};
|
||||
|
||||
#endif // THREADCHART_H
|
@ -1,87 +0,0 @@
|
||||
#include "threadpoltchart.h"
|
||||
#include <QDebug>
|
||||
|
||||
threadPoltChart::threadPoltChart(QObject *parent)
|
||||
: QThread{parent} {
|
||||
}
|
||||
|
||||
void threadPoltChart::setValue(QVector<int> jd, QString dataName, QDateTime beginTime, QDateTime endTime) {
|
||||
this->jd = jd;
|
||||
this->dataName = dataName;
|
||||
this->beginTime = beginTime;
|
||||
this->endTime = endTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void threadPoltChart::run() {
|
||||
Gloab::m_chartViews.clear();
|
||||
Gloab::rule.clear();
|
||||
Gloab::rule.append("状态");
|
||||
for (int i = 0; i < jd.size(); ++i) {
|
||||
int X = 1;
|
||||
emit newCandS();
|
||||
|
||||
// 为每个图表添加数据
|
||||
//判断右侧数据是否为数字型
|
||||
bool isEnum = Gloab::namelist[dataName];
|
||||
if (dataName.contains("版本号")) {
|
||||
isEnum = false;
|
||||
}
|
||||
if (isEnum) {
|
||||
for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) {
|
||||
//更新进度条
|
||||
Gloab::bytesRead++;
|
||||
int percent = Gloab::bytesRead * 100 / Gloab::fileSize;
|
||||
emit setProgressBar(percent);
|
||||
|
||||
if (Gloab::g_param[jd[i]][j].keys().size()<=deleteName.size()) {
|
||||
bool f=true;
|
||||
for(auto key : Gloab::g_param[jd[i]][j].keys()) {
|
||||
if (!deleteName.contains(key)) {
|
||||
f=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (f) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
if (temTime >= beginTime && temTime < endTime) {
|
||||
if (Gloab::g_param[jd[i]][j].contains(dataName)) {
|
||||
if (Gloab::g_param[jd[i]][j][dataName].contains(".")) {
|
||||
emit appSeries(X++, Gloab::g_param[jd[i]][j][dataName].toDouble());
|
||||
} else {
|
||||
emit appSeries(X++, Gloab::g_param[jd[i]][j][dataName].toLongLong());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) {
|
||||
//更新进度条
|
||||
Gloab::bytesRead++;
|
||||
int percent = Gloab::bytesRead * 100 / Gloab::fileSize;
|
||||
emit setProgressBar(percent);
|
||||
|
||||
QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
if (temTime >= beginTime && temTime < endTime) {
|
||||
if (Gloab::g_param[jd[i]][j].contains(dataName)) {
|
||||
QString tem1 = Gloab::g_param[jd[i]][j][dataName];
|
||||
if (!Gloab::rule.contains(tem1)) {
|
||||
Gloab::rule.append(tem1);
|
||||
}
|
||||
emit appSeries(X++, Gloab::rule.indexOf(tem1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
emit setChartView(jd[i], isEnum);
|
||||
}
|
||||
|
||||
emit setWidget();
|
||||
quit();
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
#ifndef THREADPOLTCHART_H
|
||||
#define THREADPOLTCHART_H
|
||||
|
||||
#include <QThread>
|
||||
#include <QDateTime>
|
||||
#include <QDialog>
|
||||
#include <QChart>
|
||||
using namespace QtCharts;
|
||||
#include <QLineSeries>
|
||||
#include <QRegularExpression>
|
||||
#include <QCategoryAxis>
|
||||
#include <QDateTimeAxis>
|
||||
#include <QGridLayout>
|
||||
|
||||
|
||||
#include "gloab.h"
|
||||
|
||||
class threadPoltChart : public QThread {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit threadPoltChart(QObject *parent = nullptr);
|
||||
|
||||
void setValue(QVector<int> jd, QString dataName, QDateTime beginTime, QDateTime endTime );
|
||||
|
||||
|
||||
signals:
|
||||
void newCandS();
|
||||
|
||||
void appSeries(qreal A, qreal B);
|
||||
|
||||
void setChartView(int jd, bool isEnum);
|
||||
|
||||
void setWidget();
|
||||
|
||||
void setProgressBar(int percent);
|
||||
|
||||
protected:
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
QVector<int> jd;
|
||||
QDateTime beginTime;
|
||||
QDateTime endTime;
|
||||
QString dataName;
|
||||
QStringList deleteName;
|
||||
};
|
||||
|
||||
#endif // THREADPOLTCHART_H
|
121
threadread.cpp
121
threadread.cpp
@ -1,121 +0,0 @@
|
||||
#include "threadread.h"
|
||||
|
||||
threadRead::threadRead(QObject *parent)
|
||||
: QThread{parent} {
|
||||
}
|
||||
|
||||
bool threadRead::isNumeric(QString data) {
|
||||
// 正则表达式匹配数字和可选的正负号
|
||||
QRegularExpression pattern("^[+-]?([1-9][0-9]*|0)[.]?[0-9]*$");
|
||||
QRegularExpressionMatch patternMatch =pattern.match(data);
|
||||
// 使用std::regex_match来检查字符串是否完全匹配模式
|
||||
return patternMatch.hasMatch();
|
||||
}
|
||||
|
||||
void threadRead::run() {
|
||||
//正则表达式
|
||||
//时间
|
||||
QRegularExpression dateTimeRegex("([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{3})");
|
||||
QRegularExpressionMatch matchDateTime;
|
||||
//基带
|
||||
QRegularExpression jdRegex("\\[.*(\\d)\\]");
|
||||
QRegularExpressionMatch matchLogLevel;
|
||||
|
||||
|
||||
//初始化数据
|
||||
for (auto &i: Gloab::g_param) {
|
||||
i.clear();
|
||||
}
|
||||
//清除下拉框数据
|
||||
emit clearCombo();
|
||||
if(!Gloab::namelist.empty()){
|
||||
Gloab::namelist.clear();
|
||||
Gloab::completer->deleteLater();
|
||||
}
|
||||
|
||||
//设置状态栏
|
||||
emit showStatusbar("正在打开文件");
|
||||
|
||||
//读取文件
|
||||
QTextStream in(&Gloab::file);
|
||||
while (!in.atEnd()) {
|
||||
//读取一行
|
||||
QString line = in.readLine();
|
||||
|
||||
//更新进度条
|
||||
Gloab::bytesRead += line.size();
|
||||
int percent = Gloab::bytesRead * 150 / Gloab::fileSize;
|
||||
emit setProgressBar(percent);
|
||||
|
||||
|
||||
/* 匹配数据 */
|
||||
//匹配日期时间
|
||||
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 (Gloab::temData.isEmpty()) {
|
||||
emit setBeginTime(QDateTime::fromString(temtime, "yyyy-MM-dd hh:mm:ss:zzz"));
|
||||
}
|
||||
Gloab::temData.clear();
|
||||
Gloab::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 (!Gloab::namelist.contains(tem[0])) {
|
||||
Gloab::namelist[tem[0]]=isNumeric(tem[1]);
|
||||
if (tem[0].contains("版本号")) {
|
||||
Gloab::namelist[tem[0]] = false;
|
||||
}
|
||||
}
|
||||
Gloab::temData[tem[0]] = tem[1];
|
||||
}
|
||||
//记录数据
|
||||
Gloab::g_param[JD].append(Gloab::temData);
|
||||
|
||||
}
|
||||
|
||||
//设置结束时间
|
||||
emit setEndTime(QDateTime::fromString(Gloab::temData["时间"], "yyyy-MM-dd hh:mm:ss:zzz"));
|
||||
|
||||
//设置状态栏
|
||||
emit showStatusbar("打开成功:" + Gloab::fileName);
|
||||
|
||||
//添加下拉框数据
|
||||
emit addCombo(Gloab::namelist.keys());
|
||||
|
||||
//关闭
|
||||
emit closeProg();
|
||||
Gloab::file.close();
|
||||
Gloab::temData.clear();
|
||||
quit();
|
||||
}
|
31
threadread.h
31
threadread.h
@ -1,31 +0,0 @@
|
||||
#ifndef THREADREAD_H
|
||||
#define THREADREAD_H
|
||||
|
||||
#include "gloab.h"
|
||||
|
||||
#include <QtCharts>
|
||||
|
||||
class threadRead : public QThread {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit threadRead(QObject *parent = nullptr);
|
||||
bool isNumeric(QString data);
|
||||
|
||||
signals:
|
||||
void clearCombo();
|
||||
void showStatusbar(QString message);
|
||||
void setBeginTime(QDateTime begin);
|
||||
void setEndTime(QDateTime begin);
|
||||
void addCombo(QStringList list);
|
||||
void setProgressBar(int percent);
|
||||
void closeProg();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // THREADREAD_H
|
Reference in New Issue
Block a user