adjust to Qt 5.14.x; remove compiler warnings.

This commit is contained in:
suter_a 2020-12-22 22:36:07 +01:00
parent 04fff97704
commit daef50e35a
25 changed files with 948 additions and 28 deletions

View File

@ -49,7 +49,11 @@ PShowVarNameDialog::PShowVarNameDialog(PCollInfo &info)
// if fCollName is a path name, extract the fln // if fCollName is a path name, extract the fln
QString collNameStr(info.fCollName); QString collNameStr(info.fCollName);
if (collNameStr.contains("/")) { if (collNameStr.contains("/")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = collNameStr.split('/', QString::SkipEmptyParts); QStringList tok = collNameStr.split('/', QString::SkipEmptyParts);
#else
QStringList tok = collNameStr.split('/', Qt::SkipEmptyParts);
#endif
collNameStr = tok[tok.count()-1]; collNameStr = tok[tok.count()-1];
} }
QLabel *collName = new QLabel(collNameStr); QLabel *collName = new QLabel(collNameStr);
@ -281,7 +285,11 @@ bool PVarDialog::basic_check()
} }
// tokenize variable input // tokenize variable input
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList strList = varStr.split(QRegularExpression("\\s+"), QString::SkipEmptyParts); 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 // check if there are ANY var definitions
ok = false; ok = false;

View File

@ -432,7 +432,11 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
if (param_found && !line.isEmpty()) { if (param_found && !line.isEmpty()) {
// check if parameter or run number and title // check if parameter or run number and title
token.clear(); token.clear();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
token = line.split(",", QString::SkipEmptyParts); token = line.split(",", QString::SkipEmptyParts);
#else
token = line.split(",", Qt::SkipEmptyParts);
#endif
if (token.size()==0) { if (token.size()==0) {
errorMsg = fln + QString(". No parameter tokens."); errorMsg = fln + QString(". No parameter tokens.");
std::cerr << std::endl; std::cerr << std::endl;
@ -584,7 +588,11 @@ PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool &
// read header information // read header information
line = in.readLine(); line = in.readLine();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
token = line.split(QRegExp("\\s+"), QString::SkipEmptyParts); token = line.split(QRegExp("\\s+"), QString::SkipEmptyParts);
#else
token = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts);
#endif
QVector<QString> headerInfo; QVector<QString> headerInfo;
QVector<int> headerCode; // 0=value, 1=pos/neg err, 2=pos err, 3=neg err, 4=run number QVector<int> 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; continue;
lineNo++; lineNo++;
token.clear(); token.clear();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
token = line.split(QRegExp("\\s+"), QString::SkipEmptyParts); token = line.split(QRegExp("\\s+"), QString::SkipEmptyParts);
#else
token = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts);
#endif
// paranoia check // paranoia check
if (token.size() != headerInfo.size()) { 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()); 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) void PParamDataHandler::processDone(int exitCode, QProcess::ExitStatus exitStatus)
{ {
qInfo() << "in processDone()"; 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; qInfo() << "**ERROR** processDone: exitCode = " << exitCode << endl;
#else
qInfo() << "**ERROR** processDone: exitCode = " << exitCode << Qt::endl;
#endif
}
} }

View File

