Raw -> Smart Pointers for mupp, qt5/qt6.
This commit is contained in:
parent
3d149dc6ab
commit
51520868f1
@ -290,10 +290,10 @@ bool PParamDataHandler::ReadParamFile(const QStringList fln, QString &errorMsg)
|
||||
|
||||
// make sure that the system environment variables are properly set
|
||||
QString cmd("");
|
||||
fProc = new QProcess(this);
|
||||
connect( fProc, SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc, SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc, SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT( processDone(int, QProcess::ExitStatus) ) );
|
||||
fProc = std::make_unique<QProcess>(this);
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc.get(), SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT( processDone(int, QProcess::ExitStatus) ) );
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
#if defined(Q_OS_DARWIN)
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PMUPP_H_
|
||||
#define _PMUPP_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
@ -156,7 +158,7 @@ class PParamDataHandler : public QObject {
|
||||
void newData();
|
||||
|
||||
private:
|
||||
QProcess *fProc; ///< this will be needed if msr2data needs to be called
|
||||
std::unique_ptr<QProcess> fProc; ///< this will be needed if msr2data needs to be called
|
||||
QVector<PmuppCollection> fCollection; ///< all the collections handeled
|
||||
|
||||
bool analyzeFileList(const QStringList &fln, QString &collectionName,
|
||||
|
@ -242,13 +242,8 @@ PmuppGui::PmuppGui(QStringList fln)
|
||||
fDatime = dt.toTime_t();
|
||||
fMuppInstance = -1;
|
||||
|
||||
fMuppPlot = nullptr;
|
||||
fNormalizeAction = nullptr;
|
||||
|
||||
fNormalize = false;
|
||||
|
||||
fVarDlg = nullptr;
|
||||
|
||||
fMacroPath = QString("./");
|
||||
fMacroName = QString("");
|
||||
|
||||
@ -287,135 +282,135 @@ PmuppGui::PmuppGui(QStringList fln)
|
||||
setupHelpActions();
|
||||
|
||||
// create central widget
|
||||
fCentralWidget = new QWidget(this);
|
||||
fCentralWidget = std::make_unique<QWidget>(this);
|
||||
|
||||
// setup widgets
|
||||
fBoxLayout_Main = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||
fBoxLayout_Main = std::make_unique<QBoxLayout>(QBoxLayout::TopToBottom);
|
||||
fBoxLayout_Main->setGeometry(QRect(10, 40, 600, 500));
|
||||
|
||||
fBoxLayout_Top = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||
fGridLayout_Left = new QGridLayout();
|
||||
fGridLayout_Right = new QGridLayout();
|
||||
fBoxLayout_Cmd = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||
fBoxLayout_Top = std::make_unique<QBoxLayout>(QBoxLayout::LeftToRight);
|
||||
fGridLayout_Left = std::make_unique<QGridLayout>();
|
||||
fGridLayout_Right = std::make_unique<QGridLayout>();
|
||||
fBoxLayout_Cmd = std::make_unique<QBoxLayout>(QBoxLayout::LeftToRight);
|
||||
|
||||
// label for the collection/parameter list widgets
|
||||
fColLabel = new QLabel(this);
|
||||
fColLabel = std::make_unique<QLabel>(this);
|
||||
fColLabel->setText("Collection -> Parameter");
|
||||
fColLabel->setMaximumHeight(15);
|
||||
|
||||
// central widget for the collection/parameter list widgets
|
||||
fColParamSplitter = new QSplitter(Qt::Horizontal, this);
|
||||
fColParamSplitter = std::make_unique<QSplitter>(Qt::Horizontal, this);
|
||||
fColParamSplitter->setMinimumSize(550,330);
|
||||
|
||||
fColList = new QListWidget(this);
|
||||
fColList = std::make_unique<QListWidget>(this);
|
||||
fColList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
fParamList = new QListWidget(this);
|
||||
fParamList = std::make_unique<QListWidget>(this);
|
||||
// the next two lines enable drag and drop facility (drag)
|
||||
fParamList->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
fParamList->setDragEnabled(true);
|
||||
|
||||
fColParamSplitter->addWidget(fColList);
|
||||
fColParamSplitter->addWidget(fParamList);
|
||||
fColParamSplitter->addWidget(fColList.get());
|
||||
fColParamSplitter->addWidget(fParamList.get());
|
||||
|
||||
fRemoveCollection = new QPushButton("Remove Collection", this);
|
||||
fRefreshCollection = new QPushButton("Refresh Collection", this);
|
||||
fRemoveCollection = std::make_unique<QPushButton>("Remove Collection", this);
|
||||
fRefreshCollection = std::make_unique<QPushButton>("Refresh Collection", this);
|
||||
|
||||
fGridLayout_Left->addWidget(fColLabel, 1, 1, 1, 2);
|
||||
fGridLayout_Left->addWidget(fColParamSplitter, 2, 1, 1, 2);
|
||||
fGridLayout_Left->addWidget(fRemoveCollection, 3, 1);
|
||||
fGridLayout_Left->addWidget(fRefreshCollection, 3, 2);
|
||||
fGridLayout_Left->addWidget(fColLabel.get(), 1, 1, 1, 2);
|
||||
fGridLayout_Left->addWidget(fColParamSplitter.get(), 2, 1, 1, 2);
|
||||
fGridLayout_Left->addWidget(fRemoveCollection.get(), 3, 1);
|
||||
fGridLayout_Left->addWidget(fRefreshCollection.get(), 3, 2);
|
||||
|
||||
// X-axis
|
||||
fXaxisLabel = new QLabel("x-axis");
|
||||
fViewX = new QListWidget(this);
|
||||
fXaxisLabel = std::make_unique<QLabel>("x-axis");
|
||||
fViewX = std::make_unique<QListWidget>(this);
|
||||
// the next two lines enable drag and drop facility (copy drop)
|
||||
fViewX->viewport()->setAcceptDrops(true);
|
||||
fViewX->setDropIndicatorShown(true);
|
||||
|
||||
fAddX = new QPushButton("add X", this);
|
||||
fRemoveX = new QPushButton("remove X", this);
|
||||
fAddX = std::make_unique<QPushButton>("add X", this);
|
||||
fRemoveX = std::make_unique<QPushButton>("remove X", this);
|
||||
|
||||
// Y-axis
|
||||
fYaxisLabel = new QLabel("y-axis");
|
||||
fViewY = new QListWidget(this);
|
||||
fYaxisLabel = std::make_unique<QLabel>("y-axis");
|
||||
fViewY = std::make_unique<QListWidget>(this);
|
||||
// the next two lines enable drag and drop facility (copy drop)
|
||||
fViewY->viewport()->setAcceptDrops(true);
|
||||
fViewY->setDropIndicatorShown(true);
|
||||
|
||||
fAddY = new QPushButton("add Y", this);
|
||||
fRemoveY = new QPushButton("remove Y", this);
|
||||
fAddY = std::make_unique<QPushButton>("add Y", this);
|
||||
fRemoveY = std::make_unique<QPushButton>("remove Y", this);
|
||||
|
||||
// 2 column button's for the right grid
|
||||
fAddDitto = new QPushButton("Add Ditto", this);
|
||||
fPlot = new QPushButton("Plot", this);
|
||||
fAddDitto = std::make_unique<QPushButton>("Add Ditto", this);
|
||||
fPlot = std::make_unique<QPushButton>("Plot", this);
|
||||
|
||||
fGridLayout_Right->addWidget(fXaxisLabel, 1, 1);
|
||||
fGridLayout_Right->addWidget(fYaxisLabel, 1, 2);
|
||||
fGridLayout_Right->addWidget(fViewX, 2, 1);
|
||||
fGridLayout_Right->addWidget(fViewY, 2, 2);
|
||||
fGridLayout_Right->addWidget(fAddX, 3, 1);
|
||||
fGridLayout_Right->addWidget(fAddY, 3, 2);
|
||||
fGridLayout_Right->addWidget(fRemoveX, 4, 1);
|
||||
fGridLayout_Right->addWidget(fRemoveY, 4, 2);
|
||||
fGridLayout_Right->addWidget(fAddDitto, 5, 1, 1, 2);
|
||||
fGridLayout_Right->addWidget(fPlot, 6, 1, 1, 2);
|
||||
fGridLayout_Right->addWidget(fXaxisLabel.get(), 1, 1);
|
||||
fGridLayout_Right->addWidget(fYaxisLabel.get(), 1, 2);
|
||||
fGridLayout_Right->addWidget(fViewX.get(), 2, 1);
|
||||
fGridLayout_Right->addWidget(fViewY.get(), 2, 2);
|
||||
fGridLayout_Right->addWidget(fAddX.get(), 3, 1);
|
||||
fGridLayout_Right->addWidget(fAddY.get(), 3, 2);
|
||||
fGridLayout_Right->addWidget(fRemoveX.get(), 4, 1);
|
||||
fGridLayout_Right->addWidget(fRemoveY.get(), 4, 2);
|
||||
fGridLayout_Right->addWidget(fAddDitto.get(), 5, 1, 1, 2);
|
||||
fGridLayout_Right->addWidget(fPlot.get(), 6, 1, 1, 2);
|
||||
|
||||
fBoxLayout_Top->addLayout(fGridLayout_Left);
|
||||
fBoxLayout_Top->addLayout(fGridLayout_Right);
|
||||
fBoxLayout_Top->addLayout(fGridLayout_Left.get());
|
||||
fBoxLayout_Top->addLayout(fGridLayout_Right.get());
|
||||
|
||||
fCmdLineHistory = new QPlainTextEdit(this);
|
||||
fCmdLineHistory = std::make_unique<QPlainTextEdit>(this);
|
||||
fCmdLineHistory->setReadOnly(true);
|
||||
fCmdLineHistory->setMaximumBlockCount(50);
|
||||
// fill cmd history
|
||||
for (int i=0; i<fCmdHistory.size(); i++)
|
||||
fCmdLineHistory->insertPlainText(QString("%1\n").arg(fCmdHistory[i]));
|
||||
fCmdLine = new QLineEdit(this);
|
||||
fCmdLine = std::make_unique<QLineEdit>(this);
|
||||
fCmdLine->installEventFilter(this);
|
||||
fCmdLine->setText("$ ");
|
||||
fCmdLine->setFocus(); // sets the keyboard focus
|
||||
fExitButton = new QPushButton("E&xit", this);
|
||||
fExitButton = std::make_unique<QPushButton>("E&xit", this);
|
||||
|
||||
QVBoxLayout *cmdLayout = new QVBoxLayout;
|
||||
QLabel *cmdLabel = new QLabel("History:");
|
||||
cmdLayout->addWidget(cmdLabel);
|
||||
cmdLayout->addWidget(fCmdLineHistory);
|
||||
cmdLayout->addWidget(fCmdLine);
|
||||
cmdLayout->addWidget(fCmdLineHistory.get());
|
||||
cmdLayout->addWidget(fCmdLine.get());
|
||||
|
||||
fBoxLayout_Cmd = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||
fBoxLayout_Cmd = std::make_unique<QBoxLayout>(QBoxLayout::LeftToRight);
|
||||
fBoxLayout_Cmd->addLayout(cmdLayout);
|
||||
fBoxLayout_Cmd->addWidget(fExitButton);
|
||||
fBoxLayout_Cmd->setAlignment(fCmdLine, Qt::AlignBottom);
|
||||
fBoxLayout_Cmd->setAlignment(fExitButton, Qt::AlignBottom);
|
||||
fBoxLayout_Cmd->addWidget(fExitButton.get());
|
||||
fBoxLayout_Cmd->setAlignment(fCmdLine.get(), Qt::AlignBottom);
|
||||
fBoxLayout_Cmd->setAlignment(fExitButton.get(), Qt::AlignBottom);
|
||||
|
||||
fCmdSplitter = new QSplitter(Qt::Vertical, this);
|
||||
fCmdSplitter = std::make_unique<QSplitter>(Qt::Vertical, this);
|
||||
QWidget *topWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
||||
topWidget->setLayout(fBoxLayout_Top);
|
||||
topWidget->setLayout(fBoxLayout_Top.get());
|
||||
QWidget *cmdWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
||||
cmdWidget->setLayout(fBoxLayout_Cmd);
|
||||
cmdWidget->setLayout(fBoxLayout_Cmd.get());
|
||||
fCmdSplitter->addWidget(topWidget);
|
||||
fCmdSplitter->addWidget(cmdWidget);
|
||||
|
||||
fBoxLayout_Main->addWidget(fCmdSplitter);
|
||||
fBoxLayout_Main->addWidget(fCmdSplitter.get());
|
||||
|
||||
// establish all the necessary signal/slots
|
||||
connect(fRefreshCollection, SIGNAL( pressed() ), this, SLOT( refresh() ));
|
||||
connect(fRemoveCollection, SIGNAL( pressed() ), this, SLOT( remove() ));
|
||||
connect(fAddX, SIGNAL( pressed() ), this, SLOT( addX() ));
|
||||
connect(fAddY, SIGNAL( pressed() ), this, SLOT( addY() ));
|
||||
connect(fRemoveX, SIGNAL( pressed() ), this, SLOT( removeX() ));
|
||||
connect(fRemoveY, SIGNAL( pressed() ), this, SLOT( removeY() ));
|
||||
connect(fAddDitto, SIGNAL( pressed() ), this, SLOT( addDitto() ));
|
||||
connect(fPlot, SIGNAL( pressed()), this, SLOT( plot()) );
|
||||
connect(fCmdLine, SIGNAL ( returnPressed() ), this, SLOT( handleCmds() ));
|
||||
connect(fExitButton, SIGNAL( pressed() ), this, SLOT( aboutToQuit() ));
|
||||
connect(fRefreshCollection.get(), SIGNAL( pressed() ), this, SLOT( refresh() ));
|
||||
connect(fRemoveCollection.get(), SIGNAL( pressed() ), this, SLOT( remove() ));
|
||||
connect(fAddX.get(), SIGNAL( pressed() ), this, SLOT( addX() ));
|
||||
connect(fAddY.get(), SIGNAL( pressed() ), this, SLOT( addY() ));
|
||||
connect(fRemoveX.get(), SIGNAL( pressed() ), this, SLOT( removeX() ));
|
||||
connect(fRemoveY.get(), SIGNAL( pressed() ), this, SLOT( removeY() ));
|
||||
connect(fAddDitto.get(), SIGNAL( pressed() ), this, SLOT( addDitto() ));
|
||||
connect(fPlot.get(), SIGNAL( pressed()), this, SLOT( plot()) );
|
||||
connect(fCmdLine.get(), SIGNAL ( returnPressed() ), this, SLOT( handleCmds() ));
|
||||
connect(fExitButton.get(), SIGNAL( pressed() ), this, SLOT( aboutToQuit() ));
|
||||
|
||||
connect(fColList, SIGNAL( currentRowChanged(int) ), this, SLOT( updateParamList(int) ));
|
||||
connect(fColList, SIGNAL( itemDoubleClicked(QListWidgetItem*) ), this, SLOT( editCollName(QListWidgetItem*) ));
|
||||
connect(fColList.get(), SIGNAL( currentRowChanged(int) ), this, SLOT( updateParamList(int) ));
|
||||
connect(fColList.get(), SIGNAL( itemDoubleClicked(QListWidgetItem*) ), this, SLOT( editCollName(QListWidgetItem*) ));
|
||||
|
||||
connect(fViewX, SIGNAL( currentRowChanged(int) ), this, SLOT( refreshY() ));
|
||||
connect(fViewX, SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewX(QListWidgetItem*) ));
|
||||
connect(fViewY, SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewY(QListWidgetItem*) ));
|
||||
connect(fViewX.get(), SIGNAL( currentRowChanged(int) ), this, SLOT( refreshY() ));
|
||||
connect(fViewX.get(), SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewX(QListWidgetItem*) ));
|
||||
connect(fViewY.get(), SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewY(QListWidgetItem*) ));
|
||||
|
||||
// deal with parameter data specifics
|
||||
if (dataAtStartup)
|
||||
@ -423,8 +418,8 @@ PmuppGui::PmuppGui(QStringList fln)
|
||||
|
||||
connect(fParamDataHandler, SIGNAL( newData() ), this, SLOT( handleNewData() ));
|
||||
|
||||
fCentralWidget->setLayout(fBoxLayout_Main);
|
||||
setCentralWidget(fCentralWidget);
|
||||
fCentralWidget->setLayout(fBoxLayout_Main.get());
|
||||
setCentralWidget(fCentralWidget.get());
|
||||
|
||||
// in case there is no db/dat file list given open the db/dat file open menu automatically.
|
||||
if (fln.size() == 0) {
|
||||
@ -593,11 +588,11 @@ void PmuppGui::setupToolActions()
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
fNormalizeAction = new QAction(tr( "Normalize" ), this);
|
||||
fNormalizeAction = std::make_unique<QAction>(tr( "Normalize" ), this);
|
||||
fNormalizeAction->setStatusTip( tr("Plot Data Normalized (y-axis)") );
|
||||
fNormalizeAction->setCheckable(true);
|
||||
connect( fNormalizeAction, SIGNAL( changed() ), this, SLOT( normalize() ) );
|
||||
menu->addAction(fNormalizeAction);
|
||||
connect( fNormalizeAction.get(), SIGNAL( changed() ), this, SLOT( normalize() ) );
|
||||
menu->addAction(fNormalizeAction.get());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1319,13 +1314,10 @@ void PmuppGui::addVar()
|
||||
}
|
||||
|
||||
// call variable dialog
|
||||
if (fVarDlg != nullptr) {
|
||||
delete fVarDlg;
|
||||
fVarDlg = nullptr;
|
||||
}
|
||||
fVarDlg = new PVarDialog(collection_list, fDarkTheme);
|
||||
connect(fVarDlg, SIGNAL(check_request(QString,QVector<int>)), this, SLOT(check(QString,QVector<int>)));
|
||||
connect(fVarDlg, SIGNAL(add_request(QString,QVector<int>)), this, SLOT(add(QString,QVector<int>)));
|
||||
fVarDlg.reset();
|
||||
fVarDlg = std::make_unique<PVarDialog>(collection_list, fDarkTheme);
|
||||
connect(fVarDlg.get(), SIGNAL(check_request(QString,QVector<int>)), this, SLOT(check(QString,QVector<int>)));
|
||||
connect(fVarDlg.get(), SIGNAL(add_request(QString,QVector<int>)), this, SLOT(add(QString,QVector<int>)));
|
||||
fVarDlg->show();
|
||||
}
|
||||
|
||||
@ -2398,7 +2390,7 @@ void PmuppGui::plot()
|
||||
}
|
||||
|
||||
// start native ROOT parameter plot application if not already running
|
||||
if (fMuppPlot == 0) { // not running yet
|
||||
if (fMuppPlot == nullptr) { // not running yet
|
||||
startMuppPlot();
|
||||
} else {
|
||||
// check if mupp_plot is still running
|
||||
@ -2425,9 +2417,9 @@ void PmuppGui::startMuppPlot()
|
||||
// feed the mupp instance
|
||||
arg << QString("%1").arg(fMuppInstance);
|
||||
|
||||
fMuppPlot = new QProcess(this);
|
||||
fMuppPlot = std::make_unique<QProcess>(this);
|
||||
if (fMuppPlot == nullptr) {
|
||||
QMessageBox::critical(0, "**ERROR**", "Couldn't invoke QProcess for mupp_plot!");
|
||||
QMessageBox::critical(this, "**ERROR**", "Couldn't invoke QProcess for mupp_plot!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2443,7 +2435,7 @@ void PmuppGui::startMuppPlot()
|
||||
if (!fMuppPlot->waitForStarted()) {
|
||||
// error handling
|
||||
QString msg(tr("Could not execute the output command: ")+cmd);
|
||||
QMessageBox::critical( 0,
|
||||
QMessageBox::critical(this,
|
||||
tr("Fatal error"),
|
||||
msg,
|
||||
tr("Quit") );
|
||||
@ -2490,7 +2482,7 @@ void PmuppGui::handleCmds()
|
||||
fMacroName = tok[1];
|
||||
createMacro();
|
||||
} 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(this, "INFO", "set's eventually the path for the macros to be saved.");
|
||||
// will set the path to where to save the macro
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
|
||||
@ -2514,7 +2506,7 @@ void PmuppGui::handleCmds()
|
||||
QString fullPath = env.value(envVar); // get environment variable value if present, otherwise "" is returned
|
||||
if (fullPath.isEmpty()) {
|
||||
fMacroPath = "";
|
||||
QMessageBox::critical(0, "ERROR", QString("Environment variable '%1' not present. Typo?!").arg(envVar.prepend("$")));
|
||||
QMessageBox::critical(this, "ERROR", QString("Environment variable '%1' not present. Typo?!").arg(envVar.prepend("$")));
|
||||
return;
|
||||
}
|
||||
fMacroPath.replace(envVar.prepend("$"), fullPath);
|
||||
@ -2530,7 +2522,7 @@ void PmuppGui::handleCmds()
|
||||
if (tok.size() > 1)
|
||||
addX(tok[1]);
|
||||
else
|
||||
QMessageBox::critical(0, "ERROR", QString("Found command 'x' without variable."));
|
||||
QMessageBox::critical(this, "ERROR", QString("Found command 'x' without variable."));
|
||||
} else if (cmd.startsWith("y")) {
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
|
||||
@ -2540,7 +2532,7 @@ void PmuppGui::handleCmds()
|
||||
if (tok.size() > 1)
|
||||
addY(tok[1]);
|
||||
else
|
||||
QMessageBox::critical(0, "ERROR", QString("Found command 'y' without variable."));
|
||||
QMessageBox::critical(this, "ERROR", QString("Found command 'y' without variable."));
|
||||
} else if (cmd.startsWith("ditto")) {
|
||||
addDitto();
|
||||
} else if (cmd.startsWith("rmx")) {
|
||||
@ -2552,7 +2544,7 @@ void PmuppGui::handleCmds()
|
||||
if (tok.size() > 1)
|
||||
removeX(tok[1]);
|
||||
else
|
||||
QMessageBox::critical(0, "ERROR", QString("Found command 'rmx' without variable."));
|
||||
QMessageBox::critical(this, "ERROR", QString("Found command 'rmx' without variable."));
|
||||
} else if (cmd.startsWith("rmy")) {
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
|
||||
@ -2562,7 +2554,7 @@ void PmuppGui::handleCmds()
|
||||
if (tok.size() > 1)
|
||||
removeY(tok[1]);
|
||||
else
|
||||
QMessageBox::critical(0, "ERROR", QString("Found command 'rmy' without variable."));
|
||||
QMessageBox::critical(this, "ERROR", QString("Found command 'rmy' without variable."));
|
||||
} else if (cmd.startsWith("norm")) {
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PMUPPGUI_H_
|
||||
#define _PMUPPGUI_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
@ -171,44 +173,44 @@ private:
|
||||
QString fMacroPath;
|
||||
QString fMacroName;
|
||||
|
||||
QWidget *fCentralWidget;
|
||||
std::unique_ptr<QWidget> fCentralWidget;
|
||||
|
||||
QMenu *fRecentFilesMenu; ///< recent file menu
|
||||
QAction *fRecentFilesAction[MAX_RECENT_FILES]; ///< array of the recent file actions
|
||||
QAction *fNormalizeAction;
|
||||
std::unique_ptr<QAction> fNormalizeAction;
|
||||
|
||||
QBoxLayout *fBoxLayout_Main; // top->bottom (0)
|
||||
QBoxLayout *fBoxLayout_Top; // left->right (1)
|
||||
QGridLayout *fGridLayout_Left; // 2 columns, 3 rows
|
||||
QGridLayout *fGridLayout_Right; // 2 columns, 6 rows
|
||||
QBoxLayout *fBoxLayout_Cmd; // left->right (1)
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Main; // top->bottom (0)
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Top; // left->right (1)
|
||||
std::unique_ptr<QGridLayout> fGridLayout_Left; // 2 columns, 3 rows
|
||||
std::unique_ptr<QGridLayout> fGridLayout_Right; // 2 columns, 6 rows
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Cmd; // left->right (1)
|
||||
|
||||
QLabel *fColLabel;
|
||||
QSplitter *fColParamSplitter;
|
||||
QListWidget *fColList;
|
||||
QListWidget *fParamList;
|
||||
QPushButton *fRemoveCollection;
|
||||
QPushButton *fRefreshCollection;
|
||||
QLabel *fXaxisLabel;
|
||||
QLabel *fYaxisLabel;
|
||||
QListWidget *fViewX;
|
||||
QListWidget *fViewY;
|
||||
QPushButton *fAddX;
|
||||
QPushButton *fAddY;
|
||||
QPushButton *fAddDitto;
|
||||
QPushButton *fRemoveX;
|
||||
QPushButton *fRemoveY;
|
||||
QPushButton *fPlot;
|
||||
QSplitter *fCmdSplitter;
|
||||
QPlainTextEdit *fCmdLineHistory;
|
||||
QLineEdit *fCmdLine;
|
||||
QPushButton *fExitButton;
|
||||
std::unique_ptr<QLabel> fColLabel;
|
||||
std::unique_ptr<QSplitter> fColParamSplitter;
|
||||
std::unique_ptr<QListWidget> fColList;
|
||||
std::unique_ptr<QListWidget> fParamList;
|
||||
std::unique_ptr<QPushButton> fRemoveCollection;
|
||||
std::unique_ptr<QPushButton> fRefreshCollection;
|
||||
std::unique_ptr<QLabel> fXaxisLabel;
|
||||
std::unique_ptr<QLabel> fYaxisLabel;
|
||||
std::unique_ptr<QListWidget> fViewX;
|
||||
std::unique_ptr<QListWidget> fViewY;
|
||||
std::unique_ptr<QPushButton> fAddX;
|
||||
std::unique_ptr<QPushButton> fAddY;
|
||||
std::unique_ptr<QPushButton> fAddDitto;
|
||||
std::unique_ptr<QPushButton> fRemoveX;
|
||||
std::unique_ptr<QPushButton> fRemoveY;
|
||||
std::unique_ptr<QPushButton> fPlot;
|
||||
std::unique_ptr<QSplitter> fCmdSplitter;
|
||||
std::unique_ptr<QPlainTextEdit> fCmdLineHistory;
|
||||
std::unique_ptr<QLineEdit> fCmdLine;
|
||||
std::unique_ptr<QPushButton> fExitButton;
|
||||
|
||||
QVector<QString> fCmdHistory; ///< command history buffer
|
||||
|
||||
PVarDialog *fVarDlg; ///< variable dialog
|
||||
std::unique_ptr<PVarDialog> fVarDlg; ///< variable dialog
|
||||
|
||||
QProcess *fMuppPlot; ///< mupp plotter
|
||||
std::unique_ptr<QProcess> fMuppPlot; ///< mupp plotter
|
||||
|
||||
void setupFileActions();
|
||||
void setupToolActions();
|
||||
|
@ -49,31 +49,14 @@
|
||||
PmuppScript::PmuppScript(QStringList script) :
|
||||
fScript(script)
|
||||
{
|
||||
fParamDataHandler = 0;
|
||||
fLoadPath = QString("./");
|
||||
fSavePath = QString("./");
|
||||
fSelected = -2; // nothing selected
|
||||
fNorm = false;
|
||||
|
||||
fAdmin = new PmuppAdmin();
|
||||
fAdmin = std::make_unique<PmuppAdmin>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PmuppScript::~PmuppScript. Dtor
|
||||
*/
|
||||
PmuppScript::~PmuppScript()
|
||||
{
|
||||
if (fParamDataHandler) {
|
||||
delete fParamDataHandler;
|
||||
fParamDataHandler = 0;
|
||||
}
|
||||
|
||||
if (fAdmin) {
|
||||
delete fAdmin;
|
||||
fAdmin = 0;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PmuppScript::executeScript. Handles the script commands.
|
||||
@ -81,8 +64,8 @@ PmuppScript::~PmuppScript()
|
||||
*/
|
||||
int PmuppScript::executeScript()
|
||||
{
|
||||
fParamDataHandler = new PParamDataHandler();
|
||||
if (fParamDataHandler == 0) {
|
||||
fParamDataHandler = std::make_unique<PParamDataHandler>();
|
||||
if (fParamDataHandler == nullptr) {
|
||||
std::cerr << std::endl << "**ERROR** couldn't invoke data handler ..." << std::endl << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PMUPPSCRIPT_H_
|
||||
#define _PMUPPSCRIPT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
@ -55,7 +57,6 @@ class PmuppScript : public QObject
|
||||
|
||||
public:
|
||||
PmuppScript(QStringList script);
|
||||
~PmuppScript();
|
||||
|
||||
void setLoadPath(const QString cmd);
|
||||
QString getLoadPath() { return fLoadPath; }
|
||||
@ -79,10 +80,10 @@ class PmuppScript : public QObject
|
||||
void finished();
|
||||
|
||||
private:
|
||||
PmuppAdmin *fAdmin; ///< admin object
|
||||
std::unique_ptr<PmuppAdmin> fAdmin; ///< admin object
|
||||
|
||||
QStringList fScript; ///< script source
|
||||
PParamDataHandler *fParamDataHandler; ///< parameter data handler
|
||||
std::unique_ptr<PParamDataHandler> fParamDataHandler; ///< parameter data handler
|
||||
int fSelected; ///< -2=nothing selected, -1=all selected, >=0 is the index if the selected collection
|
||||
|
||||
PmuppPlotEntry fPlotEntry; ///< plot entry object
|
||||
|
@ -291,10 +291,10 @@ bool PParamDataHandler::ReadParamFile(const QStringList fln, QString &errorMsg)
|
||||
|
||||
// make sure that the system environment variables are properly set
|
||||
QString cmd("");
|
||||
fProc = new QProcess(this);
|
||||
connect( fProc, SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc, SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc, SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT( processDone(int, QProcess::ExitStatus) ) );
|
||||
fProc = std::make_unique<QProcess>(this);
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc.get(), SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT( processDone(int, QProcess::ExitStatus) ) );
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
#if defined(Q_OS_DARWIN)
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PMUPP_H_
|
||||
#define _PMUPP_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
@ -156,7 +158,7 @@ class PParamDataHandler : public QObject {
|
||||
void newData();
|
||||
|
||||
private:
|
||||
QProcess *fProc; ///< this will be needed if msr2data needs to be called
|
||||
std::unique_ptr<QProcess> fProc; ///< this will be needed if msr2data needs to be called
|
||||
QVector<PmuppCollection> fCollection; ///< all the collections handeled
|
||||
|
||||
bool analyzeFileList(const QStringList &fln, QString &collectionName,
|
||||
|
@ -2199,7 +2199,7 @@ void PmuppGui::plot()
|
||||
}
|
||||
|
||||
// start native ROOT parameter plot application if not already running
|
||||
if (fMuppPlot == 0) { // not running yet
|
||||
if (fMuppPlot == nullptr) { // not running yet
|
||||
startMuppPlot();
|
||||
} else {
|
||||
// check if mupp_plot is still running
|
||||
|
Loading…
x
Reference in New Issue
Block a user