diff --git a/.gitignore b/.gitignore index 8b3612c..b682d06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea/ *.user +build_cmake/ +build_qt/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 42058df..18c8f7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/customthread.cpp b/customthread.cpp index ed24a66..7dc1556 100644 --- a/customthread.cpp +++ b/customthread.cpp @@ -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(); } diff --git a/global.h b/global.h index aba8f61..d44646b 100644 --- a/global.h +++ b/global.h @@ -10,7 +10,7 @@ #include #include "qcustomplot.h" -extern QVector> g_param[4]; //存储4条基带的数据 +extern QVector> g_param[5]; //存储4条基带的数据+其他 extern QMap namelist; //存储数据名以及数据是否是数字 extern QFile file; //打开文件 extern QCompleter *completer; //下拉框选项 @@ -19,8 +19,8 @@ extern QDateTime beginTime; //开始时间 extern QDateTime endTime; //结束时间 extern QVector m_PlotView; //custom图 extern QVector rule; //Y轴映射 -extern QVector xData[4]; //X轴数据 -extern QVector yData[4]; //Y轴数据 +extern QVector xData[5]; //X轴数据 +extern QVector yData[5]; //Y轴数据 #endif //READLOG_GLOBAL_H diff --git a/main.cpp b/main.cpp index 7e2f8f9..bef2ab8 100644 --- a/main.cpp +++ b/main.cpp @@ -7,7 +7,7 @@ //初始化数据 -QVector> g_param[4]; +QVector> g_param[5]; QMap namelist; QFile file; QCompleter *completer; @@ -16,14 +16,14 @@ QDateTime beginTime; QDateTime endTime; QVector m_PlotView; QVector rule; -QVector xData[4]; -QVector yData[4]; +QVector xData[5]; +QVector 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); diff --git a/mainwindow.cpp b/mainwindow.cpp index 222406a..6710fd0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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轴 diff --git a/mainwindow.ui b/mainwindow.ui index cfc8eb1..7b4ef48 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -12,7 +12,7 @@ 0 0 - 450 + 529 700 @@ -161,11 +161,11 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - + + + - 基带 3 + 基带 1 @@ -176,6 +176,13 @@ + + + + 基带 3 + + + @@ -183,10 +190,10 @@ - - + + - 基带 1 + 主控单元 diff --git a/readthread.cpp b/readthread.cpp index 98c1438..290c609 100644 --- a/readthread.cpp +++ b/readthread.cpp @@ -60,7 +60,6 @@ void ReadThread::run() { QMap 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) {