@ -208,7 +208,11 @@ bool PmuppAdminXMLParser::characters()
fAdmin->setTheme(false); fAdmin->setTheme(false);
break; break;
case eMarker: case eMarker:
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(",", QString::SkipEmptyParts); tok = str.split(",", QString::SkipEmptyParts);
#else
tok = str.split(",", Qt::SkipEmptyParts);
#endif
if ((tok.count() != 1) && (tok.count() != 2)) { if ((tok.count() != 1) && (tok.count() != 2)) {
return false; return false;
@ -227,7 +231,11 @@ bool PmuppAdminXMLParser::characters()
fAdmin->setMarker(ival, dval); fAdmin->setMarker(ival, dval);
break; break;
case eColor: case eColor:
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(",", QString::SkipEmptyParts); tok = str.split(",", QString::SkipEmptyParts);
#else
tok = str.split(",", Qt::SkipEmptyParts);
#endif
if ((tok.count() != 3) && (tok.count() != 4)) { if ((tok.count() != 3) && (tok.count() != 4)) {
return false; return false;
@ -533,8 +541,13 @@ void PmuppAdmin::saveRecentFiles()
return; return;
} }
fin.setDevice(&file); fin.setDevice(&file);
for (int i=0; i<data.size(); i++) for (int i=0; i<data.size(); i++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fin << data[i] << endl; fin << data[i] << endl;
#else
fin << data[i] << Qt::endl;
#endif
}
file.close(); file.close();
} else { } else {
QString msg("Failed to write mupp_startup.xml. Neither a local nor a global copy found."); QString msg("Failed to write mupp_startup.xml. Neither a local nor a global copy found.");
@ -592,7 +605,11 @@ void PmuppAdmin::createMuppStartupFile()
QString line; QString line;
while (!fin.atEnd()) { while (!fin.atEnd()) {
line = fin.readLine(); line = fin.readLine();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << line << endl; fout << line << endl;
#else
fout << line << Qt::endl;
#endif
} }
file.close(); file.close();

View File

@ -233,8 +233,7 @@ PVarErrorDialog::PVarErrorDialog(QString errMsg)
* \param parent pointer to the parent object * \param parent pointer to the parent object
* \param f qt windows flags * \param f qt windows flags
*/ */
PmuppGui::PmuppGui( QStringList fln, QWidget *parent, Qt::WindowFlags f ) PmuppGui::PmuppGui(QStringList fln)
: QMainWindow( parent, f )
{ {
QDateTime dt = QDateTime::currentDateTime(); QDateTime dt = QDateTime::currentDateTime();
fDatime = dt.toTime_t(); fDatime = dt.toTime_t();
@ -945,6 +944,7 @@ void PmuppGui::writeCmdHistory()
// write header // write header
QDateTime dt = QDateTime::currentDateTime(); QDateTime dt = QDateTime::currentDateTime();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "% mupp history file" << endl; fout << "% mupp history file" << endl;
fout << "% " << dt.toString("HH:mm:ss - yy/MM/dd") << endl; fout << "% " << dt.toString("HH:mm:ss - yy/MM/dd") << endl;
@ -953,6 +953,16 @@ void PmuppGui::writeCmdHistory()
fout << fCmdHistory[i] << endl; fout << fCmdHistory[i] << endl;
fout << "% end mupp history file" << endl; fout << "% end mupp history file" << endl;
#else
fout << "% mupp history file" << Qt::endl;
fout << "% " << dt.toString("HH:mm:ss - yy/MM/dd") << Qt::endl;
// write history
for (int i=0; i<fCmdHistory.size(); i++)
fout << fCmdHistory[i] << Qt::endl;
fout << "% end mupp history file" << Qt::endl;
#endif
file.close(); file.close();
} }
@ -1461,7 +1471,12 @@ QVector<double> PmuppGui::getValues(QString collName, QString paramName, bool &o
for (int i=0; i<fVarHandler.size(); i++) { for (int i=0; i<fVarHandler.size(); i++) {
if ((fVarHandler[i].getCollName() == collName) && if ((fVarHandler[i].getCollName() == collName) &&
(fVarHandler[i].getVarName() == paramName)) { (fVarHandler[i].getVarName() == paramName)) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
values = QVector<double>::fromStdVector(fVarHandler[i].getValues()); values = QVector<double>::fromStdVector(fVarHandler[i].getValues());
#else
QVector<double> qvec(fVarHandler[i].getValues().begin(), fVarHandler[i].getValues().end());
values = qvec;
#endif
} }
} }
} }
@ -1495,7 +1510,12 @@ QVector<double> PmuppGui::getPosErr(QString collName, QString paramName, bool &o
for (int i=0; i<fVarHandler.size(); i++) { for (int i=0; i<fVarHandler.size(); i++) {
if ((fVarHandler[i].getCollName() == collName) && if ((fVarHandler[i].getCollName() == collName) &&
(fVarHandler[i].getVarName() == paramName)) { (fVarHandler[i].getVarName() == paramName)) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
values = QVector<double>::fromStdVector(fVarHandler[i].getErrors()); values = QVector<double>::fromStdVector(fVarHandler[i].getErrors());
#else
QVector<double> qvec(fVarHandler[i].getErrors().begin(), fVarHandler[i].getErrors().end());
values = qvec;
#endif
} }
} }
} }
@ -1529,7 +1549,12 @@ QVector<double> PmuppGui::getNegErr(QString collName, QString paramName, bool &o
for (int i=0; i<fVarHandler.size(); i++) { for (int i=0; i<fVarHandler.size(); i++) {
if ((fVarHandler[i].getCollName() == collName) && if ((fVarHandler[i].getCollName() == collName) &&
(fVarHandler[i].getVarName() == paramName)) { (fVarHandler[i].getVarName() == paramName)) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
values = QVector<double>::fromStdVector(fVarHandler[i].getErrors()); values = QVector<double>::fromStdVector(fVarHandler[i].getErrors());
#else
QVector<double> qvec(fVarHandler[i].getErrors().begin(), fVarHandler[i].getErrors().end());
values = qvec;
#endif
} }
} }
} }
@ -1823,6 +1848,7 @@ void PmuppGui::createMacro()
QTextStream fout(&file); QTextStream fout(&file);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "// " << fMacroName.toLatin1().data() << endl; fout << "// " << fMacroName.toLatin1().data() << endl;
fout << "// " << QDateTime::currentDateTime().toString("yy/MM/dd - HH:mm:ss") << endl; fout << "// " << QDateTime::currentDateTime().toString("yy/MM/dd - HH:mm:ss") << endl;
fout << "// " << endl; fout << "// " << endl;
@ -1840,6 +1866,25 @@ void PmuppGui::createMacro()
fout << " Double_t yy[512];" << endl; fout << " Double_t yy[512];" << endl;
fout << " Double_t yyPosErr[512];" << endl; fout << " Double_t yyPosErr[512];" << endl;
fout << " Double_t yyNegErr[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 // create all the necessary TGraph's
int collTag = -1, pos; int collTag = -1, pos;
QString collName(""); QString collName("");
@ -1894,40 +1939,98 @@ void PmuppGui::createMacro()
yLabel = substituteDefaultLabels(yLabel); yLabel = substituteDefaultLabels(yLabel);
getMinMax(yy, yMin, yMax); getMinMax(yy, yMin, yMax);
// create TGraph objects // create TGraph objects
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << endl; fout << endl;
snprintf(gLabel, sizeof(gLabel), "g_%d_%d", i, j); snprintf(gLabel, sizeof(gLabel), "g_%d_%d", i, j);
fout << " nn = " << xx.size() << ";" << endl; fout << " nn = " << xx.size() << ";" << endl;
fout << endl; fout << endl;
fout << " // null value vector" << 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; k<xx.size(); k++) { for (int k=0; k<xx.size(); k++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " null[" << k << "]=0.0;" << endl; fout << " null[" << k << "]=0.0;" << endl;
#else
fout << " null[" << k << "]=0.0;" << Qt::endl;
#endif
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " // xx" << endl; fout << " // xx" << endl;
#else
fout << " // xx" << Qt::endl;
#endif
for (int k=0; k<xx.size(); k++) { for (int k=0; k<xx.size(); k++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " xx[" << k << "]=" << xx[k] << ";" << endl; fout << " xx[" << k << "]=" << xx[k] << ";" << endl;
#else
fout << " xx[" << k << "]=" << xx[k] << ";" << Qt::endl;
#endif
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " // yy" << endl; fout << " // yy" << endl;
#else
fout << " // yy" << Qt::endl;
#endif
for (int k=0; k<xx.size(); k++) { for (int k=0; k<xx.size(); k++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " yy[" << k << "]=" << yy[k] << ";" << endl; fout << " yy[" << k << "]=" << yy[k] << ";" << endl;
#else
fout << " yy[" << k << "]=" << yy[k] << ";" << Qt::endl;
#endif
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " // yyPosErr" << endl; fout << " // yyPosErr" << endl;
#else
fout << " // yyPosErr" << Qt::endl;
#endif
for (int k=0; k<xx.size(); k++) { for (int k=0; k<xx.size(); k++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " yyPosErr[" << k << "]=" << yyPosErr[k] << ";" << endl; fout << " yyPosErr[" << k << "]=" << yyPosErr[k] << ";" << endl;
#else
fout << " yyPosErr[" << k << "]=" << yyPosErr[k] << ";" << Qt::endl;
#endif
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " // yyNegErr" << endl; fout << " // yyNegErr" << endl;
#else
fout << " // yyNegErr" << Qt::endl;
#endif
for (int k=0; k<xx.size(); k++) { for (int k=0; k<xx.size(); k++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " yyNegErr[" << k << "]=" << fabs(yyNegErr[k]) << ";" << endl; fout << " yyNegErr[" << k << "]=" << fabs(yyNegErr[k]) << ";" << endl;
#else
fout << " yyNegErr[" << k << "]=" << fabs(yyNegErr[k]) << ";" << Qt::endl;
#endif
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << endl; fout << endl;
fout << " TGraphAsymmErrors *" << gLabel << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << endl; fout << " TGraphAsymmErrors *" << gLabel << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << endl;
#else
fout << Qt::endl;
fout << " TGraphAsymmErrors *" << gLabel << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << Qt::endl;
#endif
} }
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << endl; fout << endl;
fout << " //***************" << endl; fout << " //***************" << endl;
fout << " // plotting " << endl; fout << " // plotting " << endl;
fout << " //***************" << endl; fout << " //***************" << endl;
fout << " TCanvas *c1 = new TCanvas(\"c1\", \"" << fMacroName.toLatin1().data() << "\", 10, 10, 600, 700);" << endl; fout << " TCanvas *c1 = new TCanvas(\"c1\", \"" << fMacroName.toLatin1().data() << "\", 10, 10, 600, 700);" << endl;
fout << endl; fout << endl;
#else
fout << Qt::endl;
fout << " //***************" << Qt::endl;
fout << " // plotting " << Qt::endl;
fout << " //***************" << Qt::endl;
fout << " TCanvas *c1 = new TCanvas(\"c1\", \"" << fMacroName.toLatin1().data() << "\", 10, 10, 600, 700);" << Qt::endl;
fout << Qt::endl;
#endif
int idx, r, g, b; int idx, r, g, b;
PmuppMarker markerObj; PmuppMarker markerObj;
for (int i=0; i<fXY.size(); i++) { for (int i=0; i<fXY.size(); i++) {
@ -1945,20 +2048,41 @@ void PmuppGui::createMacro()
snprintf(gLabel, sizeof(gLabel), "g_%d_%d", i, j); snprintf(gLabel, sizeof(gLabel), "g_%d_%d", i, j);
if ((i==0) && (j==0)) { // first graph if ((i==0) && (j==0)) { // first graph
if (idx < marker.size()) { if (idx < marker.size()) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << endl; fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << endl;
fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << endl; fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << endl;
#else
fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << Qt::endl;
fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << Qt::endl;
#endif
} else { } else {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " " << gLabel << "->SetMarkerStyle(20); // bullet" << endl; fout << " " << gLabel << "->SetMarkerStyle(20); // bullet" << endl;
fout << " " << gLabel << "->SetMarkerSize(1.5);" << 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()) { if (idx < color.size()) {
color[idx].getRGB(r, g, b); 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 << "->SetMarkerColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << endl;
fout << " " << gLabel << "->SetLineColor(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 { } else {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " " << gLabel << "->SetMarkerColor(kBlue);" << endl; fout << " " << gLabel << "->SetMarkerColor(kBlue);" << endl;
fout << " " << gLabel << "->SetLineColor(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 << "->SetFillColor(kWhite);" << endl;
fout << " " << gLabel << "->GetXaxis()->SetTitle(\"" << xLabel.toLatin1().data() << "\");" << endl; fout << " " << gLabel << "->GetXaxis()->SetTitle(\"" << xLabel.toLatin1().data() << "\");" << endl;
fout << " " << gLabel << "->GetXaxis()->SetTitleSize(0.05);" << 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 << "->GetYaxis()->SetRangeUser(" << 0.95*yMin << ", " << 1.05*yMax << ");" << endl;
fout << " " << gLabel << "->GetXaxis()->SetDecimals(kTRUE);" << endl; fout << " " << gLabel << "->GetXaxis()->SetDecimals(kTRUE);" << endl;
fout << " " << gLabel << "->Draw(\"AP\");" << 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 } else { // consecutive graphs
if (idx < marker.size()) { if (idx < marker.size()) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << endl; fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << endl;
fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << endl; fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << endl;
#else
fout << " " << gLabel << "->SetMarkerStyle(" << markerObj.getMarker() << ");" << Qt::endl;
fout << " " << gLabel << "->SetMarkerSize(" << markerObj.getMarkerSize() << ");" << Qt::endl;
#endif
} else { } else {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " " << gLabel << "->SetMarkerStyle(" << 21+j << ");" << endl; fout << " " << gLabel << "->SetMarkerStyle(" << 21+j << ");" << endl;
fout << " " << gLabel << "->SetMarkerSize(1.5);" << 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()) { if (idx < color.size()) {
color[idx].getRGB(r, g, b); 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 << "->SetMarkerColor(TColor::GetColor(" << r << "," << g << "," << b << "));" << endl;
fout << " " << gLabel << "->SetLineColor(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 { } else {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " " << gLabel << "->SetMarkerColor(kBlue);" << endl; fout << " " << gLabel << "->SetMarkerColor(kBlue);" << endl;
fout << " " << gLabel << "->SetLineColor(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 << "->SetFillColor(kWhite);" << endl;
fout << " " << gLabel << "->Draw(\"Psame\");" << 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; fout << "}" << endl;
#else
fout << "}" << Qt::endl;
#endif
// clear macro name // clear macro name
fMacroName = QString(""); fMacroName = QString("");
@ -2028,17 +2193,29 @@ void PmuppGui::plot()
} }
QTextStream fout(&file); QTextStream fout(&file);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "% path file name: " << pathName << endl; fout << "% path file name: " << pathName << endl;
fout << "% creation time : " << QDateTime::currentDateTime().toString("yyyy.MM.dd - hh:mm:ss") << endl; fout << "% creation time : " << QDateTime::currentDateTime().toString("yyyy.MM.dd - hh:mm:ss") << endl;
fout << "%" << 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; i<fXY.size(); i++) { for (int i=0; i<fXY.size(); i++) {
// header info // header info
collTag = fXY[i].getCollectionTag(); collTag = fXY[i].getCollectionTag();
collName = fColList->item(collTag)->text(); collName = fColList->item(collTag)->text();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "% ---------" << endl; fout << "% ---------" << endl;
fout << "% collName = " << collName << endl; fout << "% collName = " << collName << endl;
fout << "% start ---" << endl; fout << "% start ---" << endl;
#else
fout << "% ---------" << Qt::endl;
fout << "% collName = " << collName << Qt::endl;
fout << "% start ---" << Qt::endl;
#endif
// x-label // x-label
xLabel = fXY[i].getXlabel(); xLabel = fXY[i].getXlabel();
@ -2113,7 +2290,11 @@ void PmuppGui::plot()
yyyNegErr.push_back(yyNegErr); yyyNegErr.push_back(yyNegErr);
yLabel = substituteDefaultLabels(yLabel); yLabel = substituteDefaultLabels(yLabel);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "yLabel: " << yLabel << endl; fout << "yLabel: " << yLabel << endl;
#else
fout << "yLabel: " << yLabel << Qt::endl;
#endif
// normalize if wished // normalize if wished
if (fNormalize) { if (fNormalize) {
@ -2140,10 +2321,18 @@ void PmuppGui::plot()
} }
idx = yyy.size()-1; idx = yyy.size()-1;
fout << yyy[idx][j] << ", " << yyyPosErr[idx][j] << ", " << yyyNegErr[idx][j]; fout << yyy[idx][j] << ", " << yyyPosErr[idx][j] << ", " << yyyNegErr[idx][j];
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << endl; fout << endl;
#else
fout << Qt::endl;
#endif
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "% end -----" << endl; fout << "% end -----" << endl;
#else
fout << "% end -----" << Qt::endl;
#endif
// clear collection related vectors // clear collection related vectors
yyy.clear(); yyy.clear();
@ -2169,7 +2358,11 @@ void PmuppGui::plot()
return; return;
} }
fout.setDevice(&file); fout.setDevice(&file);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << QCoreApplication::applicationFilePath().toLatin1().data() << endl; fout << QCoreApplication::applicationFilePath().toLatin1().data() << endl;
#else
fout << QCoreApplication::applicationFilePath().toLatin1().data() << Qt::endl;
#endif
file.close(); file.close();
key = ftok(QCoreApplication::applicationFilePath().toLatin1().data(), fMuppInstance); key = ftok(QCoreApplication::applicationFilePath().toLatin1().data(), fMuppInstance);
@ -2274,7 +2467,11 @@ void PmuppGui::handleCmds()
} else if (!cmd.compare("plot", Qt::CaseInsensitive)) { } else if (!cmd.compare("plot", Qt::CaseInsensitive)) {
plot(); plot();
} else if (cmd.startsWith("macro")) { // cmd: macro <fln> } else if (cmd.startsWith("macro")) { // cmd: macro <fln>
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(" ", QString::SkipEmptyParts); QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(" ", Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
QMessageBox::critical(this, "ERROR", QString("wrong macro cmd: %1.\nPlease check the help.").arg(cmd)); QMessageBox::critical(this, "ERROR", QString("wrong macro cmd: %1.\nPlease check the help.").arg(cmd));
return; return;
@ -2284,7 +2481,11 @@ void PmuppGui::handleCmds()
} else if (cmd.startsWith("path")) { // cmd: path <macro_path> } else if (cmd.startsWith("path")) { // cmd: path <macro_path>
QMessageBox::information(0, "INFO", "set's eventually the path for the macros to be saved."); 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 // 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); QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(" ", Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
QMessageBox::critical(this, "ERROR", QString("wrong path cmd: %1.\nPlease check the help.").arg(cmd)); QMessageBox::critical(this, "ERROR", QString("wrong path cmd: %1.\nPlease check the help.").arg(cmd));
return; return;
@ -2310,13 +2511,21 @@ void PmuppGui::handleCmds()
} else if (cmd.startsWith("select") || cmd.startsWith("sc")) { } else if (cmd.startsWith("select") || cmd.startsWith("sc")) {
selectCollection(cmd); selectCollection(cmd);
} else if (cmd.startsWith("x")) { } else if (cmd.startsWith("x")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(" ", QString::SkipEmptyParts); QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(" ", Qt::SkipEmptyParts);
#endif
if (tok.size() > 1) if (tok.size() > 1)
addX(tok[1]); addX(tok[1]);
else else
QMessageBox::critical(0, "ERROR", QString("Found command 'x' without variable.")); QMessageBox::critical(0, "ERROR", QString("Found command 'x' without variable."));
} else if (cmd.startsWith("y")) { } else if (cmd.startsWith("y")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(" ", QString::SkipEmptyParts); QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(" ", Qt::SkipEmptyParts);
#endif
if (tok.size() > 1) if (tok.size() > 1)
addY(tok[1]); addY(tok[1]);
else else
@ -2324,19 +2533,31 @@ void PmuppGui::handleCmds()
} else if (cmd.startsWith("ditto")) { } else if (cmd.startsWith("ditto")) {
addDitto(); addDitto();
} else if (cmd.startsWith("rmx")) { } else if (cmd.startsWith("rmx")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(" ", QString::SkipEmptyParts); QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(" ", Qt::SkipEmptyParts);
#endif
if (tok.size() > 1) if (tok.size() > 1)
removeX(tok[1]); removeX(tok[1]);
else else
QMessageBox::critical(0, "ERROR", QString("Found command 'rmx' without variable.")); QMessageBox::critical(0, "ERROR", QString("Found command 'rmx' without variable."));
} else if (cmd.startsWith("rmy")) { } else if (cmd.startsWith("rmy")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(" ", QString::SkipEmptyParts); QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(" ", Qt::SkipEmptyParts);
#endif
if (tok.size() > 1) if (tok.size() > 1)
removeY(tok[1]); removeY(tok[1]);
else else
QMessageBox::critical(0, "ERROR", QString("Found command 'rmy' without variable.")); QMessageBox::critical(0, "ERROR", QString("Found command 'rmy' without variable."));
} else if (cmd.startsWith("norm")) { } else if (cmd.startsWith("norm")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(" ", QString::SkipEmptyParts); QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(" ", Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
QMessageBox::critical(this, "**ERROR**", "found wrong norm cmd, will ignore it."); QMessageBox::critical(this, "**ERROR**", "found wrong norm cmd, will ignore it.");
return; return;

View File

@ -132,7 +132,7 @@ class PmuppGui : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
PmuppGui(QStringList fln, QWidget *parent = 0, Qt::WindowFlags f = 0); PmuppGui(QStringList fln);
virtual ~PmuppGui(); virtual ~PmuppGui();
public slots: public slots:

View File

@ -146,7 +146,11 @@ void PmuppScript::setLoadPath(const QString cmd)
str = str.remove("loadPath "); str = str.remove("loadPath ");
// tokenize path string // tokenize path string
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split("/", QString::SkipEmptyParts); tok = str.split("/", QString::SkipEmptyParts);
#else
tok = str.split("/", Qt::SkipEmptyParts);
#endif
// check if there is a bash variable which needs to be resolved // check if there is a bash variable which needs to be resolved
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment(); QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
@ -180,7 +184,11 @@ void PmuppScript::setSavePath(const QString cmd)
str = str.remove("savePath "); str = str.remove("savePath ");
// tokenize path string // tokenize path string
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split("/", QString::SkipEmptyParts); tok = str.split("/", QString::SkipEmptyParts);
#else
tok = str.split("/", Qt::SkipEmptyParts);
#endif
// check if there is a bash variable which needs to be resolved // check if there is a bash variable which needs to be resolved
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment(); QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
@ -230,7 +238,11 @@ int PmuppScript::loadCollection(const QString str)
int PmuppScript::select(const QString str) int PmuppScript::select(const QString str)
{ {
QString cmd = str; QString cmd = str;
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(' ', QString::SkipEmptyParts); QStringList tok = cmd.split(' ', QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl << "**ERROR** wrong 'select' command syntax." << std::endl << std::endl; std::cerr << std::endl << "**ERROR** wrong 'select' command syntax." << std::endl << std::endl;
return -1; return -1;
@ -287,7 +299,11 @@ int PmuppScript::selectAll()
int PmuppScript::addX(const QString str) int PmuppScript::addX(const QString str)
{ {
QString cmd = str, label; QString cmd = str, label;
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(' ', QString::SkipEmptyParts); QStringList tok = cmd.split(' ', QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl << "**ERROR** in addX: number of tokens missmatch." << std::endl << std::endl; 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; QString cmd = str;
QVector<QString> label; QVector<QString> label;
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(' ', QString::SkipEmptyParts); QStringList tok = cmd.split(' ', QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() < 2) { if (tok.size() < 2) {
std::cerr << std::endl << "**ERROR** in addY: number of tokens < 2." << std::endl << std::endl; 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) int PmuppScript::plot(const QString str)
{ {
QString cmd = str; QString cmd = str;
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(' ', QString::SkipEmptyParts); QStringList tok = cmd.split(' ', QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl << "**ERROR** in plot: number of tokens != 2." << std::endl << std::endl; std::cerr << std::endl << "**ERROR** in plot: number of tokens != 2." << std::endl << std::endl;
return -1; return -1;
@ -542,7 +566,11 @@ int PmuppScript::macro(const QString str, const QString plotFln)
QVector<PmuppColor> color = fAdmin->getColors(); QVector<PmuppColor> color = fAdmin->getColors();
QString cmd = str; QString cmd = str;
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = cmd.split(' ', QString::SkipEmptyParts); QStringList tok = cmd.split(' ', QString::SkipEmptyParts);
#else
QStringList tok = cmd.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl << "**ERROR** macro command with wrong number of arguments (" << tok.size() << ")." << std::endl << std::endl; std::cerr << std::endl << "**ERROR** macro command with wrong number of arguments (" << tok.size() << ")." << std::endl << std::endl;
return -1; return -1;
@ -559,6 +587,7 @@ int PmuppScript::macro(const QString str, const QString plotFln)
QTextStream fout(&file); QTextStream fout(&file);
// write header // write header
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "// --------------------------" << endl; fout << "// --------------------------" << endl;
fout << "// " << fln.toLatin1().constData() << endl; fout << "// " << fln.toLatin1().constData() << endl;
fout << "// " << QDateTime::currentDateTime().toString("yy/MM/dd - HH:mm:ss") << 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 yyPosErr[512];" << endl;
fout << " Double_t yyNegErr[512];" << endl; fout << " Double_t yyNegErr[512];" << endl;
fout << 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 // write data
QVector<double> xx, yy, yyPosErr, yyNegErr; QVector<double> 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; std::cerr << " This should never happens." << std::endl;
return -3; return -3;
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
xx = QVector<double>::fromStdVector(fVarHandler[idx].getValues()); xx = QVector<double>::fromStdVector(fVarHandler[idx].getValues());
#else
QVector<double> qvec(fVarHandler[idx].getValues().begin(), fVarHandler[idx].getValues().end());
xx = qvec;
#endif
} }
// get x-axis min/max // get x-axis min/max
minMax(xx, x_min, x_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; std::cerr << " This should never happens." << std::endl;
return -3; return -3;
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
yy = QVector<double>::fromStdVector(fVarHandler[idx].getValues()); yy = QVector<double>::fromStdVector(fVarHandler[idx].getValues());
yyPosErr = QVector<double>::fromStdVector(fVarHandler[idx].getErrors()); yyPosErr = QVector<double>::fromStdVector(fVarHandler[idx].getErrors());
yyNegErr = QVector<double>::fromStdVector(fVarHandler[idx].getErrors()); yyNegErr = QVector<double>::fromStdVector(fVarHandler[idx].getErrors());
#else
QVector<double> qvecV(fVarHandler[idx].getValues().begin(), fVarHandler[idx].getValues().end());
yy = qvecV;
QVector<double> qvecE(fVarHandler[idx].getErrors().begin(), fVarHandler[idx].getErrors().end());
yyPosErr = qvecE;
yyNegErr = qvecE;
#endif
} }
// get y-axis min/max // get y-axis min/max
minMax(yy, y_min, y_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) if (y_max > y_max_new)
y_max_new = y_max; y_max_new = y_max;
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " // " << ++count << ". data set" << endl; fout << " // " << ++count << ". data set" << endl;
fout << " nn = " << xx.size() << ";" << endl; fout << " nn = " << xx.size() << ";" << endl;
fout << " // null-values" << endl; fout << " // null-values" << endl;
@ -675,6 +739,45 @@ int PmuppScript::macro(const QString str, const QString plotFln)
fout << endl; fout << endl;
fout << " TGraphAsymmErrors *g_" << i << "_" << j << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << endl; fout << " TGraphAsymmErrors *g_" << i << "_" << j << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << endl;
fout << 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; k<xx.size(); k++) {
fout << " null[" << k << "]=0.0;" << Qt::endl;
}
fout << " // x-values" << Qt::endl;
for (int k=0; k<xx.size(); k++) {
fout << " xx[" << k << "]=" << xx[k] << ";" << Qt::endl;
}
fout << " // y-values" << Qt::endl;
for (int k=0; k<yy.size(); k++) {
dval = yy[k];
if (fNorm) {
dval /= y_max;
if (dval < y_min_norm)
y_min_norm = dval;
}
fout << " yy[" << k << "]=" << dval << ";" << Qt::endl;
}
fout << " // yyNegErr-values" << Qt::endl;
for (int k=0; k<yyNegErr.size(); k++) {
dval = fabs(yyNegErr[k]);
if (fNorm)
dval /= fabs(y_max);
fout << " yyNegErr[" << k << "]=" << dval << ";" << Qt::endl;
}
fout << " // yyPosErr-values" << Qt::endl;
for (int k=0; k<yyPosErr.size(); k++) {
dval = fabs(yyPosErr[k]);
if (fNorm)
dval /= fabs(y_max);
fout << " yyPosErr[" << k << "]=" << dval << ";" << Qt::endl;
}
fout << Qt::endl;
fout << " TGraphAsymmErrors *g_" << i << "_" << j << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << Qt::endl;
fout << Qt::endl;
#endif
} }
} }
@ -696,6 +799,7 @@ int PmuppScript::macro(const QString str, const QString plotFln)
} }
// plotting // plotting
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << " //**********" << endl; fout << " //**********" << endl;
fout << " // plotting " << endl; fout << " // plotting " << endl;
fout << " //**********" << endl; fout << " //**********" << endl;
@ -755,6 +859,67 @@ int PmuppScript::macro(const QString str, const QString plotFln)
fout << " c1->SaveAs(\"" << plotFln.toLatin1().constData() << "\");" << endl; fout << " c1->SaveAs(\"" << plotFln.toLatin1().constData() << "\");" << endl;
} }
fout << "}" << 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; i<fPlotInfo.size(); i++) {
for (int j=0; j<fPlotInfo[i].yLabel.size(); j++) {
if (count == 0) {
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 << "->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; return 0;
} }
@ -771,7 +936,11 @@ int PmuppScript::var_cmd(const QString str)
int idx=0; int idx=0;
// get linked collection index for further use // get linked collection index for further use
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok[1].endsWith("Err")) // error variable no need to do something if (tok[1].endsWith("Err")) // error variable no need to do something
return 0; return 0;
idx = getCollectionIndex(tok[1]); idx = getCollectionIndex(tok[1]);
@ -962,7 +1131,11 @@ int PmuppScript::getCollectionIndex(const QString var_name)
cmd = fScript.at(i); cmd = fScript.at(i);
if (cmd.startsWith("col")) { if (cmd.startsWith("col")) {
tok.clear(); tok.clear();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = cmd.split(' ', QString::SkipEmptyParts); tok = cmd.split(' ', QString::SkipEmptyParts);
#else
tok = cmd.split(' ', Qt::SkipEmptyParts);
#endif
if (tok[3] == var_name) { if (tok[3] == var_name) {
idx = tok[1].toInt(&ok); idx = tok[1].toInt(&ok);
if (!ok) { if (!ok) {

View File

@ -191,7 +191,11 @@ int mupp_script_syntax_check(QStringList &list)
tok.clear(); tok.clear();
str = list.at(i); str = list.at(i);
if (str.startsWith("loadPath")) { if (str.startsWith("loadPath")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() < 2) { if (tok.size() < 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -216,7 +220,11 @@ int mupp_script_syntax_check(QStringList &list)
} }
} }
} else if (str.startsWith("load")) { } else if (str.startsWith("load")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() < 2) { if (tok.size() < 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -226,7 +234,11 @@ int mupp_script_syntax_check(QStringList &list)
} }
noOfCollections++; noOfCollections++;
} else if (str.startsWith("x")) { } else if (str.startsWith("x")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -235,7 +247,11 @@ int mupp_script_syntax_check(QStringList &list)
return -1; return -1;
} }
} else if (str.startsWith("y")) { } else if (str.startsWith("y")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() < 2) { if (tok.size() < 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -244,7 +260,11 @@ int mupp_script_syntax_check(QStringList &list)
return -1; return -1;
} }
} else if (str.startsWith("select ")) { } else if (str.startsWith("select ")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -261,7 +281,11 @@ int mupp_script_syntax_check(QStringList &list)
return -1; return -1;
} }
} else if (str.startsWith("savePath")) { } else if (str.startsWith("savePath")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -270,7 +294,11 @@ int mupp_script_syntax_check(QStringList &list)
return -1; return -1;
} }
} else if (str.startsWith("plot")) { } else if (str.startsWith("plot")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -280,7 +308,11 @@ int mupp_script_syntax_check(QStringList &list)
} }
// check extension // check extension
tok.clear(); tok.clear();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split('.', QString::SkipEmptyParts); tok = str.split('.', QString::SkipEmptyParts);
#else
tok = str.split('.', Qt::SkipEmptyParts);
#endif
QString ext = tok.at(tok.size()-1); QString ext = tok.at(tok.size()-1);
ext = ext.toLower(); ext = ext.toLower();
if ((ext != "pdf") && (ext != "jpg") && (ext != "png") && (ext != "svg") && (ext != "gif")) { if ((ext != "pdf") && (ext != "jpg") && (ext != "png") && (ext != "svg") && (ext != "gif")) {
@ -292,7 +324,11 @@ int mupp_script_syntax_check(QStringList &list)
return -2; return -2;
} }
} else if (str.startsWith("macro")) { } else if (str.startsWith("macro")) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 2) { if (tok.size() != 2) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;
@ -302,7 +338,11 @@ int mupp_script_syntax_check(QStringList &list)
} }
// check extension // check extension
tok.clear(); tok.clear();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split('.', QString::SkipEmptyParts); tok = str.split('.', QString::SkipEmptyParts);
#else
tok = str.split('.', Qt::SkipEmptyParts);
#endif
QString ext = tok.at(tok.size()-1); QString ext = tok.at(tok.size()-1);
ext = ext.toLower(); ext = ext.toLower();
if (ext != "c") { if (ext != "c") {
@ -317,7 +357,11 @@ int mupp_script_syntax_check(QStringList &list)
// nothing-to-be-done // nothing-to-be-done
} else if (str.startsWith("var")) { } else if (str.startsWith("var")) {
tok.clear(); tok.clear();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() < 2) { if (tok.size() < 2) {
std::cerr << std::endl; std::cerr << std::endl;
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 // the parsing etc is dealt within the scripting class
} else if (str.startsWith("col")) { } else if (str.startsWith("col")) {
tok.clear(); tok.clear();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
tok = str.split(' ', QString::SkipEmptyParts); tok = str.split(' ', QString::SkipEmptyParts);
#else
tok = str.split(' ', Qt::SkipEmptyParts);
#endif
if (tok.size() != 4) { if (tok.size() != 4) {
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "****************" << std::endl; std::cerr << "****************" << std::endl;

View File

@ -478,7 +478,11 @@ int PMusrStep::readMsrFile()
} }
if (parameter) { if (parameter) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
strL = str.split(" ", QString::SkipEmptyParts); strL = str.split(" ", QString::SkipEmptyParts);
#else
strL = str.split(" ", Qt::SkipEmptyParts);
#endif
if ((strL.size() != 5) && (strL.size() != 7)) { if ((strL.size() != 5) && (strL.size() != 7)) {
fin.close(); fin.close();
return -2; return -2;

View File

@ -660,7 +660,11 @@ bool PInstrumentDefXMLParser::characters()
fSetup->setLgb(ival); fSetup->setLgb(ival);
break; break;
case eBkgRange: case eBkgRange:
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
strList = str.split(' ', QString::SkipEmptyParts); strList = str.split(' ', QString::SkipEmptyParts);
#else
strList = str.split(' ', Qt::SkipEmptyParts);
#endif
if (strList.size() != 2) { if (strList.size() != 2) {
errMsg = QString("Found wrong Asymmetry background range: '%1'").arg(str); errMsg = QString("Found wrong Asymmetry background range: '%1'").arg(str);
QMessageBox::critical(0, "ERROR", errMsg); QMessageBox::critical(0, "ERROR", errMsg);

View File

@ -920,7 +920,11 @@ void PTheoPage::checkTheory()
return; return;
} }
} else { // assume musrfit functions here } else { // assume musrfit functions here
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList strList = line[i].split(" ", QString::SkipEmptyParts); QStringList strList = line[i].split(" ", QString::SkipEmptyParts);
#else
QStringList strList = line[i].split(" ", Qt::SkipEmptyParts);
#endif
func = fAdmin->getMusrfitFunc(strList[0]); func = fAdmin->getMusrfitFunc(strList[0]);
if (func.getName() == "UnDef") { // function not found 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]); 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) bool PTheoPage::analyzeTokens(QString str, int noOfTokens)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = str.trimmed().split(" ", QString::SkipEmptyParts); QStringList tok = str.trimmed().split(" ", QString::SkipEmptyParts);
#else
QStringList tok = str.trimmed().split(" ", Qt::SkipEmptyParts);
#endif
bool ok; bool ok;
// check if line is of the form 'funX' or 'mapX' // check if line is of the form 'funX' or 'mapX'
@ -2070,6 +2078,7 @@ int PMusrWiz::writeMsrFileSingleHisto()
QString line = QString("###############################################################"); QString line = QString("###############################################################");
// write title // write title
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << fMsrData->getMsrFileName() << endl; fout << fMsrData->getMsrFileName() << endl;
fout << line << endl; fout << line << endl;
@ -2095,6 +2104,33 @@ int PMusrWiz::writeMsrFileSingleHisto()
fout << qSetFieldWidth(0); fout << qSetFieldWidth(0);
fout << endl; 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; i<fMsrData->getNoOfParam(); 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 // detector specific fit parameters
QString str; QString str;
@ -2135,9 +2171,14 @@ int PMusrWiz::writeMsrFileSingleHisto()
detector = setup->getDetector(i); detector = setup->getDetector(i);
detectorName = detector->getName(); detectorName = detector->getName();
// name comment // name comment
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "# " << detectorName << endl; fout << "# " << detectorName << endl;
#else
fout << "# " << detectorName << Qt::endl;
#endif
// first all maps // first all maps
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
for (int j=0; j<fMsrData->getNoOfMap(); j++) { for (int j=0; j<fMsrData->getNoOfMap(); j++) {
map = fMsrData->getMap(j); map = fMsrData->getMap(j);
fout << qSetFieldWidth(9); fout << qSetFieldWidth(9);
@ -2166,57 +2207,139 @@ int PMusrWiz::writeMsrFileSingleHisto()
} }
fout << qSetFieldWidth(0); fout << qSetFieldWidth(0);
fout << endl; fout << endl;
#else
for (int j=0; j<fMsrData->getNoOfMap(); 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 // write N0 and N_bkg
fout << qSetFieldWidth(9); fout << qSetFieldWidth(9);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << right << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 1 + (fMsrData->getNoOfMap()+2)*i; 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(0) << " ";
fout << qSetFieldWidth(11); fout << qSetFieldWidth(11);
str = QString("N0_%1").arg(detectorName); str = QString("N0_%1").arg(detectorName);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << left << str; fout << left << str;
fout << left << "123.4"; fout << left << "123.4";
fout << left << "1.0"; fout << left << "1.0";
fout << left << "none"; fout << left << "none";
fout << qSetFieldWidth(0); fout << qSetFieldWidth(0);
fout << endl; 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); fout << qSetFieldWidth(9);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << right << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 2 + (fMsrData->getNoOfMap()+2)*i; 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(0) << " ";
fout << qSetFieldWidth(11); fout << qSetFieldWidth(11);
str = QString("N_bkg_%1").arg(detectorName); str = QString("N_bkg_%1").arg(detectorName);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << left << str; fout << left << str;
fout << left << "1.234"; fout << left << "1.234";
fout << left << "0.1"; fout << left << "0.1";
fout << left << "none"; fout << left << "none";
fout << qSetFieldWidth(0); fout << qSetFieldWidth(0);
fout << endl; 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); fout.setFieldWidth(0);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << endl << line << endl; fout << endl << line << endl;
#else
fout << Qt::endl << line << Qt::endl;
#endif
// write theory block // write theory block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "THEORY" << endl; fout << "THEORY" << endl;
fout << fMsrData->getTheory() << endl; fout << fMsrData->getTheory() << endl;
fout << endl << line << 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 // write functions block
if (fMsrData->getNoOfFunc() > 0) { if (fMsrData->getNoOfFunc() > 0) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "FUNCTIONS" << endl; fout << "FUNCTIONS" << endl;
for (int i=0; i<fMsrData->getNoOfFunc(); i++) { for (int i=0; i<fMsrData->getNoOfFunc(); i++) {
fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << endl; fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << endl;
} }
fout << endl << line << endl; fout << endl << line << endl;
#else
fout << "FUNCTIONS" << Qt::endl;
for (int i=0; i<fMsrData->getNoOfFunc(); i++) {
fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << Qt::endl;
}
fout << Qt::endl << line << Qt::endl;
#endif
} }
// write global block // write global block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "GLOBAL" << endl; fout << "GLOBAL" << endl;
fout << "fittype " << fMsrData->getFitType()-1 << endl; fout << "fittype " << fMsrData->getFitType()-1 << endl;
fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << endl; fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << endl;
fout << "packing " << fMsrData->getPacking() << endl; fout << "packing " << fMsrData->getPacking() << endl;
fout << endl << line << 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) // write run block(s)
int t0 = 0; int t0 = 0;
@ -2229,15 +2352,26 @@ int PMusrWiz::writeMsrFileSingleHisto()
for (int i=0; i<noOfDetec; i++) { for (int i=0; i<noOfDetec; i++) {
detector = setup->getDetector(i); detector = setup->getDetector(i);
detectorNo = detector->getForwards(); detectorNo = detector->getForwards();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "RUN " << runName << endl; fout << "RUN " << runName << endl;
#else
fout << "RUN " << runName << Qt::endl;
#endif
fout << "map "; fout << "map ";
fout << qSetFieldWidth(10); fout << qSetFieldWidth(10);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
for (int j=0; j<fMsrData->getNoOfMap(); j++) for (int j=0; j<fMsrData->getNoOfMap(); j++)
fout << left << fMsrData->getNoOfParam()+ 1 + (fMsrData->getNoOfMap()+2)*i + j; fout << left << fMsrData->getNoOfParam()+ 1 + (fMsrData->getNoOfMap()+2)*i + j;
fout << qSetFieldWidth(0) << endl; fout << qSetFieldWidth(0) << endl;
#else
for (int j=0; j<fMsrData->getNoOfMap(); j++)
fout << Qt::left << fMsrData->getNoOfParam()+ 1 + (fMsrData->getNoOfMap()+2)*i + j;
fout << qSetFieldWidth(0) << Qt::endl;
#endif
fout << "forward "; fout << "forward ";
for (int j=0; j<detectorNo.size()-1; j++) for (int j=0; j<detectorNo.size()-1; j++)
fout << detectorNo[j] << " "; fout << detectorNo[j] << " ";
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << detectorNo[detectorNo.size()-1] << endl; fout << detectorNo[detectorNo.size()-1] << endl;
fout << "norm " << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 1 + (fMsrData->getNoOfMap()+2)*i << endl; fout << "norm " << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 1 + (fMsrData->getNoOfMap()+2)*i << endl;
fout << "backgr.fit " << fMsrData->getNoOfParam() + fMsrData->getNoOfMap() + 2 + (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; fout << "#-----------------------------------------------" << endl;
else else
fout << endl << line << endl; 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 (i<noOfDetec-1)
fout << "#-----------------------------------------------" << Qt::endl;
else
fout << Qt::endl << line << Qt::endl;
#endif
} }
// write command block // write command block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "COMMANDS" << endl; fout << "COMMANDS" << endl;
fout << fMsrData->getCmd() << endl; fout << fMsrData->getCmd() << endl;
fout << endl << line << 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 // write plot block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "PLOT " << fMsrData->getFitType()-1 << endl; fout << "PLOT " << fMsrData->getFitType()-1 << endl;
fout << "lifetimecorrection" << endl; fout << "lifetimecorrection" << endl;
fout << "runs 1-" << setup->getNoOfLogicalDetectors() << endl; fout << "runs 1-" << setup->getNoOfLogicalDetectors() << endl;
fout << "range 0.0 " << fMsrData->getFitEnd() << endl; fout << "range 0.0 " << fMsrData->getFitEnd() << endl;
fout << "view_packing " << fMsrData->getPacking() << endl; fout << "view_packing " << fMsrData->getPacking() << endl;
fout << endl << line << 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 // write fourier block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "FOURIER" << endl; fout << "FOURIER" << endl;
fout << "units MHz" << endl; fout << "units MHz" << endl;
fout << "fourier_power 12" << endl; fout << "fourier_power 12" << endl;
fout << "apodization NONE" << endl; fout << "apodization NONE" << endl;
fout << "plot POWER" << endl; fout << "plot POWER" << endl;
fout << endl << line << 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 // 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 << "STATISTIC --- " << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss") << endl;
fout << "*** FIT DID NOT CONVERGE ***" << 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(); fln.close();
@ -2303,20 +2482,35 @@ int PMusrWiz::writeMsrFileAsymmetry()
QString line = QString("###############################################################"); QString line = QString("###############################################################");
// write title // write title
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << fMsrData->getMsrFileName() << endl; fout << fMsrData->getMsrFileName() << endl;
fout << line << endl; fout << line << endl;
#else
fout << fMsrData->getMsrFileName() << Qt::endl;
fout << line << Qt::endl;
#endif
// write parameter block // write parameter block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "FITPARAMETER" << endl; fout << "FITPARAMETER" << endl;
fout << "# Nr. Name Value Step Pos_Error Boundaries" << 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; PParam param;
// global fit parameters // global fit parameters
for (int i=0; i<fMsrData->getNoOfParam(); i++) { for (int i=0; i<fMsrData->getNoOfParam(); i++) {
param = fMsrData->getParam(i); param = fMsrData->getParam(i);
fout << qSetFieldWidth(9); fout << qSetFieldWidth(9);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << right << param.getNumber(); fout << right << param.getNumber();
#else
fout << Qt::right << param.getNumber();
#endif
fout << qSetFieldWidth(0) << " "; fout << qSetFieldWidth(0) << " ";
fout << qSetFieldWidth(11); fout << qSetFieldWidth(11);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << left << param.getName(); fout << left << param.getName();
fout << left << param.getValue(); fout << left << param.getValue();
fout << left << param.getStep(); fout << left << param.getStep();
@ -2327,6 +2521,18 @@ int PMusrWiz::writeMsrFileAsymmetry()
fout << left << param.getBoundHigh(); fout << left << param.getBoundHigh();
fout << qSetFieldWidth(0); fout << qSetFieldWidth(0);
fout << endl; 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 // detector specific fit parameters
@ -2368,31 +2574,53 @@ int PMusrWiz::writeMsrFileAsymmetry()
detector = setup->getAsymDetector(i); detector = setup->getAsymDetector(i);
detectorName = detector->getName(); detectorName = detector->getName();
// name comment // name comment
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "# " << detectorName << endl; fout << "# " << detectorName << endl;
#else
fout << "# " << detectorName << Qt::endl;
#endif
// first all maps // first all maps
// write Alpha (mandatory) // write Alpha (mandatory)
fout << qSetFieldWidth(9); fout << qSetFieldWidth(9);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << right << fMsrData->getNoOfParam() + 1 + (fMsrData->getNoOfMap()+1)*i; 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(0) << " ";
fout << qSetFieldWidth(11); fout << qSetFieldWidth(11);
str = QString("Alpha_%1").arg(detectorName); str = QString("Alpha_%1").arg(detectorName);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << left << str; fout << left << str;
fout << left << detector->getAlpha(); fout << left << detector->getAlpha();
fout << left << "0.01"; fout << left << "0.01";
fout << left << "none"; fout << left << "none";
fout << qSetFieldWidth(0); fout << qSetFieldWidth(0);
fout << endl; 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 // write user defined maps
for (int j=0; j<fMsrData->getNoOfMap(); j++) { for (int j=0; j<fMsrData->getNoOfMap(); j++) {
map = fMsrData->getMap(j); map = fMsrData->getMap(j);
fout << qSetFieldWidth(9); fout << qSetFieldWidth(9);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << right << fMsrData->getNoOfParam() + 2 + j + (fMsrData->getNoOfMap()+1)*i; 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(0) << " ";
fout << qSetFieldWidth(11); fout << qSetFieldWidth(11);
str = map.getName() + QString("_%1").arg(detectorName); str = map.getName() + QString("_%1").arg(detectorName);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << left << str; fout << left << str;
if (map.getName().startsWith("ph", Qt::CaseInsensitive) || if (map.getName().startsWith("ph", Qt::CaseInsensitive) ||
map.getName().startsWith("relph", Qt::CaseInsensitive)) { map.getName().startsWith("relph", Qt::CaseInsensitive)) {
@ -2413,32 +2641,84 @@ int PMusrWiz::writeMsrFileAsymmetry()
} }
fout << qSetFieldWidth(0); fout << qSetFieldWidth(0);
fout << endl; 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); fout.setFieldWidth(0);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << endl << line << endl; fout << endl << line << endl;
#else
fout << Qt::endl << line << Qt::endl;
#endif
// write theory block // write theory block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "THEORY" << endl; fout << "THEORY" << endl;
fout << fMsrData->getTheory(); fout << fMsrData->getTheory();
fout << endl << line << endl; fout << endl << line << endl;
#else
fout << "THEORY" << Qt::endl;
fout << fMsrData->getTheory();
fout << Qt::endl << line << Qt::endl;
#endif
// write functions block // write functions block
if (fMsrData->getNoOfFunc() > 0) { if (fMsrData->getNoOfFunc() > 0) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "FUNCTIONS" << endl; fout << "FUNCTIONS" << endl;
#else
fout << "FUNCTIONS" << Qt::endl;
#endif
for (int i=0; i<fMsrData->getNoOfFunc(); i++) { for (int i=0; i<fMsrData->getNoOfFunc(); i++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << fMsrData->getFunc(fMsrData->getFuncNo(i)) << endl; 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; fout << endl << line << endl;
#else
fout << Qt::endl << line << Qt::endl;
#endif
} }
// write global block // write global block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "GLOBAL" << endl; fout << "GLOBAL" << endl;
fout << "fittype " << fMsrData->getFitType()-1 << endl; fout << "fittype " << fMsrData->getFitType()-1 << endl;
fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << endl; fout << "fit " << fMsrData->getFitStart() << " " << fMsrData->getFitEnd() << endl;
fout << "packing " << fMsrData->getPacking() << endl; fout << "packing " << fMsrData->getPacking() << endl;
fout << endl << line << 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) // write run block(s)
int t0 = 0; int t0 = 0;
@ -2452,11 +2732,17 @@ int PMusrWiz::writeMsrFileAsymmetry()
detector = setup->getAsymDetector(i); detector = setup->getAsymDetector(i);
detectorNoF = detector->getForwards(); detectorNoF = detector->getForwards();
detectorNoB = detector->getBackwards(); detectorNoB = detector->getBackwards();
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "RUN " << runName << endl; fout << "RUN " << runName << endl;
fout << "alpha " << fMsrData->getNoOfParam() + 1 + (fMsrData->getNoOfMap()+1)*i << 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 << "map ";
fout << qSetFieldWidth(10); fout << qSetFieldWidth(10);
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
if (fMsrData->getNoOfMap() == 0) { if (fMsrData->getNoOfMap() == 0) {
fout << left << "0 0 0 0 0 0 0 0 0 0"; fout << left << "0 0 0 0 0 0 0 0 0 0";
} else { } else {
@ -2464,34 +2750,76 @@ int PMusrWiz::writeMsrFileAsymmetry()
fout << left << fMsrData->getNoOfParam() + 2 + (fMsrData->getNoOfMap()+1)*i + j; fout << left << fMsrData->getNoOfParam() + 2 + (fMsrData->getNoOfMap()+1)*i + j;
} }
fout << qSetFieldWidth(0) << endl; 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; j<fMsrData->getNoOfMap(); j++)
fout << Qt::left << fMsrData->getNoOfParam() + 2 + (fMsrData->getNoOfMap()+1)*i + j;
}
fout << qSetFieldWidth(0) << Qt::endl;
#endif
fout << "forward "; fout << "forward ";
for (int j=0; j<detectorNoF.size()-1; j++) for (int j=0; j<detectorNoF.size()-1; j++)
fout << detectorNoF[j] << " "; fout << detectorNoF[j] << " ";
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << detectorNoF[detectorNoF.size()-1] << endl; fout << detectorNoF[detectorNoF.size()-1] << endl;
#else
fout << detectorNoF[detectorNoF.size()-1] << Qt::endl;
#endif
fout << "backward "; fout << "backward ";
for (int j=0; j<detectorNoB.size()-1; j++) for (int j=0; j<detectorNoB.size()-1; j++)
fout << detectorNoB[j] << " "; fout << detectorNoB[j] << " ";
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << detectorNoB[detectorNoB.size()-1] << endl; fout << detectorNoB[detectorNoB.size()-1] << endl;
fout << "background " << setup->getBkgStartBin() << " " << setup->getBkgEndBin() << " " << setup->getBkgStartBin() << " " << setup->getBkgEndBin() << endl; fout << "background " << setup->getBkgStartBin() << " " << 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) { 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; 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 } 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 << "data 120 " << lgb << " 120 " << lgb << endl;
fout << "t0 100 100" << 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 (i<noOfDetec-1) if (i<noOfDetec-1)
fout << "#-----------------------------------------------" << endl; fout << "#-----------------------------------------------" << endl;
else else
fout << endl << line << endl; fout << endl << line << endl;
#else
if (i<noOfDetec-1)
fout << "#-----------------------------------------------" << Qt::endl;
else
fout << Qt::endl << line << Qt::endl;
#endif
} }
// write command block // write command block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "COMMANDS" << endl; fout << "COMMANDS" << endl;
fout << fMsrData->getCmd() << endl; fout << fMsrData->getCmd() << endl;
fout << endl << line << 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 // write plot block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "PLOT " << fMsrData->getFitType()-1 << endl; fout << "PLOT " << fMsrData->getFitType()-1 << endl;
fout << "lifetimecorrection" << endl; fout << "lifetimecorrection" << endl;
if (setup->getNoOfLogicalAsymDetectors() > 1) if (setup->getNoOfLogicalAsymDetectors() > 1)
@ -2501,18 +2829,43 @@ int PMusrWiz::writeMsrFileAsymmetry()
fout << "range 0.0 " << fMsrData->getFitEnd() << endl; fout << "range 0.0 " << fMsrData->getFitEnd() << endl;
fout << "view_packing " << fMsrData->getPacking() << endl; fout << "view_packing " << fMsrData->getPacking() << endl;
fout << endl << line << 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 // write fourier block
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << "FOURIER" << endl; fout << "FOURIER" << endl;
fout << "units MHz" << endl; fout << "units MHz" << endl;
fout << "fourier_power 12" << endl; fout << "fourier_power 12" << endl;
fout << "apodization NONE" << endl; fout << "apodization NONE" << endl;
fout << "plot POWER" << endl; fout << "plot POWER" << endl;
fout << endl << line << 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 // 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 << "STATISTIC --- " << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss") << endl;
fout << "*** FIT DID NOT CONVERGE ***" << 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(); fln.close();

View File

@ -1017,8 +1017,13 @@ int PAdmin::savePrefs(QString pref_fln)
return 0; return 0;
} }
fin.setDevice(&file); fin.setDevice(&file);
for (int i=0; i<data.size(); i++) for (int i=0; i<data.size(); i++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fin << data[i] << endl; fin << data[i] << endl;
#else
fin << data[i] << Qt::endl;
#endif
}
file.close(); file.close();
} else { } else {
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found."); QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
@ -1106,8 +1111,13 @@ void PAdmin::saveRecentFiles()
return; return;
} }
fin.setDevice(&file); fin.setDevice(&file);
for (int i=0; i<data.size(); i++) for (int i=0; i<data.size(); i++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fin << data[i] << endl; fin << data[i] << endl;
#else
fin << data[i] << Qt::endl;
#endif
}
file.close(); file.close();
} else { } else {
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found."); QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
@ -1176,7 +1186,11 @@ void PAdmin::createMusreditStartupFile()
line.replace("12", "16"); line.replace("12", "16");
} }
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
fout << line << endl; fout << line << endl;
#else
fout << line << Qt::endl;
#endif
} }
file.close(); file.close();

