From daef50e35a3fd0d5ca63f073b37f6cdd5e0cb092 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Tue, 22 Dec 2020 22:36:07 +0100 Subject: [PATCH] adjust to Qt 5.14.x; remove compiler warnings. --- src/musredit_qt5/mupp/PVarDialog.cpp | 8 + src/musredit_qt5/mupp/Pmupp.cpp | 19 +- src/musredit_qt5/mupp/PmuppAdmin.cpp | 19 +- src/musredit_qt5/mupp/PmuppGui.cpp | 225 ++++++++++- src/musredit_qt5/mupp/PmuppGui.h | 2 +- src/musredit_qt5/mupp/PmuppScript.cpp | 173 +++++++++ src/musredit_qt5/mupp/mupp.cpp | 48 +++ src/musredit_qt5/musrStep/PMusrStep.cpp | 4 + src/musredit_qt5/musrWiz/PAdmin.cpp | 4 + src/musredit_qt5/musrWiz/PMusrWiz.cpp | 355 +++++++++++++++++- src/musredit_qt5/musredit/PAdmin.cpp | 18 +- .../musredit/PChangeDefaultPathsDialog.cpp | 15 +- .../musredit/PDumpOutputHandler.cpp | 13 + src/musredit_qt5/musredit/PFindDialog.cpp | 4 +- src/musredit_qt5/musredit/PFindDialog.h | 2 +- .../musredit/PFitOutputHandler.cpp | 19 +- .../musredit/PGetMusrFTOptionsDialog.cpp | 8 + src/musredit_qt5/musredit/PMusrEditAbout.cpp | 2 +- src/musredit_qt5/musredit/PMusrEditAbout.h | 2 +- .../musredit/PReplaceConfirmationDialog.cpp | 2 +- .../musredit/PReplaceConfirmationDialog.h | 2 +- src/musredit_qt5/musredit/PReplaceDialog.cpp | 4 +- src/musredit_qt5/musredit/PReplaceDialog.h | 2 +- src/musredit_qt5/musredit/PTextEdit.cpp | 24 +- src/musredit_qt5/musredit/PTextEdit.h | 2 +- 25 files changed, 948 insertions(+), 28 deletions(-) diff --git a/src/musredit_qt5/mupp/PVarDialog.cpp b/src/musredit_qt5/mupp/PVarDialog.cpp index 9785a329..6c97351c 100644 --- a/src/musredit_qt5/mupp/PVarDialog.cpp +++ b/src/musredit_qt5/mupp/PVarDialog.cpp @@ -49,7 +49,11 @@ PShowVarNameDialog::PShowVarNameDialog(PCollInfo &info) // if fCollName is a path name, extract the fln QString collNameStr(info.fCollName); if (collNameStr.contains("/")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = collNameStr.split('/', QString::SkipEmptyParts); +#else + QStringList tok = collNameStr.split('/', Qt::SkipEmptyParts); +#endif collNameStr = tok[tok.count()-1]; } QLabel *collName = new QLabel(collNameStr); @@ -281,7 +285,11 @@ bool PVarDialog::basic_check() } // tokenize variable input +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList strList = varStr.split(QRegularExpression("\\s+"), QString::SkipEmptyParts); +#else + QStringList strList = varStr.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts); +#endif // check if there are ANY var definitions ok = false; diff --git a/src/musredit_qt5/mupp/Pmupp.cpp b/src/musredit_qt5/mupp/Pmupp.cpp index b5c75a51..1bffae27 100644 --- a/src/musredit_qt5/mupp/Pmupp.cpp +++ b/src/musredit_qt5/mupp/Pmupp.cpp @@ -432,7 +432,11 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS if (param_found && !line.isEmpty()) { // check if parameter or run number and title token.clear(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) token = line.split(",", QString::SkipEmptyParts); +#else + token = line.split(",", Qt::SkipEmptyParts); +#endif if (token.size()==0) { errorMsg = fln + QString(". No parameter tokens."); std::cerr << std::endl; @@ -584,7 +588,11 @@ PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool & // read header information line = in.readLine(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) token = line.split(QRegExp("\\s+"), QString::SkipEmptyParts); +#else + token = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts); +#endif QVector headerInfo; QVector headerCode; // 0=value, 1=pos/neg err, 2=pos err, 3=neg err, 4=run number @@ -612,7 +620,11 @@ PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool & continue; lineNo++; token.clear(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) token = line.split(QRegExp("\\s+"), QString::SkipEmptyParts); +#else + token = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts); +#endif // paranoia check if (token.size() != headerInfo.size()) { errorMsg = QString("size mismatch between header and parameter int line: %1 (header=%2 / param=%3)").arg(lineNo).arg(headerInfo.size()).arg(token.size()); @@ -1037,6 +1049,11 @@ void PParamDataHandler::readFromStdErr() void PParamDataHandler::processDone(int exitCode, QProcess::ExitStatus exitStatus) { qInfo() << "in processDone()"; - if ((exitStatus == QProcess::CrashExit) && (exitCode != 0)) + if ((exitStatus == QProcess::CrashExit) && (exitCode != 0)) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) qInfo() << "**ERROR** processDone: exitCode = " << exitCode << endl; +#else + qInfo() << "**ERROR** processDone: exitCode = " << exitCode << Qt::endl; +#endif + } } diff --git a/src/musredit_qt5/mupp/PmuppAdmin.cpp b/src/musredit_qt5/mupp/PmuppAdmin.cpp index 67f1f8fe..f9a44a4f 100644 --- a/src/musredit_qt5/mupp/PmuppAdmin.cpp +++ b/src/musredit_qt5/mupp/PmuppAdmin.cpp @@ -208,7 +208,11 @@ bool PmuppAdminXMLParser::characters() fAdmin->setTheme(false); break; case eMarker: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(",", QString::SkipEmptyParts); +#else + tok = str.split(",", Qt::SkipEmptyParts); +#endif if ((tok.count() != 1) && (tok.count() != 2)) { return false; @@ -227,7 +231,11 @@ bool PmuppAdminXMLParser::characters() fAdmin->setMarker(ival, dval); break; case eColor: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(",", QString::SkipEmptyParts); +#else + tok = str.split(",", Qt::SkipEmptyParts); +#endif if ((tok.count() != 3) && (tok.count() != 4)) { return false; @@ -533,8 +541,13 @@ void PmuppAdmin::saveRecentFiles() return; } fin.setDevice(&file); - for (int i=0; i PmuppGui::getValues(QString collName, QString paramName, bool &o for (int i=0; i::fromStdVector(fVarHandler[i].getValues()); +#else + QVector qvec(fVarHandler[i].getValues().begin(), fVarHandler[i].getValues().end()); + values = qvec; +#endif } } } @@ -1495,7 +1510,12 @@ QVector PmuppGui::getPosErr(QString collName, QString paramName, bool &o for (int i=0; i::fromStdVector(fVarHandler[i].getErrors()); +#else + QVector qvec(fVarHandler[i].getErrors().begin(), fVarHandler[i].getErrors().end()); + values = qvec; +#endif } } } @@ -1529,7 +1549,12 @@ QVector PmuppGui::getNegErr(QString collName, QString paramName, bool &o for (int i=0; i::fromStdVector(fVarHandler[i].getErrors()); +#else + QVector qvec(fVarHandler[i].getErrors().begin(), fVarHandler[i].getErrors().end()); + values = qvec; +#endif } } } @@ -1823,6 +1848,7 @@ void PmuppGui::createMacro() QTextStream fout(&file); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "// " << fMacroName.toLatin1().data() << endl; fout << "// " << QDateTime::currentDateTime().toString("yy/MM/dd - HH:mm:ss") << endl; fout << "// " << endl; @@ -1840,6 +1866,25 @@ void PmuppGui::createMacro() fout << " Double_t yy[512];" << endl; fout << " Double_t yyPosErr[512];" << endl; fout << " Double_t yyNegErr[512];" << endl; +#else + fout << "// " << fMacroName.toLatin1().data() << Qt::endl; + fout << "// " << QDateTime::currentDateTime().toString("yy/MM/dd - HH:mm:ss") << Qt::endl; + fout << "// " << Qt::endl; + fout << "{" << Qt::endl; + fout << " gROOT->Reset();" << Qt::endl; + fout << Qt::endl; + fout << " gStyle->SetOptTitle(0);" << Qt::endl; + fout << " gStyle->SetOptDate(0);" << Qt::endl; + fout << " gStyle->SetPadColor(TColor::GetColor(255,255,255)); // pad bkg to white" << Qt::endl; + fout << " gStyle->SetCanvasColor(TColor::GetColor(255,255,255)); // canvas bkg to white" << Qt::endl; + fout << Qt::endl; + fout << " Int_t nn=0, i=0;" << Qt::endl; + fout << " Double_t null[512];" << Qt::endl; + fout << " Double_t xx[512];" << Qt::endl; + fout << " Double_t yy[512];" << Qt::endl; + fout << " Double_t yyPosErr[512];" << Qt::endl; + fout << " Double_t yyNegErr[512];" << Qt::endl; +#endif // create all the necessary TGraph's int collTag = -1, pos; QString collName(""); @@ -1894,40 +1939,98 @@ void PmuppGui::createMacro() yLabel = substituteDefaultLabels(yLabel); getMinMax(yy, yMin, yMax); // create TGraph objects +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << endl; snprintf(gLabel, sizeof(gLabel), "g_%d_%d", i, j); fout << " nn = " << xx.size() << ";" << endl; fout << endl; fout << " // null value vector" << endl; +#else + fout << Qt::endl; + snprintf(gLabel, sizeof(gLabel), "g_%d_%d", i, j); + fout << " nn = " << xx.size() << ";" << Qt::endl; + fout << Qt::endl; + fout << " // null value vector" << Qt::endl; +#endif for (int k=0; kSetMarkerStyle(" << markerObj.getMarker() << ");" << endl; fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << endl; +#else + fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << Qt::endl; + fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << Qt::endl; +#endif } else { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetMarkerStyle(20); // bullet" << endl; fout << " " << gLabel << "->SetMarkerSize(1.5);" << endl; +#else + fout << " " << gLabel << "->SetMarkerStyle(20); // bullet" << Qt::endl; + fout << " " << gLabel << "->SetMarkerSize(1.5);" << Qt::endl; +#endif } if (idx < color.size()) { color[idx].getRGB(r, g, b); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetMarkerColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << endl; fout << " " << gLabel << "->SetLineColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << endl; +#else + fout << " " << gLabel << "->SetMarkerColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << Qt::endl; + fout << " " << gLabel << "->SetLineColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << Qt::endl; +#endif } else { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetMarkerColor(kBlue);" << endl; fout << " " << gLabel << "->SetLineColor(kBlue);" << endl; +#else + fout << " " << gLabel << "->SetMarkerColor(kBlue);" << Qt::endl; + fout << " " << gLabel << "->SetLineColor(kBlue);" << Qt::endl; +#endif } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetFillColor(kWhite);" << endl; fout << " " << gLabel << "->GetXaxis()->SetTitle(\"" << xLabel.toLatin1().data() << "\");" << endl; fout << " " << gLabel << "->GetXaxis()->SetTitleSize(0.05);" << endl; @@ -1969,28 +2093,69 @@ void PmuppGui::createMacro() fout << " " << gLabel << "->GetYaxis()->SetRangeUser(" << 0.95*yMin << ", " << 1.05*yMax << ");" << endl; fout << " " << gLabel << "->GetXaxis()->SetDecimals(kTRUE);" << endl; fout << " " << gLabel << "->Draw(\"AP\");" << endl; +#else + fout << " " << gLabel << "->SetFillColor(kWhite);" << Qt::endl; + fout << " " << gLabel << "->GetXaxis()->SetTitle(\"" << xLabel.toLatin1().data() << "\");" << Qt::endl; + fout << " " << gLabel << "->GetXaxis()->SetTitleSize(0.05);" << Qt::endl; + fout << " " << gLabel << "->GetXaxis()->SetRangeUser(" << 0.95*xMin << ", " << 1.05*xMax << ");" << Qt::endl; + fout << " " << gLabel << "->GetYaxis()->SetTitle(\"" << yLabel.toLatin1().data() << "\");" << Qt::endl; + fout << " " << gLabel << "->GetYaxis()->SetTitleSize(0.05);" << Qt::endl; + fout << " " << gLabel << "->GetYaxis()->SetTitleOffset(1.30);" << Qt::endl; + fout << " " << gLabel << "->GetYaxis()->SetRangeUser(" << 0.95*yMin << ", " << 1.05*yMax << ");" << Qt::endl; + fout << " " << gLabel << "->GetXaxis()->SetDecimals(kTRUE);" << Qt::endl; + fout << " " << gLabel << "->Draw(\"AP\");" << Qt::endl; +#endif } else { // consecutive graphs if (idx < marker.size()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << endl; fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << endl; +#else + fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << Qt::endl; + fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << Qt::endl; +#endif } else { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetMarkerStyle(" << 21+j << ");" << endl; fout << " " << gLabel << "->SetMarkerSize(1.5);" << endl; +#else + fout << " " << gLabel << "->SetMarkerStyle(" << 21+j << ");" << Qt::endl; + fout << " " << gLabel << "->SetMarkerSize(1.5);" << Qt::endl; +#endif } if (idx < color.size()) { color[idx].getRGB(r, g, b); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetMarkerColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << endl; fout << " " << gLabel << "->SetLineColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << endl; +#else + fout << " " << gLabel << "->SetMarkerColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << Qt::endl; + fout << " " << gLabel << "->SetLineColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << Qt::endl; +#endif } else { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetMarkerColor(kBlue);" << endl; fout << " " << gLabel << "->SetLineColor(kBlue);" << endl; +#else + fout << " " << gLabel << "->SetMarkerColor(kBlue);" << Qt::endl; + fout << " " << gLabel << "->SetLineColor(kBlue);" << Qt::endl; +#endif } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " " << gLabel << "->SetFillColor(kWhite);" << endl; fout << " " << gLabel << "->Draw(\"Psame\");" << endl; +#else + fout << " " << gLabel << "->SetFillColor(kWhite);" << Qt::endl; + fout << " " << gLabel << "->Draw(\"Psame\");" << Qt::endl; +#endif } } } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "}" << endl; +#else + fout << "}" << Qt::endl; +#endif // clear macro name fMacroName = QString(""); @@ -2028,17 +2193,29 @@ void PmuppGui::plot() } QTextStream fout(&file); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "% path file name: " << pathName << endl; fout << "% creation time : " << QDateTime::currentDateTime().toString("yyyy.MM.dd - hh:mm:ss") << endl; fout << "%" << endl; +#else + fout << "% path file name: " << pathName << Qt::endl; + fout << "% creation time : " << QDateTime::currentDateTime().toString("yyyy.MM.dd - hh:mm:ss") << Qt::endl; + fout << "%" << Qt::endl; +#endif for (int i=0; iitem(collTag)->text(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "% ---------" << endl; fout << "% collName = " << collName << endl; fout << "% start ---" << endl; +#else + fout << "% ---------" << Qt::endl; + fout << "% collName = " << collName << Qt::endl; + fout << "% start ---" << Qt::endl; +#endif // x-label xLabel = fXY[i].getXlabel(); @@ -2113,7 +2290,11 @@ void PmuppGui::plot() yyyNegErr.push_back(yyNegErr); yLabel = substituteDefaultLabels(yLabel); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "yLabel: " << yLabel << endl; +#else + fout << "yLabel: " << yLabel << Qt::endl; +#endif // normalize if wished if (fNormalize) { @@ -2140,10 +2321,18 @@ void PmuppGui::plot() } idx = yyy.size()-1; fout << yyy[idx][j] << ", " << yyyPosErr[idx][j] << ", " << yyyNegErr[idx][j]; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << endl; +#else + fout << Qt::endl; +#endif } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "% end -----" << endl; +#else + fout << "% end -----" << Qt::endl; +#endif // clear collection related vectors yyy.clear(); @@ -2169,7 +2358,11 @@ void PmuppGui::plot() return; } fout.setDevice(&file); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << QCoreApplication::applicationFilePath().toLatin1().data() << endl; +#else + fout << QCoreApplication::applicationFilePath().toLatin1().data() << Qt::endl; +#endif file.close(); key = ftok(QCoreApplication::applicationFilePath().toLatin1().data(), fMuppInstance); @@ -2274,7 +2467,11 @@ void PmuppGui::handleCmds() } else if (!cmd.compare("plot", Qt::CaseInsensitive)) { plot(); } else if (cmd.startsWith("macro")) { // cmd: macro +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(" ", QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(" ", Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { QMessageBox::critical(this, "ERROR", QString("wrong macro cmd: %1.\nPlease check the help.").arg(cmd)); return; @@ -2284,7 +2481,11 @@ void PmuppGui::handleCmds() } else if (cmd.startsWith("path")) { // cmd: path QMessageBox::information(0, "INFO", "set's eventually the path for the macros to be saved."); // will set the path to where to save the macro +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(" ", QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(" ", Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { QMessageBox::critical(this, "ERROR", QString("wrong path cmd: %1.\nPlease check the help.").arg(cmd)); return; @@ -2310,13 +2511,21 @@ void PmuppGui::handleCmds() } else if (cmd.startsWith("select") || cmd.startsWith("sc")) { selectCollection(cmd); } else if (cmd.startsWith("x")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(" ", QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(" ", Qt::SkipEmptyParts); +#endif if (tok.size() > 1) addX(tok[1]); else QMessageBox::critical(0, "ERROR", QString("Found command 'x' without variable.")); } else if (cmd.startsWith("y")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(" ", QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(" ", Qt::SkipEmptyParts); +#endif if (tok.size() > 1) addY(tok[1]); else @@ -2324,19 +2533,31 @@ void PmuppGui::handleCmds() } else if (cmd.startsWith("ditto")) { addDitto(); } else if (cmd.startsWith("rmx")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(" ", QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(" ", Qt::SkipEmptyParts); +#endif if (tok.size() > 1) removeX(tok[1]); else QMessageBox::critical(0, "ERROR", QString("Found command 'rmx' without variable.")); } else if (cmd.startsWith("rmy")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(" ", QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(" ", Qt::SkipEmptyParts); +#endif if (tok.size() > 1) removeY(tok[1]); else QMessageBox::critical(0, "ERROR", QString("Found command 'rmy' without variable.")); } else if (cmd.startsWith("norm")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(" ", QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(" ", Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { QMessageBox::critical(this, "**ERROR**", "found wrong norm cmd, will ignore it."); return; diff --git a/src/musredit_qt5/mupp/PmuppGui.h b/src/musredit_qt5/mupp/PmuppGui.h index b93e50a2..b778d417 100644 --- a/src/musredit_qt5/mupp/PmuppGui.h +++ b/src/musredit_qt5/mupp/PmuppGui.h @@ -132,7 +132,7 @@ class PmuppGui : public QMainWindow Q_OBJECT public: - PmuppGui(QStringList fln, QWidget *parent = 0, Qt::WindowFlags f = 0); + PmuppGui(QStringList fln); virtual ~PmuppGui(); public slots: diff --git a/src/musredit_qt5/mupp/PmuppScript.cpp b/src/musredit_qt5/mupp/PmuppScript.cpp index 5862f822..8e33de16 100644 --- a/src/musredit_qt5/mupp/PmuppScript.cpp +++ b/src/musredit_qt5/mupp/PmuppScript.cpp @@ -146,7 +146,11 @@ void PmuppScript::setLoadPath(const QString cmd) str = str.remove("loadPath "); // tokenize path string +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split("/", QString::SkipEmptyParts); +#else + tok = str.split("/", Qt::SkipEmptyParts); +#endif // check if there is a bash variable which needs to be resolved QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment(); @@ -180,7 +184,11 @@ void PmuppScript::setSavePath(const QString cmd) str = str.remove("savePath "); // tokenize path string +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split("/", QString::SkipEmptyParts); +#else + tok = str.split("/", Qt::SkipEmptyParts); +#endif // check if there is a bash variable which needs to be resolved QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment(); @@ -230,7 +238,11 @@ int PmuppScript::loadCollection(const QString str) int PmuppScript::select(const QString str) { QString cmd = str; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(' ', QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl << "**ERROR** wrong 'select' command syntax." << std::endl << std::endl; return -1; @@ -287,7 +299,11 @@ int PmuppScript::selectAll() int PmuppScript::addX(const QString str) { QString cmd = str, label; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(' ', QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl << "**ERROR** in addX: number of tokens missmatch." << std::endl << std::endl; @@ -377,7 +393,11 @@ int PmuppScript::addY(const QString str) { QString cmd = str; QVector label; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(' ', QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() < 2) { std::cerr << std::endl << "**ERROR** in addY: number of tokens < 2." << std::endl << std::endl; @@ -484,7 +504,11 @@ int PmuppScript::addY(const QString str) int PmuppScript::plot(const QString str) { QString cmd = str; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(' ', QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl << "**ERROR** in plot: number of tokens != 2." << std::endl << std::endl; return -1; @@ -542,7 +566,11 @@ int PmuppScript::macro(const QString str, const QString plotFln) QVector color = fAdmin->getColors(); QString cmd = str; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = cmd.split(' ', QString::SkipEmptyParts); +#else + QStringList tok = cmd.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl << "**ERROR** macro command with wrong number of arguments (" << tok.size() << ")." << std::endl << std::endl; return -1; @@ -559,6 +587,7 @@ int PmuppScript::macro(const QString str, const QString plotFln) QTextStream fout(&file); // write header +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "// --------------------------" << endl; fout << "// " << fln.toLatin1().constData() << endl; fout << "// " << QDateTime::currentDateTime().toString("yy/MM/dd - HH:mm:ss") << endl; @@ -578,6 +607,27 @@ int PmuppScript::macro(const QString str, const QString plotFln) fout << " Double_t yyPosErr[512];" << endl; fout << " Double_t yyNegErr[512];" << endl; fout << endl; +#else + fout << "// --------------------------" << Qt::endl; + fout << "// " << fln.toLatin1().constData() << Qt::endl; + fout << "// " << QDateTime::currentDateTime().toString("yy/MM/dd - HH:mm:ss") << Qt::endl; + fout << "// --------------------------" << Qt::endl; + fout << "{" << Qt::endl; + fout << " gROOT->Reset();" << Qt::endl; + fout << Qt::endl; + fout << " gStyle->SetOptTitle(0);" << Qt::endl; + fout << " gStyle->SetOptDate(0);" << Qt::endl; + fout << " gStyle->SetPadColor(TColor::GetColor(255,255,255)); // pad bkg to white" << Qt::endl; + fout << " gStyle->SetCanvasColor(TColor::GetColor(255,255,255)); // canvas bkg to white" << Qt::endl; + fout << Qt::endl; + fout << " Int_t nn=0, i=0;" << Qt::endl; + fout << " Double_t null[512];" << Qt::endl; + fout << " Double_t xx[512];" << Qt::endl; + fout << " Double_t yy[512];" << Qt::endl; + fout << " Double_t yyPosErr[512];" << Qt::endl; + fout << " Double_t yyNegErr[512];" << Qt::endl; + fout << Qt::endl; +#endif // write data QVector xx, yy, yyPosErr, yyNegErr; @@ -597,7 +647,12 @@ int PmuppScript::macro(const QString str, const QString plotFln) std::cerr << " This should never happens." << std::endl; return -3; } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) xx = QVector::fromStdVector(fVarHandler[idx].getValues()); +#else + QVector qvec(fVarHandler[idx].getValues().begin(), fVarHandler[idx].getValues().end()); + xx = qvec; +#endif } // get x-axis min/max minMax(xx, x_min, x_max); @@ -623,9 +678,17 @@ int PmuppScript::macro(const QString str, const QString plotFln) std::cerr << " This should never happens." << std::endl; return -3; } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) yy = QVector::fromStdVector(fVarHandler[idx].getValues()); yyPosErr = QVector::fromStdVector(fVarHandler[idx].getErrors()); yyNegErr = QVector::fromStdVector(fVarHandler[idx].getErrors()); +#else + QVector qvecV(fVarHandler[idx].getValues().begin(), fVarHandler[idx].getValues().end()); + yy = qvecV; + QVector qvecE(fVarHandler[idx].getErrors().begin(), fVarHandler[idx].getErrors().end()); + yyPosErr = qvecE; + yyNegErr = qvecE; +#endif } // get y-axis min/max minMax(yy, y_min, y_max); @@ -638,6 +701,7 @@ int PmuppScript::macro(const QString str, const QString plotFln) if (y_max > y_max_new) y_max_new = y_max; } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << " // " << ++count << ". data set" << endl; fout << " nn = " << xx.size() << ";" << endl; fout << " // null-values" << endl; @@ -675,6 +739,45 @@ int PmuppScript::macro(const QString str, const QString plotFln) fout << endl; fout << " TGraphAsymmErrors *g_" << i << "_" << j << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << endl; fout << endl; +#else + fout << " // " << ++count << ". data set" << Qt::endl; + fout << " nn = " << xx.size() << ";" << Qt::endl; + fout << " // null-values" << Qt::endl; + for (int k=0; kSaveAs(\"" << plotFln.toLatin1().constData() << "\");" << endl; } fout << "}" << endl; +#else + fout << " //**********" << Qt::endl; + fout << " // plotting " << Qt::endl; + fout << " //**********" << Qt::endl; + fout << " TCanvas *c1 = new TCanvas(\"c1\", \"" << macroName.toLatin1().constData() << "\", 10, 10, 600, 700);" << Qt::endl; + fout << Qt::endl; + + count = 0; + int rr, gg, bb; + for (int i=0; iSetMarkerStyle(" << marker[count].getMarker() << ");" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetMarkerSize(" << marker[count].getMarkerSize() << ");" << Qt::endl; + color[count].getRGB(rr, gg, bb); + fout << " g_" << i << "_" << j << "->SetMarkerColor(TColor::GetColor(" << rr << "," << gg << "," << bb << "));" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetLineColor(TColor::GetColor(" << rr << "," << gg << "," << bb << "));" << Qt::endl; + } else { + fout << " g_" << i << "_" << j << "->SetMarkerStyle(20);" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetMarkerSize(1.3);" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetMarkerColor(TColor::GetColor(0,0,0));" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetLineColor(TColor::GetColor(0,0,0));" << Qt::endl; + } + fout << " g_" << i << "_" << j << "->SetFillColor(kWhite);" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetXaxis()->SetTitle(\"" << getNicerLabel(fPlotInfo[0].xLabel).toLatin1().data() << "\");" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetXaxis()->SetTitleSize(0.05);" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetXaxis()->SetDecimals(kTRUE);" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetXaxis()->SetLimits(" << x_min << "," << x_max << ");" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetYaxis()->SetTitle(\"" << getNicerLabel(fPlotInfo[0].yLabel[0]).toLatin1().data() << "\");" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetYaxis()->SetTitleSize(0.05);" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetYaxis()->SetTitleOffset(1.30);" << Qt::endl; + fout << " g_" << i << "_" << j << "->GetYaxis()->SetRangeUser(" << y_min << "," << y_max << ");" << Qt::endl; + fout << " g_" << i << "_" << j << "->Draw(\"AP\");" << Qt::endl; + } else { + if (count < marker.size()) { + fout << " g_" << i << "_" << j << "->SetMarkerStyle(" << marker[count].getMarker() << ");" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetMarkerSize(" << marker[count].getMarkerSize() << ");" << Qt::endl; + color[count].getRGB(rr, gg, bb); + fout << " g_" << i << "_" << j << "->SetMarkerColor(TColor::GetColor(" << rr << "," << gg << "," << bb << "));" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetLineColor(TColor::GetColor(" << rr << "," << gg << "," << bb << "));" << Qt::endl; + } else { + fout << " g_" << i << "_" << j << "->SetMarkerStyle(20);" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetMarkerSize(1.3);" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetMarkerColor(TColor::GetColor(0,0,0));" << Qt::endl; + fout << " g_" << i << "_" << j << "->SetLineColor(TColor::GetColor(0,0,0));" << Qt::endl; + } + fout << " g_" << i << "_" << j << "->SetFillColor(kWhite);" << Qt::endl; + fout << " g_" << i << "_" << j << "->Draw(\"Psame\");" << Qt::endl; + } + count++; + } + } + fout << " c1->SetMargin(0.15, 0.05, 0.12, 0.05);" << Qt::endl; + fout << " c1->Update();" << Qt::endl; + if (!plotFln.isEmpty()) { + fout << Qt::endl; + fout << " c1->SaveAs(\"" << plotFln.toLatin1().constData() << "\");" << Qt::endl; + } + fout << "}" << Qt::endl; +#endif return 0; } @@ -771,7 +936,11 @@ int PmuppScript::var_cmd(const QString str) int idx=0; // get linked collection index for further use +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok[1].endsWith("Err")) // error variable no need to do something return 0; idx = getCollectionIndex(tok[1]); @@ -962,7 +1131,11 @@ int PmuppScript::getCollectionIndex(const QString var_name) cmd = fScript.at(i); if (cmd.startsWith("col")) { tok.clear(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = cmd.split(' ', QString::SkipEmptyParts); +#else + tok = cmd.split(' ', Qt::SkipEmptyParts); +#endif if (tok[3] == var_name) { idx = tok[1].toInt(&ok); if (!ok) { diff --git a/src/musredit_qt5/mupp/mupp.cpp b/src/musredit_qt5/mupp/mupp.cpp index ea6a8311..881dc62b 100644 --- a/src/musredit_qt5/mupp/mupp.cpp +++ b/src/musredit_qt5/mupp/mupp.cpp @@ -191,7 +191,11 @@ int mupp_script_syntax_check(QStringList &list) tok.clear(); str = list.at(i); if (str.startsWith("loadPath")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() < 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -216,7 +220,11 @@ int mupp_script_syntax_check(QStringList &list) } } } else if (str.startsWith("load")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() < 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -226,7 +234,11 @@ int mupp_script_syntax_check(QStringList &list) } noOfCollections++; } else if (str.startsWith("x")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -235,7 +247,11 @@ int mupp_script_syntax_check(QStringList &list) return -1; } } else if (str.startsWith("y")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() < 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -244,7 +260,11 @@ int mupp_script_syntax_check(QStringList &list) return -1; } } else if (str.startsWith("select ")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -261,7 +281,11 @@ int mupp_script_syntax_check(QStringList &list) return -1; } } else if (str.startsWith("savePath")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -270,7 +294,11 @@ int mupp_script_syntax_check(QStringList &list) return -1; } } else if (str.startsWith("plot")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -280,7 +308,11 @@ int mupp_script_syntax_check(QStringList &list) } // check extension tok.clear(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split('.', QString::SkipEmptyParts); +#else + tok = str.split('.', Qt::SkipEmptyParts); +#endif QString ext = tok.at(tok.size()-1); ext = ext.toLower(); if ((ext != "pdf") && (ext != "jpg") && (ext != "png") && (ext != "svg") && (ext != "gif")) { @@ -292,7 +324,11 @@ int mupp_script_syntax_check(QStringList &list) return -2; } } else if (str.startsWith("macro")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -302,7 +338,11 @@ int mupp_script_syntax_check(QStringList &list) } // check extension tok.clear(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split('.', QString::SkipEmptyParts); +#else + tok = str.split('.', Qt::SkipEmptyParts); +#endif QString ext = tok.at(tok.size()-1); ext = ext.toLower(); if (ext != "c") { @@ -317,7 +357,11 @@ int mupp_script_syntax_check(QStringList &list) // nothing-to-be-done } else if (str.startsWith("var")) { tok.clear(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() < 2) { std::cerr << std::endl; std::cerr << "****************" << std::endl; @@ -332,7 +376,11 @@ int mupp_script_syntax_check(QStringList &list) // the parsing etc is dealt within the scripting class } else if (str.startsWith("col")) { tok.clear(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) tok = str.split(' ', QString::SkipEmptyParts); +#else + tok = str.split(' ', Qt::SkipEmptyParts); +#endif if (tok.size() != 4) { std::cerr << std::endl; std::cerr << "****************" << std::endl; diff --git a/src/musredit_qt5/musrStep/PMusrStep.cpp b/src/musredit_qt5/musrStep/PMusrStep.cpp index 035e290d..98a0a732 100644 --- a/src/musredit_qt5/musrStep/PMusrStep.cpp +++ b/src/musredit_qt5/musrStep/PMusrStep.cpp @@ -478,7 +478,11 @@ int PMusrStep::readMsrFile() } if (parameter) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) strL = str.split(" ", QString::SkipEmptyParts); +#else + strL = str.split(" ", Qt::SkipEmptyParts); +#endif if ((strL.size() != 5) && (strL.size() != 7)) { fin.close(); return -2; diff --git a/src/musredit_qt5/musrWiz/PAdmin.cpp b/src/musredit_qt5/musrWiz/PAdmin.cpp index 319c33b6..2eadcf93 100644 --- a/src/musredit_qt5/musrWiz/PAdmin.cpp +++ b/src/musredit_qt5/musrWiz/PAdmin.cpp @@ -660,7 +660,11 @@ bool PInstrumentDefXMLParser::characters() fSetup->setLgb(ival); break; case eBkgRange: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) strList = str.split(' ', QString::SkipEmptyParts); +#else + strList = str.split(' ', Qt::SkipEmptyParts); +#endif if (strList.size() != 2) { errMsg = QString("Found wrong Asymmetry background range: '%1'").arg(str); QMessageBox::critical(0, "ERROR", errMsg); diff --git a/src/musredit_qt5/musrWiz/PMusrWiz.cpp b/src/musredit_qt5/musrWiz/PMusrWiz.cpp index eac12767..d520d559 100644 --- a/src/musredit_qt5/musrWiz/PMusrWiz.cpp +++ b/src/musredit_qt5/musrWiz/PMusrWiz.cpp @@ -920,7 +920,11 @@ void PTheoPage::checkTheory() return; } } else { // assume musrfit functions here +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList strList = line[i].split(" ", QString::SkipEmptyParts); +#else + QStringList strList = line[i].split(" ", Qt::SkipEmptyParts); +#endif func = fAdmin->getMusrfitFunc(strList[0]); if (func.getName() == "UnDef") { // function not found QString str = QString("**ERROR** in line %1, '%2' is not a recognized musrfit function.").arg(i+1).arg(line[i]); @@ -998,7 +1002,11 @@ QString PTheoPage::getTheoryFunction(int idx) */ bool PTheoPage::analyzeTokens(QString str, int noOfTokens) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = str.trimmed().split(" ", QString::SkipEmptyParts); +#else + QStringList tok = str.trimmed().split(" ", Qt::SkipEmptyParts); +#endif bool ok; // check if line is of the form 'funX' or 'mapX' @@ -2070,6 +2078,7 @@ int PMusrWiz::writeMsrFileSingleHisto() QString line = QString("###############################################################"); // write title +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << fMsrData->getMsrFileName() << endl; fout << line << endl; @@ -2095,6 +2104,33 @@ int PMusrWiz::writeMsrFileSingleHisto() fout << qSetFieldWidth(0); fout << endl; } +#else + fout << fMsrData->getMsrFileName() << Qt::endl; + fout << line << Qt::endl; + + // write parameter block + fout << "FITPARAMETER" << Qt::endl; + fout << "# Nr. Name Value Step Pos_Error Boundaries" << Qt::endl; + PParam param; + // global fit parameters + for (int i=0; igetNoOfParam(); i++) { + param = fMsrData->getParam(i); + fout << qSetFieldWidth(9); + fout << Qt::right << param.getNumber(); + fout << qSetFieldWidth(0) << " "; + fout << qSetFieldWidth(11); + fout << Qt::left << param.getName(); + fout << Qt::left << param.getValue(); + fout << Qt::left << param.getStep(); + fout << Qt::left << param.getPosErr(); + if (!param.getBoundLow().isEmpty()) + fout << Qt::left << param.getBoundLow(); + if (!param.getBoundHigh().isEmpty()) + fout << Qt::left << param.getBoundHigh(); + fout << qSetFieldWidth(0); + fout << Qt::endl; + } +#endif // detector specific fit parameters QString str; @@ -2135,9 +2171,14 @@ int PMusrWiz::writeMsrFileSingleHisto() detector = setup->getDetector(i); detectorName = detector->getName(); // name comment +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "# " << detectorName << endl; +#else + fout << "# " << detectorName << Qt::endl; +#endif // first all maps +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) for (int j=0; jgetNoOfMap(); j++) { map = fMsrData->getMap(j); fout << qSetFieldWidth(9); @@ -2166,57 +2207,139 @@ int PMusrWiz::writeMsrFileSingleHisto() } fout << qSetFieldWidth(0); fout << endl; +#else + for (int j=0; jgetNoOfMap(); j++) { + map = fMsrData->getMap(j); + fout << qSetFieldWidth(9); + fout << Qt::right << fMsrData->getNoOfParam() + 1 + j + (fMsrData->getNoOfMap()+2)*i; + fout << qSetFieldWidth(0) << " "; + fout << qSetFieldWidth(11); + str = map.getName() + QString("_%1").arg(detectorName); + fout << Qt::left << str; + if (map.getName().startsWith("ph", Qt::CaseInsensitive) || + map.getName().startsWith("relph", Qt::CaseInsensitive)) { + fout << Qt::left << detector->getRelGeomPhase(); + // if RelPh is found, the first will be fixed to 0 + if (map.getName().startsWith("relph", Qt::CaseInsensitive) && (i==0)) + fout << Qt::left << 0.0; + else + fout << Qt::left << 12.3; + fout << Qt::left << "none"; + } else { + fout << Qt::left << map.getValue(); + fout << Qt::left << map.getStep(); + fout << Qt::left << map.getPosErr(); + if (map.getBoundLow() != "") + fout << Qt::left << map.getBoundLow(); + if (map.getBoundHigh() != "") + fout << Qt::left << map.getBoundHigh(); + } + fout << qSetFieldWidth(0); + fout << Qt::endl; +#endif } // write N0 and N_bkg fout << qSetFieldWidth(9); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << right << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 1 + (fMsrData->getNoOfMap()+2)*i; +#else + fout << Qt::right << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 1 + (fMsrData->getNoOfMap()+2)*i; +#endif fout << qSetFieldWidth(0) << " "; fout << qSetFieldWidth(11); str = QString("N0_%1").arg(detectorName); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << left << str; fout << left << "123.4"; fout << left << "1.0"; fout << left << "none"; fout << qSetFieldWidth(0); fout << endl; +#else + fout << Qt::left << str; + fout << Qt::left << "123.4"; + fout << Qt::left << "1.0"; + fout << Qt::left << "none"; + fout << qSetFieldWidth(0); + fout << Qt::endl; +#endif fout << qSetFieldWidth(9); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << right << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 2 + (fMsrData->getNoOfMap()+2)*i; +#else + fout << Qt::right << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 2 + (fMsrData->getNoOfMap()+2)*i; +#endif fout << qSetFieldWidth(0) << " "; fout << qSetFieldWidth(11); str = QString("N_bkg_%1").arg(detectorName); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << left << str; fout << left << "1.234"; fout << left << "0.1"; fout << left << "none"; fout << qSetFieldWidth(0); fout << endl; +#else + fout << Qt::left << str; + fout << Qt::left << "1.234"; + fout << Qt::left << "0.1"; + fout << Qt::left << "none"; + fout << qSetFieldWidth(0); + fout << Qt::endl; +#endif } fout.setFieldWidth(0); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << endl << line << endl; +#else + fout << Qt::endl << line << Qt::endl; +#endif // write theory block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "THEORY" << endl; fout << fMsrData->getTheory() << endl; fout << endl << line << endl; +#else + fout << "THEORY" << Qt::endl; + fout << fMsrData->getTheory() << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write functions block if (fMsrData->getNoOfFunc() > 0) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "FUNCTIONS" << endl; for (int i=0; igetNoOfFunc(); i++) { fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << endl; } fout << endl << line << endl; +#else + fout << "FUNCTIONS" << Qt::endl; + for (int i=0; igetNoOfFunc(); i++) { + fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << Qt::endl; + } + fout << Qt::endl << line << Qt::endl; +#endif } // write global block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "GLOBAL" << endl; fout << "fittype " << fMsrData->getFitType()-1 << endl; fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << endl; fout << "packing " << fMsrData->getPacking() << endl; fout << endl << line << endl; +#else + fout << "GLOBAL" << Qt::endl; + fout << "fittype " << fMsrData->getFitType()-1 << Qt::endl; + fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << Qt::endl; + fout << "packing " << fMsrData->getPacking() << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write run block(s) int t0 = 0; @@ -2229,15 +2352,26 @@ int PMusrWiz::writeMsrFileSingleHisto() for (int i=0; igetDetector(i); detectorNo = detector->getForwards(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "RUN " << runName << endl; +#else + fout << "RUN " << runName << Qt::endl; +#endif fout << "map "; fout << qSetFieldWidth(10); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) for (int j=0; jgetNoOfMap(); j++) fout << left << fMsrData->getNoOfParam()+ 1 + (fMsrData->getNoOfMap()+2)*i + j; fout << qSetFieldWidth(0) << endl; +#else + for (int j=0; jgetNoOfMap(); j++) + fout << Qt::left << fMsrData->getNoOfParam()+ 1 + (fMsrData->getNoOfMap()+2)*i + j; + fout << qSetFieldWidth(0) << Qt::endl; +#endif fout << "forward "; for (int j=0; jgetNoOfParam() + fMsrData->getNoOfMap() + 1 + (fMsrData->getNoOfMap()+2)*i << endl; fout << "backgr.fit " << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 2 + (fMsrData->getNoOfMap()+2)*i << endl; @@ -2252,32 +2386,77 @@ int PMusrWiz::writeMsrFileSingleHisto() fout << "#-----------------------------------------------" << endl; else fout << endl << line << endl; +#else + fout << detectorNo[detectorNo.size()-1] << Qt::endl; + fout << "norm " << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 1 + (fMsrData->getNoOfMap()+2)*i << Qt::endl; + fout << "backgr.fit " << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 2 + (fMsrData->getNoOfMap()+2)*i << Qt::endl; + if (fMsrData->getT0Tag() == T0_ENTER_WIZ) { + fout << "data " << t0+fgbOffset << " " << lgb << Qt::endl; + fout << "t0 " << t0 << Qt::endl; + } else if (fMsrData->getT0Tag() == T0_FROM_MUSR_T0) { + fout << "data 120 " << lgb << Qt::endl; + fout << "t0 100 " << Qt::endl; + } + if (igetCmd() << endl; fout << endl << line << endl; +#else + fout << "COMMANDS" << Qt::endl; + fout << fMsrData->getCmd() << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write plot block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "PLOT " << fMsrData->getFitType()-1 << endl; fout << "lifetimecorrection" << endl; fout << "runs 1-" << setup->getNoOfLogicalDetectors() << endl; fout << "range 0.0 " << fMsrData->getFitEnd() << endl; fout << "view_packing " << fMsrData->getPacking() << endl; fout << endl << line << endl; +#else + fout << "PLOT " << fMsrData->getFitType()-1 << Qt::endl; + fout << "lifetimecorrection" << Qt::endl; + fout << "runs 1-" << setup->getNoOfLogicalDetectors() << Qt::endl; + fout << "range 0.0 " << fMsrData->getFitEnd() << Qt::endl; + fout << "view_packing " << fMsrData->getPacking() << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write fourier block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "FOURIER" << endl; fout << "units MHz" << endl; fout << "fourier_power 12" << endl; fout << "apodization NONE" << endl; fout << "plot POWER" << endl; fout << endl << line << endl; +#else + fout << "FOURIER" << Qt::endl; + fout << "units MHz" << Qt::endl; + fout << "fourier_power 12" << Qt::endl; + fout << "apodization NONE" << Qt::endl; + fout << "plot POWER" << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write statistic block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "STATISTIC --- " << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss") << endl; fout << "*** FIT DID NOT CONVERGE ***" << endl; +#else + fout << "STATISTIC --- " << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss") << Qt::endl; + fout << "*** FIT DID NOT CONVERGE ***" << Qt::endl; +#endif fln.close(); @@ -2303,20 +2482,35 @@ int PMusrWiz::writeMsrFileAsymmetry() QString line = QString("###############################################################"); // write title +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << fMsrData->getMsrFileName() << endl; fout << line << endl; +#else + fout << fMsrData->getMsrFileName() << Qt::endl; + fout << line << Qt::endl; +#endif // write parameter block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "FITPARAMETER" << endl; fout << "# Nr. Name Value Step Pos_Error Boundaries" << endl; +#else + fout << "FITPARAMETER" << Qt::endl; + fout << "# Nr. Name Value Step Pos_Error Boundaries" << Qt::endl; +#endif PParam param; // global fit parameters for (int i=0; igetNoOfParam(); i++) { param = fMsrData->getParam(i); fout << qSetFieldWidth(9); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << right << param.getNumber(); +#else + fout << Qt::right << param.getNumber(); +#endif fout << qSetFieldWidth(0) << " "; fout << qSetFieldWidth(11); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << left << param.getName(); fout << left << param.getValue(); fout << left << param.getStep(); @@ -2327,6 +2521,18 @@ int PMusrWiz::writeMsrFileAsymmetry() fout << left << param.getBoundHigh(); fout << qSetFieldWidth(0); fout << endl; +#else + fout << Qt::left << param.getName(); + fout << Qt::left << param.getValue(); + fout << Qt::left << param.getStep(); + fout << Qt::left << param.getPosErr(); + if (!param.getBoundLow().isEmpty()) + fout << Qt::left << param.getBoundLow(); + if (!param.getBoundHigh().isEmpty()) + fout << Qt::left << param.getBoundHigh(); + fout << qSetFieldWidth(0); + fout << Qt::endl; +#endif } // detector specific fit parameters @@ -2368,31 +2574,53 @@ int PMusrWiz::writeMsrFileAsymmetry() detector = setup->getAsymDetector(i); detectorName = detector->getName(); // name comment +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "# " << detectorName << endl; +#else + fout << "# " << detectorName << Qt::endl; +#endif // first all maps // write Alpha (mandatory) fout << qSetFieldWidth(9); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << right << fMsrData->getNoOfParam() + 1 + (fMsrData->getNoOfMap()+1)*i; +#else + fout << Qt::right << fMsrData->getNoOfParam() + 1 + (fMsrData->getNoOfMap()+1)*i; +#endif fout << qSetFieldWidth(0) << " "; fout << qSetFieldWidth(11); str = QString("Alpha_%1").arg(detectorName); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << left << str; fout << left << detector->getAlpha(); fout << left << "0.01"; fout << left << "none"; fout << qSetFieldWidth(0); fout << endl; +#else + fout << Qt::left << str; + fout << Qt::left << detector->getAlpha(); + fout << Qt::left << "0.01"; + fout << Qt::left << "none"; + fout << qSetFieldWidth(0); + fout << Qt::endl; +#endif // write user defined maps for (int j=0; jgetNoOfMap(); j++) { map = fMsrData->getMap(j); fout << qSetFieldWidth(9); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << right << fMsrData->getNoOfParam() + 2 + j + (fMsrData->getNoOfMap()+1)*i; +#else + fout << Qt::right << fMsrData->getNoOfParam() + 2 + j + (fMsrData->getNoOfMap()+1)*i; +#endif fout << qSetFieldWidth(0) << " "; fout << qSetFieldWidth(11); str = map.getName() + QString("_%1").arg(detectorName); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << left << str; if (map.getName().startsWith("ph", Qt::CaseInsensitive) || map.getName().startsWith("relph", Qt::CaseInsensitive)) { @@ -2413,32 +2641,84 @@ int PMusrWiz::writeMsrFileAsymmetry() } fout << qSetFieldWidth(0); fout << endl; +#else + fout << Qt::left << str; + if (map.getName().startsWith("ph", Qt::CaseInsensitive) || + map.getName().startsWith("relph", Qt::CaseInsensitive)) { + fout << Qt::left << detector->getRelGeomPhase(); + if (map.getName().startsWith("relph", Qt::CaseInsensitive) && (i==0)) + fout << Qt::left << 0.0; + else + fout << Qt::left << 12.3; + fout << Qt::left << "none"; + } else { + fout << Qt::left << map.getValue(); + fout << Qt::left << map.getStep(); + fout << Qt::left << map.getPosErr(); + if (map.getBoundLow() != "") + fout << Qt::left << map.getBoundLow(); + if (map.getBoundHigh() != "") + fout << Qt::left << map.getBoundHigh(); + } + fout << qSetFieldWidth(0); + fout << Qt::endl; +#endif } } fout.setFieldWidth(0); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << endl << line << endl; +#else + fout << Qt::endl << line << Qt::endl; +#endif // write theory block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "THEORY" << endl; fout << fMsrData->getTheory(); fout << endl << line << endl; +#else + fout << "THEORY" << Qt::endl; + fout << fMsrData->getTheory(); + fout << Qt::endl << line << Qt::endl; +#endif // write functions block if (fMsrData->getNoOfFunc() > 0) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "FUNCTIONS" << endl; +#else + fout << "FUNCTIONS" << Qt::endl; +#endif for (int i=0; igetNoOfFunc(); i++) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << endl; +#else + fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << Qt::endl; +#endif } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << endl << line << endl; +#else + fout << Qt::endl << line << Qt::endl; +#endif } // write global block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "GLOBAL" << endl; fout << "fittype " << fMsrData->getFitType()-1 << endl; fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << endl; fout << "packing " << fMsrData->getPacking() << endl; fout << endl << line << endl; +#else + fout << "GLOBAL" << Qt::endl; + fout << "fittype " << fMsrData->getFitType()-1 << Qt::endl; + fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << Qt::endl; + fout << "packing " << fMsrData->getPacking() << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write run block(s) int t0 = 0; @@ -2452,11 +2732,17 @@ int PMusrWiz::writeMsrFileAsymmetry() detector = setup->getAsymDetector(i); detectorNoF = detector->getForwards(); detectorNoB = detector->getBackwards(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "RUN " << runName << endl; fout << "alpha " << fMsrData->getNoOfParam() + 1 + (fMsrData->getNoOfMap()+1)*i << endl; +#else + fout << "RUN " << runName << Qt::endl; + fout << "alpha " << fMsrData->getNoOfParam() + 1 + (fMsrData->getNoOfMap()+1)*i << Qt::endl; +#endif fout << "map "; fout << qSetFieldWidth(10); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) if (fMsrData->getNoOfMap() == 0) { fout << left << "0 0 0 0 0 0 0 0 0 0"; } else { @@ -2464,34 +2750,76 @@ int PMusrWiz::writeMsrFileAsymmetry() fout << left << fMsrData->getNoOfParam() + 2 + (fMsrData->getNoOfMap()+1)*i + j; } fout << qSetFieldWidth(0) << endl; +#else + if (fMsrData->getNoOfMap() == 0) { + fout << Qt::left << "0 0 0 0 0 0 0 0 0 0"; + } else { + for (int j=0; jgetNoOfMap(); j++) + fout << Qt::left << fMsrData->getNoOfParam() + 2 + (fMsrData->getNoOfMap()+1)*i + j; + } + fout << qSetFieldWidth(0) << Qt::endl; +#endif fout << "forward "; for (int j=0; jgetBkgStartBin() << " " << setup->getBkgEndBin() << " " << setup->getBkgStartBin() << " " << setup->getBkgEndBin() << endl; +#else + fout << detectorNoB[detectorNoB.size()-1] << Qt::endl; + fout << "background " << setup->getBkgStartBin() << " " << setup->getBkgEndBin() << " " << setup->getBkgStartBin() << " " << setup->getBkgEndBin() << Qt::endl; +#endif if (fMsrData->getT0Tag() == T0_ENTER_WIZ) { - fout << "data " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << endl;; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + fout << "data " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << endl; fout << "t0 " << t0 << " " << t0 << endl; +#else + fout << "data " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << " " << t0+fgbOffset << " " << lgb << Qt::endl; + fout << "t0 " << t0 << " " << t0 << Qt::endl; +#endif } else if (fMsrData->getT0Tag() == T0_FROM_MUSR_T0) { // musrt0 shall be called +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "data 120 " << lgb << " 120 " << lgb << endl; fout << "t0 100 100" << endl; +#else + fout << "data 120 " << lgb << " 120 " << lgb << Qt::endl; + fout << "t0 100 100" << Qt::endl; +#endif } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) if (igetCmd() << endl; fout << endl << line << endl; +#else + fout << "COMMANDS" << Qt::endl; + fout << fMsrData->getCmd() << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write plot block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "PLOT " << fMsrData->getFitType()-1 << endl; fout << "lifetimecorrection" << endl; if (setup->getNoOfLogicalAsymDetectors() > 1) @@ -2501,18 +2829,43 @@ int PMusrWiz::writeMsrFileAsymmetry() fout << "range 0.0 " << fMsrData->getFitEnd() << endl; fout << "view_packing " << fMsrData->getPacking() << endl; fout << endl << line << endl; +#else + fout << "PLOT " << fMsrData->getFitType()-1 << Qt::endl; + fout << "lifetimecorrection" << Qt::endl; + if (setup->getNoOfLogicalAsymDetectors() > 1) + fout << "runs 1-" << setup->getNoOfLogicalAsymDetectors() << Qt::endl; + else + fout << "runs 1" << Qt::endl; + fout << "range 0.0 " << fMsrData->getFitEnd() << Qt::endl; + fout << "view_packing " << fMsrData->getPacking() << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write fourier block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "FOURIER" << endl; fout << "units MHz" << endl; fout << "fourier_power 12" << endl; fout << "apodization NONE" << endl; fout << "plot POWER" << endl; fout << endl << line << endl; +#else + fout << "FOURIER" << Qt::endl; + fout << "units MHz" << Qt::endl; + fout << "fourier_power 12" << Qt::endl; + fout << "apodization NONE" << Qt::endl; + fout << "plot POWER" << Qt::endl; + fout << Qt::endl << line << Qt::endl; +#endif // write statistic block +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) fout << "STATISTIC --- " << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss") << endl; fout << "*** FIT DID NOT CONVERGE ***" << endl; +#else + fout << "STATISTIC --- " << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss") << Qt::endl; + fout << "*** FIT DID NOT CONVERGE ***" << Qt::endl; +#endif fln.close(); diff --git a/src/musredit_qt5/musredit/PAdmin.cpp b/src/musredit_qt5/musredit/PAdmin.cpp index 150528f8..b84fe768 100644 --- a/src/musredit_qt5/musredit/PAdmin.cpp +++ b/src/musredit_qt5/musredit/PAdmin.cpp @@ -1017,8 +1017,13 @@ int PAdmin::savePrefs(QString pref_fln) return 0; } fin.setDevice(&file); - for (int i=0; i")) { // if not data_path was present, add the new data_paths just before the end of the musrfit_start.xml close tag if ((dataPathPresent == false) && (str.trimmed().startsWith(""))) { - for (int j=0; jcount(); j++) + for (int j=0; jcount(); j++) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) out << " " << fSearchPath_listWidget->item(j)->text() << "" << endl; +#else + out << " " << fSearchPath_listWidget->item(j)->text() << "" << Qt::endl; +#endif + } } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) out << fileContent[i] << endl; +#else + out << fileContent[i] << Qt::endl; +#endif } else { if (first) { first = false; for (int j=0; jcount(); j++) +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) out << " " << fSearchPath_listWidget->item(j)->text() << "" << endl; +#else + out << " " << fSearchPath_listWidget->item(j)->text() << "" << Qt::endl; +#endif } } } diff --git a/src/musredit_qt5/musredit/PDumpOutputHandler.cpp b/src/musredit_qt5/musredit/PDumpOutputHandler.cpp index 2bddcea2..ff5f3aef 100644 --- a/src/musredit_qt5/musredit/PDumpOutputHandler.cpp +++ b/src/musredit_qt5/musredit/PDumpOutputHandler.cpp @@ -85,7 +85,12 @@ PDumpOutputHandler::PDumpOutputHandler(QVector &cmd) tr("Quit") ); done(0); } + +#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0)) fProcPID = fProc->pid(); +#else + fProcPID = fProc->processId(); +#endif } //---------------------------------------------------------------------------------------------------- @@ -97,7 +102,11 @@ PDumpOutputHandler::~PDumpOutputHandler() if (fProc->state() == QProcess::Running) { fProc->terminate(); if (!fProc->waitForFinished()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) qDebug() << "fProc still running, will call kill." << endl; +#else + qDebug() << "fProc still running, will call kill." << Qt::endl; +#endif fProc->kill(); } fProc->waitForFinished(); @@ -105,7 +114,11 @@ PDumpOutputHandler::~PDumpOutputHandler() if (fProc->state() == QProcess::Running) { QString cmd = "kill -9 "+ QString("%1").arg(fProcPID); QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) qDebug() << msg << endl; +#else + qDebug() << msg << Qt::endl; +#endif system(cmd.toLatin1()); } if (fProc) { diff --git a/src/musredit_qt5/musredit/PFindDialog.cpp b/src/musredit_qt5/musredit/PFindDialog.cpp index d8101ee6..d512d40c 100644 --- a/src/musredit_qt5/musredit/PFindDialog.cpp +++ b/src/musredit_qt5/musredit/PFindDialog.cpp @@ -44,8 +44,8 @@ * \param parent pointer to the parent object * \param f qt specific window flags */ -PFindDialog::PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) : - QDialog(parent, f), fData(data) +PFindDialog::PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent) : + QDialog(parent), fData(data) { setupUi(this); diff --git a/src/musredit_qt5/musredit/PFindDialog.h b/src/musredit_qt5/musredit/PFindDialog.h index b3348183..55ed89a7 100644 --- a/src/musredit_qt5/musredit/PFindDialog.h +++ b/src/musredit_qt5/musredit/PFindDialog.h @@ -42,7 +42,7 @@ class PFindDialog : public QDialog, private Ui::PFindDialog Q_OBJECT public: - PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent = 0, Qt::WindowFlags f = 0); + PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent = nullptr); virtual ~PFindDialog() {} virtual PFindReplaceData *getData(); diff --git a/src/musredit_qt5/musredit/PFitOutputHandler.cpp b/src/musredit_qt5/musredit/PFitOutputHandler.cpp index 63953bf1..afd50528 100644 --- a/src/musredit_qt5/musredit/PFitOutputHandler.cpp +++ b/src/musredit_qt5/musredit/PFitOutputHandler.cpp @@ -89,7 +89,11 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector tr("Quit") ); done(0); } +#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0)) fProcPID = fProc->pid(); +#else + fProcPID = fProc->processId(); +#endif } //---------------------------------------------------------------------------------------------------- @@ -101,7 +105,11 @@ PFitOutputHandler::~PFitOutputHandler() if (fProc->state() == QProcess::Running) { fProc->terminate(); if (!fProc->waitForFinished()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) qDebug() << "fProc still running, will call kill." << endl; +#else + qDebug() << "fProc still running, will call kill." << Qt::endl; +#endif fProc->kill(); } fProc->waitForFinished(); @@ -109,7 +117,11 @@ PFitOutputHandler::~PFitOutputHandler() if (fProc->state() == QProcess::Running) { QString cmd = "kill -9 "+ QString("%1").arg(fProcPID); QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) qDebug() << msg << endl; +#else + qDebug() << msg << Qt::endl; +#endif system(cmd.toLatin1()); } if (fProc) { @@ -149,8 +161,13 @@ void PFitOutputHandler::readFromStdErr() */ void PFitOutputHandler::processDone(int exitCode, QProcess::ExitStatus exitStatus) { - if ((exitStatus == QProcess::CrashExit) && (exitCode != 0)) + if ((exitStatus == QProcess::CrashExit) && (exitCode != 0)) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) qDebug() << "**ERROR** PFitOutputHandler::processDone: exitCode = " << exitCode << endl; +#else + qDebug() << "**ERROR** PFitOutputHandler::processDone: exitCode = " << exitCode << Qt::endl; +#endif + } fQuitButton->setText("Done"); } diff --git a/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp b/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp index 3acf1306..2d275c01 100644 --- a/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp +++ b/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp @@ -331,7 +331,11 @@ QStringList PGetMusrFTOptionsDialog::getMusrFTOptions() // histo list if (fHistoList_lineEdit->text().length() > 0) { cmd << "--histo"; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) strList = fHistoList_lineEdit->text().split(" ", QString::SkipEmptyParts); +#else + strList = fHistoList_lineEdit->text().split(" ", Qt::SkipEmptyParts); +#endif for (int i=0; itext().length() > 0) { cmd << "--t0"; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) strList = fT0_lineEdit->text().split(" ", QString::SkipEmptyParts); +#else + strList = fT0_lineEdit->text().split(" ", Qt::SkipEmptyParts); +#endif for (int i=0; iHandles the musredit about popup. */ -PMusrEditAbout::PMusrEditAbout(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) +PMusrEditAbout::PMusrEditAbout(QWidget *parent) : QDialog(parent) { setupUi(this); diff --git a/src/musredit_qt5/musredit/PMusrEditAbout.h b/src/musredit_qt5/musredit/PMusrEditAbout.h index a5915265..aaa5adf8 100644 --- a/src/musredit_qt5/musredit/PMusrEditAbout.h +++ b/src/musredit_qt5/musredit/PMusrEditAbout.h @@ -38,7 +38,7 @@ class PMusrEditAbout : public QDialog, private Ui::PMusrEditAbout Q_OBJECT public: - PMusrEditAbout(QWidget *parent = 0, Qt::WindowFlags f = 0); + PMusrEditAbout(QWidget *parent = nullptr); virtual ~PMusrEditAbout() {} }; diff --git a/src/musredit_qt5/musredit/PReplaceConfirmationDialog.cpp b/src/musredit_qt5/musredit/PReplaceConfirmationDialog.cpp index 20e7bea2..42e75973 100644 --- a/src/musredit_qt5/musredit/PReplaceConfirmationDialog.cpp +++ b/src/musredit_qt5/musredit/PReplaceConfirmationDialog.cpp @@ -36,7 +36,7 @@ * \param parent pointer to the parent object * \param f qt windows flags */ -PReplaceConfirmationDialog::PReplaceConfirmationDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) +PReplaceConfirmationDialog::PReplaceConfirmationDialog(QWidget *parent) : QDialog(parent) { setupUi(this); diff --git a/src/musredit_qt5/musredit/PReplaceConfirmationDialog.h b/src/musredit_qt5/musredit/PReplaceConfirmationDialog.h index 86611ec1..c097c067 100644 --- a/src/musredit_qt5/musredit/PReplaceConfirmationDialog.h +++ b/src/musredit_qt5/musredit/PReplaceConfirmationDialog.h @@ -40,7 +40,7 @@ class PReplaceConfirmationDialog : public QDialog, public Ui::PReplaceConfirmati Q_OBJECT public: - PReplaceConfirmationDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); + PReplaceConfirmationDialog(QWidget *parent = nullptr); virtual ~PReplaceConfirmationDialog() {} }; diff --git a/src/musredit_qt5/musredit/PReplaceDialog.cpp b/src/musredit_qt5/musredit/PReplaceDialog.cpp index 11a6322d..bc095646 100644 --- a/src/musredit_qt5/musredit/PReplaceDialog.cpp +++ b/src/musredit_qt5/musredit/PReplaceDialog.cpp @@ -42,8 +42,8 @@ * \param parent pointer to the parent object * \param f qt windows flag */ -PReplaceDialog::PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) : - QDialog(parent, f), fData(data) +PReplaceDialog::PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent) : + QDialog(parent), fData(data) { setupUi(this); diff --git a/src/musredit_qt5/musredit/PReplaceDialog.h b/src/musredit_qt5/musredit/PReplaceDialog.h index b0534239..5e63cccd 100644 --- a/src/musredit_qt5/musredit/PReplaceDialog.h +++ b/src/musredit_qt5/musredit/PReplaceDialog.h @@ -38,7 +38,7 @@ class PReplaceDialog : public QDialog, private Ui::PReplaceDialog Q_OBJECT public: - PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent = 0, Qt::WindowFlags f = 0); + PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent = nullptr); virtual ~PReplaceDialog() {} virtual PFindReplaceData *getData(); diff --git a/src/musredit_qt5/musredit/PTextEdit.cpp b/src/musredit_qt5/musredit/PTextEdit.cpp index 79fd75e1..33d361cc 100644 --- a/src/musredit_qt5/musredit/PTextEdit.cpp +++ b/src/musredit_qt5/musredit/PTextEdit.cpp @@ -84,8 +84,8 @@ * \param parent pointer to the parent object * \param f qt windows flags */ -PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f ) - : QMainWindow( parent, f ) +PTextEdit::PTextEdit( QWidget *parent ) + : QMainWindow( parent ) { bool gotTheme = getTheme(); @@ -1743,7 +1743,7 @@ void PTextEdit::editFind() if (!fFindReplaceData->fromCursor) currentEditor()->textCursor().setPosition(0); - QTextDocument::FindFlags flags = nullptr; + QTextDocument::FindFlags flags; if (fFindReplaceData->caseSensitive) flags |= QTextDocument::FindCaseSensitively; else if (fFindReplaceData->findBackwards) @@ -1760,7 +1760,7 @@ void PTextEdit::editFind() */ void PTextEdit::editFindNext() { - QTextDocument::FindFlags flags = nullptr; + QTextDocument::FindFlags flags; if (fFindReplaceData->caseSensitive) flags |= QTextDocument::FindCaseSensitively; else if (fFindReplaceData->wholeWordsOnly) @@ -1775,7 +1775,7 @@ void PTextEdit::editFindNext() */ void PTextEdit::editFindPrevious() { - QTextDocument::FindFlags flags = nullptr; + QTextDocument::FindFlags flags; if (fFindReplaceData->caseSensitive) flags |= QTextDocument::FindCaseSensitively; else if (fFindReplaceData->wholeWordsOnly) @@ -2936,6 +2936,8 @@ void PTextEdit::mupp() cmd = QString("/Applications/mupp.app/Contents/MacOS/mupp"); #endif + QStringList arg; + QProcess *proc = new QProcess(this); QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(); @@ -2945,7 +2947,7 @@ void PTextEdit::mupp() env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" + env.value("LD_LIBRARY_PATH")); proc->setProcessEnvironment(env); proc->setWorkingDirectory(workDir); - proc->start(cmd); + proc->start(cmd, arg); if (!proc->waitForStarted()) { // error handling QString msg(tr("Could not execute the output command: ")+cmd); @@ -3186,7 +3188,7 @@ void PTextEdit::replaceAll() currentEditor()->moveCursor(QTextCursor::Start); // construct search flags - QTextDocument::FindFlags flags = 0; + QTextDocument::FindFlags flags; if (fFindReplaceData->caseSensitive) flags |= QTextDocument::FindCaseSensitively; else if (fFindReplaceData->findBackwards) @@ -3357,10 +3359,18 @@ QStringList PTextEdit::getRunList(QString runListStr, bool &ok) ok = true; // first split space separated parts +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) QStringList tok = runListStr.split(' ', QString::SkipEmptyParts); +#else + QStringList tok = runListStr.split(' ', Qt::SkipEmptyParts); +#endif for (int i=0; i