work on smart pointer transition of musrWiz.
This commit is contained in:
parent
3d7d86d657
commit
eb234b7de5
@ -28,6 +28,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QObject>
|
||||
@ -423,26 +424,26 @@ PShowTheo::PShowTheo(QString theo, QString func, QWidget *parent, Qt::WindowFlag
|
||||
{
|
||||
setWindowTitle("used Theory");
|
||||
|
||||
QLabel *label = new QLabel("<h2>used Theory</h2>");
|
||||
QPlainTextEdit *theoTextEdit = new QPlainTextEdit(theo);
|
||||
std::unique_ptr<QLabel> label = std::make_unique<QLabel>("<h2>used Theory</h2>");
|
||||
std::unique_ptr<QPlainTextEdit> theoTextEdit = std::make_unique<QPlainTextEdit>(theo);
|
||||
theoTextEdit->setReadOnly(true);
|
||||
QPlainTextEdit *funcTextEdit = 0;
|
||||
std::unique_ptr<QPlainTextEdit> funcTextEdit;
|
||||
if (!func.isEmpty()) {
|
||||
funcTextEdit = new QPlainTextEdit(func);
|
||||
funcTextEdit = std::make_unique<QPlainTextEdit>(func);
|
||||
funcTextEdit->setReadOnly(true);
|
||||
}
|
||||
QPushButton *cancel = new QPushButton("&Cancel");
|
||||
std::unique_ptr<QPushButton> cancel = std::make_unique<QPushButton>("&Cancel");
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(label);
|
||||
layout->addWidget(theoTextEdit);
|
||||
std::unique_ptr<QVBoxLayout> layout = std::make_unique<QVBoxLayout>();
|
||||
layout->addWidget(label.get());
|
||||
layout->addWidget(theoTextEdit.get());
|
||||
if (funcTextEdit)
|
||||
layout->addWidget(funcTextEdit);
|
||||
layout->addWidget(cancel);
|
||||
layout->addWidget(funcTextEdit.get());
|
||||
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>");
|
||||
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->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::make_unique<QLineEdit>();
|
||||
fYear->setValidator(new QIntValidator());
|
||||
QDate date = QDate::currentDate();
|
||||
fYear->setText(QString("%1").arg(date.year()));
|
||||
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.");
|
||||
|
||||
fRunNumber = new QLineEdit();
|
||||
fRunNumber = std::make_unique<QLineEdit>();
|
||||
fRunNumber->setValidator(new QIntValidator());
|
||||
fRunNumber->setText(QString("%1").arg(fMsrData->getRunNumber()));
|
||||
fRunNumber->setToolTip("enter the run number here.");
|
||||
|
||||
fInstitute = new QComboBox();
|
||||
fInstitute = std::make_unique<QComboBox>();
|
||||
QStringList list = fAdmin->getInstituteList(); // get list form the instrument_def's
|
||||
list.prepend("UnDef");
|
||||
fInstitute->addItems(list);
|
||||
@ -483,7 +484,7 @@ PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
||||
if (idx != -1)
|
||||
fInstitute->setCurrentIndex(idx);
|
||||
|
||||
fInstrument = new QComboBox();
|
||||
fInstrument = std::make_unique<QComboBox>();
|
||||
list.clear();
|
||||
list << fAdmin->getInstrumentList(fMsrData->getInstitute());
|
||||
list.prepend("UnDef");
|
||||
@ -492,20 +493,20 @@ PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
||||
if (idx != -1)
|
||||
fInstrument->setCurrentIndex(idx);
|
||||
|
||||
fFitType = new QComboBox();
|
||||
fFitType = std::make_unique<QComboBox>();
|
||||
list.clear();
|
||||
list << "UnDef" << "Single Histo" << "Single Histo RRF" << "Asymmetry" << "Asymmetry RRF" << "Mu Minus" << "None muSR";
|
||||
fFitType->addItems(list);
|
||||
idx = fFitType->findText(fAdmin->getDefaultFitType());
|
||||
fFitType->setCurrentIndex(idx);
|
||||
|
||||
fMeasurementType = new QComboBox();
|
||||
fMeasurementType = std::make_unique<QComboBox>();
|
||||
list.clear();
|
||||
list << "UnDef" << "ZF" << "TF" << "LF";
|
||||
fMeasurementType->addItems(list);
|
||||
fMeasurementType->setCurrentIndex(fMsrData->getTypeOfMeasurement());
|
||||
|
||||
fT0 = new QComboBox();
|
||||
fT0 = std::make_unique<QComboBox>();
|
||||
list.clear();
|
||||
list << "from data file" << "call musrT0" << "enter here";
|
||||
fT0->addItems(list);
|
||||
@ -514,23 +515,23 @@ PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
||||
|
||||
QFormLayout *layout = new QFormLayout;
|
||||
|
||||
layout->addRow("Add msr-file name:", fMsrFileName);
|
||||
layout->addRow("Year:", fYear);
|
||||
layout->addRow("Run Number:", fRunNumber);
|
||||
layout->addRow("Institute:", fInstitute);
|
||||
layout->addRow("Instrument:", fInstrument);
|
||||
layout->addRow("Fit Type:", fFitType);
|
||||
layout->addRow("Type of Measurement:", fMeasurementType);
|
||||
layout->addRow("T0's:", fT0);
|
||||
layout->addRow("Add msr-file name:", fMsrFileName.get());
|
||||
layout->addRow("Year:", fYear.get());
|
||||
layout->addRow("Run Number:", fRunNumber.get());
|
||||
layout->addRow("Institute:", fInstitute.get());
|
||||
layout->addRow("Instrument:", fInstrument.get());
|
||||
layout->addRow("Fit Type:", fFitType.get());
|
||||
layout->addRow("Type of Measurement:", fMeasurementType.get());
|
||||
layout->addRow("T0's:", fT0.get());
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
registerField("runNumber*", fRunNumber);
|
||||
registerField("runNumber*", fRunNumber.get());
|
||||
|
||||
QObject::connect(fInstitute, SIGNAL(activated(int)), this, SLOT(handleInstituteChanged(int)));
|
||||
QObject::connect(fFitType, SIGNAL(activated(int)), this , SLOT(handleFitType(int)));
|
||||
QObject::connect(fMeasurementType, SIGNAL(activated(int)), this, SLOT(checkSetup(int)));
|
||||
QObject::connect(fT0, SIGNAL(activated(int)), this, SLOT(handleT0(int)));
|
||||
QObject::connect(fInstitute.get(), SIGNAL(activated(int)), this, SLOT(handleInstituteChanged(int)));
|
||||
QObject::connect(fFitType.get(), SIGNAL(activated(int)), this , SLOT(handleFitType(int)));
|
||||
QObject::connect(fMeasurementType.get(), SIGNAL(activated(int)), this, SLOT(checkSetup(int)));
|
||||
QObject::connect(fT0.get(), SIGNAL(activated(int)), this, SLOT(handleT0(int)));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -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());
|
||||
setSubTitle(str);
|
||||
|
||||
fTheo = new QPlainTextEdit();
|
||||
fTheo = std::make_unique<QPlainTextEdit>();
|
||||
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->hide();
|
||||
|
||||
fClearAll = new QPushButton();
|
||||
fClearAll = std::make_unique<QPushButton>();
|
||||
fClearAll->setText("Clear All");
|
||||
fClearAll->setToolTip("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->setToolTip("check if the theory is valid.");
|
||||
fCheckTheo->setWhatsThis("Check is the theory string is valid.");
|
||||
|
||||
QVector<PTheoTemplate> templ = fAdmin->getTheoTemplates();
|
||||
QVector<PMusrfitFunc> funcs = fAdmin->getMusrfitFunc();
|
||||
fTheoSelect = new QComboBox();
|
||||
fTheoSelect = std::make_unique<QComboBox>();
|
||||
QStringList list;
|
||||
// all the templates defined in musrfit_func.xml
|
||||
for (int i=0; i<templ.size(); i++) {
|
||||
@ -716,25 +717,25 @@ PTheoPage::PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent) :
|
||||
fTheoSelect->addItems(list);
|
||||
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();
|
||||
hLayout->addWidget(fTheoSelect);
|
||||
hLayout->addWidget(fTheoAdd);
|
||||
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||
hLayout->addWidget(fTheoSelect.get());
|
||||
hLayout->addWidget(fTheoAdd.get());
|
||||
|
||||
QFormLayout *layout = new QFormLayout;
|
||||
layout->addRow("Enter Theory:", fTheo);
|
||||
layout->addRow(fEditTemplate);
|
||||
layout->addRow("Clear Theory:", fClearAll);
|
||||
layout->addRow("Enter Theory:", fTheo.get());
|
||||
layout->addRow(fEditTemplate.get());
|
||||
layout->addRow("Clear Theory:", fClearAll.get());
|
||||
layout->addRow("Pre Def. Theory Select:", hLayout);
|
||||
layout->addRow("Press for Validation:", fCheckTheo);
|
||||
layout->addRow("Press for Validation:", fCheckTheo.get());
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
QObject::connect(fEditTemplate, SIGNAL(stateChanged(int)), this, SLOT(templateState(int)));
|
||||
QObject::connect(fClearAll, SIGNAL(clicked()), this, SLOT(clearAll()));
|
||||
QObject::connect(fCheckTheo, SIGNAL(clicked()), this, SLOT(checkTheory()));
|
||||
QObject::connect(fTheoAdd, SIGNAL(clicked()), this, SLOT(addTheory()));
|
||||
QObject::connect(fEditTemplate.get(), SIGNAL(stateChanged(int)), this, SLOT(templateState(int)));
|
||||
QObject::connect(fClearAll.get(), SIGNAL(clicked()), this, SLOT(clearAll()));
|
||||
QObject::connect(fCheckTheo.get(), SIGNAL(clicked()), this, SLOT(checkTheory()));
|
||||
QObject::connect(fTheoAdd.get(), SIGNAL(clicked()), this, SLOT(addTheory()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -951,7 +952,7 @@ void PTheoPage::checkTheory()
|
||||
fTheoValid = true;
|
||||
|
||||
QObject *obj = sender();
|
||||
if (obj == fCheckTheo)
|
||||
if (obj == (QObject*)fCheckTheo.get())
|
||||
QMessageBox::information(this, "Check Theory", "Theory seems to be OK.");
|
||||
}
|
||||
|
||||
@ -1188,7 +1189,6 @@ PMapPage::PMapPage(PMsrData *data, QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
fMsrData(data)
|
||||
{
|
||||
fMapPageLayout = 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -1214,8 +1214,8 @@ void PMapPage::initializePage()
|
||||
// sort maps
|
||||
fMsrData->sort("map");
|
||||
|
||||
fMapPageLayout = new QFormLayout;
|
||||
setLayout(fMapPageLayout);
|
||||
fMapPageLayout = std::make_unique<QFormLayout>();
|
||||
setLayout(fMapPageLayout.get());
|
||||
|
||||
// make sure that the map list is empty
|
||||
fMapGuiVec.clear();
|
||||
@ -1276,12 +1276,12 @@ void PMapPage::initializePage()
|
||||
fMapPageLayout->addRow(QString("map%1").arg(i+1), hLayout);
|
||||
}
|
||||
|
||||
fShowTheo = new QPushButton("Show &Theory");
|
||||
fMapPageLayout->addRow(fShowTheo);
|
||||
fShowTheo = std::make_unique<QPushButton>("Show &Theory");
|
||||
fMapPageLayout->addRow(fShowTheo.get());
|
||||
|
||||
update();
|
||||
|
||||
connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||
connect(fShowTheo.get(), SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -1346,18 +1346,18 @@ PFuncPage::PFuncPage(PMsrData *data, QWidget *parent) :
|
||||
QString str = QString("Now you will need to enter your functions. Fit type: %1").arg(fMsrData->getFitTypeString());
|
||||
setSubTitle(str);
|
||||
|
||||
fFunc = new QPlainTextEdit();
|
||||
fFunc = std::make_unique<QPlainTextEdit>();
|
||||
fFunc->setWhatsThis("Enter the function(s) here.");
|
||||
|
||||
fShowTheo = new QPushButton("Show &Theory");
|
||||
fShowTheo = std::make_unique<QPushButton>("Show &Theory");
|
||||
|
||||
QFormLayout *layout = new QFormLayout;
|
||||
layout->addRow("Enter Function(s):", fFunc);
|
||||
layout->addRow(fShowTheo);
|
||||
layout->addRow("Enter Function(s):", fFunc.get());
|
||||
layout->addRow(fShowTheo.get());
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||
connect(fShowTheo.get(), SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -1449,8 +1449,16 @@ bool PFuncPage::validatePage()
|
||||
while ((idx = str.indexOf("par", idx)) != -1) {
|
||||
tok = "";
|
||||
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()) {
|
||||
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);
|
||||
if (ok) {
|
||||
@ -1460,6 +1468,9 @@ bool PFuncPage::validatePage()
|
||||
param.setValue(0.0);
|
||||
param.setStep(0.1);
|
||||
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);
|
||||
@ -1471,8 +1482,16 @@ bool PFuncPage::validatePage()
|
||||
while ((idx = str.indexOf("map", idx)) != -1) {
|
||||
tok = "";
|
||||
idx += 3;
|
||||
while (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;
|
||||
}
|
||||
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);
|
||||
if (ok) {
|
||||
@ -1480,6 +1499,9 @@ bool PFuncPage::validatePage()
|
||||
sstr = QString("map%1").arg(mapNo);
|
||||
map.setName(sstr);
|
||||
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);
|
||||
@ -1537,7 +1559,6 @@ PParamPage::PParamPage(PMsrData *data, QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
fMsrData(data)
|
||||
{
|
||||
fParameterPageLayout = 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -1563,8 +1584,8 @@ void PParamPage::initializePage()
|
||||
QString str = QString("Here you can fine tune your parameters. Fit type: %1").arg(fMsrData->getFitTypeString());
|
||||
setSubTitle(str);
|
||||
|
||||
fParameterPageLayout = new QFormLayout;
|
||||
setLayout(fParameterPageLayout);
|
||||
fParameterPageLayout = std::make_unique<QFormLayout>();
|
||||
setLayout(fParameterPageLayout.get());
|
||||
|
||||
// make sure that parameter list is empty
|
||||
fParamGuiVec.clear();
|
||||
@ -1623,12 +1644,12 @@ void PParamPage::initializePage()
|
||||
fParameterPageLayout->addRow(QString("%1").arg(i+1), hLayout);
|
||||
}
|
||||
|
||||
fShowTheo = new QPushButton("Show &Theory");
|
||||
fParameterPageLayout->addRow(fShowTheo);
|
||||
fShowTheo = std::make_unique<QPushButton>("Show &Theory");
|
||||
fParameterPageLayout->addRow(fShowTheo.get());
|
||||
|
||||
update();
|
||||
|
||||
connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||
connect(fShowTheo.get(), SIGNAL(pressed()), this, SLOT(showTheo()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -1692,25 +1713,25 @@ PFitInfoPage::PFitInfoPage(PMsrData *data, QWidget *parent) :
|
||||
QString str = QString("Collect necessary fit information. Fit type: %1").arg(fMsrData->getFitTypeString());
|
||||
setSubTitle(str);
|
||||
|
||||
fFitRangeStart = new QLineEdit("0.0");
|
||||
fFitRangeStart = std::make_unique<QLineEdit>("0.0");
|
||||
fFitRangeStart->setValidator(new QDoubleValidator());
|
||||
fFitRangeEnd = new QLineEdit("9.0");
|
||||
fFitRangeEnd = std::make_unique<QLineEdit>("9.0");
|
||||
fFitRangeEnd->setValidator(new QDoubleValidator());
|
||||
|
||||
QHBoxLayout *hLayout = new QHBoxLayout();
|
||||
hLayout->addWidget(fFitRangeStart);
|
||||
hLayout->addWidget(fFitRangeEnd);
|
||||
hLayout->addWidget(fFitRangeStart.get());
|
||||
hLayout->addWidget(fFitRangeEnd.get());
|
||||
|
||||
fPacking = new QLineEdit("1");
|
||||
fPacking = std::make_unique<QLineEdit>("1");
|
||||
fPacking->setValidator(new QIntValidator());
|
||||
|
||||
fCommands = new QPlainTextEdit();
|
||||
fCommands = std::make_unique<QPlainTextEdit>();
|
||||
fCommands->setPlainText("#MAX_LIKELIHOOD\nPRINT_LEVEL 2\nMINIMIZE\nMINOS\nSAVE");
|
||||
|
||||
QFormLayout *layout = new QFormLayout;
|
||||
layout->addRow("Fit Range:", hLayout);
|
||||
layout->addRow("Packing:", fPacking);
|
||||
layout->addRow("Commands:", fCommands);
|
||||
layout->addRow("Packing:", fPacking.get());
|
||||
layout->addRow("Commands:", fCommands.get());
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
@ -1776,22 +1797,22 @@ PConclusionPage::PConclusionPage(PAdmin *admin, PMsrData *data, QString *msrFile
|
||||
|
||||
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||
|
||||
fMsrPathFileLabel = new QLabel("Current msr-File Path:");
|
||||
fMsrFilePathLineEdit = new QLineEdit(ddir.absolutePath());
|
||||
fMsrPathFileLabel = std::make_unique<QLabel>("Current msr-File Path:");
|
||||
fMsrFilePathLineEdit = std::make_unique<QLineEdit>(ddir.absolutePath());
|
||||
fMsrFilePathLineEdit->setReadOnly(true);
|
||||
fSaveAsMsrFile = new QPushButton("Save As (msr-file path)");
|
||||
fSaveAsTemplate = new QPushButton("Save As (template)");
|
||||
fSaveAsMsrFile = std::make_unique<QPushButton>("Save As (msr-file path)");
|
||||
fSaveAsTemplate = std::make_unique<QPushButton>("Save As (template)");
|
||||
|
||||
vLayout->addWidget(fMsrPathFileLabel);
|
||||
vLayout->addWidget(fMsrFilePathLineEdit);
|
||||
vLayout->addWidget(fSaveAsMsrFile);
|
||||
vLayout->addWidget(fMsrPathFileLabel.get());
|
||||
vLayout->addWidget(fMsrFilePathLineEdit.get());
|
||||
vLayout->addWidget(fSaveAsMsrFile.get());
|
||||
vLayout->addStretch(1);
|
||||
vLayout->addWidget(fSaveAsTemplate);
|
||||
vLayout->addWidget(fSaveAsTemplate.get());
|
||||
|
||||
setLayout(vLayout);
|
||||
|
||||
connect(fSaveAsMsrFile, SIGNAL(pressed()), this, SLOT(saveAsMsrFile()));
|
||||
connect(fSaveAsTemplate, SIGNAL(pressed()), this, SLOT(saveAsTemplate()));
|
||||
connect(fSaveAsMsrFile.get(), SIGNAL(pressed()), this, SLOT(saveAsMsrFile()));
|
||||
connect(fSaveAsTemplate.get(), SIGNAL(pressed()), this, SLOT(saveAsTemplate()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -1987,15 +2008,6 @@ PMusrWiz::PMusrWiz(PAdmin *admin, PMsrData *msrData, QWidget *parent) :
|
||||
QObject::connect(this, SIGNAL(helpRequested()), this, SLOT(help()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PMusrWiz::~PMusrWiz
|
||||
*/
|
||||
PMusrWiz::~PMusrWiz()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PMusrWiz::writeMsrFile
|
||||
@ -2539,6 +2551,8 @@ QString PMusrWiz::getRunName(PInstrument *instru)
|
||||
if (idx != -1) {
|
||||
do {
|
||||
count++;
|
||||
if (idx+count >= runTemplate.length())
|
||||
break;
|
||||
} while (runTemplate[idx+count] == 'N');
|
||||
}
|
||||
if (count >= 4)
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PMUSRWIZ_
|
||||
#define _PMUSRWIZ_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QWizard>
|
||||
@ -204,14 +206,14 @@ class PIntroPage : public QWizardPage
|
||||
PAdmin *fAdmin;
|
||||
PMsrData *fMsrData;
|
||||
|
||||
QLineEdit *fMsrFileName;
|
||||
QLineEdit *fYear;
|
||||
QLineEdit *fRunNumber;
|
||||
QComboBox *fInstitute;
|
||||
QComboBox *fInstrument;
|
||||
QComboBox *fFitType;
|
||||
QComboBox *fMeasurementType;
|
||||
QComboBox *fT0;
|
||||
std::unique_ptr<QLineEdit> fMsrFileName;
|
||||
std::unique_ptr<QLineEdit> fYear;
|
||||
std::unique_ptr<QLineEdit> fRunNumber;
|
||||
std::unique_ptr<QComboBox> fInstitute;
|
||||
std::unique_ptr<QComboBox> fInstrument;
|
||||
std::unique_ptr<QComboBox> fFitType;
|
||||
std::unique_ptr<QComboBox> fMeasurementType;
|
||||
std::unique_ptr<QComboBox> fT0;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@ -246,12 +248,12 @@ class PTheoPage : public QWizardPage
|
||||
QVector<PParam> fMapList;
|
||||
QVector<int> fFunList;
|
||||
|
||||
QPlainTextEdit *fTheo;
|
||||
QCheckBox *fEditTemplate;
|
||||
QPushButton *fClearAll;
|
||||
QComboBox *fTheoSelect;
|
||||
QPushButton *fTheoAdd;
|
||||
QPushButton *fCheckTheo;
|
||||
std::unique_ptr<QPlainTextEdit> fTheo;
|
||||
std::unique_ptr<QCheckBox> fEditTemplate;
|
||||
std::unique_ptr<QPushButton> fClearAll;
|
||||
std::unique_ptr<QComboBox> fTheoSelect;
|
||||
std::unique_ptr<QPushButton> fTheoAdd;
|
||||
std::unique_ptr<QPushButton> fCheckTheo;
|
||||
|
||||
QString getTheoryFunction(int idx);
|
||||
bool analyzeTokens(QString str, int noOfTokens);
|
||||
@ -279,9 +281,8 @@ class PFuncPage : public QWizardPage
|
||||
private:
|
||||
PMsrData *fMsrData;
|
||||
|
||||
QFormLayout *fMapPageLayout;
|
||||
QPlainTextEdit *fFunc;
|
||||
QPushButton *fShowTheo;
|
||||
std::unique_ptr<QPlainTextEdit> fFunc;
|
||||
std::unique_ptr<QPushButton> fShowTheo;
|
||||
|
||||
int getFuncNo(const QString str);
|
||||
};
|
||||
@ -304,9 +305,9 @@ class PMapPage : public QWizardPage
|
||||
private:
|
||||
PMsrData *fMsrData;
|
||||
|
||||
QFormLayout *fMapPageLayout;
|
||||
std::unique_ptr<QFormLayout> fMapPageLayout;
|
||||
QVector<PParamGui> fMapGuiVec;
|
||||
QPushButton *fShowTheo;
|
||||
std::unique_ptr<QPushButton> fShowTheo;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@ -327,9 +328,9 @@ class PParamPage : public QWizardPage
|
||||
private:
|
||||
PMsrData *fMsrData;
|
||||
|
||||
QFormLayout *fParameterPageLayout;
|
||||
std::unique_ptr<QFormLayout> fParameterPageLayout;
|
||||
QVector<PParamGui> fParamGuiVec;
|
||||
QPushButton *fShowTheo;
|
||||
std::unique_ptr<QPushButton> fShowTheo;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@ -347,10 +348,10 @@ class PFitInfoPage : public QWizardPage
|
||||
private:
|
||||
PMsrData *fMsrData;
|
||||
|
||||
QLineEdit *fFitRangeStart;
|
||||
QLineEdit *fFitRangeEnd;
|
||||
QLineEdit *fPacking;
|
||||
QPlainTextEdit *fCommands;
|
||||
std::unique_ptr<QLineEdit> fFitRangeStart;
|
||||
std::unique_ptr<QLineEdit> fFitRangeEnd;
|
||||
std::unique_ptr<QLineEdit> fPacking;
|
||||
std::unique_ptr<QPlainTextEdit> fCommands;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@ -370,10 +371,10 @@ class PConclusionPage : public QWizardPage
|
||||
PAdmin *fAdmin;
|
||||
PMsrData *fMsrData;
|
||||
|
||||
QLabel *fMsrPathFileLabel;
|
||||
QLineEdit *fMsrFilePathLineEdit;
|
||||
QPushButton *fSaveAsMsrFile;
|
||||
QPushButton *fSaveAsTemplate;
|
||||
std::unique_ptr<QLabel> fMsrPathFileLabel;
|
||||
std::unique_ptr<QLineEdit> fMsrFilePathLineEdit;
|
||||
std::unique_ptr<QPushButton> fSaveAsMsrFile;
|
||||
std::unique_ptr<QPushButton> fSaveAsTemplate;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@ -391,7 +392,6 @@ class PMusrWiz : public QWizard
|
||||
public:
|
||||
PMusrWiz(QWidget *parent=Q_NULLPTR);
|
||||
PMusrWiz(PAdmin *admin, PMsrData *msrData, QWidget *parent=Q_NULLPTR);
|
||||
virtual ~PMusrWiz();
|
||||
|
||||
private slots:
|
||||
virtual int writeMsrFile(int result);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
@ -83,16 +84,18 @@ int main(int argc, char *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()) {
|
||||
delete admin;
|
||||
return 1;
|
||||
}
|
||||
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();
|
||||
|
||||
app.exec();
|
||||
@ -138,10 +141,5 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (info)
|
||||
delete info;
|
||||
if (admin)
|
||||
delete admin;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user