View File

@ -318,15 +318,28 @@ void PChangeDefaultPathsDialog::saveDefaultPathList()
if (!str.trimmed().startsWith("<data_path>")) { if (!str.trimmed().startsWith("<data_path>")) {
// if not data_path was present, add the new data_paths just before the end of the musrfit_start.xml close tag // 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("</musrfit>"))) { if ((dataPathPresent == false) && (str.trimmed().startsWith("</musrfit>"))) {
for (int j=0; j<fSearchPath_listWidget->count(); j++) for (int j=0; j<fSearchPath_listWidget->count(); j++) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
out << " <data_path>" << fSearchPath_listWidget->item(j)->text() << "</data_path>" << endl; out << " <data_path>" << fSearchPath_listWidget->item(j)->text() << "</data_path>" << endl;
#else
out << " <data_path>" << fSearchPath_listWidget->item(j)->text() << "</data_path>" << Qt::endl;
#endif
} }
}
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
out << fileContent[i] << endl; out << fileContent[i] << endl;
#else
out << fileContent[i] << Qt::endl;
#endif
} else { } else {
if (first) { if (first) {
first = false; first = false;
for (int j=0; j<fSearchPath_listWidget->count(); j++) for (int j=0; j<fSearchPath_listWidget->count(); j++)
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
out << " <data_path>" << fSearchPath_listWidget->item(j)->text() << "</data_path>" << endl; out << " <data_path>" << fSearchPath_listWidget->item(j)->text() << "</data_path>" << endl;
#else
out << " <data_path>" << fSearchPath_listWidget->item(j)->text() << "</data_path>" << Qt::endl;
#endif
} }
} }
} }

