From cfcf8b0ecf1fcecda40bc650eae9071542aa9d51 Mon Sep 17 00:00:00 2001 From: yuntang <123@qq.com> Date: Mon, 26 May 2025 14:32:01 +0800 Subject: [PATCH] 2025-05-26T14:32:01 --- src/AnalysisTool.pro | 3 + src/FvbVvC.json | 1 + src/data/confighandler.cpp | 2 +- src/data/pointcalculate.cpp | 61 +- src/data/pointcalculate.h | 4 + src/global.cpp | 2 + src/global.h | 12 +- src/language/cn.ts | 1364 +++++++++++++++++++++++++++++++++++ src/language/en.ts | 1364 +++++++++++++++++++++++++++++++++++ src/mainwindow.cpp | 12 + src/mainwindow.h | 2 + src/mainwindow.ui | 6 + src/ui/axissettingform.cpp | 2 - src/ui/centralwidget.cpp | 113 +-- src/ui/centralwidget.h | 3 +- 15 files changed, 2860 insertions(+), 91 deletions(-) create mode 100644 src/FvbVvC.json create mode 100644 src/language/cn.ts create mode 100644 src/language/en.ts diff --git a/src/AnalysisTool.pro b/src/AnalysisTool.pro index fef68b7..581857e 100644 --- a/src/AnalysisTool.pro +++ b/src/AnalysisTool.pro @@ -133,3 +133,6 @@ RESOURCES += \ DISTFILES += \ logger/log.conf + +TRANSLATIONS = language/cn.ts \ +language/en.ts diff --git a/src/FvbVvC.json b/src/FvbVvC.json new file mode 100644 index 0000000..a31cc40 --- /dev/null +++ b/src/FvbVvC.json @@ -0,0 +1 @@ +[{"excluded":[],"includePaths":["D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx","D:/gitfile/analysis_tool/src/serialport","D:/gitfile/analysis_tool/src/ui","D:/gitfile/analysis_tool/src/logger","D:/gitfile/analysis_tool/src/thirdparty/easylogging","D:/gitfile/analysis_tool/src/thirdparty/qcustomplot","D:/gitfile/analysis_tool/src/data","D:/gitfile/analysis_tool/src","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtPrintSupport","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtWidgets","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtGui/5.14.2","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtGui/5.14.2/QtGui","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtGui","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtANGLE","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtSerialPort","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtCore/5.14.2","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtCore/5.14.2/QtCore","D:/qt/Qt5.14.2/5.14.2/mingw73_64/include/QtCore","D:/gitfile/analysis_tool/src","D:/gitfile/analysis_tool/src"],"projectFile":"D:/gitfile/analysis_tool/src/AnalysisTool.pro","sources":["D:/gitfile/analysis_tool/src/data/confighandler.cpp","D:/gitfile/analysis_tool/src/data/confighandler.h","D:/gitfile/analysis_tool/src/data/filemanager.cpp","D:/gitfile/analysis_tool/src/data/filemanager.h","D:/gitfile/analysis_tool/src/data/pointcalculate.cpp","D:/gitfile/analysis_tool/src/data/pointcalculate.h","D:/gitfile/analysis_tool/src/data/txthandler.cpp","D:/gitfile/analysis_tool/src/data/txthandler.h","D:/gitfile/analysis_tool/src/data/xlsxhandler.cpp","D:/gitfile/analysis_tool/src/data/xlsxhandler.h","D:/gitfile/analysis_tool/src/defines.h","D:/gitfile/analysis_tool/src/global.cpp","D:/gitfile/analysis_tool/src/global.h","D:/gitfile/analysis_tool/src/logger/logger.cpp","D:/gitfile/analysis_tool/src/logger/logger.h","D:/gitfile/analysis_tool/src/main.cpp","D:/gitfile/analysis_tool/src/mainwindow.cpp","D:/gitfile/analysis_tool/src/mainwindow.h","D:/gitfile/analysis_tool/src/mainwindow.ui","D:/gitfile/analysis_tool/src/serialport/dataparser.cpp","D:/gitfile/analysis_tool/src/serialport/dataparser.h","D:/gitfile/analysis_tool/src/serialport/protocol.h","D:/gitfile/analysis_tool/src/serialport/serialport.cpp","D:/gitfile/analysis_tool/src/serialport/serialport.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxabstractooxmlfile.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxabstractooxmlfile.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxabstractooxmlfile_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxabstractsheet.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxabstractsheet.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxabstractsheet_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcell.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcell.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcell_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcellformula.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcellformula.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcellformula_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcellrange.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcellrange.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcellreference.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcellreference.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxchart.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxchart.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxchart_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxchartsheet.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxchartsheet.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxchartsheet_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcolor.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcolor_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxconditionalformatting.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxconditionalformatting.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxconditionalformatting_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcontenttypes.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxcontenttypes_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdatavalidation.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdatavalidation.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdatavalidation_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdocpropsapp.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdocpropsapp_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdocpropscore.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdocpropscore_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdocument.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdocument.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdocument_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdrawing.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdrawing_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdrawinganchor.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxdrawinganchor_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxformat.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxformat.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxformat_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxglobal.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxmediafile.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxmediafile_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxnumformatparser.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxnumformatparser_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxrelationships.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxrelationships_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxrichstring.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxrichstring.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxrichstring_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxsharedstrings.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxsharedstrings_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxsimpleooxmlfile.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxsimpleooxmlfile_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxstyles.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxstyles_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxtheme.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxtheme_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxutility.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxutility_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxworkbook.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxworkbook.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxworkbook_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxworksheet.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxworksheet.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxworksheet_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxzipreader.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxzipreader_p.h","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxzipwriter.cpp","D:/gitfile/analysis_tool/src/thirdparty/QtXlsxWriter-0.3.0/src/xlsx/xlsxzipwriter_p.h","D:/gitfile/analysis_tool/src/thirdparty/easylogging/easylogging++.cc","D:/gitfile/analysis_tool/src/thirdparty/easylogging/easylogging++.h","D:/gitfile/analysis_tool/src/thirdparty/qcustomplot/qcustomplot.cpp","D:/gitfile/analysis_tool/src/thirdparty/qcustomplot/qcustomplot.h","D:/gitfile/analysis_tool/src/ui/aboutform.cpp","D:/gitfile/analysis_tool/src/ui/aboutform.h","D:/gitfile/analysis_tool/src/ui/aboutform.ui","D:/gitfile/analysis_tool/src/ui/analysisoperationrecorder.cpp","D:/gitfile/analysis_tool/src/ui/analysisoperationrecorder.h","D:/gitfile/analysis_tool/src/ui/analysissettingform.cpp","D:/gitfile/analysis_tool/src/ui/analysissettingform.h","D:/gitfile/analysis_tool/src/ui/axissettingform.cpp","D:/gitfile/analysis_tool/src/ui/axissettingform.h","D:/gitfile/analysis_tool/src/ui/axissettingform.ui","D:/gitfile/analysis_tool/src/ui/centralwidget.cpp","D:/gitfile/analysis_tool/src/ui/centralwidget.h","D:/gitfile/analysis_tool/src/ui/coefficientselectionform.cpp","D:/gitfile/analysis_tool/src/ui/coefficientselectionform.h","D:/gitfile/analysis_tool/src/ui/coefficientselectionform.ui","D:/gitfile/analysis_tool/src/ui/degreeofcrystallinityform.cpp","D:/gitfile/analysis_tool/src/ui/degreeofcrystallinityform.h","D:/gitfile/analysis_tool/src/ui/degreeofcrystallinityform.ui","D:/gitfile/analysis_tool/src/ui/degreeofcureform.cpp","D:/gitfile/analysis_tool/src/ui/degreeofcureform.h","D:/gitfile/analysis_tool/src/ui/degreeofcureform.ui","D:/gitfile/analysis_tool/src/ui/enthalpydatacorrectionform.cpp","D:/gitfile/analysis_tool/src/ui/enthalpydatacorrectionform.h","D:/gitfile/analysis_tool/src/ui/enthalpydatacorrectionform.ui","D:/gitfile/analysis_tool/src/ui/eventhandler.cpp","D:/gitfile/analysis_tool/src/ui/eventhandler.h","D:/gitfile/analysis_tool/src/ui/experimentsettingform.cpp","D:/gitfile/analysis_tool/src/ui/experimentsettingform.h","D:/gitfile/analysis_tool/src/ui/experimentsettingform.ui","D:/gitfile/analysis_tool/src/ui/instrumentcoefficientform.cpp","D:/gitfile/analysis_tool/src/ui/instrumentcoefficientform.h","D:/gitfile/analysis_tool/src/ui/instrumentcoefficientform.ui","D:/gitfile/analysis_tool/src/ui/itemmanager.cpp","D:/gitfile/analysis_tool/src/ui/itemmanager.h","D:/gitfile/analysis_tool/src/ui/leftwidget.cpp","D:/gitfile/analysis_tool/src/ui/leftwidget.h","D:/gitfile/analysis_tool/src/ui/localcustomplot.cpp","D:/gitfile/analysis_tool/src/ui/localcustomplot.h","D:/gitfile/analysis_tool/src/ui/oitautoanalysisparamform.cpp","D:/gitfile/analysis_tool/src/ui/oitautoanalysisparamform.h","D:/gitfile/analysis_tool/src/ui/oitautoanalysisparamform.ui","D:/gitfile/analysis_tool/src/ui/printereditform.cpp","D:/gitfile/analysis_tool/src/ui/printereditform.h","D:/gitfile/analysis_tool/src/ui/printereditform.ui","D:/gitfile/analysis_tool/src/ui/printpreviewform.cpp","D:/gitfile/analysis_tool/src/ui/printpreviewform.h","D:/gitfile/analysis_tool/src/ui/printpreviewform.ui","D:/gitfile/analysis_tool/src/ui/realtimedataform.cpp","D:/gitfile/analysis_tool/src/ui/realtimedataform.h","D:/gitfile/analysis_tool/src/ui/realtimedataform.ui","D:/gitfile/analysis_tool/src/ui/rightwidget.cpp","D:/gitfile/analysis_tool/src/ui/rightwidget.h","D:/gitfile/analysis_tool/src/ui/specificheatcomparisonmethodform.cpp","D:/gitfile/analysis_tool/src/ui/specificheatcomparisonmethodform.h","D:/gitfile/analysis_tool/src/ui/specificheatcomparisonmethodform.ui"],"translations":["D:/gitfile/analysis_tool/src/Language/linguist_cn.ts","D:/gitfile/analysis_tool/src/Language/linguist_en.ts"]}] diff --git a/src/data/confighandler.cpp b/src/data/confighandler.cpp index 792aff6..74aa9d4 100644 --- a/src/data/confighandler.cpp +++ b/src/data/confighandler.cpp @@ -12,7 +12,7 @@ void ConfigHandler::reader() { // 检查文件是否已经存在 if (QFile::exists(ConConfigFilePath)) { - logde << "config config file existed. "; + logde << "config file existed. "; }else{ writer(false); } diff --git a/src/data/pointcalculate.cpp b/src/data/pointcalculate.cpp index 29b3a31..db79d50 100644 --- a/src/data/pointcalculate.cpp +++ b/src/data/pointcalculate.cpp @@ -748,10 +748,10 @@ QPair PointCalculate::calculateS { QPair leftAndRightPair = calculateStartAndEndPoint(); - ExperimentData leftEd = getClosestDataByTemperature(leftAndRightPair.first.x()); - ExperimentData rightEd = getClosestDataByTemperature(leftAndRightPair.second.x()); + ExperimentData leftEd = getClosestDataByTemperature(leftAndRightPair.first.x()); + ExperimentData rightEd = getClosestDataByTemperature(leftAndRightPair.second.x()); - return qMakePair (leftEd,rightEd); + return qMakePair (leftEd,rightEd); } QPair PointCalculate::getMinAndMaxOfRunTime() @@ -770,6 +770,59 @@ QPair PointCalculate::getMinAndMaxOfRunTime() return qMakePair(runTimeMin,runTimeMax); } +Global::ExperimentData PointCalculate::findOnSetDataByTemperature(const double x1,const double x2) +{ + Global::ExperimentData resultEd; + + QVector edVtr = getDataInXRange(x1,x2); + if(edVtr.empty()){ + return resultEd; + } + + double maxDsc = std::numeric_limits::min(); + for(Global::ExperimentData& ed:edVtr){ + if(ed.dsc > maxDsc){ + maxDsc = ed.dsc; + } + } + + // 从后往前遍历,找到第一个 dsc 与 standardDsc 相等的 ExperimentData + for (auto it = edVtr.rbegin(); it != edVtr.rend(); ++it) { + if(std::abs(it->dsc - maxDsc) < Global::OnsetAndEndSetRate * maxDsc){ + resultEd = *it; // 找到匹配项,返回该值 + break; + } + } + + return resultEd; +} + +Global::ExperimentData PointCalculate::findEndSetDataByTemperature(const double x1, const double x2) +{ + Global::ExperimentData resultEd; + + QVector edVtr = getDataInXRange(x1,x2); + if(edVtr.empty()){ + return resultEd; + } + + double maxDsc = std::numeric_limits::min(); + for(Global::ExperimentData& ed:edVtr){ + if(ed.dsc > maxDsc){ + maxDsc = ed.dsc; + } + } + + // 从后往前遍历,找到第一个 dsc 与 standardDsc 相等的 ExperimentData + for (auto it = edVtr.begin(); it != edVtr.end(); ++it) { + if(std::abs(it->dsc - maxDsc) < Global::OnsetAndEndSetRate * maxDsc){ + resultEd = *it; // 找到匹配项,返回该值 + break; + } + } + + return resultEd; +} QPair PointCalculate::getMinAndMaxOfDSC() { @@ -820,3 +873,5 @@ QString PointCalculate::textFormatGlassTranstionWithTime(const float t1, const f .arg(QString::number(tg, 'f', 3)) .arg(QString::number(t2, 'f', 3)); } + + diff --git a/src/data/pointcalculate.h b/src/data/pointcalculate.h index ab880d7..ed4d203 100644 --- a/src/data/pointcalculate.h +++ b/src/data/pointcalculate.h @@ -41,6 +41,10 @@ QPair calculateStartAndEndData(); float calculateArea(); double obtainTimeValueBasedOnTemperatureValue(const double sampleTemp); +ExperimentData findOnSetDataByTemperature(const double x1,const double x2); +ExperimentData findEndSetDataByTemperature(const double x1,const double x2); + + // text format QString textFormatPeakPoint(const float enthalpyValue, const float peakValue, diff --git a/src/global.cpp b/src/global.cpp index 4c681b3..a518a8e 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -18,6 +18,8 @@ QVector _enthalpyCoefficientVtr; bool _displayTimeValue = false; +LanguageType _languageType = LanguageType::Chinese; + QString converDoubleToStr(const double num) { return QString::number(num,'f',3); diff --git a/src/global.h b/src/global.h index 4721f19..9da02d6 100644 --- a/src/global.h +++ b/src/global.h @@ -30,8 +30,16 @@ const QString RateStr("rate"); // const double DefaultParamter = 8.177; - +const double OnsetAndEndSetRate = 0.01; // +enum LanguageType{ + Chinese, + English +}; + +const QString EnglishStr("English"); +const QString ChineseStr("中文"); + enum Mode{ None, Analysis, @@ -110,6 +118,8 @@ extern bool _enthalpyCoefficientEnableFlag; extern QVector _enthalpyCoefficientVtr; // peak comprehensive ananlysis extern bool _displayTimeValue; +// +extern LanguageType _languageType; // common func QString converDoubleToStr(const double); diff --git a/src/language/cn.ts b/src/language/cn.ts new file mode 100644 index 0000000..1dc17ee --- /dev/null +++ b/src/language/cn.ts @@ -0,0 +1,1364 @@ + + + + + AboutForm + + + Form + + + + + 差示扫描量热仪Logo + + + + + + TextLabel + + + + + 关闭 + + + + + AxisSettingForm + + + Form + + + + + 坐标轴 + + + + + 最大值 + + + + + 最小值 + + + + + X + + + + + Y 左侧 + + + + + Y 右侧 + + + + + 应用 + + + + + 关闭 + + + + + CoefficientSelectionForm + + + Form + + + + + 参数 + + + + + 理论熔融热焓(J/g): + + + + + 实测熔融热焓(J/g): + + + + + 退出 + + + + + 多点系数 + + + + + 计算结果 + + + + + 仪器系数 K: + + + + + 单点系数 + + + + + 确定 + + + + + 计算 + + + + + 当前热焓文件: + + + + + 选择文件 + + + + + DegreeOfCrystallinityForm + + + Form + + + + + 计算公式: + + + + + Xc = (结晶焓 - 冷结晶焓) / 理论热焓 X 100% + + + + + 参数: + + + + + 结晶焓(J/g): + + + + + 冷结晶焓(J/g): + + + + + 理论热焓(J/g) + + + + + 计算结果: + + + + + 结晶度Xc(%) + + + + + 计算 + + + + + 退出 + + + + + DegreeOfCureForm + + + Form + + + + + 计算公式: + + + + + 固化度= + + + + + ------------------------------- + + + + + 固化前热焓 - 固化后热焓 + + + + + 固化前热焓 + + + + + X 100% + + + + + 参数: + + + + + 固化前热焓(J/g) + + + + + 固化后热焓(J/g) + + + + + 计算结果: + + + + + 固化度(%): + + + + + 计算 + + + + + 退出 + + + + + EnthalpyDataCorrectionForm + + + Form + + + + + 7 + + + + + K2SO4 + + + + + Sn + + + + + CsCl + + + + + In + + + + + 573.0 + + + + + 299.5 + + + + + 8 + + + + + 13 + + + + + 476.0 + + + + + 5 + + + + + C6H5COOH + + + + + 327.4 + + + + + 430.0 + + + + + 28.42 + + + + + 理论温度(℃) + + + + + 665.0 + + + + + 11 + + + + + 11.47 + + + + + Cu + + + + + 10 + + + + + C6H12 + + + + + 231.9 + + + + + 15 + + + + + 122.1 + + + + + 4 + + + + + 16 + + + + + 810.0 + + + + + 标样 + + + + + 1 + + + + + SiO2 + + + + + 583.0 + + + + + KC1O3 + + + + + 334.0 + + + + + 3 + + + + + -86.0 + + + + + 实测热焓(J/g) + + + + + BaCO3 + + + + + Ag + + + + + KNO3 + + + + + Zn + + + + + 961.8 + + + + + 9 + + + + + Bi + + + + + 271.4 + + + + + Hg + + + + + 1083.0 + + + + + 60.22 + + + + + 14 + + + + + 6 + + + + + 419.5 + + + + + 12 + + + + + K2CrO4 + + + + + Pb + + + + + Ag2SO4 + + + + + -38.8 + + + + + 17 + + + + + 18 + + + + + 理论热焓(J/g) + + + + + 2 + + + + + 156.6 + + + + + 107.38 + + + + + 23.16 + + + + + 保存 + + + + + 退出 + + + + + 气氛: + + + + + 速率(℃/min): + + + + + ExperimentSettingForm + + + Form + + + + + 样品参数 + + + + + 样品名称: + + + + + 样品质量: + + + + + 实验日期: + + + + + 操作员: + + + + + 实验参数 + + + + + + + + + + + NC + + + + + + + + + + + N2 + + + + + + + + + + + O2 + + + + + 2 + + + + + 4 + + + + + 初始气氛: + + + + + 3 + + + + + 截止温度 + + + + + 阶段 + + + + + 气氛 + + + + + 非OIT + + + + + 5 + + + + + OIT + + + + + 测试类型: + + + + + 1 + + + + + 恒温时间 + + + + + 6 + + + + + 扫描速率 + + + + + 下发数据 + + + + + 取消 + + + + + InstrumentCoefficientForm + + + Form + + + + + 参数 + + + + + 理论熔融热焓(J/g): + + + + + 实测熔融热焓(J/g): + + + + + 计算结果 + + + + + 仪器系数 K: + + + + + 计算 + + + + + 退出 + + + + + MainWindow + + + MainWindow + + + + + 文件 + + + + + 视图 + + + + + 测量 + + + + + 分析 + + + + + 工具 + + + + + 语言 + + + + + 帮助 + + + + + 设置 + + + + + toolBar + + + + + 新建 + + + + + 开始 + + + + + 实时数据 + + + + + 停止 + + + + + 实时窗口 + + + + + 连接设备 + + + + + 起始点 + + + + + 终止点 + + + + + 数值标记 + + + + + 峰综合分析 + + + + + + 清除数据 + + + + + 玻璃化转变 + + + + + 氧化诱导期 + + + + + 比热比较法 + + + + + 结晶度 + + + + + 仪器系数 + + + + + + 初熔点 + + + + + + 终熔点 + + + + + OIT自动分析参数 + + + + + OIT自动分析模式 + + + + + 时间轴分析峰综合温度模式 + + + + + 固化度 + + + + + 关于 + + + + + 热焓校正系数编辑 + + + + + 热焓校正系数选择 + + + + + + 保存数据 + + + + + 打印预览 + + + + + Y轴 + + + + + 坐标轴设置 + + + + + 另存为 + + + + + language + + + + + OITAutoAnalysisParamForm + + + Form + + + + + 确定 + + + + + 参数 + + + + + 系数: + + + + + 阈值: + + + + + PrintPreviewForm + + + Form + + + + + TextLabel + + + + + PrinterEditForm + + + Form + + + + + + + GroupBox + + + + + 样品名称: + + + + + 样品质量: + + + + + 实验日期: + + + + + 操作员: + + + + + + + + + + + NC + + + + + + + + + + + N2 + + + + + + + + + + + O2 + + + + + 2 + + + + + 4 + + + + + 初始气氛: + + + + + 3 + + + + + 截止温度 + + + + + 阶段 + + + + + 气氛 + + + + + 非OIT + + + + + 5 + + + + + OIT + + + + + 测试类型: + + + + + 1 + + + + + 恒温时间 + + + + + 6 + + + + + 扫描速率 + + + + + X: + + + + + Y: + + + + + 确定 + + + + + 取消 + + + + + RealTimeDataForm + + + Form + + + + + 异常信息 + + + + + 运行状态 + + + + + 当前阶段 + + + + + 恒温时间 + + + + + 样品温度/C + + + + + DSC/mw + + + + + 累计运行时间/time + + + + + 样品质量/mg + + + + + 通氧时间/min + + + + + 扫描速率 + + + + + 当前气氛 + + + + + SpecificHeatComparisonMethodForm + + + Form + + + + + 参数 + + + + + 温度(℃) + + + + + 校正系数 + + + + + 数据文件 + + + + + 相关参数 + + + + + 样品质量 + + + + + 标样质量 + + + + + 标样比热(J/(g*℃)) + + + + + 计算结果 + + + + + 样品比热(J/(g*℃)) + + + + + 计算 + + + + + 退出 + + + + diff --git a/src/language/en.ts b/src/language/en.ts new file mode 100644 index 0000000..1dc17ee --- /dev/null +++ b/src/language/en.ts @@ -0,0 +1,1364 @@ + + + + + AboutForm + + + Form + + + + + 差示扫描量热仪Logo + + + + + + TextLabel + + + + + 关闭 + + + + + AxisSettingForm + + + Form + + + + + 坐标轴 + + + + + 最大值 + + + + + 最小值 + + + + + X + + + + + Y 左侧 + + + + + Y 右侧 + + + + + 应用 + + + + + 关闭 + + + + + CoefficientSelectionForm + + + Form + + + + + 参数 + + + + + 理论熔融热焓(J/g): + + + + + 实测熔融热焓(J/g): + + + + + 退出 + + + + + 多点系数 + + + + + 计算结果 + + + + + 仪器系数 K: + + + + + 单点系数 + + + + + 确定 + + + + + 计算 + + + + + 当前热焓文件: + + + + + 选择文件 + + + + + DegreeOfCrystallinityForm + + + Form + + + + + 计算公式: + + + + + Xc = (结晶焓 - 冷结晶焓) / 理论热焓 X 100% + + + + + 参数: + + + + + 结晶焓(J/g): + + + + + 冷结晶焓(J/g): + + + + + 理论热焓(J/g) + + + + + 计算结果: + + + + + 结晶度Xc(%) + + + + + 计算 + + + + + 退出 + + + + + DegreeOfCureForm + + + Form + + + + + 计算公式: + + + + + 固化度= + + + + + ------------------------------- + + + + + 固化前热焓 - 固化后热焓 + + + + + 固化前热焓 + + + + + X 100% + + + + + 参数: + + + + + 固化前热焓(J/g) + + + + + 固化后热焓(J/g) + + + + + 计算结果: + + + + + 固化度(%): + + + + + 计算 + + + + + 退出 + + + + + EnthalpyDataCorrectionForm + + + Form + + + + + 7 + + + + + K2SO4 + + + + + Sn + + + + + CsCl + + + + + In + + + + + 573.0 + + + + + 299.5 + + + + + 8 + + + + + 13 + + + + + 476.0 + + + + + 5 + + + + + C6H5COOH + + + + + 327.4 + + + + + 430.0 + + + + + 28.42 + + + + + 理论温度(℃) + + + + + 665.0 + + + + + 11 + + + + + 11.47 + + + + + Cu + + + + + 10 + + + + + C6H12 + + + + + 231.9 + + + + + 15 + + + + + 122.1 + + + + + 4 + + + + + 16 + + + + + 810.0 + + + + + 标样 + + + + + 1 + + + + + SiO2 + + + + + 583.0 + + + + + KC1O3 + + + + + 334.0 + + + + + 3 + + + + + -86.0 + + + + + 实测热焓(J/g) + + + + + BaCO3 + + + + + Ag + + + + + KNO3 + + + + + Zn + + + + + 961.8 + + + + + 9 + + + + + Bi + + + + + 271.4 + + + + + Hg + + + + + 1083.0 + + + + + 60.22 + + + + + 14 + + + + + 6 + + + + + 419.5 + + + + + 12 + + + + + K2CrO4 + + + + + Pb + + + + + Ag2SO4 + + + + + -38.8 + + + + + 17 + + + + + 18 + + + + + 理论热焓(J/g) + + + + + 2 + + + + + 156.6 + + + + + 107.38 + + + + + 23.16 + + + + + 保存 + + + + + 退出 + + + + + 气氛: + + + + + 速率(℃/min): + + + + + ExperimentSettingForm + + + Form + + + + + 样品参数 + + + + + 样品名称: + + + + + 样品质量: + + + + + 实验日期: + + + + + 操作员: + + + + + 实验参数 + + + + + + + + + + + NC + + + + + + + + + + + N2 + + + + + + + + + + + O2 + + + + + 2 + + + + + 4 + + + + + 初始气氛: + + + + + 3 + + + + + 截止温度 + + + + + 阶段 + + + + + 气氛 + + + + + 非OIT + + + + + 5 + + + + + OIT + + + + + 测试类型: + + + + + 1 + + + + + 恒温时间 + + + + + 6 + + + + + 扫描速率 + + + + + 下发数据 + + + + + 取消 + + + + + InstrumentCoefficientForm + + + Form + + + + + 参数 + + + + + 理论熔融热焓(J/g): + + + + + 实测熔融热焓(J/g): + + + + + 计算结果 + + + + + 仪器系数 K: + + + + + 计算 + + + + + 退出 + + + + + MainWindow + + + MainWindow + + + + + 文件 + + + + + 视图 + + + + + 测量 + + + + + 分析 + + + + + 工具 + + + + + 语言 + + + + + 帮助 + + + + + 设置 + + + + + toolBar + + + + + 新建 + + + + + 开始 + + + + + 实时数据 + + + + + 停止 + + + + + 实时窗口 + + + + + 连接设备 + + + + + 起始点 + + + + + 终止点 + + + + + 数值标记 + + + + + 峰综合分析 + + + + + + 清除数据 + + + + + 玻璃化转变 + + + + + 氧化诱导期 + + + + + 比热比较法 + + + + + 结晶度 + + + + + 仪器系数 + + + + + + 初熔点 + + + + + + 终熔点 + + + + + OIT自动分析参数 + + + + + OIT自动分析模式 + + + + + 时间轴分析峰综合温度模式 + + + + + 固化度 + + + + + 关于 + + + + + 热焓校正系数编辑 + + + + + 热焓校正系数选择 + + + + + + 保存数据 + + + + + 打印预览 + + + + + Y轴 + + + + + 坐标轴设置 + + + + + 另存为 + + + + + language + + + + + OITAutoAnalysisParamForm + + + Form + + + + + 确定 + + + + + 参数 + + + + + 系数: + + + + + 阈值: + + + + + PrintPreviewForm + + + Form + + + + + TextLabel + + + + + PrinterEditForm + + + Form + + + + + + + GroupBox + + + + + 样品名称: + + + + + 样品质量: + + + + + 实验日期: + + + + + 操作员: + + + + + + + + + + + NC + + + + + + + + + + + N2 + + + + + + + + + + + O2 + + + + + 2 + + + + + 4 + + + + + 初始气氛: + + + + + 3 + + + + + 截止温度 + + + + + 阶段 + + + + + 气氛 + + + + + 非OIT + + + + + 5 + + + + + OIT + + + + + 测试类型: + + + + + 1 + + + + + 恒温时间 + + + + + 6 + + + + + 扫描速率 + + + + + X: + + + + + Y: + + + + + 确定 + + + + + 取消 + + + + + RealTimeDataForm + + + Form + + + + + 异常信息 + + + + + 运行状态 + + + + + 当前阶段 + + + + + 恒温时间 + + + + + 样品温度/C + + + + + DSC/mw + + + + + 累计运行时间/time + + + + + 样品质量/mg + + + + + 通氧时间/min + + + + + 扫描速率 + + + + + 当前气氛 + + + + + SpecificHeatComparisonMethodForm + + + Form + + + + + 参数 + + + + + 温度(℃) + + + + + 校正系数 + + + + + 数据文件 + + + + + 相关参数 + + + + + 样品质量 + + + + + 标样质量 + + + + + 标样比热(J/(g*℃)) + + + + + 计算结果 + + + + + 样品比热(J/(g*℃)) + + + + + 计算 + + + + + 退出 + + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a10a11a..440d2cb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -514,3 +514,15 @@ void MainWindow::on_actionSaveas_triggered() saveFile(Global::_experimentInfo.sampleName,Global::Mode::None); _leftWidget->reloadFileName(); } + +void MainWindow::on_actionLanguage_triggered() +{ + if(Global::_languageType == Global::LanguageType::Chinese){ + Global::_languageType = Global::LanguageType::English; + ui->actionLanguage->setText(Global::EnglishStr); + }else{ + Global::_languageType = Global::LanguageType::Chinese; + ui->actionLanguage->setText(Global::ChineseStr); + } + +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 07f1707..16fa453 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -96,6 +96,8 @@ private slots: void on_actionSaveas_triggered(); + void on_actionLanguage_triggered(); + private: void connections(); void setActionEnable(const bool); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index e960ae1..7ea5cb4 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -78,6 +78,7 @@ 语言 + @@ -335,6 +336,11 @@ 另存为 + + + language + + diff --git a/src/ui/axissettingform.cpp b/src/ui/axissettingform.cpp index 0489027..679aadc 100644 --- a/src/ui/axissettingform.cpp +++ b/src/ui/axissettingform.cpp @@ -7,8 +7,6 @@ AxisSettingForm::AxisSettingForm(QWidget *parent) : ui(new Ui::AxisSettingForm) { ui->setupUi(this); - - } AxisSettingForm::~AxisSettingForm() diff --git a/src/ui/centralwidget.cpp b/src/ui/centralwidget.cpp index 256e196..201dcf0 100644 --- a/src/ui/centralwidget.cpp +++ b/src/ui/centralwidget.cpp @@ -184,7 +184,7 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd) _currentCurve->addData(index++,cd.sample_temp, cd.dsc); - // _customPlot->rescaleAxes(); + // _customPlot->rescaleAxes(); _customPlot->replot(); // return; @@ -211,6 +211,7 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd) logde<<"_currentCurveExperimentDataPtr dataVtr size:" <dataVtr.size(); #endif + } void CentralWidget::slotRecvAnalysisFileName(const QString &filePath) @@ -232,56 +233,6 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &filePath) // uiLoadXlsxFileData(); - -#if 0 - for(int i = 0;i < cfd.phaseTotalVtr.size();i++){ - Global::PhaseTotalInfo& pti = cfd.phaseTotalVtr[i]; - - PointCalculate::setAnalysisData(pti.dataVtr); - - QPairstartEndPointPair = PointCalculate::getStartAndEndPoint(); - - QPointF endPoint = startEndPointPair.second; - _customPlot->xAxis->setRange(0, endPoint.x() / 3 * 4); - - QPair maxMinPair = PointCalculate::getMaxMinValue(); - float absY = std::abs(maxMinPair.first - maxMinPair.second); - _customPlot->yAxis->setRange(- absY * 2,absY *2); - - _customPlot->yAxis->setLabel("DSC/mW"); - _customPlot->xAxis->setLabel("Temp/℃"); - - QVector dataVtr; - QVector tVtr,xVtr, yVtr; - int index = 0; - for (Global::ExperimentData &ed : pti.dataVtr) - { - tVtr.push_back(index++); - xVtr.push_back(ed.sampleTemp); - yVtr.push_back(ed.dsc); - } - - _currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis); - _currentCurve->setData(tVtr, xVtr, yVtr); - _currentCurve->setSelectable(QCP::stWhole); // 设置曲线可选 - _currentCurve->setLineStyle(QCPCurve::lsLine); // 线性连接 - - _currentCurve->setObjectName(filePath); - - pti.curve = _currentCurve; - } - - // Add analysis operation data. - if(cfd.analysisOperationVtr.size() > 0){ - for(AnaOpRecorder::AnalysisOperation& ao - :cfd.analysisOperationVtr){ - loadAnalysisData(ao.mode,ao.x1,ao.x2,filePath); - } - } - // Refresh ui. - _customPlot->rescaleAxes(); - _customPlot->replot(); -#endif } void CentralWidget::slotAnalysisSettingApply() @@ -796,30 +747,26 @@ PointCalculate::Line CentralWidget::calculateLinearRegression(const QVector rowPointVtr = PointCalculate::getPointVtrInXRange(x1,x2); + Global::ExperimentData ed = PointCalculate::findOnSetDataByTemperature(x1,x2); - QVector pointVtr = PointCalculate::movingAveragePoint(rowPointVtr,5); - - QVector xVtr,yVtr; - for (QPointF &point : pointVtr) { - xVtr.push_back(point.x()); - yVtr.push_back(point.y()); + if(_axisMode == AxisMode::SingleY){ + return QPointF(ed.sampleTemp,ed.dsc); + }else{ + return QPointF(ed.runTime,ed.dsc); } +} - double coeff[3] = {0}; - Global::quadraticLeastSquaresFit(xVtr.data(),yVtr.data(),xVtr.size(),coeff); +QPointF CentralWidget::endSetTemperaturePointHandle(const double x1, const double x2) +{ + Global::ExperimentData ed = PointCalculate::findEndSetDataByTemperature(x1,x2); - // derivative - double a = coeff[0] * 2; - double b = coeff[1]; - - double targetX = Global::findNegativeStartPoint(a,b,pointVtr.first().x(),pointVtr.last().x()); - logde<<"traget x:"<point1->setCoords(xRight,_line2->point1->coords().y()); _line2->point2->setCoords(xRight,_line2->point2->coords().y()); #endif + lineVisiableFunc(_line1); if(AnalysisMode::NumericalLabel != _analysisMode){ lineVisiableFunc(_line2); @@ -901,8 +849,7 @@ QPointF CentralWidget::getTheCoordinatesOfTheTextBox(const QPointF point) QVector ticks = _customPlot->xAxis->tickVector(); int numTicks = ticks.size(); - logde<<"ticks:"<plottable(i); if (auto curve = dynamic_cast(plottable)) { logde<<"clear data,curve object Name:"<objectName().toStdString(); - if(curve->objectName() == ItemManager::TemporaryStr){ + if(curve->objectName().contains( ItemManager::TemporaryStr)){ _customPlot->removePlottable(curve); ItemManager::removeItem(curve); @@ -1045,7 +992,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode) for (int i = _customPlot->graphCount() - 1; i >= 0; --i) { QCPGraph *graph = _customPlot->graph(i); logde<<"clear data,graph object Name:"<objectName().toStdString(); - if(graph && graph->objectName() == ItemManager::TemporaryStr){ + if(graph && graph->objectName().contains(ItemManager::TemporaryStr)){ _customPlot->removeGraph(graph); ItemManager::removeItem(graph); @@ -1060,7 +1007,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode) QCPAbstractItem *item = _customPlot->item(i); logde<<"item data,graph object Name:"<objectName().toStdString(); if(item && !itemsToKeep.contains(item) - && item->objectName() == ItemManager::TemporaryStr){ + && item->objectName().contains(ItemManager::TemporaryStr)){ _customPlot->removeItem(item); ItemManager::removeItem(item); @@ -1324,21 +1271,21 @@ void CentralWidget::loadAnalysisData( break; } case AnalysisMode::OnsetTemperaturePoint:{ -#if 0 - QPointF point = OnsetTemperaturePointHandle(x1,x2); + QPointF point = onsetTemperaturePointHandle(x1,x2); + logde<<"onset point:"<& x, const QVector& y); - QPointF OnsetTemperaturePointHandle(const double x1,const double x2); + QPointF onsetTemperaturePointHandle(const double x1,const double x2); + QPointF endSetTemperaturePointHandle(const double x1,const double x2); void setEventHandlerEnable(const bool); QPointF getTheCoordinatesOfTheTextBox(const QPointF point);