new project

This commit is contained in:
2024-09-14 11:18:18 +08:00
parent 53362d9373
commit f4e058c009
21 changed files with 251 additions and 1404 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
.idea/
*.user
.idea

View File

@ -1,6 +1,6 @@
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)
@ -9,60 +9,52 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
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)
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
lib/qcustomplot.h
lib/qcustomplot.cpp
qcustplot.cpp
qcustplot.h
qcustplot.ui
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(ReadLog_7
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
# 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
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")
else()
add_executable(ReadLog_7
add_executable(ReadLog
${PROJECT_SOURCES}
threadread.h threadread.cpp
threadchart.h threadchart.cpp
threadpoltchart.h threadpoltchart.cpp
log7.pro
qcustomplot.cpp qcustomplot.h
)
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
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}
@ -71,12 +63,12 @@ set_target_properties(ReadLog_7 PROPERTIES
)
include(GNUInstallDirs)
install(TARGETS ReadLog_7
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()

View File

@ -1,4 +1,4 @@
QT += core gui charts
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
@ -9,27 +9,16 @@ CONFIG += c++11
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
gloab.cpp \
lib/qcustomplot.cpp \
main.cpp \
mainwindow.cpp \
qcustplot.cpp \
threadchart.cpp \
threadpoltchart.cpp \
threadread.cpp
mainwindow.cpp
# qcustomplot.cpp
HEADERS += \
gloab.h \
lib/qcustomplot.h \
mainwindow.h \
qcustplot.h \
threadchart.h \
threadpoltchart.h \
threadread.h
mainwindow.h
# qcustomplot.h
FORMS += \
mainwindow.ui \
qcustplot.ui
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin

View File

@ -1,14 +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<QCustPlot*> Gloab::m_QCView;
QWidget * Gloab::widget;
QVector<QString> Gloab::rule;
QFile Gloab::file;
qint64 Gloab::fileSize;
qint64 Gloab::bytesRead;
QCompleter *Gloab::completer;
QVector<double> Gloab::xData[4],Gloab::yData[4];

36
gloab.h
View File

@ -1,36 +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>
#include "qcustplot.h"
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<QCustPlot*> m_QCView;
static QWidget *widget;
static QVector<QString> rule;
static QFile file;
static qint64 fileSize;
static qint64 bytesRead;
static QCompleter *completer;
static QVector<double> xData[4],yData[4];
};
#endif //GLOAB_H

View File

@ -1,275 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 12.0.2, 2024-09-14T08:27:16. -->
<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&lt;int&gt;" 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>

View File

@ -1,13 +1,10 @@
#include "mainwindow.h"
#include <QApplication>
#include <QTextCodec>
#include <QDebug>
int main(int argc, char *argv[])
{
// qputenv("QT_SCALE_FACTOR", "2.0");
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForLocale(codec);
QApplication a(argc, argv);
MainWindow w;
w.show();

View File

@ -1,289 +1,22 @@
#include "mainwindow.h"
#include <QMessageBox>
#include "lib/qcustomplot.h"
#include "ui_mainwindow.h"
#include "./ui_mainwindow.h"
#include <QCompleter>
#include <QListView>
#include <QStyledItemDelegate>
#include <QLineEdit>
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)
{
ui->setupUi(this);
this->setWindowTitle("日志查询工具");
// 创建版本号标签
m_versionLabel = new QLabel(tr("v1.2.0"), this);
// 将标签添加到状态栏的右端
ui->statusbar->addPermanentWidget(m_versionLabel);
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);
//chart
connect(thread_chart, &ThreadChart::setChartView, this, &MainWindow::setChartView);
connect(thread_chart, &ThreadChart::setWidget, this, &MainWindow::setWidget);
connect(thread_chart, &ThreadChart::setProgressBar, this, &MainWindow::setProgressBar);
//plot
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() {
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_openFileBtn_clicked() {
Gloab::fileName = QFileDialog::getOpenFileName();
//打开文件
Gloab::file.setFileName(Gloab::fileName);
if (!Gloab::file.open(QIODevice::ReadOnly)) {
// 打开失败时弹窗
QString dlgTitle = "错误";
QString strInfo = "文件打开失败";
QMessageBox::warning(this, dlgTitle, strInfo);
//退出
return;
}
//设置进度条
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();
}
void MainWindow::clearCombo() {
ui->comboBox->clear();
}
void MainWindow::showStatusbar(const QString &message) {
ui->statusbar->showMessage(message);
}
void MainWindow::setBeginTime(const QDateTime &begin) {
ui->beginTime->setDateTime(begin);
}
void MainWindow::setEndTime(const QDateTime &begin) {
ui->endTime->setDateTime(begin);
}
void MainWindow::addCombo(const QStringList &list) {
ui->comboBox->addItems(list);
//根据输入匹配下拉框
Gloab::completer = new QCompleter(list);
Gloab::completer->setFilterMode(Qt::MatchContains);
ui->comboBox->setCompleter(Gloab::completer);
}
void MainWindow::setProgressBar(int percent) {
progressBar->setValue(percent);
}
void MainWindow::closeProg() {
layout->deleteLater();
progressBar->deleteLater();
ui->widget->close();
}
void MainWindow::setChartView(int jd, bool isEnum) {
// 设置图表标题
QCustPlot *qCustPlot = new QCustPlot(Gloab::xData[jd], Gloab::yData[jd], jd, isEnum, true);
// 将qCustPlot添加到容器中
Gloab::m_QCView.append(qCustPlot);
}
void MainWindow::setWidget() {
// 设置布局
int wide = 850;
int hight = 600;
if (Gloab::m_QCView.size() > 1) {
wide = 1800;
}
QGridLayout *gridLayout = new QGridLayout(Gloab::widget);
for (int i = 0, j = 0; i < Gloab::m_QCView.size(); i++) {
if (i != 0 && i % 2 == 0) {
j++;
hight += 350;
}
gridLayout->addWidget(Gloab::m_QCView[i], j, i - 2 * j);
}
Gloab::widget->resize(wide, hight);
Gloab::widget->move(70, 20);
Gloab::widget->show();
layout->deleteLater();
progressBar->deleteLater();
ui->widget->close();
}
void MainWindow::setPlotChartView(int jd, bool isEnum) {
// 设置图表标题
QCustPlot *qCustPlot = new QCustPlot(Gloab::xData[jd], Gloab::yData[jd], jd, isEnum, false);
// 将qCustPlot添加到容器中
Gloab::m_QCView.append(qCustPlot);
}
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();
}

View File

@ -1,17 +1,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "gloab.h"
#include "threadread.h"
#include <QMainWindow>
#include <QString>
#include <QDialog>
#include <QVBoxLayout>
#include <QProgressBar>
#include "qcustplot.h"
#include "threadchart.h"
#include "threadpoltchart.h"
QT_BEGIN_NAMESPACE
namespace Ui {
@ -27,39 +17,8 @@ public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_openFileBtn_clicked();
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 closeProg();
void setChartView(int jd,bool isEnum);
void setWidget();
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;
};
#endif // MAINWINDOW_H

View File

@ -6,44 +6,40 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>450</width>
<height>700</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</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">
<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="dateTimeEdit_2">
<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 +50,67 @@
</widget>
</item>
<item row="10" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
<size>
<width>20</width>
<width>0</width>
<height>40</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>
<layout class="QGridLayout" name="gridLayout_13">
<item row="0" column="0">
<widget class="QProgressBar" name="progressBar_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>选择基带</string>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</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 name="value">
<number>24</number>
</property>
<property name="text">
<string>基带1</string>
<property name="alignment">
<set>Qt::AlignCenter</set>
</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 name="textVisible">
<bool>false</bool>
</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">
<item row="5" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="font">
<font>
<family>宋体</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>结束时间</string>
<string>开始时间</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<layout class="QGridLayout" name="gridLayout_12">
<item row="0" column="0">
<widget class="QDateTimeEdit" name="endTime">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
<widget class="QDateTimeEdit" name="dateTimeEdit">
<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,35 +120,59 @@
</layout>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</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">
<property name="font">
<font>
<pointsize>14</pointsize>
<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_11">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>数据变化图</string>
<string>基带 1</string>
</property>
</widget>
</item>
<item row="2" column="0">
<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">
<property name="text">
<string>基带 3</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>基带 4</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -237,7 +185,7 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -250,11 +198,24 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<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">
@ -262,8 +223,104 @@
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_6">
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_4">
<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="pushButton_2">
<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="pushButton_3">
<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="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -277,16 +334,6 @@
</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/>

View File

@ -1,63 +0,0 @@
#include "qcustplot.h"
#include "ui_qcustplot.h"
#include <QDateTime>
#include <QDebug>
#include "gloab.h"
QCustPlot::QCustPlot(QVector<double> xData, QVector<double> yData, int jd, bool isNub, bool isTime,
QWidget *parent)
: QWidget(parent)
, ui(new Ui::QCustPlot)
{
ui->setupUi(this);
//标题
QCPTextElement *m_title;
ui->plot->plotLayout()->insertRow(0);
m_title = new QCPTextElement(ui->plot, QString("基带 %1").arg(jd+1));
ui->plot->plotLayout()->addElement(0, 0, m_title);
// X轴
if (isTime) {
QSharedPointer<QCPAxisTickerDateTime> timeTicker(new QCPAxisTickerDateTime);
timeTicker->setDateTimeFormat("hh:mm:ss");
ui->plot->xAxis->setTicker(timeTicker);
}
// Y轴
if(!isNub){
QVector<double> ticks;
QVector<QString> labels;
for (int i = 1; i < Gloab::rule.size(); ++i) {
ticks.append(i);
labels.append(Gloab::rule[i]);
}
QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
textTicker->addTicks(ticks, labels);
ui->plot->yAxis->setTicker(textTicker);
}else{
ui->plot->yAxis->setNumberFormat("f");
ui->plot->yAxis->setNumberPrecision(2);
}
// 添加图形
ui->plot->addGraph();
ui->plot->graph(0)->setData(xData, yData);
// 自动调整轴范围
ui->plot->rescaleAxes();
ui->plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom );
if(!xData.empty()){
ui->plot->xAxis->setRange(xData.first(),xData.last());
}
}
QCustPlot::~QCustPlot()
{
delete ui;
}