View File

@ -85,7 +85,12 @@ PDumpOutputHandler::PDumpOutputHandler(QVector<QString> &cmd)
tr("Quit") ); tr("Quit") );
done(0); done(0);
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
fProcPID = fProc->pid(); fProcPID = fProc->pid();
#else
fProcPID = fProc->processId();
#endif
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -97,7 +102,11 @@ PDumpOutputHandler::~PDumpOutputHandler()
if (fProc->state() == QProcess::Running) { if (fProc->state() == QProcess::Running) {
fProc->terminate(); fProc->terminate();
if (!fProc->waitForFinished()) { if (!fProc->waitForFinished()) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
qDebug() << "fProc still running, will call kill." << endl; qDebug() << "fProc still running, will call kill." << endl;
#else
qDebug() << "fProc still running, will call kill." << Qt::endl;
#endif
fProc->kill(); fProc->kill();
} }
fProc->waitForFinished(); fProc->waitForFinished();
@ -105,7 +114,11 @@ PDumpOutputHandler::~PDumpOutputHandler()
if (fProc->state() == QProcess::Running) { if (fProc->state() == QProcess::Running) {
QString cmd = "kill -9 "+ QString("%1").arg(fProcPID); QString cmd = "kill -9 "+ QString("%1").arg(fProcPID);
QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd; 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; qDebug() << msg << endl;
#else
qDebug() << msg << Qt::endl;
#endif
system(cmd.toLatin1()); system(cmd.toLatin1());
} }
if (fProc) { if (fProc) {

View File

@ -44,8 +44,8 @@
* \param parent pointer to the parent object * \param parent pointer to the parent object
* \param f qt specific window flags * \param f qt specific window flags
*/ */
PFindDialog::PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) : PFindDialog::PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent) :
QDialog(parent, f), fData(data) QDialog(parent), fData(data)
{ {
setupUi(this); setupUi(this);

View File

@ -42,7 +42,7 @@ class PFindDialog : public QDialog, private Ui::PFindDialog
Q_OBJECT Q_OBJECT
public: 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 ~PFindDialog() {}
virtual PFindReplaceData *getData(); virtual PFindReplaceData *getData();

View File

@ -89,7 +89,11 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
tr("Quit") ); tr("Quit") );
done(0); done(0);
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
fProcPID = fProc->pid(); fProcPID = fProc->pid();
#else
fProcPID = fProc->processId();
#endif
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -101,7 +105,11 @@ PFitOutputHandler::~PFitOutputHandler()
if (fProc->state() == QProcess::Running) { if (fProc->state() == QProcess::Running) {
fProc->terminate(); fProc->terminate();
if (!fProc->waitForFinished()) { if (!fProc->waitForFinished()) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
qDebug() << "fProc still running, will call kill." << endl; qDebug() << "fProc still running, will call kill." << endl;
#else
qDebug() << "fProc still running, will call kill." << Qt::endl;
#endif
fProc->kill(); fProc->kill();
} }
fProc->waitForFinished(); fProc->waitForFinished();
@ -109,7 +117,11 @@ PFitOutputHandler::~PFitOutputHandler()
if (fProc->state() == QProcess::Running) { if (fProc->state() == QProcess::Running) {
QString cmd = "kill -9 "+ QString("%1").arg(fProcPID); QString cmd = "kill -9 "+ QString("%1").arg(fProcPID);
QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd; 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; qDebug() << msg << endl;
#else
qDebug() << msg << Qt::endl;
#endif
system(cmd.toLatin1()); system(cmd.toLatin1());
} }
if (fProc) { if (fProc) {
@ -149,8 +161,13 @@ void PFitOutputHandler::readFromStdErr()
*/ */
void PFitOutputHandler::processDone(int exitCode, QProcess::ExitStatus exitStatus) 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; qDebug() << "**ERROR** PFitOutputHandler::processDone: exitCode = " << exitCode << endl;
#else
qDebug() << "**ERROR** PFitOutputHandler::processDone: exitCode = " << exitCode << Qt::endl;
#endif
}
fQuitButton->setText("Done"); fQuitButton->setText("Done");
} }

View File

@ -331,7 +331,11 @@ QStringList PGetMusrFTOptionsDialog::getMusrFTOptions()
// histo list // histo list
if (fHistoList_lineEdit->text().length() > 0) { if (fHistoList_lineEdit->text().length() > 0) {
cmd << "--histo"; cmd << "--histo";
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
strList = fHistoList_lineEdit->text().split(" ", QString::SkipEmptyParts); strList = fHistoList_lineEdit->text().split(" ", QString::SkipEmptyParts);
#else
strList = fHistoList_lineEdit->text().split(" ", Qt::SkipEmptyParts);
#endif
for (int i=0; i<strList.size(); i++) for (int i=0; i<strList.size(); i++)
cmd << strList[i]; cmd << strList[i];
} }
@ -347,7 +351,11 @@ QStringList PGetMusrFTOptionsDialog::getMusrFTOptions()
// t0 list // t0 list
if (fT0_lineEdit->text().length() > 0) { if (fT0_lineEdit->text().length() > 0) {
cmd << "--t0"; cmd << "--t0";
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
strList = fT0_lineEdit->text().split(" ", QString::SkipEmptyParts); strList = fT0_lineEdit->text().split(" ", QString::SkipEmptyParts);
#else
strList = fT0_lineEdit->text().split(" ", Qt::SkipEmptyParts);
#endif
for (int i=0; i<strList.size(); i++) for (int i=0; i<strList.size(); i++)
cmd << strList[i]; cmd << strList[i];
} }

View File

@ -34,7 +34,7 @@
/** /**
* <p>Handles the musredit about popup. * <p>Handles the musredit about popup.
*/ */
PMusrEditAbout::PMusrEditAbout(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) PMusrEditAbout::PMusrEditAbout(QWidget *parent) : QDialog(parent)
{ {
setupUi(this); setupUi(this);

View File

@ -38,7 +38,7 @@ class PMusrEditAbout : public QDialog, private Ui::PMusrEditAbout
Q_OBJECT Q_OBJECT
public: public:
PMusrEditAbout(QWidget *parent = 0, Qt::WindowFlags f = 0); PMusrEditAbout(QWidget *parent = nullptr);
virtual ~PMusrEditAbout() {} virtual ~PMusrEditAbout() {}
}; };

View File

@ -36,7 +36,7 @@
* \param parent pointer to the parent object * \param parent pointer to the parent object
* \param f qt windows flags * \param f qt windows flags
*/ */
PReplaceConfirmationDialog::PReplaceConfirmationDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) PReplaceConfirmationDialog::PReplaceConfirmationDialog(QWidget *parent) : QDialog(parent)
{ {
setupUi(this); setupUi(this);

View File

@ -40,7 +40,7 @@ class PReplaceConfirmationDialog : public QDialog, public Ui::PReplaceConfirmati
Q_OBJECT Q_OBJECT
public: public:
PReplaceConfirmationDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); PReplaceConfirmationDialog(QWidget *parent = nullptr);
virtual ~PReplaceConfirmationDialog() {} virtual ~PReplaceConfirmationDialog() {}
}; };

