添加主控单元过滤

This commit is contained in:
2025-06-11 16:36:43 +08:00
parent 98bd5fb3b0
commit 82388559ad
8 changed files with 86 additions and 46 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.idea/
*.user
build_cmake/
build_qt/

View File

@ -7,8 +7,11 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
#设置必须支持C++设定版本
set(CMAKE_CXX_STANDARD_REQUIRED ON)
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)
@ -30,23 +33,23 @@ set(PROJECT_SOURCES
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(ReadLog
MANUAL_FINALIZATION
${PROJECT_SOURCES}
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# 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
# 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 SHARED
${PROJECT_SOURCES}
${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
${PROJECT_SOURCES}
${PROJECT_SOURCES}
)
endif()
@ -59,21 +62,21 @@ target_link_libraries(ReadLog PRIVATE Qt5::PrintSupport)
# 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)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.ReadLog)
endif()
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
${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
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(QT_VERSION_MAJOR EQUAL 6)

View File

@ -12,7 +12,7 @@ void CustomThread::run() {
m_PlotView.clear();
rule.clear();
for (int var = 0; var < 4; ++var) {
for (int var = 0; var < 5; ++var) {
xData[var].clear();
yData[var].clear();
}

View File

@ -10,7 +10,7 @@
#include <QDateTime>
#include "qcustomplot.h"
extern QVector<QMap<QString, QString>> g_param[4]; //存储4条基带的数据
extern QVector<QMap<QString, QString>> g_param[5]; //存储4条基带的数据+其他
extern QMap<QString, bool> namelist; //存储数据名以及数据是否是数字
extern QFile file; //打开文件
extern QCompleter *completer; //下拉框选项
@ -19,8 +19,8 @@ extern QDateTime beginTime; //开始时间
extern QDateTime endTime; //结束时间
extern QVector<QCustomPlot *> m_PlotView; //custom图
extern QVector<QString> rule; //Y轴映射
extern QVector<double> xData[4]; //X轴数据
extern QVector<double> yData[4]; //Y轴数据
extern QVector<double> xData[5]; //X轴数据
extern QVector<double> yData[5]; //Y轴数据
#endif //READLOG_GLOBAL_H

View File

@ -7,7 +7,7 @@
//初始化数据
QVector<QMap<QString, QString>> g_param[4];
QVector<QMap<QString, QString>> g_param[5];
QMap<QString, bool> namelist;
QFile file;
QCompleter *completer;
@ -16,14 +16,14 @@ QDateTime beginTime;
QDateTime endTime;
QVector<QCustomPlot *> m_PlotView;
QVector<QString> rule;
QVector<double> xData[4];
QVector<double> yData[4];
QVector<double> xData[5];
QVector<double> yData[5];
int main(int argc, char *argv[]) {
//设置logo
QApplication::setWindowIcon(QIcon("logo.ico"));
//放大窗口
// qputenv("QT_SCALE_FACTOR", "2.0");
qputenv("QT_SCALE_FACTOR", "1.0");
//设置使用UTF8字符集正确显示中文
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForLocale(codec);

View File

@ -105,6 +105,9 @@ bool MainWindow::inspectionData() {
if (ui->jd4->isChecked()) {
jd.append(3);
}
if (ui->mainCtrl->isChecked()) {
jd.append(4);
}
//判断基带是否为空
if (jd.isEmpty()) {
QMessageBox::warning(this, "警告", "请至少选择一个基带");
@ -181,7 +184,12 @@ void MainWindow::setPlotView(int jd, bool isNum, bool isTime) {
//标题
QCPTextElement *m_title;
qCustomPlot->plotLayout()->insertRow(0);
m_title = new QCPTextElement(qCustomPlot, QString("基带 %1").arg(jd + 1));
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);
// X轴

View File

@ -12,7 +12,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<width>529</width>
<height>700</height>
</rect>
</property>
@ -161,11 +161,11 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="2">
<widget class="QCheckBox" name="jd3">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="jd1">
<property name="text">
<string>基带 3</string>
<string>基带 1</string>
</property>
</widget>
</item>
@ -176,6 +176,13 @@
</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">
@ -183,10 +190,10 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="jd1">
<item row="0" column="4">
<widget class="QCheckBox" name="mainCtrl">
<property name="text">
<string>基带 1</string>
<string>主控单元</string>
</property>
</widget>
</item>

View File

@ -60,7 +60,6 @@ void ReadThread::run() {
QMap<QString, QString> temMap;
int JD;
QString temtime;
QString temjd;
matchDateTime = dateTimeRegex.match(line);
if (matchDateTime.hasMatch()) {
temtime = matchDateTime.captured(1);
@ -68,15 +67,36 @@ void ReadThread::run() {
} else {
continue;
}
//匹配基带
matchLogLevel = jdRegex.match(line);
if (matchLogLevel.hasMatch()) {
temjd = matchLogLevel.captured(1);
temMap["基带"] = temjd;
JD = temjd.toInt() - 1;
} 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) {