View File

@ -1,25 +0,0 @@
#ifndef QCUSTPLOT_H
#define QCUSTPLOT_H
#include <QWidget>
#include "lib/qcustomplot.h"
namespace Ui {
class QCustPlot;
}
class QCustPlot : public QWidget
{
Q_OBJECT
public:
explicit QCustPlot(QVector<double> xData, QVector<double> yData, int jd, bool isNub, bool isTime,
QWidget *parent = nullptr);
~QCustPlot();
private:
Ui::QCustPlot *ui;
};
#endif // QCUSTPLOT_H

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QCustPlot</class>
<widget class="QWidget" name="QCustPlot">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>673</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCustomPlot" name="plot" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QCustomPlot</class>
<extends>QWidget</extends>
<header>lib/qcustomplot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,85 +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_QCView.clear();
Gloab::rule.clear();
Gloab::rule.append("状态");
for (int var = 0; var < 4; ++var) {
Gloab::xData[var].clear();
Gloab::yData[var].clear();
}
//判断右侧数据是否为数字型
bool isEnum = Gloab::namelist[dataName];
for (int i = 0; i < jd.size(); ++i) {
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) {
Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData[jd[i]].append(y);
}
} else {
y = Gloab::g_param[jd[i]][j][dataName].toDouble();
Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData[jd[i]].append(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);
}
Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData[jd[i]].append(Gloab::rule.indexOf(tem1));
}
} else {
tem1 = Gloab::g_param[jd[i]][j][dataName];
if (!Gloab::rule.contains(tem1)) {
Gloab::rule.append(tem1);
}
Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData[jd[i]].append(Gloab::rule.indexOf(tem1));
}
}
}
}
emit setChartView(jd[i], isEnum);
}
emit setWidget();
quit();
}

View File

@ -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

View File

@ -1,84 +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_QCView.clear();
Gloab::rule.clear();
Gloab::rule.append("状态");
for (int var = 0; var < 4; ++var) {
Gloab::xData[var].clear();
Gloab::yData[var].clear();
}
//判断右侧数据是否为数字型
bool isEnum = Gloab::namelist[dataName];
for (int i = 0; i < jd.size(); ++i) {
int X = 1;
// 为每个图表添加数据
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)) {
Gloab::xData[jd[i]].append(X++);
Gloab::yData[jd[i]].append(Gloab::g_param[jd[i]][j][dataName].toDouble());
}
}
}
} 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);
}
Gloab::xData[jd[i]].append(X++);
Gloab::yData[jd[i]].append(Gloab::rule.indexOf(tem1));
}
}
}
}
emit setChartView(jd[i], isEnum);
}
emit setWidget();
quit();
}

View File

@ -1,45 +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 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

View File

@ -1,129 +0,0 @@
#include "threadread.h"
threadRead::threadRead(QObject *parent)
: QThread{parent} {
}
bool threadRead::isNumeric(QString data) {
bool flag = false;
// 正则表达式匹配数字和可选的正负号
QRegularExpression pattern("^[+-]?([1-9][0-9]*|0)[.]?[0-9]*$");
QRegularExpressionMatch patternMatch =pattern.match(data);
if(patternMatch.hasMatch()){
flag = true;
}
QRegularExpression kexue("^[0-9].[0-9]e[+-][0-9][0-9]");
QRegularExpressionMatch kexueMatch =kexue.match(data);
if(kexueMatch.hasMatch()){
flag = true;
}
return flag;
}
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();
}

View File

@ -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