View File

@ -42,8 +42,8 @@
* \param parent pointer to the parent object * \param parent pointer to the parent object
* \param f qt windows flag * \param f qt windows flag
*/ */
PReplaceDialog::PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) : PReplaceDialog::PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent) :
QDialog(parent, f), fData(data) QDialog(parent), fData(data)
{ {
setupUi(this); setupUi(this);

View File

@ -38,7 +38,7 @@ class PReplaceDialog : public QDialog, private Ui::PReplaceDialog
Q_OBJECT Q_OBJECT
public: 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 ~PReplaceDialog() {}
virtual PFindReplaceData *getData(); virtual PFindReplaceData *getData();

View File

@ -84,8 +84,8 @@
* \param parent pointer to the parent object * \param parent pointer to the parent object
* \param f qt windows flags * \param f qt windows flags
*/ */
PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f ) PTextEdit::PTextEdit( QWidget *parent )
: QMainWindow( parent, f ) : QMainWindow( parent )
{ {
bool gotTheme = getTheme(); bool gotTheme = getTheme();
@ -1743,7 +1743,7 @@ void PTextEdit::editFind()
if (!fFindReplaceData->fromCursor) if (!fFindReplaceData->fromCursor)
currentEditor()->textCursor().setPosition(0); currentEditor()->textCursor().setPosition(0);
QTextDocument::FindFlags flags = nullptr; QTextDocument::FindFlags flags;
if (fFindReplaceData->caseSensitive) if (fFindReplaceData->caseSensitive)
flags |= QTextDocument::FindCaseSensitively; flags |= QTextDocument::FindCaseSensitively;
else if (fFindReplaceData->findBackwards) else if (fFindReplaceData->findBackwards)
@ -1760,7 +1760,7 @@ void PTextEdit::editFind()
*/ */
void PTextEdit::editFindNext() void PTextEdit::editFindNext()
{ {
QTextDocument::FindFlags flags = nullptr; QTextDocument::FindFlags flags;
if (fFindReplaceData->caseSensitive) if (fFindReplaceData->caseSensitive)
flags |= QTextDocument::FindCaseSensitively; flags |= QTextDocument::FindCaseSensitively;
else if (fFindReplaceData->wholeWordsOnly) else if (fFindReplaceData->wholeWordsOnly)
@ -1775,7 +1775,7 @@ void PTextEdit::editFindNext()
*/ */
void PTextEdit::editFindPrevious() void PTextEdit::editFindPrevious()
{ {
QTextDocument::FindFlags flags = nullptr; QTextDocument::FindFlags flags;
if (fFindReplaceData->caseSensitive) if (fFindReplaceData->caseSensitive)
flags |= QTextDocument::FindCaseSensitively; flags |= QTextDocument::FindCaseSensitively;
else if (fFindReplaceData->wholeWordsOnly) else if (fFindReplaceData->wholeWordsOnly)
@ -2936,6 +2936,8 @@ void PTextEdit::mupp()
cmd = QString("/Applications/mupp.app/Contents/MacOS/mupp"); cmd = QString("/Applications/mupp.app/Contents/MacOS/mupp");
#endif #endif
QStringList arg;
QProcess *proc = new QProcess(this); QProcess *proc = new QProcess(this);
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(); 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")); env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" + env.value("LD_LIBRARY_PATH"));
proc->setProcessEnvironment(env); proc->setProcessEnvironment(env);
proc->setWorkingDirectory(workDir); proc->setWorkingDirectory(workDir);
proc->start(cmd); proc->start(cmd, arg);
if (!proc->waitForStarted()) { if (!proc->waitForStarted()) {
// error handling // error handling
QString msg(tr("Could not execute the output command: ")+cmd); QString msg(tr("Could not execute the output command: ")+cmd);
@ -3186,7 +3188,7 @@ void PTextEdit::replaceAll()
currentEditor()->moveCursor(QTextCursor::Start); currentEditor()->moveCursor(QTextCursor::Start);
// construct search flags // construct search flags
QTextDocument::FindFlags flags = 0; QTextDocument::FindFlags flags;
if (fFindReplaceData->caseSensitive) if (fFindReplaceData->caseSensitive)
flags |= QTextDocument::FindCaseSensitively; flags |= QTextDocument::FindCaseSensitively;
else if (fFindReplaceData->findBackwards) else if (fFindReplaceData->findBackwards)
@ -3357,10 +3359,18 @@ QStringList PTextEdit::getRunList(QString runListStr, bool &ok)
ok = true; ok = true;
// first split space separated parts // first split space separated parts
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList tok = runListStr.split(' ', QString::SkipEmptyParts); QStringList tok = runListStr.split(' ', QString::SkipEmptyParts);
#else
QStringList tok = runListStr.split(' ', Qt::SkipEmptyParts);
#endif
for (int i=0; i<tok.size(); i++) { for (int i=0; i<tok.size(); i++) {
if (tok[i].contains('-')) { // list given, hence need to expand if (tok[i].contains('-')) { // list given, hence need to expand
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList runListTok = tok[i].split('-', QString::SkipEmptyParts); QStringList runListTok = tok[i].split('-', QString::SkipEmptyParts);
#else
QStringList runListTok = tok[i].split('-', Qt::SkipEmptyParts);
#endif
if (runListTok.size() != 2) { // error if (runListTok.size() != 2) { // error
ok = false; ok = false;
result.clear(); result.clear();

View File

@ -64,7 +64,7 @@ class PTextEdit : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
PTextEdit( QWidget *parent = nullptr, Qt::WindowFlags f = nullptr ); PTextEdit( QWidget *parent = nullptr );
virtual ~PTextEdit() {} virtual ~PTextEdit() {}
public slots: public slots: