Raw -> Smart Pointers for musrWiz, qt5.
This commit is contained in:
parent
b9d05d5fcb
commit
5002ed84de
@ -95,7 +95,7 @@ bool PFuncXMLParser::parse(QIODevice *device)
|
|||||||
if (fXml.hasError()) {
|
if (fXml.hasError()) {
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
||||||
QMessageBox::critical(0, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
QMessageBox::critical(nullptr, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ bool PFuncXMLParser::startElement()
|
|||||||
QXmlStreamAttributes qAttr = fXml.attributes();
|
QXmlStreamAttributes qAttr = fXml.attributes();
|
||||||
if (qAttr.count() != 2) {
|
if (qAttr.count() != 2) {
|
||||||
errMsg = QString("theo_map should have 2 attributes, called 'no', and 'name', found %1").arg(qAttr.count());
|
errMsg = QString("theo_map should have 2 attributes, called 'no', and 'name', found %1").arg(qAttr.count());
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PParam map;
|
PParam map;
|
||||||
@ -148,7 +148,7 @@ bool PFuncXMLParser::startElement()
|
|||||||
ival = str.toInt(&ok);
|
ival = str.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
errMsg = QString("theo_map attribute 'no' is not a number (%1)").arg(str);
|
errMsg = QString("theo_map attribute 'no' is not a number (%1)").arg(str);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
map.setNumber(ival);
|
map.setNumber(ival);
|
||||||
@ -159,7 +159,7 @@ bool PFuncXMLParser::startElement()
|
|||||||
// check that all necessary attributes where found
|
// check that all necessary attributes where found
|
||||||
if ((map.getName() == "UnDef") || (map.getNumber() == -1)) {
|
if ((map.getName() == "UnDef") || (map.getNumber() == -1)) {
|
||||||
errMsg = QString("found theo_map with missing attribute(s)");
|
errMsg = QString("found theo_map with missing attribute(s)");
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fTheoTemplate.appendMap(map);
|
fTheoTemplate.appendMap(map);
|
||||||
@ -167,7 +167,7 @@ bool PFuncXMLParser::startElement()
|
|||||||
QXmlStreamAttributes qAttr = fXml.attributes();
|
QXmlStreamAttributes qAttr = fXml.attributes();
|
||||||
if ((qAttr.count() != 4) && (qAttr.count() != 6)) {
|
if ((qAttr.count() != 4) && (qAttr.count() != 6)) {
|
||||||
errMsg = QString("template_param should have 4 or 6 attributes, called\n'no', 'name', 'value', 'step', ['boundLow', 'boundHigh'] found %1").arg(qAttr.count());
|
errMsg = QString("template_param should have 4 or 6 attributes, called\n'no', 'name', 'value', 'step', ['boundLow', 'boundHigh'] found %1").arg(qAttr.count());
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PParam param;
|
PParam param;
|
||||||
@ -176,7 +176,7 @@ bool PFuncXMLParser::startElement()
|
|||||||
ival = str.toInt(&ok);
|
ival = str.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
errMsg = QString("template_param attribute 'no' is not a number (%1)").arg(str);
|
errMsg = QString("template_param attribute 'no' is not a number (%1)").arg(str);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
param.setNumber(ival);
|
param.setNumber(ival);
|
||||||
@ -188,7 +188,7 @@ bool PFuncXMLParser::startElement()
|
|||||||
dval = str.toDouble(&ok);
|
dval = str.toDouble(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
errMsg = QString("template_param attribute 'value' is not a number (%1)").arg(str);
|
errMsg = QString("template_param attribute 'value' is not a number (%1)").arg(str);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
param.setValue(dval);
|
param.setValue(dval);
|
||||||
@ -197,7 +197,7 @@ bool PFuncXMLParser::startElement()
|
|||||||
dval = str.toDouble(&ok);
|
dval = str.toDouble(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
errMsg = QString("template_param attribute 'step' is not a number (%1)").arg(str);
|
errMsg = QString("template_param attribute 'step' is not a number (%1)").arg(str);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
param.setStep(dval);
|
param.setStep(dval);
|
||||||
@ -377,7 +377,7 @@ bool PInstrumentDefXMLParser::parse(QIODevice *device)
|
|||||||
if (fXml.hasError()) {
|
if (fXml.hasError()) {
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
||||||
QMessageBox::critical(0, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
QMessageBox::critical(nullptr, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,12 +418,12 @@ bool PInstrumentDefXMLParser::startElement()
|
|||||||
QXmlStreamAttributes qAttr = fXml.attributes();
|
QXmlStreamAttributes qAttr = fXml.attributes();
|
||||||
if (qAttr.count() != 1) {
|
if (qAttr.count() != 1) {
|
||||||
errMsg = QString("instrument should have 1 attribute, called 'name', found %1").arg(qAttr.count());
|
errMsg = QString("instrument should have 1 attribute, called 'name', found %1").arg(qAttr.count());
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (fInstituteName == "") {
|
if (fInstituteName == "") {
|
||||||
errMsg = QString("found instrument without institute set.");
|
errMsg = QString("found instrument without institute set.");
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// create an instrument object
|
// create an instrument object
|
||||||
@ -632,13 +632,13 @@ bool PInstrumentDefXMLParser::characters()
|
|||||||
case eNoOfDetectors:
|
case eNoOfDetectors:
|
||||||
if (fSetup == 0) {
|
if (fSetup == 0) {
|
||||||
errMsg = "setup object not found.";
|
errMsg = "setup object not found.";
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ival = str.toInt(&ok);
|
ival = str.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
errMsg = QString("Setup Error: No of Detectors = '%1', which is not an int.").arg(str);
|
errMsg = QString("Setup Error: No of Detectors = '%1', which is not an int.").arg(str);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fSetup->setNoOfDetectors(ival);
|
fSetup->setNoOfDetectors(ival);
|
||||||
@ -667,7 +667,7 @@ bool PInstrumentDefXMLParser::characters()
|
|||||||
#endif
|
#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(nullptr, "ERROR", errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
start = strList[0].toInt(&ok);
|
start = strList[0].toInt(&ok);
|
||||||
@ -695,7 +695,7 @@ bool PInstrumentDefXMLParser::characters()
|
|||||||
bool PInstrumentDefXMLParser::endDocument()
|
bool PInstrumentDefXMLParser::endDocument()
|
||||||
{
|
{
|
||||||
if (fInstituteName == "") {
|
if (fInstituteName == "") {
|
||||||
QMessageBox::critical(0, "FATAL ERROR", "Didn't find any institute name in the instrument definitions.");
|
QMessageBox::critical(nullptr, "FATAL ERROR", "Didn't find any institute name in the instrument definitions.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,7 +768,7 @@ bool PMusrWizDefaultXMLParser::parse(QIODevice *device)
|
|||||||
if (fXml.hasError()) {
|
if (fXml.hasError()) {
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
||||||
QMessageBox::critical(0, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
QMessageBox::critical(nullptr, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -879,7 +879,7 @@ PAdmin::PAdmin() : QObject()
|
|||||||
path = std::getenv("HOME");
|
path = std::getenv("HOME");
|
||||||
pathFln = path + "/.musrfit/musrWiz/musrWiz.xml";
|
pathFln = path + "/.musrfit/musrWiz/musrWiz.xml";
|
||||||
if (loadMusrWizDefault(pathFln)) {
|
if (loadMusrWizDefault(pathFln)) {
|
||||||
QMessageBox::warning(0, "WARNING", "Couldn't find musrWiz.xml file.");
|
QMessageBox::warning(nullptr, "WARNING", "Couldn't find musrWiz.xml file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,7 +892,7 @@ PAdmin::PAdmin() : QObject()
|
|||||||
pathFln = path + "/.musrfit/musrWiz/musrfit_funcs.xml";
|
pathFln = path + "/.musrfit/musrWiz/musrfit_funcs.xml";
|
||||||
if (loadMusrfitFunc(pathFln)) {
|
if (loadMusrfitFunc(pathFln)) {
|
||||||
fValid = false;
|
fValid = false;
|
||||||
QMessageBox::critical(0, "FATAL ERROR", "Couldn't find any musrfit function definitions.");
|
QMessageBox::critical(nullptr, "FATAL ERROR", "Couldn't find any musrfit function definitions.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -921,7 +921,7 @@ PAdmin::PAdmin() : QObject()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
QMessageBox::critical(0, "FATAL ERROR", "Couldn't find any instrument definition.");
|
QMessageBox::critical(nullptr, "FATAL ERROR", "Couldn't find any instrument definition.");
|
||||||
fValid = false;
|
fValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1218,7 +1218,7 @@ int PAdmin::loadMusrWizDefault(QString fln)
|
|||||||
cout << "**INFO** '" << pathName.toLatin1().data() << "' did not exist, hence it is created." << endl;
|
cout << "**INFO** '" << pathName.toLatin1().data() << "' did not exist, hence it is created." << endl;
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString("Couldn't create '%1'. Please check.").arg(pathName);
|
QString msg = QString("Couldn't create '%1'. Please check.").arg(pathName);
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1227,7 +1227,7 @@ int PAdmin::loadMusrWizDefault(QString fln)
|
|||||||
PMusrWizDefaultXMLParser handler(fln, this);
|
PMusrWizDefaultXMLParser handler(fln, this);
|
||||||
if (!handler.isValid()) {
|
if (!handler.isValid()) {
|
||||||
QString errMsg = QString("Error parsing %1 file.").arg(fln);
|
QString errMsg = QString("Error parsing %1 file.").arg(fln);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1251,7 +1251,7 @@ int PAdmin::loadMusrfitFunc(QString fln)
|
|||||||
cout << "**INFO** '" << pathName.toLatin1().data() << "' did not exist, hence it is created." << endl;
|
cout << "**INFO** '" << pathName.toLatin1().data() << "' did not exist, hence it is created." << endl;
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString("Couldn't create '%1'. Please check.").arg(pathName);
|
QString msg = QString("Couldn't create '%1'. Please check.").arg(pathName);
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1260,7 +1260,7 @@ int PAdmin::loadMusrfitFunc(QString fln)
|
|||||||
PFuncXMLParser handler(fln, this);
|
PFuncXMLParser handler(fln, this);
|
||||||
if (!handler.isValid()) {
|
if (!handler.isValid()) {
|
||||||
QString errMsg = QString("Error parsing %1 musrfit func file.").arg(fln);
|
QString errMsg = QString("Error parsing %1 musrfit func file.").arg(fln);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1289,7 +1289,7 @@ int PAdmin::loadInstrumentDef(QString path, QString fln)
|
|||||||
cout << "**INFO** '" << pathName.toLatin1().data() << "' did not exist, hence it is created." << endl;
|
cout << "**INFO** '" << pathName.toLatin1().data() << "' did not exist, hence it is created." << endl;
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString("Couldn't create '%1'. Please check.").arg(pathName);
|
QString msg = QString("Couldn't create '%1'. Please check.").arg(pathName);
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1300,7 +1300,7 @@ int PAdmin::loadInstrumentDef(QString path, QString fln)
|
|||||||
PInstrumentDefXMLParser handler(pathFln, this);
|
PInstrumentDefXMLParser handler(pathFln, this);
|
||||||
if (!handler.isValid()) {
|
if (!handler.isValid()) {
|
||||||
QString errMsg = QString("Error parsing %1 instrument def file.").arg(pathFln);
|
QString errMsg = QString("Error parsing %1 instrument def file.").arg(pathFln);
|
||||||
QMessageBox::critical(0, "ERROR", errMsg);
|
QMessageBox::critical(nullptr, "ERROR", errMsg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -423,26 +424,26 @@ PShowTheo::PShowTheo(QString theo, QString func, QWidget *parent, Qt::WindowFlag
|
|||||||
{
|
{
|
||||||
setWindowTitle("used Theory");
|
setWindowTitle("used Theory");
|
||||||
|
|
||||||
QLabel *label = new QLabel("<h2>used Theory</h2>");
|
std::unique_ptr<QLabel> label = std::make_unique<QLabel>("<h2>used Theory</h2>");
|
||||||
QPlainTextEdit *theoTextEdit = new QPlainTextEdit(theo);
|
std::unique_ptr<QPlainTextEdit> theoTextEdit = std::make_unique<QPlainTextEdit>(theo);
|
||||||
theoTextEdit->setReadOnly(true);
|
theoTextEdit->setReadOnly(true);
|
||||||
QPlainTextEdit *funcTextEdit = 0;
|
std::unique_ptr<QPlainTextEdit> funcTextEdit;
|
||||||
if (!func.isEmpty()) {
|
if (!func.isEmpty()) {
|
||||||
funcTextEdit = new QPlainTextEdit(func);
|
funcTextEdit = std::make_unique<QPlainTextEdit>(func);
|
||||||
funcTextEdit->setReadOnly(true);
|
funcTextEdit->setReadOnly(true);
|
||||||
}
|
}
|
||||||
QPushButton *cancel = new QPushButton("&Cancel");
|
std::unique_ptr<QPushButton> cancel = std::make_unique<QPushButton>("&Cancel");
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
std::unique_ptr<QVBoxLayout> layout = std::unique_ptr<QVBoxLayout>();
|
||||||
layout->addWidget(label);
|
layout->addWidget(label.get());
|
||||||
layout->addWidget(theoTextEdit);
|
layout->addWidget(theoTextEdit.get());
|
||||||
if (funcTextEdit)
|
if (funcTextEdit)
|
||||||
layout->addWidget(funcTextEdit);
|
layout->addWidget(funcTextEdit.get());
|
||||||
layout->addWidget(cancel);
|
layout->addWidget(cancel.get());
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout.get());
|
||||||
|
|
||||||
connect(cancel, SIGNAL(pressed()), this, SLOT(accept()));
|
connect(cancel.get(), SIGNAL(pressed()), this, SLOT(accept()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@ -459,23 +460,23 @@ PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
|||||||
setTitle("<h2>Introduction</h2>");
|
setTitle("<h2>Introduction</h2>");
|
||||||
setSubTitle("This wizard will help you to create your msr-file.");
|
setSubTitle("This wizard will help you to create your msr-file.");
|
||||||
|
|
||||||
fMsrFileName = new QLineEdit();
|
fMsrFileName = std::make_unique<QLineEdit>();
|
||||||
fMsrFileName->setToolTip("enter msr-file name or leave it empty.");
|
fMsrFileName->setToolTip("enter msr-file name or leave it empty.");
|
||||||
fMsrFileName->setWhatsThis("If empty the file name will be generate,\nbased on the run number, the fit type\nand the type of measurement.");
|
fMsrFileName->setWhatsThis("If empty the file name will be generate,\nbased on the run number, the fit type\nand the type of measurement.");
|
||||||
|
|
||||||
fYear = new QLineEdit();
|
fYear = std::unique_ptr<QLineEdit>();
|
||||||
fYear->setValidator(new QIntValidator());
|
fYear->setValidator(new QIntValidator());
|
||||||
QDate date = QDate::currentDate();
|
QDate date = QDate::currentDate();
|
||||||
fYear->setText(QString("%1").arg(date.year()));
|
fYear->setText(QString("%1").arg(date.year()));
|
||||||
fYear->setToolTip("year when the run took place.");
|
fYear->setToolTip("year when the run took place.");
|
||||||
fYear->setWhatsThis("The year is used to generate\nthe RUN header information where\nmusrfit will look for the data.");
|
fYear->setWhatsThis("The year is used to generate\nthe RUN header information where\nmusrfit will look for the data.");
|
||||||
|
|
||||||
fRunNumber = new QLineEdit();
|
fRunNumber = std::unique_ptr<QLineEdit>();
|
||||||
fRunNumber->setValidator(new QIntValidator());
|
fRunNumber->setValidator(new QIntValidator());
|
||||||
fRunNumber->setText(QString("%1").arg(fMsrData->getRunNumber()));
|
fRunNumber->setText(QString("%1").arg(fMsrData->getRunNumber()));
|
||||||
fRunNumber->setToolTip("enter the run number here.");
|
fRunNumber->setToolTip("enter the run number here.");
|
||||||
|
|
||||||
fInstitute = new QComboBox();
|
fInstitute = std::unique_ptr<QComboBox>();
|
||||||
QStringList list = fAdmin->getInstituteList(); // get list form the instrument_def's
|
QStringList list = fAdmin->getInstituteList(); // get list form the instrument_def's
|
||||||
list.prepend("UnDef");
|
list.prepend("UnDef");
|
||||||
fInstitute->addItems(list);
|
fInstitute->addItems(list);
|
||||||
@ -483,7 +484,7 @@ PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
|||||||
if (idx != -1)
|
if (idx != -1)
|
||||||
fInstitute->setCurrentIndex(idx);
|
fInstitute->setCurrentIndex(idx);
|
||||||
|
|
||||||
fInstrument = new QComboBox();
|
fInstrument = std::unique_ptr<QComboBox>();
|
||||||
list.clear();
|
list.clear();
|
||||||
list << fAdmin->getInstrumentList(fMsrData->getInstitute());
|
list << fAdmin->getInstrumentList(fMsrData->getInstitute());
|
||||||
list.prepend("UnDef");
|
list.prepend("UnDef");
|
||||||
@ -492,20 +493,20 @@ PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
|||||||
if (idx != -1)
|
if (idx != -1)
|
||||||
fInstrument->setCurrentIndex(idx);
|
fInstrument->setCurrentIndex(idx);
|
||||||
|
|
||||||
fFitType = new QComboBox();
|
fFitType = std::unique_ptr<QComboBox>();
|
||||||
list.clear();
|
list.clear();
|
||||||
list << "UnDef" << "Single Histo" << "Single Histo RRF" << "Asymmetry" << "Asymmetry RRF" << "Mu Minus" << "None muSR";
|
list << "UnDef" << "Single Histo" << "Single Histo RRF" << "Asymmetry" << "Asymmetry RRF" << "Mu Minus" << "None muSR";
|
||||||
fFitType->addItems(list);
|
fFitType->addItems(list);
|
||||||
idx = fFitType->findText(fAdmin->getDefaultFitType());
|
idx = fFitType->findText(fAdmin->getDefaultFitType());
|
||||||
fFitType->setCurrentIndex(idx);
|
fFitType->setCurrentIndex(idx);
|
||||||
|
|
||||||
fMeasurementType = new QComboBox();
|
fMeasurementType = std::unique_ptr<QComboBox>();
|
||||||
list.clear();
|
list.clear();
|
||||||
list << "UnDef" << "ZF" << "TF" << "LF";
|
list << "UnDef" << "ZF" << "TF" << "LF";
|
||||||
fMeasurementType->addItems(list);
|
fMeasurementType->addItems(list);
|
||||||
fMeasurementType->setCurrentIndex(fMsrData->getTypeOfMeasurement());
|
fMeasurementType->setCurrentIndex(fMsrData->getTypeOfMeasurement());
|
||||||
|
|
||||||
fT0 = new QComboBox();
|
fT0 = std::unique_ptr<QComboBox>();
|
||||||
list.clear();
|
list.clear();
|
||||||
list << "from data file" << "call musrT0" << "enter here";
|
list << "from data file" << "call musrT0" << "enter here";
|
||||||
fT0->addItems(list);
|
fT0->addItems(list);
|
||||||
@ -514,23 +515,23 @@ PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
|||||||
|
|
||||||
QFormLayout *layout = new QFormLayout;
|
QFormLayout *layout = new QFormLayout;
|
||||||
|
|
||||||
layout->addRow("Add msr-file name:", fMsrFileName);
|
layout->addRow("Add msr-file name:", fMsrFileName.get());
|
||||||
layout->addRow("Year:", fYear);
|
layout->addRow("Year:", fYear.get());
|
||||||
layout->addRow("Run Number:", fRunNumber);
|
layout->addRow("Run Number:", fRunNumber.get());
|
||||||
layout->addRow("Institute:", fInstitute);
|
layout->addRow("Institute:", fInstitute.get());
|
||||||
layout->addRow("Instrument:", fInstrument);
|
layout->addRow("Instrument:", fInstrument.get());
|
||||||
layout->addRow("Fit Type:", fFitType);
|
layout->addRow("Fit Type:", fFitType.get());
|
||||||
layout->addRow("Type of Measurement:", fMeasurementType);
|
layout->addRow("Type of Measurement:", fMeasurementType.get());
|
||||||
layout->addRow("T0's:", fT0);
|
layout->addRow("T0's:", fT0.get());
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
registerField("runNumber*", fRunNumber);
|
registerField("runNumber*", fRunNumber.get());
|
||||||
|
|
||||||
QObject::connect(fInstitute, SIGNAL(activated(int)), this, SLOT(handleInstituteChanged(int)));
|
QObject::connect(fInstitute.get(), SIGNAL(activated(int)), this, SLOT(handleInstituteChanged(int)));
|
||||||
QObject::connect(fFitType, SIGNAL(activated(int)), this , SLOT(handleFitType(int)));
|
QObject::connect(fFitType.get(), SIGNAL(activated(int)), this , SLOT(handleFitType(int)));
|
||||||
QObject::connect(fMeasurementType, SIGNAL(activated(int)), this, SLOT(checkSetup(int)));
|
QObject::connect(fMeasurementType.get(), SIGNAL(activated(int)), this, SLOT(checkSetup(int)));
|
||||||
QObject::connect(fT0, SIGNAL(activated(int)), this, SLOT(handleT0(int)));
|
QObject::connect(fT0.get(), SIGNAL(activated(int)), this, SLOT(handleT0(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -553,7 +554,7 @@ void PIntroPage::handleFitType(int idx)
|
|||||||
{
|
{
|
||||||
if ( (idx != FIT_TYPE_SINGLE_HISTO) &&
|
if ( (idx != FIT_TYPE_SINGLE_HISTO) &&
|
||||||
(idx != FIT_TYPE_ASYMMETRY) ){
|
(idx != FIT_TYPE_ASYMMETRY) ){
|
||||||
QMessageBox::warning(0, "WARNING", "Currently only fit type: single histo and asymmetry available.");
|
QMessageBox::warning(nullptr, "WARNING", "Currently only fit type: single histo and asymmetry available.");
|
||||||
fFitType->setCurrentIndex(FIT_TYPE_SINGLE_HISTO);
|
fFitType->setCurrentIndex(FIT_TYPE_SINGLE_HISTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,7 +581,7 @@ void PIntroPage::checkSetup(int idx)
|
|||||||
case MEASURE_LF:
|
case MEASURE_LF:
|
||||||
setup = instru->getLFSetups();
|
setup = instru->getLFSetups();
|
||||||
measure = "LF";
|
measure = "LF";
|
||||||
QMessageBox::information(0, "INFO", "Not yet implemented.");
|
QMessageBox::information(nullptr, "INFO", "Not yet implemented.");
|
||||||
break;
|
break;
|
||||||
case MEASURE_UNDEF:
|
case MEASURE_UNDEF:
|
||||||
default:
|
default:
|
||||||
@ -589,7 +590,7 @@ void PIntroPage::checkSetup(int idx)
|
|||||||
|
|
||||||
if (setup.size() == 0) {
|
if (setup.size() == 0) {
|
||||||
QString msg = QString("Didn't find any setup for:\nInstitute: %1\nInstrument: %2").arg(fInstitute->currentText()).arg(fInstrument->currentText());
|
QString msg = QString("Didn't find any setup for:\nInstitute: %1\nInstrument: %2").arg(fInstitute->currentText()).arg(fInstrument->currentText());
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return;
|
return;
|
||||||
} else if (setup.size() == 1) {
|
} else if (setup.size() == 1) {
|
||||||
if (setup[0].getName() == "Default") {
|
if (setup[0].getName() == "Default") {
|
||||||
@ -684,26 +685,26 @@ PTheoPage::PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
|||||||
QString str = QString("Now you will need to enter your theory - fit type: %1").arg(fMsrData->getFitTypeString());
|
QString str = QString("Now you will need to enter your theory - fit type: %1").arg(fMsrData->getFitTypeString());
|
||||||
setSubTitle(str);
|
setSubTitle(str);
|
||||||
|
|
||||||
fTheo = new QPlainTextEdit();
|
fTheo = std::make_unique<QPlainTextEdit>();
|
||||||
fTheo->setWhatsThis("Enter the theory function here.");
|
fTheo->setWhatsThis("Enter the theory function here.");
|
||||||
|
|
||||||
fEditTemplate = new QCheckBox("Edit Template");
|
fEditTemplate = std::make_unique<QCheckBox>("Edit Template");
|
||||||
fEditTemplate->setToolTip("if checked, it allows to edit the template");
|
fEditTemplate->setToolTip("if checked, it allows to edit the template");
|
||||||
fEditTemplate->hide();
|
fEditTemplate->hide();
|
||||||
|
|
||||||
fClearAll = new QPushButton();
|
fClearAll = std::make_unique<QPushButton>();
|
||||||
fClearAll->setText("Clear All");
|
fClearAll->setText("Clear All");
|
||||||
fClearAll->setToolTip("will clear the theory edit field.");
|
fClearAll->setToolTip("will clear the theory edit field.");
|
||||||
fClearAll->setWhatsThis("will clear the theory edit field.");
|
fClearAll->setWhatsThis("will clear the theory edit field.");
|
||||||
|
|
||||||
fCheckTheo = new QPushButton();
|
fCheckTheo = std::make_unique<QPushButton>();
|
||||||
fCheckTheo->setText("Check");
|
fCheckTheo->setText("Check");
|
||||||
fCheckTheo->setToolTip("check if the theory is valid.");
|
fCheckTheo->setToolTip("check if the theory is valid.");
|
||||||
fCheckTheo->setWhatsThis("Check is the theory string is valid.");
|
fCheckTheo->setWhatsThis("Check is the theory string is valid.");
|
||||||
|
|
||||||
QVector<PTheoTemplate> templ = fAdmin->getTheoTemplates();
|
QVector<PTheoTemplate> templ = fAdmin->getTheoTemplates();
|
||||||
QVector<PMusrfitFunc> funcs = fAdmin->getMusrfitFunc();
|
QVector<PMusrfitFunc> funcs = fAdmin->getMusrfitFunc();
|
||||||
fTheoSelect = new QComboBox();
|
fTheoSelect = std::make_unique<QComboBox>();
|
||||||
QStringList list;
|
QStringList list;
|
||||||
// all the templates defined in musrfit_func.xml
|
// all the templates defined in musrfit_func.xml
|
||||||
for (int i=0; i<templ.size(); i++) {
|
for (int i=0; i<templ.size(); i++) {
|
||||||
@ -716,25 +717,25 @@ PTheoPage::PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
|||||||
fTheoSelect->addItems(list);
|
fTheoSelect->addItems(list);
|
||||||
fTheoSelect->setWhatsThis("select some predef. theory functions.\nFor all theory functions available check the help");
|
fTheoSelect->setWhatsThis("select some predef. theory functions.\nFor all theory functions available check the help");
|
||||||
|
|
||||||
fTheoAdd = new QPushButton("Add");
|
fTheoAdd = std::make_unique<QPushButton>("Add");
|
||||||
|
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout();
|
QHBoxLayout *hLayout = new QHBoxLayout();
|
||||||
hLayout->addWidget(fTheoSelect);
|
hLayout->addWidget(fTheoSelect.get());
|
||||||
hLayout->addWidget(fTheoAdd);
|
hLayout->addWidget(fTheoAdd.get());
|
||||||
|
|
||||||
QFormLayout *layout = new QFormLayout;
|
QFormLayout *layout = new QFormLayout;
|
||||||
layout->addRow("Enter Theory:", fTheo);
|
layout->addRow("Enter Theory:", fTheo.get());
|
||||||
layout->addRow(fEditTemplate);
|
layout->addRow(fEditTemplate.get());
|
||||||
layout->addRow("Clear Theory:", fClearAll);
|
layout->addRow("Clear Theory:", fClearAll.get());
|
||||||
layout->addRow("Pre Def. Theory Select:", hLayout);
|
layout->addRow("Pre Def. Theory Select:", hLayout);
|
||||||
layout->addRow("Press for Validation:", fCheckTheo);
|
layout->addRow("Press for Validation:", fCheckTheo.get());
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
QObject::connect(fEditTemplate, SIGNAL(stateChanged(int)), this, SLOT(templateState(int)));
|
QObject::connect(fEditTemplate.get(), SIGNAL(stateChanged(int)), this, SLOT(templateState(int)));
|
||||||
QObject::connect(fClearAll, SIGNAL(clicked()), this, SLOT(clearAll()));
|
QObject::connect(fClearAll.get(), SIGNAL(clicked()), this, SLOT(clearAll()));
|
||||||
QObject::connect(fCheckTheo, SIGNAL(clicked()), this, SLOT(checkTheory()));
|
QObject::connect(fCheckTheo.get(), SIGNAL(clicked()), this, SLOT(checkTheory()));
|
||||||
QObject::connect(fTheoAdd, SIGNAL(clicked()), this, SLOT(addTheory()));
|
QObject::connect(fTheoAdd.get(), SIGNAL(clicked()), this, SLOT(addTheory()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -907,7 +908,7 @@ void PTheoPage::checkTheory()
|
|||||||
ok = analyzeTokens(line[i], 0);
|
ok = analyzeTokens(line[i], 0);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
QString str = QString("**ERROR** in line %1.\n funX takes no parameter.").arg(i+1);
|
QString str = QString("**ERROR** in line %1.\n funX takes no parameter.").arg(i+1);
|
||||||
QMessageBox::critical(0, "Check Theory", str);
|
QMessageBox::critical(nullptr, "Check Theory", str);
|
||||||
// eventually it would be nice to highlight the faulty line
|
// eventually it would be nice to highlight the faulty line
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -915,7 +916,7 @@ void PTheoPage::checkTheory()
|
|||||||
ok = analyzeTokens(line[i], 0);
|
ok = analyzeTokens(line[i], 0);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
QString str = QString("**ERROR** in line %1.\n mapX takes no parameter.").arg(i+1);
|
QString str = QString("**ERROR** in line %1.\n mapX takes no parameter.").arg(i+1);
|
||||||
QMessageBox::critical(0, "Check Theory", str);
|
QMessageBox::critical(nullptr, "Check Theory", str);
|
||||||
// eventually it would be nice to highlight the faulty line
|
// eventually it would be nice to highlight the faulty line
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -928,14 +929,14 @@ void PTheoPage::checkTheory()
|
|||||||
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]);
|
||||||
QMessageBox::critical(0, "Check Theory", str);
|
QMessageBox::critical(nullptr, "Check Theory", str);
|
||||||
// eventually it would be nice to highlight the faulty line
|
// eventually it would be nice to highlight the faulty line
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ok = analyzeTokens(line[i], func.getNoOfParam());
|
ok = analyzeTokens(line[i], func.getNoOfParam());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
QString str = QString("**ERROR** in line %1.\n %2 takes %3 parameter.").arg(i+1).arg(func.getName()).arg(func.getNoOfParam());
|
QString str = QString("**ERROR** in line %1.\n %2 takes %3 parameter.").arg(i+1).arg(func.getName()).arg(func.getNoOfParam());
|
||||||
QMessageBox::critical(0, "Check Theory", str);
|
QMessageBox::critical(nullptr, "Check Theory", str);
|
||||||
// eventually it would be nice to highlight the faulty line
|
// eventually it would be nice to highlight the faulty line
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -955,8 +956,8 @@ void PTheoPage::checkTheory()
|
|||||||
fTheoValid = true;
|
fTheoValid = true;
|
||||||
|
|
||||||
QObject *obj = sender();
|
QObject *obj = sender();
|
||||||
if (obj == fCheckTheo)
|
if (obj == (QObject*)fCheckTheo.get())
|
||||||
QMessageBox::information(0, "Check Theory", "Theory seems to be OK.");
|
QMessageBox::information(nullptr, "Check Theory", "Theory seems to be OK.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -1021,7 +1022,7 @@ bool PTheoPage::analyzeTokens(QString str, int noOfTokens)
|
|||||||
dealWithMap(tok[0], stokNo, 0);
|
dealWithMap(tok[0], stokNo, 0);
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString("Found map of the form '%1'.\nThis is NOT a legal map!").arg(tok[0]);
|
QString msg = QString("Found map of the form '%1'.\nThis is NOT a legal map!").arg(tok[0]);
|
||||||
QMessageBox::critical(0, "analyzeTokens", msg);
|
QMessageBox::critical(nullptr, "analyzeTokens", msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (tok[0].startsWith("fun")) {
|
} else if (tok[0].startsWith("fun")) {
|
||||||
@ -1032,7 +1033,7 @@ bool PTheoPage::analyzeTokens(QString str, int noOfTokens)
|
|||||||
dealWithFun(stokNo);
|
dealWithFun(stokNo);
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString("Found fun of the form '%1'.\nThis is NOT a legal function!").arg(tok[0]);
|
QString msg = QString("Found fun of the form '%1'.\nThis is NOT a legal function!").arg(tok[0]);
|
||||||
QMessageBox::critical(0, "analyzeTokens", msg);
|
QMessageBox::critical(nullptr, "analyzeTokens", msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1051,7 +1052,7 @@ bool PTheoPage::analyzeTokens(QString str, int noOfTokens)
|
|||||||
dealWithParam(tok[0], paramNo, i);
|
dealWithParam(tok[0], paramNo, i);
|
||||||
} else if (!tok[i].startsWith("map") && !tok[i].startsWith("fun")) {
|
} else if (!tok[i].startsWith("map") && !tok[i].startsWith("fun")) {
|
||||||
QString msg = QString("Found parameter of the form '%1'.\nThis is NOT a legal parameter!").arg(tok[i]);
|
QString msg = QString("Found parameter of the form '%1'.\nThis is NOT a legal parameter!").arg(tok[i]);
|
||||||
QMessageBox::critical(0, "analyzeTokens", msg);
|
QMessageBox::critical(nullptr, "analyzeTokens", msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1068,7 +1069,7 @@ bool PTheoPage::analyzeTokens(QString str, int noOfTokens)
|
|||||||
dealWithMap(tok[0], mapNo, i);
|
dealWithMap(tok[0], mapNo, i);
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString("Found map of the form '%1'.\nThis is NOT a legal map!").arg(tok[i]);
|
QString msg = QString("Found map of the form '%1'.\nThis is NOT a legal map!").arg(tok[i]);
|
||||||
QMessageBox::critical(0, "analyzeTokens", msg);
|
QMessageBox::critical(nullptr, "analyzeTokens", msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1086,7 +1087,7 @@ bool PTheoPage::analyzeTokens(QString str, int noOfTokens)
|
|||||||
dealWithFun(funNo);
|
dealWithFun(funNo);
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString("Found function of the form '%1'.\nThis is NOT a legal function!").arg(tok[i]);
|
QString msg = QString("Found function of the form '%1'.\nThis is NOT a legal function!").arg(tok[i]);
|
||||||
QMessageBox::critical(0, "analyzeTokens", msg);
|
QMessageBox::critical(nullptr, "analyzeTokens", msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1196,7 +1197,6 @@ PMapPage::PMapPage(PMsrData *data, QWidget *parent) :
|
|||||||
QWizardPage(parent),
|
QWizardPage(parent),
|
||||||
fMsrData(data)
|
fMsrData(data)
|
||||||
{
|
{
|
||||||
fMapPageLayout = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -1222,8 +1222,8 @@ void PMapPage::initializePage()
|
|||||||
// sort maps
|
// sort maps
|
||||||
fMsrData->sort("map");
|
fMsrData->sort("map");
|
||||||
|
|
||||||
fMapPageLayout = new QFormLayout;
|
fMapPageLayout = std::make_unique<QFormLayout>();
|
||||||
setLayout(fMapPageLayout);
|
setLayout(fMapPageLayout.get());
|
||||||
|
|
||||||
// make sure that the map list is empty
|
// make sure that the map list is empty
|
||||||
fMapGuiVec.clear();
|
fMapGuiVec.clear();
|
||||||
@ -1284,12 +1284,12 @@ void PMapPage::initializePage()
|
|||||||
fMapPageLayout->addRow(QString("map%1").arg(i+1), hLayout);
|
fMapPageLayout->addRow(QString("map%1").arg(i+1), hLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
fShowTheo = new QPushButton("Show &Theory");
|
fShowTheo = std::make_unique<QPushButton>("Show &Theory");
|
||||||
fMapPageLayout->addRow(fShowTheo);
|
fMapPageLayout->addRow(fShowTheo.get());
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo()));
|
connect(fShowTheo.get(), SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -1354,18 +1354,18 @@ PFuncPage::PFuncPage(PMsrData *data, QWidget *parent) :
|
|||||||
QString str = QString("Now you will need to enter your functions. Fit type: %1").arg(fMsrData->getFitTypeString());
|
QString str = QString("Now you will need to enter your functions. Fit type: %1").arg(fMsrData->getFitTypeString());
|
||||||
setSubTitle(str);
|
setSubTitle(str);
|
||||||
|
|
||||||
fFunc = new QPlainTextEdit();
|
fFunc = std::make_unique<QPlainTextEdit>();
|
||||||
fFunc->setWhatsThis("Enter the function(s) here.");
|
fFunc->setWhatsThis("Enter the function(s) here.");
|
||||||
|
|
||||||
fShowTheo = new QPushButton("Show &Theory");
|
fShowTheo = std::make_unique<QPushButton>("Show &Theory");
|
||||||
|
|
||||||
QFormLayout *layout = new QFormLayout;
|
QFormLayout *layout = new QFormLayout;
|
||||||
layout->addRow("Enter Function(s):", fFunc);
|
layout->addRow("Enter Function(s):", fFunc.get());
|
||||||
layout->addRow(fShowTheo);
|
layout->addRow(fShowTheo.get());
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo()));
|
connect(fShowTheo.get(), SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -1457,8 +1457,16 @@ bool PFuncPage::validatePage()
|
|||||||
while ((idx = str.indexOf("par", idx)) != -1) {
|
while ((idx = str.indexOf("par", idx)) != -1) {
|
||||||
tok = "";
|
tok = "";
|
||||||
idx += 3;
|
idx += 3;
|
||||||
|
if (idx >= str.length()) {
|
||||||
|
std::cerr << ">> PFuncPage::validatePage(): **ERROR** with 'par' in '" << str.toLatin1().data() << "' (idx=" << idx << ")." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
while (str[idx].isDigit()) {
|
while (str[idx].isDigit()) {
|
||||||
tok += str[idx++];
|
tok += str[idx];
|
||||||
|
if (idx++ >= str.length()) {
|
||||||
|
std::cerr << ">> PFuncPage::validatePage(): **ERROR** with 'par' in '" << str.toLatin1().data() << "' (idx=" << idx << ")." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
parNo = tok.toInt(&ok);
|
parNo = tok.toInt(&ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
@ -1468,6 +1476,9 @@ bool PFuncPage::validatePage()
|
|||||||
param.setValue(0.0);
|
param.setValue(0.0);
|
||||||
param.setStep(0.1);
|
param.setStep(0.1);
|
||||||
paramList.push_back(param);
|
paramList.push_back(param);
|
||||||
|
} else {
|
||||||
|
std::cerr << ">> PFuncPage::validatePage(): **ERROR** with 'par' in '" << str.toLatin1().data() << "' (tok=" << tok.toLatin1().data() << " not a number)." << std::endl;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fMsrData->appendParam(paramList);
|
fMsrData->appendParam(paramList);
|
||||||
@ -1479,8 +1490,16 @@ bool PFuncPage::validatePage()
|
|||||||
while ((idx = str.indexOf("map", idx)) != -1) {
|
while ((idx = str.indexOf("map", idx)) != -1) {
|
||||||
tok = "";
|
tok = "";
|
||||||
idx += 3;
|
idx += 3;
|
||||||
while (str[idx].isDigit()) {
|
if (idx >= str.length()) {
|
||||||
tok += str[idx++];
|
std::cerr << ">> PFuncPage::validatePage(): **ERROR** with 'map' in '" << str.toLatin1().data() << "' (idx=" << idx << ")." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
while ((idx < str.length()) && str[idx].isDigit()) {
|
||||||
|
tok += str[idx];
|
||||||
|
if (idx++ >= str.length()) {
|
||||||
|
std::cerr << ">> PFuncPage::validatePage(): **ERROR** with 'map' in '" << str.toLatin1().data() << "' (idx=" << idx << ")." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mapNo = tok.toInt(&ok);
|
mapNo = tok.toInt(&ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
@ -1488,6 +1507,9 @@ bool PFuncPage::validatePage()
|
|||||||
sstr = QString("map%1").arg(mapNo);
|
sstr = QString("map%1").arg(mapNo);
|
||||||
map.setName(sstr);
|
map.setName(sstr);
|
||||||
mapList.push_back(map);
|
mapList.push_back(map);
|
||||||
|
} else {
|
||||||
|
std::cerr << ">> PFuncPage::validatePage(): **ERROR** with 'map' in '" << str.toLatin1().data() << "' (tok=" << tok.toLatin1().data() << " not a number)." << std::endl;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fMsrData->appendMap(mapList);
|
fMsrData->appendMap(mapList);
|
||||||
@ -1545,7 +1567,6 @@ PParamPage::PParamPage(PMsrData *data, QWidget *parent) :
|
|||||||
QWizardPage(parent),
|
QWizardPage(parent),
|
||||||
fMsrData(data)
|
fMsrData(data)
|
||||||
{
|
{
|
||||||
fParameterPageLayout = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -1571,8 +1592,8 @@ void PParamPage::initializePage()
|
|||||||
QString str = QString("Here you can fine tune your parameters. Fit type: %1").arg(fMsrData->getFitTypeString());
|
QString str = QString("Here you can fine tune your parameters. Fit type: %1").arg(fMsrData->getFitTypeString());
|
||||||
setSubTitle(str);
|
setSubTitle(str);
|
||||||
|
|
||||||
fParameterPageLayout = new QFormLayout;
|
fParameterPageLayout = std::make_unique<QFormLayout>();
|
||||||
setLayout(fParameterPageLayout);
|
setLayout(fParameterPageLayout.get());
|
||||||
|
|
||||||
// make sure that parameter list is empty
|
// make sure that parameter list is empty
|
||||||
fParamGuiVec.clear();
|
fParamGuiVec.clear();
|
||||||
@ -1631,12 +1652,12 @@ void PParamPage::initializePage()
|
|||||||
fParameterPageLayout->addRow(QString("%1").arg(i+1), hLayout);
|
fParameterPageLayout->addRow(QString("%1").arg(i+1), hLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
fShowTheo = new QPushButton("Show &Theory");
|
fShowTheo = std::make_unique<QPushButton>("Show &Theory");
|
||||||
fParameterPageLayout->addRow(fShowTheo);
|
fParameterPageLayout->addRow(fShowTheo.get());
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo()));
|
connect(fShowTheo.get(), SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -1700,25 +1721,25 @@ PFitInfoPage::PFitInfoPage(PMsrData *data, QWidget *parent) :
|
|||||||
QString str = QString("Collect necessary fit information. Fit type: %1").arg(fMsrData->getFitTypeString());
|
QString str = QString("Collect necessary fit information. Fit type: %1").arg(fMsrData->getFitTypeString());
|
||||||
setSubTitle(str);
|
setSubTitle(str);
|
||||||
|
|
||||||
fFitRangeStart = new QLineEdit("0.0");
|
fFitRangeStart = std::make_unique<QLineEdit>("0.0");
|
||||||
fFitRangeStart->setValidator(new QDoubleValidator());
|
fFitRangeStart->setValidator(new QDoubleValidator());
|
||||||
fFitRangeEnd = new QLineEdit("9.0");
|
fFitRangeEnd = std::make_unique<QLineEdit>("9.0");
|
||||||
fFitRangeEnd->setValidator(new QDoubleValidator());
|
fFitRangeEnd->setValidator(new QDoubleValidator());
|
||||||
|
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout();
|
QHBoxLayout *hLayout = new QHBoxLayout();
|
||||||
hLayout->addWidget(fFitRangeStart);
|
hLayout->addWidget(fFitRangeStart.get());
|
||||||
hLayout->addWidget(fFitRangeEnd);
|
hLayout->addWidget(fFitRangeEnd.get());
|
||||||
|
|
||||||
fPacking = new QLineEdit("1");
|
fPacking = std::make_unique<QLineEdit>("1");
|
||||||
fPacking->setValidator(new QIntValidator());
|
fPacking->setValidator(new QIntValidator());
|
||||||
|
|
||||||
fCommands = new QPlainTextEdit();
|
fCommands = std::make_unique<QPlainTextEdit>();
|
||||||
fCommands->setPlainText("#MAX_LIKELIHOOD\nPRINT_LEVEL 2\nMINIMIZE\nMINOS\nSAVE");
|
fCommands->setPlainText("#MAX_LIKELIHOOD\nPRINT_LEVEL 2\nMINIMIZE\nMINOS\nSAVE");
|
||||||
|
|
||||||
QFormLayout *layout = new QFormLayout;
|
QFormLayout *layout = new QFormLayout;
|
||||||
layout->addRow("Fit Range:", hLayout);
|
layout->addRow("Fit Range:", hLayout);
|
||||||
layout->addRow("Packing:", fPacking);
|
layout->addRow("Packing:", fPacking.get());
|
||||||
layout->addRow("Commands:", fCommands);
|
layout->addRow("Commands:", fCommands.get());
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
@ -1784,22 +1805,22 @@ PConclusionPage::PConclusionPage(PAdmin *admin, PMsrData *data, QString *msrFile
|
|||||||
|
|
||||||
QVBoxLayout *vLayout = new QVBoxLayout;
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||||
|
|
||||||
fMsrPathFileLabel = new QLabel("Current msr-File Path:");
|
fMsrPathFileLabel = std::make_unique<QLabel>("Current msr-File Path:");
|
||||||
fMsrFilePathLineEdit = new QLineEdit(ddir.absolutePath());
|
fMsrFilePathLineEdit = std::make_unique<QLineEdit>(ddir.absolutePath());
|
||||||
fMsrFilePathLineEdit->setReadOnly(true);
|
fMsrFilePathLineEdit->setReadOnly(true);
|
||||||
fSaveAsMsrFile = new QPushButton("Save As (msr-file path)");
|
fSaveAsMsrFile = std::make_unique<QPushButton>("Save As (msr-file path)");
|
||||||
fSaveAsTemplate = new QPushButton("Save As (template)");
|
fSaveAsTemplate = std::make_unique<QPushButton>("Save As (template)");
|
||||||
|
|
||||||
vLayout->addWidget(fMsrPathFileLabel);
|
vLayout->addWidget(fMsrPathFileLabel.get());
|
||||||
vLayout->addWidget(fMsrFilePathLineEdit);
|
vLayout->addWidget(fMsrFilePathLineEdit.get());
|
||||||
vLayout->addWidget(fSaveAsMsrFile);
|
vLayout->addWidget(fSaveAsMsrFile.get());
|
||||||
vLayout->addStretch(1);
|
vLayout->addStretch(1);
|
||||||
vLayout->addWidget(fSaveAsTemplate);
|
vLayout->addWidget(fSaveAsTemplate.get());
|
||||||
|
|
||||||
setLayout(vLayout);
|
setLayout(vLayout);
|
||||||
|
|
||||||
connect(fSaveAsMsrFile, SIGNAL(pressed()), this, SLOT(saveAsMsrFile()));
|
connect(fSaveAsMsrFile.get(), SIGNAL(pressed()), this, SLOT(saveAsMsrFile()));
|
||||||
connect(fSaveAsTemplate, SIGNAL(pressed()), this, SLOT(saveAsTemplate()));
|
connect(fSaveAsTemplate.get(), SIGNAL(pressed()), this, SLOT(saveAsTemplate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -1995,15 +2016,6 @@ PMusrWiz::PMusrWiz(PAdmin *admin, PMsrData *msrData, QWidget *parent) :
|
|||||||
QObject::connect(this, SIGNAL(helpRequested()), this, SLOT(help()));
|
QObject::connect(this, SIGNAL(helpRequested()), this, SLOT(help()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief PMusrWiz::~PMusrWiz
|
|
||||||
*/
|
|
||||||
PMusrWiz::~PMusrWiz()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief PMusrWiz::writeMsrFile
|
* @brief PMusrWiz::writeMsrFile
|
||||||
@ -2023,7 +2035,7 @@ int PMusrWiz::writeMsrFile(int result)
|
|||||||
// no msr-file name given, hence generate it
|
// no msr-file name given, hence generate it
|
||||||
if (fMsrData->getMsrFileName() == QString("")) {
|
if (fMsrData->getMsrFileName() == QString("")) {
|
||||||
if (fMsrData->getRunNumber() == -1) {
|
if (fMsrData->getRunNumber() == -1) {
|
||||||
QMessageBox::critical(0, "ERROR", "No run number given! Won't do anything.");
|
QMessageBox::critical(nullptr, "ERROR", "No run number given! Won't do anything.");
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
fMsrData->setMsrFileName(QString("%1").arg(fMsrData->getRunNumber()));
|
fMsrData->setMsrFileName(QString("%1").arg(fMsrData->getRunNumber()));
|
||||||
@ -2070,7 +2082,7 @@ int PMusrWiz::writeMsrFileSingleHisto()
|
|||||||
QFile fln(pathFileName);
|
QFile fln(pathFileName);
|
||||||
|
|
||||||
if (!fln.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (!fln.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
QMessageBox::critical(0, "ERROR", "Cannot open file for writting.");
|
QMessageBox::critical(nullptr, "ERROR", "Cannot open file for writting.");
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2140,7 +2152,7 @@ int PMusrWiz::writeMsrFileSingleHisto()
|
|||||||
PInstrument *instru = fAdmin->getInstrument(fMsrData->getInstitute(), fMsrData->getInstrument());
|
PInstrument *instru = fAdmin->getInstrument(fMsrData->getInstitute(), fMsrData->getInstrument());
|
||||||
if (instru == 0) {
|
if (instru == 0) {
|
||||||
QString msg = QString("No setups found for %1: %2").arg(fMsrData->getInstitute(), fMsrData->getInstrument());
|
QString msg = QString("No setups found for %1: %2").arg(fMsrData->getInstitute(), fMsrData->getInstrument());
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
PSetup *setup = 0;
|
PSetup *setup = 0;
|
||||||
@ -2160,7 +2172,7 @@ int PMusrWiz::writeMsrFileSingleHisto()
|
|||||||
}
|
}
|
||||||
if (setup == 0) {
|
if (setup == 0) {
|
||||||
QString msg = QString("No setups found for %1: %2: %3").arg(fMsrData->getInstitute(), fMsrData->getInstrument()).arg(fMsrData->getSetup());
|
QString msg = QString("No setups found for %1: %2: %3").arg(fMsrData->getInstitute(), fMsrData->getInstrument()).arg(fMsrData->getSetup());
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
int noOfDetec = setup->getNoOfLogicalDetectors();
|
int noOfDetec = setup->getNoOfLogicalDetectors();
|
||||||
@ -2474,7 +2486,7 @@ int PMusrWiz::writeMsrFileAsymmetry()
|
|||||||
QFile fln(pathFileName);
|
QFile fln(pathFileName);
|
||||||
|
|
||||||
if (!fln.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (!fln.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
QMessageBox::critical(0, "ERROR", "Cannot open file for writting.");
|
QMessageBox::critical(nullptr, "ERROR", "Cannot open file for writting.");
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2541,12 +2553,12 @@ int PMusrWiz::writeMsrFileAsymmetry()
|
|||||||
|
|
||||||
// get proper detector information from the instrument definition
|
// get proper detector information from the instrument definition
|
||||||
PInstrument *instru = fAdmin->getInstrument(fMsrData->getInstitute(), fMsrData->getInstrument());
|
PInstrument *instru = fAdmin->getInstrument(fMsrData->getInstitute(), fMsrData->getInstrument());
|
||||||
if (instru == 0) {
|
if (instru == nullptr) {
|
||||||
QString msg = QString("No setups found for %1: %2").arg(fMsrData->getInstitute(), fMsrData->getInstrument());
|
QString msg = QString("No setups found for %1: %2").arg(fMsrData->getInstitute(), fMsrData->getInstrument());
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
PSetup *setup = 0;
|
PSetup *setup = nullptr;
|
||||||
switch (fMsrData->getTypeOfMeasurement()) {
|
switch (fMsrData->getTypeOfMeasurement()) {
|
||||||
case MEASURE_ZF:
|
case MEASURE_ZF:
|
||||||
setup = instru->getZFSetup(fMsrData->getSetup());
|
setup = instru->getZFSetup(fMsrData->getSetup());
|
||||||
@ -2561,14 +2573,14 @@ int PMusrWiz::writeMsrFileAsymmetry()
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (setup == 0) {
|
if (setup == nullptr) {
|
||||||
QString msg = QString("No setups found for %1: %2: %3").arg(fMsrData->getInstitute(), fMsrData->getInstrument()).arg(fMsrData->getSetup());
|
QString msg = QString("No setups found for %1: %2: %3").arg(fMsrData->getInstitute(), fMsrData->getInstrument()).arg(fMsrData->getSetup());
|
||||||
QMessageBox::critical(0, "ERROR", msg);
|
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
int noOfDetec = setup->getNoOfLogicalAsymDetectors();
|
int noOfDetec = setup->getNoOfLogicalAsymDetectors();
|
||||||
|
|
||||||
PDetector *detector = 0;
|
PDetector *detector = nullptr;
|
||||||
QString detectorName("");
|
QString detectorName("");
|
||||||
for (int i=0; i<noOfDetec; i++) {
|
for (int i=0; i<noOfDetec; i++) {
|
||||||
detector = setup->getAsymDetector(i);
|
detector = setup->getAsymDetector(i);
|
||||||
@ -2892,6 +2904,8 @@ QString PMusrWiz::getRunName(PInstrument *instru)
|
|||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
do {
|
do {
|
||||||
count++;
|
count++;
|
||||||
|
if (idx+count >= runTemplate.length())
|
||||||
|
break;
|
||||||
} while (runTemplate[idx+count] == 'N');
|
} while (runTemplate[idx+count] == 'N');
|
||||||
}
|
}
|
||||||
if (count >= 4)
|
if (count >= 4)
|
||||||
@ -2932,5 +2946,5 @@ QString PMusrWiz::getRunName(PInstrument *instru)
|
|||||||
*/
|
*/
|
||||||
void PMusrWiz::help()
|
void PMusrWiz::help()
|
||||||
{
|
{
|
||||||
QMessageBox::information(0, "Help", "Eventually there will be a help here.");
|
QMessageBox::information(nullptr, "Help", "Eventually there will be a help here.");
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#ifndef _PMUSRWIZ_
|
#ifndef _PMUSRWIZ_
|
||||||
#define _PMUSRWIZ_
|
#define _PMUSRWIZ_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QWizard>
|
#include <QWizard>
|
||||||
@ -204,14 +206,14 @@ class PIntroPage : public QWizardPage
|
|||||||
PAdmin *fAdmin;
|
PAdmin *fAdmin;
|
||||||
PMsrData *fMsrData;
|
PMsrData *fMsrData;
|
||||||
|
|
||||||
QLineEdit *fMsrFileName;
|
std::unique_ptr<QLineEdit> fMsrFileName;
|
||||||
QLineEdit *fYear;
|
std::unique_ptr<QLineEdit> fYear;
|
||||||
QLineEdit *fRunNumber;
|
std::unique_ptr<QLineEdit> fRunNumber;
|
||||||
QComboBox *fInstitute;
|
std::unique_ptr<QComboBox> fInstitute;
|
||||||
QComboBox *fInstrument;
|
std::unique_ptr<QComboBox> fInstrument;
|
||||||
QComboBox *fFitType;
|
std::unique_ptr<QComboBox> fFitType;
|
||||||
QComboBox *fMeasurementType;
|
std::unique_ptr<QComboBox> fMeasurementType;
|
||||||
QComboBox *fT0;
|
std::unique_ptr<QComboBox> fT0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -246,12 +248,12 @@ class PTheoPage : public QWizardPage
|
|||||||
QVector<PParam> fMapList;
|
QVector<PParam> fMapList;
|
||||||
QVector<int> fFunList;
|
QVector<int> fFunList;
|
||||||
|
|
||||||
QPlainTextEdit *fTheo;
|
std::unique_ptr<QPlainTextEdit> fTheo;
|
||||||
QCheckBox *fEditTemplate;
|
std::unique_ptr<QCheckBox> fEditTemplate;
|
||||||
QPushButton *fClearAll;
|
std::unique_ptr<QPushButton> fClearAll;
|
||||||
QComboBox *fTheoSelect;
|
std::unique_ptr<QComboBox> fTheoSelect;
|
||||||
QPushButton *fTheoAdd;
|
std::unique_ptr<QPushButton> fTheoAdd;
|
||||||
QPushButton *fCheckTheo;
|
std::unique_ptr<QPushButton> fCheckTheo;
|
||||||
|
|
||||||
QString getTheoryFunction(int idx);
|
QString getTheoryFunction(int idx);
|
||||||
bool analyzeTokens(QString str, int noOfTokens);
|
bool analyzeTokens(QString str, int noOfTokens);
|
||||||
@ -279,9 +281,8 @@ class PFuncPage : public QWizardPage
|
|||||||
private:
|
private:
|
||||||
PMsrData *fMsrData;
|
PMsrData *fMsrData;
|
||||||
|
|
||||||
QFormLayout *fMapPageLayout;
|
std::unique_ptr<QPlainTextEdit> fFunc;
|
||||||
QPlainTextEdit *fFunc;
|
std::unique_ptr<QPushButton> fShowTheo;
|
||||||
QPushButton *fShowTheo;
|
|
||||||
|
|
||||||
int getFuncNo(const QString str);
|
int getFuncNo(const QString str);
|
||||||
};
|
};
|
||||||
@ -304,9 +305,9 @@ class PMapPage : public QWizardPage
|
|||||||
private:
|
private:
|
||||||
PMsrData *fMsrData;
|
PMsrData *fMsrData;
|
||||||
|
|
||||||
QFormLayout *fMapPageLayout;
|
std::unique_ptr<QFormLayout> fMapPageLayout;
|
||||||
QVector<PParamGui> fMapGuiVec;
|
QVector<PParamGui> fMapGuiVec;
|
||||||
QPushButton *fShowTheo;
|
std::unique_ptr<QPushButton> fShowTheo;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -327,9 +328,9 @@ class PParamPage : public QWizardPage
|
|||||||
private:
|
private:
|
||||||
PMsrData *fMsrData;
|
PMsrData *fMsrData;
|
||||||
|
|
||||||
QFormLayout *fParameterPageLayout;
|
std::unique_ptr<QFormLayout> fParameterPageLayout;
|
||||||
QVector<PParamGui> fParamGuiVec;
|
QVector<PParamGui> fParamGuiVec;
|
||||||
QPushButton *fShowTheo;
|
std::unique_ptr<QPushButton> fShowTheo;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -347,10 +348,10 @@ class PFitInfoPage : public QWizardPage
|
|||||||
private:
|
private:
|
||||||
PMsrData *fMsrData;
|
PMsrData *fMsrData;
|
||||||
|
|
||||||
QLineEdit *fFitRangeStart;
|
std::unique_ptr<QLineEdit> fFitRangeStart;
|
||||||
QLineEdit *fFitRangeEnd;
|
std::unique_ptr<QLineEdit> fFitRangeEnd;
|
||||||
QLineEdit *fPacking;
|
std::unique_ptr<QLineEdit> fPacking;
|
||||||
QPlainTextEdit *fCommands;
|
std::unique_ptr<QPlainTextEdit> fCommands;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -370,10 +371,10 @@ class PConclusionPage : public QWizardPage
|
|||||||
PAdmin *fAdmin;
|
PAdmin *fAdmin;
|
||||||
PMsrData *fMsrData;
|
PMsrData *fMsrData;
|
||||||
|
|
||||||
QLabel *fMsrPathFileLabel;
|
std::unique_ptr<QLabel> fMsrPathFileLabel;
|
||||||
QLineEdit *fMsrFilePathLineEdit;
|
std::unique_ptr<QLineEdit> fMsrFilePathLineEdit;
|
||||||
QPushButton *fSaveAsMsrFile;
|
std::unique_ptr<QPushButton> fSaveAsMsrFile;
|
||||||
QPushButton *fSaveAsTemplate;
|
std::unique_ptr<QPushButton> fSaveAsTemplate;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -391,7 +392,6 @@ class PMusrWiz : public QWizard
|
|||||||
public:
|
public:
|
||||||
PMusrWiz(QWidget *parent=Q_NULLPTR);
|
PMusrWiz(QWidget *parent=Q_NULLPTR);
|
||||||
PMusrWiz(PAdmin *admin, PMsrData *msrData, QWidget *parent=Q_NULLPTR);
|
PMusrWiz(PAdmin *admin, PMsrData *msrData, QWidget *parent=Q_NULLPTR);
|
||||||
virtual ~PMusrWiz();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
virtual int writeMsrFile(int result);
|
virtual int writeMsrFile(int result);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -83,16 +84,18 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
PAdmin *admin = new PAdmin();
|
std::unique_ptr<PAdmin> admin = std::make_unique<PAdmin>();
|
||||||
|
if (admin == nullptr) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (!admin->IsValid()) {
|
if (!admin->IsValid()) {
|
||||||
delete admin;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
admin->dump(dump);
|
admin->dump(dump);
|
||||||
|
|
||||||
PMsrData *info = new PMsrData(); // this content will eventually be set by the xml-handler
|
std::unique_ptr<PMsrData> info = std::make_unique<PMsrData>(); // this content will eventually be set by the xml-handler
|
||||||
|
|
||||||
PMusrWiz wizard(admin, info);
|
PMusrWiz wizard(admin.get(), info.get());
|
||||||
wizard.show();
|
wizard.show();
|
||||||
|
|
||||||
app.exec();
|
app.exec();
|
||||||
@ -132,16 +135,11 @@ int main(int argc, char *argv[])
|
|||||||
arguments << pathFln;
|
arguments << pathFln;
|
||||||
QProcess::startDetached(musrt0, arguments, "./");
|
QProcess::startDetached(musrt0, arguments, "./");
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(0, "WARNING", "Couldn't find musrt0 :-(.\n Only the msr-file has been generated.");
|
QMessageBox::warning(nullptr, "WARNING", "Couldn't find musrt0 :-(.\n Only the msr-file has been generated.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info)
|
|
||||||
delete info;
|
|
||||||
if (admin)
|
|
||||||
delete admin;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user