mupp: worked on the doxygen docu.

This commit is contained in:
suter_a 2020-05-11 20:20:23 +02:00
parent f19a94651b
commit 1a2853e548
11 changed files with 552 additions and 367 deletions

View File

@ -40,6 +40,10 @@
#include "PVarDialog.h"
//--------------------------------------------------------------------------
/**
* @brief PShowVarNameDialog::PShowVarNameDialog. Ctor
* @param info containing the necessary information of the collection
*/
PShowVarNameDialog::PShowVarNameDialog(PCollInfo &info)
{
// if fCollName is a path name, extract the fln
@ -80,6 +84,14 @@ PShowVarNameDialog::PShowVarNameDialog(PCollInfo &info)
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::PVarDialog. Variable GUI allowing the users to define
* variables.
* @param collection_list list of all the collections
* @param darkTheme plain/dark theme flag
* @param parent parent widget pointer
* @param f window flag
*/
PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
QWidget *parent, Qt::WindowFlags f) :
QDialog(parent, f), fCollList(collection_list)
@ -152,6 +164,9 @@ PVarDialog::PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::check. Allows the user to check the variable string.
*/
void PVarDialog::check()
{
if (!basic_check())
@ -170,6 +185,9 @@ void PVarDialog::check()
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::add. It is used to initiate the add variable to the mupp GUI.
*/
void PVarDialog::add()
{
if (fVarEdit->toPlainText().isEmpty()) {
@ -198,12 +216,19 @@ void PVarDialog::add()
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::help
*/
void PVarDialog::help()
{
QMessageBox::information(this, "Var Help", "Syntax: var <var_name> = <expr>.\n<expr> can contain identifiers defined in the collections.\nExample:\nvar sigSC = pow(abs(pow($sigma,2.0)-pow(0.11,2.0)),0.5)");
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::showVarNames. Show a variable name dialog for a given
* selected collection.
*/
void PVarDialog::showVarNames()
{
// get the selected collection
@ -229,6 +254,11 @@ void PVarDialog::showVarNames()
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::basic_check. Carry out basic checks before feeding it
* to the parser.
* @return true on success
*/
bool PVarDialog::basic_check()
{
QString varStr = fVarEdit->toPlainText();
@ -275,6 +305,12 @@ bool PVarDialog::basic_check()
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::var_consistency_check. Variable consistency checks. For
* instance it is checked that for each variable there is also the corresponding
* error variable defined.
* @return true on success
*/
bool PVarDialog::var_consistency_check()
{
QString varStr = fVarEdit->toPlainText();
@ -360,6 +396,12 @@ bool PVarDialog::var_consistency_check()
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::collectVarNames. Collect variable names from edit variable.
* @param list input list
* @param ok true if ok
* @return return variable list
*/
QStringList PVarDialog::collectVarNames(QStringList &list, bool &ok)
{
QStringList name;
@ -380,6 +422,12 @@ QStringList PVarDialog::collectVarNames(QStringList &list, bool &ok)
}
//--------------------------------------------------------------------------
/**
* @brief PVarDialog::hasErrorDef. Check for error definition
* @param varNames variable name list
* @param name failed variable name
* @return true on success
*/
bool PVarDialog::hasErrorDef(QStringList &varNames, QString &name)
{
QString errStr;

View File

@ -37,13 +37,20 @@
#include <QVector>
//-----------------------------------------------------------------------------
/**
* @brief The PCollInfo struct
*/
struct PCollInfo
{
QString fCollName;
QStringList fVarName;
QString fCollName; ///< collection name
QStringList fVarName; ///< variable names of the given collection
};
//-----------------------------------------------------------------------------
/**
* @brief The PShowVarNameDialog class. Class used to create a show variable
* name dialog.
*/
class PShowVarNameDialog : public QDialog
{
Q_OBJECT
@ -53,6 +60,9 @@ class PShowVarNameDialog : public QDialog
};
//-----------------------------------------------------------------------------
/**
* @brief The PVarDialog class
*/
class PVarDialog : public QDialog
{
Q_OBJECT

View File

@ -54,7 +54,7 @@
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* @brief PmuppParam::PmuppParam
* @brief PmuppParam::PmuppParam. Ctor
*/
PmuppParam::PmuppParam() {
ResetParam();
@ -62,10 +62,10 @@ PmuppParam::PmuppParam() {
//--------------------------------------------------------------------------
/**
* @brief PmuppParam::PmuppParam
* @param name
* @param param
* @param posErr
* @brief PmuppParam::PmuppParam. Ctor
* @param name parameter name
* @param param parameter value
* @param posErr parameter error
*/
PmuppParam::PmuppParam(QString name, double param, double posErr)
{
@ -74,11 +74,11 @@ PmuppParam::PmuppParam(QString name, double param, double posErr)
//--------------------------------------------------------------------------
/**
* @brief PmuppParam::PmuppParam
* @param name
* @param param
* @param posErr
* @param negErr
* @brief PmuppParam::PmuppParam. Ctor
* @param name parameter name
* @param param parameter value
* @param posErr positive parameter error
* @param negErr negative parameter error
*/
PmuppParam::PmuppParam(QString name, double param, double posErr, double negErr)
{
@ -87,7 +87,7 @@ PmuppParam::PmuppParam(QString name, double param, double posErr, double negErr)
//--------------------------------------------------------------------------
/**
* @brief PmuppParam::ResetParam
* @brief PmuppParam::ResetParam. Reset the parameter values
*/
void PmuppParam::ResetParam()
{
@ -99,10 +99,10 @@ void PmuppParam::ResetParam()
//--------------------------------------------------------------------------
/**
* @brief PmuppParam::SetParam
* @param name
* @param param
* @param posErr
* @brief PmuppParam::SetParam. Set a parameter
* @param name parameter name
* @param param parameter value
* @param posErr parameter error
*/
void PmuppParam::SetParam(QString name, double param, double posErr)
{
@ -113,11 +113,11 @@ void PmuppParam::SetParam(QString name, double param, double posErr)
//--------------------------------------------------------------------------
/**
* @brief PmuppParam::SetParam
* @param name
* @param param
* @param posErr
* @param negErr
* @brief PmuppParam::SetParam. Set a parameter
* @param name parameter name
* @param param parameter value
* @param posErr positive parameter value
* @param negErr negative parameter value
*/
void PmuppParam::SetParam(QString name, double param, double posErr, double negErr)
{
@ -129,9 +129,9 @@ void PmuppParam::SetParam(QString name, double param, double posErr, double negE
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* @brief PmuppRun::GetParam
* @param idx
* @return
* @brief PmuppRun::GetParam. Get a parameter from a run
* @param idx index of the parameter
* @return the parameter value
*/
PmuppParam PmuppRun::GetParam(unsigned int idx)
{
@ -145,9 +145,9 @@ PmuppParam PmuppRun::GetParam(unsigned int idx)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* @brief PmuppCollection::GetRun
* @param idx
* @return
* @brief PmuppCollection::GetRun. Returns a run from a collection.
* @param idx of the run in a collection
* @return a run from a collection
*/
PmuppRun PmuppCollection::GetRun(unsigned int idx)
{
@ -161,8 +161,9 @@ PmuppRun PmuppCollection::GetRun(unsigned int idx)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* @brief PParamDataHandler::NewCollection
* @param name
* @brief PParamDataHandler::NewCollection. Adds an empty new collection with
* name 'name'.
* @param name of the new collection
*/
void PParamDataHandler::NewCollection(const QString name)
{
@ -174,15 +175,20 @@ void PParamDataHandler::NewCollection(const QString name)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::analyzeFileList
* @param fln
* @param collectionName
* @param arg
* @param workDir
* @param errorMsg
* @return
* @brief PParamDataHandler::analyzeFileList. In case the input is given by
* msr-files, the structure of the file names needs to be analyzed that
* msr2data can be called.
*
* @param fln list of msr-files to be analyzed.
* @param collectionName output collection name (db-/dat-file).
* @param arg argument list which is needed to feed msr2data
* @param workDir working directory
* @param errorMsg error message in case something went wrong.
*
* @return true if successful, false otherwise
*/
bool PParamDataHandler::analyzeFileList(const QStringList &fln, QString &collectionName, QStringList &arg, QString &workDir, QString &errorMsg)
bool PParamDataHandler::analyzeFileList(const QStringList &fln, QString &collectionName,
QStringList &arg, QString &workDir, QString &errorMsg)
{
// 1) check all the msr-files have the same structure: <runNo><extension>.msr with <extension> the same
// for all msr-files present.
@ -253,10 +259,11 @@ bool PParamDataHandler::analyzeFileList(const QStringList &fln, QString &collect
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::ReadParamFile
* @param fln
* @param errorMsg
* @return
* @brief PParamDataHandler::ReadParamFile. Reads a msr-file.
* @param fln file name of the msr-file to be read
* @param errorMsg error message in case reading fails.
*
* @return true on success, otherwise false.
*/
bool PParamDataHandler::ReadParamFile(const QStringList fln, QString &errorMsg)
{
@ -385,11 +392,12 @@ bool PParamDataHandler::ReadParamFile(const QStringList fln, QString &errorMsg)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::ReadDbFile
* @param fln
* @param valid
* @param errorMsg
* @return
* @brief PParamDataHandler::ReadDbFile. Reads a db-file.
* @param fln file name of the db-file
* @param valid true on success, otherwise false
* @param errorMsg error messages in case read fails
*
* @return the collection object containing the db-file on success.
*/
PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QString &errorMsg)
{
@ -541,11 +549,12 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::ReadColumnParamFile
* @param fln
* @param valid
* @param errorMsg
* @return
* @brief PParamDataHandler::ReadColumnParamFile. Reads a dat-file
* @param fln file name of the dat-file to be read
* @param valid true on success, false otherwise.
* @param errorMsg error message in case read fails.
*
* @return the collection object containing the dat-file on success.
*/
PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool &valid, QString &errorMsg)
{
@ -677,10 +686,12 @@ PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool &
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetCollection
* @param idx
* @param valid
* @return
* @brief PParamDataHandler::GetCollection. Get a single collection from all
* the loaded collections
* @param idx of the collection
* @param valid true if collection is found
*
* @return requested collection on success.
*/
PmuppCollection PParamDataHandler::GetCollection(const int idx, bool &valid)
{
@ -697,14 +708,16 @@ PmuppCollection PParamDataHandler::GetCollection(const int idx, bool &valid)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetCollection
* @param idx
* @return
* @brief PParamDataHandler::GetCollection. Get a pointer of the requested
* collection.
* @param idx of the collection
*
* @return requested pointer to the collection on success.
*/
PmuppCollection *PParamDataHandler::GetCollection(const int idx)
{
if ((idx<0) || (idx>=fCollection.size())) {
return 0;
return nullptr;
}
return &fCollection[idx];
@ -712,10 +725,11 @@ PmuppCollection *PParamDataHandler::GetCollection(const int idx)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetCollection
* @param name
* @param valid
* @return
* @brief PParamDataHandler::GetCollection. Get collection by name.
* @param name of the requested collection
* @param valid true if found
*
* @return requested collection on success.
*/
PmuppCollection PParamDataHandler::GetCollection(const QString name, bool &valid)
{
@ -740,9 +754,10 @@ PmuppCollection PParamDataHandler::GetCollection(const QString name, bool &valid
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetCollection
* @param name
* @return
* @brief PParamDataHandler::GetCollection. Get collection pointer by name.
* @param name of the requested collection
*
* @return pointer of the requested collection on success, nullptr otherwise
*/
PmuppCollection *PParamDataHandler::GetCollection(const QString name)
{
@ -755,7 +770,7 @@ PmuppCollection *PParamDataHandler::GetCollection(const QString name)
}
if (idx==-1) { // not found
return 0;
return nullptr;
}
return &fCollection[idx];
@ -763,9 +778,11 @@ PmuppCollection *PParamDataHandler::GetCollection(const QString name)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetCollectionIndex
* @param name
* @return
* @brief PParamDataHandler::GetCollectionIndex. Get the collection index of
* a given collection name.
* @param name of the requested collection
*
* @return index of the requested collection on success, otherwise -1.
*/
int PParamDataHandler::GetCollectionIndex(const QString name)
{
@ -799,10 +816,13 @@ QString PParamDataHandler::GetCollectionName(const int idx)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetValues
* @param collName
* @param paramName
* @return
* @brief PParamDataHandler::GetValues. Get the data values of a parameter of
* a requested collection.
* @param collName name of the collection
* @param paramName parameter name
*
* @return data values of the requested parameter name of the collection collName.
* Empty data vector otherwise.
*/
QVector<double> PParamDataHandler::GetValues(QString collName, QString paramName)
{
@ -842,10 +862,13 @@ QVector<double> PParamDataHandler::GetValues(QString collName, QString paramName
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetPosErr
* @param collName
* @param paramName
* @return
* @brief PParamDataHandler::GetPosErr. Get the positive data error values of
* a parameter of a requested collection.
* @param collName name of the requested collection
* @param paramName parameter name
*
* @return positive error values of the requested parameter name of the
* collection collName. Empty positive error vector otherwise.
*/
QVector<double> PParamDataHandler::GetPosErr(QString collName, QString paramName)
{
@ -885,10 +908,13 @@ QVector<double> PParamDataHandler::GetPosErr(QString collName, QString paramName
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::GetNegErr
* @param collName
* @param paramName
* @return
* @brief PParamDataHandler::GetNegErr. Get the negative data error values of
* a parameter of a requested collection.
* @param collName name of the requested collection
* @param paramName parameter name
*
* @return negative error values of the requested parameter name of the
* collection collName. Empty negative error vector otherwise.
*/
QVector<double> PParamDataHandler::GetNegErr(QString collName, QString paramName)
{
@ -928,8 +954,9 @@ QVector<double> PParamDataHandler::GetNegErr(QString collName, QString paramName
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::RemoveCollection
* @param name
* @brief PParamDataHandler::RemoveCollection. Remove a collection from the
* data handler.
* @param name of the collection to be removed.
*/
void PParamDataHandler::RemoveCollection(QString name)
{
@ -943,9 +970,10 @@ void PParamDataHandler::RemoveCollection(QString name)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::ReplaceCollection
* @param coll
* @param idx
* @brief PParamDataHandler::ReplaceCollection. Replaces a collection at index
* position idx.
* @param coll collection
* @param idx index of the collection to be replaced
*/
void PParamDataHandler::ReplaceCollection(PmuppCollection coll, int idx)
{
@ -957,7 +985,7 @@ void PParamDataHandler::ReplaceCollection(PmuppCollection coll, int idx)
//--------------------------------------------------------------------------
/**
* @brief PParamDataHandler::Dump
* @brief PParamDataHandler::Dump. Dumps the collection onto stdout
*/
void PParamDataHandler::Dump()
{

View File

@ -38,6 +38,11 @@
#define MUPP_UNDEF 1.0e99
//----------------------------------------------------------------------------
/**
* <p>The PmuppParam class. It handles a single parameter: name, value,
* positive- and negative error.
*/
class PmuppParam {
public:
PmuppParam();
@ -58,12 +63,16 @@ class PmuppParam {
double GetNegErr() { return fNegErr; }
private:
QString fName;
double fValue;
double fPosErr;
double fNegErr;
QString fName; ///< parameter name
double fValue; ///< parameter value
double fPosErr; ///< positive error of the parameter
double fNegErr; ///< negative error of the parameter
};
//----------------------------------------------------------------------------
/**
* <p>The PmuppRun class. Contains all the parameters of a single run.
*/
class PmuppRun {
public:
PmuppRun() { fNumber = -1; fName=""; fParam.clear(); }
@ -81,10 +90,15 @@ class PmuppRun {
private:
int fNumber; ///< run number
QString fName;
QVector<PmuppParam> fParam;
QString fName; ///< name of the run
QVector<PmuppParam> fParam; ///< parameters of the run
};
//----------------------------------------------------------------------------
/**
* <p>The PmuppCollection class. Is collecting a number of runs. Typically
* something like a full temperature scan, an energy scan, etc.
*/
class PmuppCollection {
public:
PmuppCollection() { fPathName=""; fName = ""; fRun.clear(); }
@ -99,11 +113,16 @@ class PmuppCollection {
PmuppRun GetRun(unsigned int idx);
private:
QString fPathName;
QString fName;
QVector<PmuppRun> fRun;
QString fPathName; ///< path-name of the collection
QString fName; ///< name of the collection
QVector<PmuppRun> fRun; ///< all the runs in the collection
};
//----------------------------------------------------------------------------
/**
* <p>The PParamDataHandler class. This class handles all the collections
* loaded.
*/
class PParamDataHandler : public QObject {
Q_OBJECT
@ -137,10 +156,11 @@ class PParamDataHandler : public QObject {
void newData();
private:
QProcess *fProc;
QVector<PmuppCollection> fCollection;
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, QStringList &arg, QString &workDir, QString &errorMsg);
bool analyzeFileList(const QStringList &fln, QString &collectionName,
QStringList &arg, QString &workDir, QString &errorMsg);
private slots:
void readFromStdOut();

View File

@ -47,7 +47,7 @@
// implementation of PmuppColor class
//--------------------------------------------------------------------------
/**
* @brief PmuppColor::PmuppColor
* @brief PmuppColor::PmuppColor. Ctor
*/
PmuppColor::PmuppColor()
{
@ -59,10 +59,10 @@ PmuppColor::PmuppColor()
//--------------------------------------------------------------------------
/**
* @brief PmuppColor::setRGB
* @param r
* @param g
* @param b
* @brief PmuppColor::setRGB. set RGB value
* @param r red (0..255)
* @param g green (0..255)
* @param b blue (0..255)
*/
void PmuppColor::setRGB(const int r, const int g, const int b)
{
@ -366,9 +366,12 @@ void PmuppAdmin::addRecentFile(const QString str)
//--------------------------------------------------------------------------
/**
* @brief PmuppAdmin::getRecentFile
* @brief PmuppAdmin::getRecentFile. Get a file from the recent files with
* index idx.
* @param idx
* @return
*
* @return return the recent file with index idx if present, otherwise return
* an empty string.
*/
QString PmuppAdmin::getRecentFile(int idx)
{
@ -382,9 +385,10 @@ QString PmuppAdmin::getRecentFile(int idx)
//--------------------------------------------------------------------------
/**
* @brief PmuppAdmin::getMarker
* @param idx
* @return
* @brief PmuppAdmin::getMarker. Get the marker with index idx.
* @param idx marker index
*
* @return requested marker
*/
PmuppMarker PmuppAdmin::getMarker(int idx) {
PmuppMarker marker;
@ -397,11 +401,11 @@ PmuppMarker PmuppAdmin::getMarker(int idx) {
//--------------------------------------------------------------------------
/**
* @brief PmuppAdmin::getColor
* @param name
* @param r
* @param g
* @param b
* @brief PmuppAdmin::getColor. Get rgb color codes of name
* @param name of the requeset color.
* @param r red value (0..255)
* @param g green value (0..255)
* @param b blue value (0..255
*/
void PmuppAdmin::getColor(QString name, int &r, int &g, int &b)
{
@ -424,11 +428,11 @@ void PmuppAdmin::getColor(QString name, int &r, int &g, int &b)
//--------------------------------------------------------------------------
/**
* @brief PmuppAdmin::getColor
* @param idx
* @param r
* @param g
* @param b
* @brief PmuppAdmin::getColor. Get color codes of color at index idx
* @param idx requested color index
* @param r red value (0..255)
* @param g green value (0..255)
* @param b blue value (0..255)
*/
void PmuppAdmin::getColor(int idx, int &r, int &g, int &b)
{
@ -443,9 +447,9 @@ void PmuppAdmin::getColor(int idx, int &r, int &g, int &b)
//--------------------------------------------------------------------------
/**
* @brief PmuppAdmin::setMaker
* @param marker
* @param size
* @brief PmuppAdmin::setMaker. Set a marker
* @param marker marker code
* @param size marker size
*/
void PmuppAdmin::setMarker(int marker, double size)
{
@ -464,11 +468,11 @@ void PmuppAdmin::setMarker(int marker, double size)
//--------------------------------------------------------------------------
/**
* @brief PmuppAdmin::setColor
* @param r
* @param g
* @param b
* @param name
* @brief PmuppAdmin::setColor. Set a color
* @param r red value (0..255)
* @param g green value (0..255)
* @param b blue value (0..255)
* @param name color name
*/
void PmuppAdmin::setColor(int r, int g, int b, QString name)
{
@ -558,7 +562,8 @@ void PmuppAdmin::saveRecentFiles()
//--------------------------------------------------------------------------
/**
* @brief PmuppAdmin::createMuppStartupFile
* @brief PmuppAdmin::createMuppStartupFile. Create a default mupp_startup.xml
* file if not present.
*/
void PmuppAdmin::createMuppStartupFile()
{

View File

@ -42,7 +42,8 @@ class PmuppAdmin;
//---------------------------------------------------------------------------
/**
* @brief The PmuppColor class
* @brief The PmuppColor class. Contains to colors read from the xml-startup
* which are used for the plotted data.
*/
class PmuppColor {
public:
@ -64,7 +65,8 @@ class PmuppColor {
//---------------------------------------------------------------------------
/**
* @brief The PmuppMarker class
* @brief The PmuppMarker class. List of the markers used in the plotter. Read
* from the xml-startup.
*/
class PmuppMarker {
public:

View File

@ -62,7 +62,7 @@
//----------------------------------------------------------------------------------------------------
/**
* @brief PmuppXY::init
* @brief PmuppXY::init the xy object
*/
void PmuppXY::init()
{
@ -71,11 +71,11 @@ void PmuppXY::init()
fYlabel.clear();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::setYlabel
* @param idx
* @param str
* @brief PmuppXY::setYlabel. Set the y-label
* @param idx index of the y-label
* @param str name of the y-label
*/
void PmuppXY::setYlabel(int idx, QString str)
{
@ -85,10 +85,10 @@ void PmuppXY::setYlabel(int idx, QString str)
fYlabel[idx] = str;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::removeYlabel
* @param idx
* @brief PmuppXY::removeYlabel. Remove the y-label at position idx.
* @param idx index of the y-label to be removed.
*/
void PmuppXY::removeYlabel(int idx)
{
@ -98,10 +98,10 @@ void PmuppXY::removeYlabel(int idx)
fYlabel.remove(idx);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::removeYlabel
* @param str
* @brief PmuppXY::removeYlabel. Remove the y-label with name str.
* @param str name of the y-label to be removed.
*/
void PmuppXY::removeYlabel(QString str)
{
@ -113,11 +113,12 @@ void PmuppXY::removeYlabel(QString str)
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::getYlabel
* @param idx
* @return
* @brief PmuppXY::getYlabel. Get the y-label with index idx
* @param idx index of the requested y-label.
*
* @return requested y-label if found, empty string otherwise.
*/
QString PmuppXY::getYlabel(int idx)
{
@ -127,10 +128,10 @@ QString PmuppXY::getYlabel(int idx)
return fYlabel[idx];
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::getXlabelIdx
* @return
* @brief PmuppXY::getXlabelIdx. Get the x-label index.
* @return x-label index if found, otherwise -1.
*/
int PmuppXY::getXlabelIdx()
{
@ -157,11 +158,11 @@ int PmuppXY::getXlabelIdx()
return idx;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::getYlabelIdx
* @param idx
* @return
* @brief PmuppXY::getYlabelIdx. Get y-label index of index idx.
* @param idx index of the y-label.
* @return y-label index on success, -1 otherwise.
*/
int PmuppXY::getYlabelIdx(int idx)
{
@ -191,7 +192,7 @@ int PmuppXY::getYlabelIdx(int idx)
return iidx;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* <p>Constructor
*
@ -399,18 +400,19 @@ PmuppGui::PmuppGui( QStringList fln, QWidget *parent, Qt::WindowFlags f )
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::~PmuppGui
* @brief PmuppGui::~PmuppGui. Dtor
*/
PmuppGui::~PmuppGui()
{
// all relevant clean up job are done in ::aboutToQuit()
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::aboutToQuit
* @brief PmuppGui::aboutToQuit. Called when the GUI is going to close. Cleans
* up everything.
*/
void PmuppGui::aboutToQuit()
{
@ -466,9 +468,9 @@ void PmuppGui::aboutToQuit()
exit(0);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::setupFileActions
* @brief PmuppGui::setupFileActions. Setup the file action menus.
*/
void PmuppGui::setupFileActions()
{
@ -514,9 +516,9 @@ void PmuppGui::setupFileActions()
menu->addAction(a);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::setupToolActions
* @brief PmuppGui::setupToolActions. Setup the tools action menu.
*/
void PmuppGui::setupToolActions()
{
@ -570,9 +572,9 @@ void PmuppGui::setupToolActions()
*/
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::setupHelpActions
* @brief PmuppGui::setupHelpActions. Setup the help actions menu.
*/
void PmuppGui::setupHelpActions()
{
@ -603,17 +605,17 @@ void PmuppGui::setupHelpActions()
menu->addAction(a);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::fileOpen
* @brief PmuppGui::fileOpen. Open muSR parameter files.
*/
void PmuppGui::fileOpen()
{
QStringList list = QFileDialog::getOpenFileNames(
this,
"muSR Parameter Files",
"./",
"db-files (*.db);; All Params (*.msr *.db *.dat);; Msr-Files (*.msr);; dat-Files (*.dat);; All (*)");
this,
"muSR Parameter Files",
"./",
"db-files (*.db);; All Params (*.msr *.db *.dat);; Msr-Files (*.msr);; dat-Files (*.dat);; All (*)");
if (list.count() == 0)
return;
@ -651,9 +653,9 @@ void PmuppGui::fileOpen()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::fileOpenRecent
* @brief PmuppGui::fileOpenRecent. Opens a selected recent file.
*/
void PmuppGui::fileOpenRecent()
{
@ -670,18 +672,18 @@ void PmuppGui::fileOpenRecent()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::fileExit
* @brief PmuppGui::fileExit. Exit mupp
*/
void PmuppGui::fileExit()
{
aboutToQuit();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::toolDump
* @brief PmuppGui::toolDump. Dumps collection for debug purposes.
*/
void PmuppGui::toolDumpCollections()
{
@ -692,7 +694,10 @@ void PmuppGui::toolDumpCollections()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::toolDumpXY. Dump XY objects for debug purposes.
*/
void PmuppGui::toolDumpXY()
{
if (fXY.size() > 0) {
@ -708,15 +713,19 @@ void PmuppGui::toolDumpXY()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::normalize. SLOT called when menu Tools/Normalize is selected.
* Keeps the normalizer flag
*/
void PmuppGui::normalize()
{
fNormalize = fNormalizeAction->isChecked();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::helpCmds
* @brief PmuppGui::helpCmds. help command information popup.
*/
void PmuppGui::helpCmds()
{
@ -739,29 +748,30 @@ void PmuppGui::helpCmds()
"<b>flush:</b> flush the history buffer.");
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::helpAbout
* @brief PmuppGui::helpAbout. Help about message box.
*/
void PmuppGui::helpAbout()
{
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1\nBranch: %2\nHash: %3").arg(MUPP_VERSION).arg(GIT_BRANCH).arg(GIT_COMMIT_HASH));
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::helpAboutQt
* @brief PmuppGui::helpAboutQt. Qt about message box.
*/
void PmuppGui::helpAboutQt()
{
QMessageBox::aboutQt(this);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::eventFilter
* @param o
* @param e
* @brief PmuppGui::eventFilter. Event filter for the history buffer.
* @param o object pointer
* @param e event pointer
*
* @return
*/
bool PmuppGui::eventFilter(QObject *o, QEvent *e)
@ -805,14 +815,15 @@ bool PmuppGui::eventFilter(QObject *o, QEvent *e)
return QMainWindow::eventFilter(o, e);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::getTheme
* @brief PmuppGui::getTheme. Tries to get the theme of the system.
*/
void PmuppGui::getTheme()
{
fDarkTheme = false; // true if theme is dark
fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons are dark, however the toolbar icons are plain!
fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons
// are dark, however the toolbar icons are plain!
QString str = QIcon::themeName();
@ -834,7 +845,7 @@ void PmuppGui::getTheme()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* <p>fill the recent file list in the menu.
*/
@ -846,9 +857,10 @@ void PmuppGui::fillRecentFiles()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::readCmdHistory
* @brief PmuppGui::readCmdHistory. Read the command history from file
* mupp_history.txt under $HOME/.musrfit/mupp
*/
void PmuppGui::readCmdHistory()
{
@ -880,7 +892,10 @@ void PmuppGui::readCmdHistory()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::writeCmdHistory. Write the command history buffer to file.
*/
void PmuppGui::writeCmdHistory()
{
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
@ -916,9 +931,9 @@ void PmuppGui::writeCmdHistory()
file.close();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::refresh
* @brief PmuppGui::refresh. Refresh the collections, i.e. re-read it from file.
*/
void PmuppGui::refresh()
{
@ -979,9 +994,9 @@ void PmuppGui::refresh()
updateXYListGui();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::remove
* @brief PmuppGui::remove. Remove collection from data handler and GUI.
*/
void PmuppGui::remove()
{
@ -1024,9 +1039,10 @@ void PmuppGui::remove()
updateXYListGui();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::addX
* @brief PmuppGui::addX add param to x-axis
* @param param name of the parameter
*/
void PmuppGui::addX(QString param)
{
@ -1066,9 +1082,10 @@ void PmuppGui::addX(QString param)
fXY.push_back(xyItem);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::addY
* @brief PmuppGui::addY add param to y-labels
* @param param name of the parameter
*/
void PmuppGui::addY(QString param)
{
@ -1122,9 +1139,10 @@ void PmuppGui::addY(QString param)
fXY[idx].addYlabel(yLabel);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::removeX
* @brief PmuppGui::removeX. remove from the x-axis
* @param param x-axis parameter name to be removed
*/
void PmuppGui::removeX(QString param)
{
@ -1149,9 +1167,10 @@ void PmuppGui::removeX(QString param)
delete item;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::removeY
* @brief PmuppGui::removeY. remove from the y-axis
* @param param y-axis paramter name to be removed.
*/
void PmuppGui::removeY(QString param)
{
@ -1175,9 +1194,10 @@ void PmuppGui::removeY(QString param)
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::addDitto
* @brief PmuppGui::addDitto. Add x-/y-axis settings present for selected
* collection.
*/
void PmuppGui::addDitto()
{
@ -1233,7 +1253,11 @@ void PmuppGui::addDitto()
fColList->clearSelection();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::addVar. Add a variable. A variable is an expression of
* variables present in the collection.
*/
void PmuppGui::addVar()
{
// create collection list
@ -1258,10 +1282,15 @@ void PmuppGui::addVar()
connect(fVarDlg, SIGNAL(add_request(QString,QVector<int>)), this, SLOT(add(QString,QVector<int>)));
}
fVarDlg->show();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::check a variable string syntactically and sementically for
* validity.
* @param varStr var string to be parsed.
* @param idx vector of indices telling which collections have been selected.
*/
void PmuppGui::check(QString varStr, QVector<int> idx)
{
int count = 0;
@ -1297,18 +1326,23 @@ void PmuppGui::check(QString varStr, QVector<int> idx)
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::add a variable to the GUI for given collections.
* @param varStr variable string to be parsed.
* @param idx vector of indices telling which collections have been selected.
*/
void PmuppGui::add(QString varStr, QVector<int> idx)
{
// STILL TO BE IMPLEMENTED
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::findValue
* @param run
* @param tag
* @return
* @brief PmuppGui::findValue check if run is found x-/y-axis
* @param run which is searched
* @param tag x-/y-axis selector
* @return true if found
*/
bool PmuppGui::findValue(PmuppRun &run, EAxis tag)
{
@ -1339,10 +1373,10 @@ bool PmuppGui::findValue(PmuppRun &run, EAxis tag)
return result;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::allXYEqual
* @return
* @brief PmuppGui::allXYEqual. Check that all x-/y-labels present are equal.
* @return true if this is the case.
*/
bool PmuppGui::allXYEqual()
{
@ -1384,11 +1418,12 @@ bool PmuppGui::allXYEqual()
return true;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::indexAlreadyPresent
* @param idx
* @return
* @brief PmuppGui::indexAlreadyPresent. Check if x-label as given by idx is
* already present.
* @param idx which gets the x-label.
* @return true, if found.
*/
bool PmuppGui::indexAlreadyPresent(const int idx)
{
@ -1402,11 +1437,11 @@ bool PmuppGui::indexAlreadyPresent(const int idx)
return false;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::replaceIndex
* @param data
* @param idx
* @brief PmuppGui::replaceIndex replace xy-object at position idx.
* @param data xy-object to be replaced
* @param idx index position where data needs to be replaced.
*/
void PmuppGui::replaceIndex(PmuppXY &data, const int idx)
{
@ -1430,11 +1465,11 @@ void PmuppGui::replaceIndex(PmuppXY &data, const int idx)
data.setCollectionTag(idx);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::getXlabelIndex
* @param label
* @return
* @brief PmuppGui::getXlabelIndex. Get x-label index for a given search label.
* @param label for which the index is searched for.
* @return idx of the searched label on success, -1 otherwise.
*/
int PmuppGui::getXlabelIndex(QString label)
{
@ -1450,10 +1485,10 @@ int PmuppGui::getXlabelIndex(QString label)
return idx;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::dropOnViewX
* @param item
* @brief PmuppGui::dropOnViewX. Drag and drop for x-axis.
* @param item to be dropped.
*/
void PmuppGui::dropOnViewX(QListWidgetItem *item)
{
@ -1486,10 +1521,10 @@ void PmuppGui::dropOnViewX(QListWidgetItem *item)
fXY.push_back(xyItem);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::dropOnViewY
* @param item
* @brief PmuppGui::dropOnViewY. Drag and drop for y-axis.
* @param item to be dropped.
*/
void PmuppGui::dropOnViewY(QListWidgetItem *item)
{
@ -1530,9 +1565,9 @@ void PmuppGui::dropOnViewY(QListWidgetItem *item)
fXY[idx].addYlabel(yLabel);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::refreshY
* @brief PmuppGui::refreshY. Refresh the y-axis objects.
*/
void PmuppGui::refreshY()
{
@ -1553,9 +1588,9 @@ void PmuppGui::refreshY()
fViewY->addItem(fXY[idx].getYlabel(i));
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::createMacro
* @brief PmuppGui::createMacro. create a root macro based on the current settings.
*/
void PmuppGui::createMacro()
{
@ -1737,9 +1772,10 @@ void PmuppGui::createMacro()
fMacroName = QString("");
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::plot
* @brief PmuppGui::plot. plot all the requested x-/y-axis settings. It first
* prepares all necessary data sets, afterwards is calling mupp_plotter.
*/
void PmuppGui::plot()
{
@ -1912,9 +1948,9 @@ void PmuppGui::plot()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::startMuppPlot
* @brief PmuppGui::startMuppPlot start the mupp_plotter
*/
void PmuppGui::startMuppPlot()
{
@ -1951,9 +1987,9 @@ void PmuppGui::startMuppPlot()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::handleCmds
* @brief PmuppGui::handleCmds. Handles the commands form the command line.
*/
void PmuppGui::handleCmds()
{
@ -2067,9 +2103,9 @@ void PmuppGui::handleCmds()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::handleNewData
* @brief PmuppGui::handleNewData. Handle new data from the fParamDataHandler.
*/
void PmuppGui::handleNewData()
{
@ -2077,9 +2113,9 @@ void PmuppGui::handleNewData()
updateCollectionList();
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::updateCollectionList
* @brief PmuppGui::updateCollectionList. update collection list.
*/
void PmuppGui::updateCollectionList()
{
@ -2094,10 +2130,11 @@ void PmuppGui::updateCollectionList()
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::updateParamList
* @param currentRow
* @brief PmuppGui::updateParamList. Update parameter list of the selected
* collection defined by currentRow.
* @param currentRow is the index of the selected collection.
*/
void PmuppGui::updateParamList(int currentRow)
{
@ -2122,9 +2159,9 @@ void PmuppGui::updateParamList(int currentRow)
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::updateXYList
* @brief PmuppGui::updateXYList. Update xy-objects.
* @param idx collection index which has been removed
*/
void PmuppGui::updateXYList(int idx)
@ -2165,9 +2202,10 @@ void PmuppGui::updateXYList(int idx)
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::updateXYListGui
* @brief PmuppGui::updateXYListGui. Update x-axis settings. This is needed
* after a remove or refresh.
*/
void PmuppGui::updateXYListGui()
{
@ -2180,11 +2218,11 @@ void PmuppGui::updateXYListGui()
fViewX->setCurrentRow(0);
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::isNewCollection
* @param coll
* @return
* @brief PmuppGui::isNewCollection. Check if coll is a new collection.
* @param coll collection which needs to be searched for.
* @return true if present, flase otherwise.
*/
bool PmuppGui::isNewCollection(PmuppCollection &coll)
{
@ -2194,10 +2232,10 @@ bool PmuppGui::isNewCollection(PmuppCollection &coll)
return true;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::editCollName
* @param item
* @brief PmuppGui::editCollName allow to edit the collection name.
* @param item from the listWidget.
*/
void PmuppGui::editCollName(QListWidgetItem *item)
{
@ -2212,12 +2250,12 @@ void PmuppGui::editCollName(QListWidgetItem *item)
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::getMinMax
* @param data
* @param min
* @param max
* @brief PmuppGui::getMinMax. Get minimum and maximum from data set.
* @param data data set
* @param min minimum of data
* @param max maximum of data
*/
void PmuppGui::getMinMax(QVector<double> &data, double &min, double &max)
{
@ -2229,11 +2267,12 @@ void PmuppGui::getMinMax(QVector<double> &data, double &min, double &max)
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::substituteDefaultLabels
* @param label
* @return
* @brief PmuppGui::substituteDefaultLabels. Substitutes default labels, like
* sigma -> #sigma to make the plot nicer.
* @param label to be checked to prettify.
* @return prettified label string.
*/
QString PmuppGui::substituteDefaultLabels(QString label)
{
@ -2279,10 +2318,11 @@ QString PmuppGui::substituteDefaultLabels(QString label)
return result;
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::selectCollection
* @param cmd
* @brief PmuppGui::selectCollection. Called from the command line. It allows to
* select a collection.
* @param cmd string to select a collection
*/
void PmuppGui::selectCollection(QString cmd)
{
@ -2317,10 +2357,11 @@ void PmuppGui::selectCollection(QString cmd)
}
}
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/**
* @brief PmuppGui::getFirstAvailableMuppInstance
* @return
* @brief PmuppGui::getFirstAvailableMuppInstance. Get the first free mupp
* instance of the mupp <-> mupp_plotter ICP message queue
* @return the first free instance.
*/
uint PmuppGui::getFirstAvailableMuppInstance()
{

View File

@ -52,6 +52,9 @@
#include "mupp.h"
//-----------------------------------------------------------------------------
/**
* @brief The PmuppXY class.
*/
class PmuppXY
{
public:
@ -94,6 +97,8 @@ private:
// | |----------------------------------------------------------------| |
// | |
// | |----------------------------------------------------------------| |
// | | History | |
// | |----------------------------------------------------------------| |
// | | Cmd | |
// | |----------------------------------------------------------------| |
// ----------------------------------------------------------------------
@ -180,11 +185,11 @@ private:
QLineEdit *fCmdLine;
QPushButton *fExitButton;
QVector<QString> fCmdHistory;
QVector<QString> fCmdHistory; ///< command history buffer
PVarDialog *fVarDlg;
PVarDialog *fVarDlg; ///< variable dialog
QProcess *fMuppPlot;
QProcess *fMuppPlot; ///< mupp plotter
void setupFileActions();
void setupToolActions();

View File

@ -42,8 +42,8 @@
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::PmuppScript
* @param script
* @brief PmuppScript::PmuppScript. Ctor
* @param script source
*/
PmuppScript::PmuppScript(QStringList script) :
fScript(script)
@ -59,7 +59,7 @@ PmuppScript::PmuppScript(QStringList script) :
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::~PmuppScript
* @brief PmuppScript::~PmuppScript. Dtor
*/
PmuppScript::~PmuppScript()
{
@ -75,8 +75,8 @@ PmuppScript::~PmuppScript()
}
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::executeScript
* @return
* @brief PmuppScript::executeScript. Handles the script commands.
* @return 0 on success.
*/
int PmuppScript::executeScript()
{
@ -132,8 +132,9 @@ int PmuppScript::executeScript()
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::setLoadPath
* @param cmd
* @brief PmuppScript::setLoadPath. Sets the load path (where to look for input
* data.
* @param cmd set load path command string.
*/
void PmuppScript::setLoadPath(const QString cmd)
{
@ -165,8 +166,9 @@ void PmuppScript::setLoadPath(const QString cmd)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::setSavePath
* @param cmd
* @brief PmuppScript::setSavePath. Sets the save path (where to save the output
* files.
* @param cmd save path command string.
*/
void PmuppScript::setSavePath(const QString cmd)
{
@ -198,9 +200,9 @@ void PmuppScript::setSavePath(const QString cmd)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::loadCollection
* @param str
* @return
* @brief PmuppScript::loadCollection. Load collection command
* @param str load collection command string
* @return 0 on success.
*/
int PmuppScript::loadCollection(const QString str)
{
@ -220,9 +222,9 @@ int PmuppScript::loadCollection(const QString str)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::select
* @param str
* @return
* @brief PmuppScript::select. Select collection command.
* @param str selection command string
* @return 0 on success
*/
int PmuppScript::select(const QString str)
{
@ -259,8 +261,8 @@ int PmuppScript::select(const QString str)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::selectAll
* @return
* @brief PmuppScript::selectAll. Select all collections
* @return 0 on success
*/
int PmuppScript::selectAll()
{
@ -277,9 +279,9 @@ int PmuppScript::selectAll()
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::addX
* @param str
* @return
* @brief PmuppScript::addX. Add label to x-axis
* @param str label string
* @return 0 on success
*/
int PmuppScript::addX(const QString str)
{
@ -374,9 +376,9 @@ int PmuppScript::addX(const QString str)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::addY
* @param str
* @return
* @brief PmuppScript::addY. Add label to y-axis.
* @param str label string
* @return 0 on success
*/
int PmuppScript::addY(const QString str)
{
@ -490,9 +492,9 @@ int PmuppScript::addY(const QString str)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::plot
* @param str
* @return
* @brief PmuppScript::plot. Create root macro and feed it to root in the bash mode.
* @param str plot script command string
* @return 0 on success
*/
int PmuppScript::plot(const QString str)
{
@ -543,10 +545,11 @@ int PmuppScript::plot(const QString str)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::macro
* @param str
* @param plotFln
* @return
* @brief PmuppScript::macro. Create a root macro
* @param str macro string command string
* @param plotFln plot file name. Depending on the extension (*.png, *.pdf, ...)
* the given a file will be created.
* @return 0 on success
*/
int PmuppScript::macro(const QString str, const QString plotFln)
{
@ -773,9 +776,9 @@ int PmuppScript::macro(const QString str, const QString plotFln)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::var_cmd
* @param str
* @return
* @brief PmuppScript::var_cmd. Variable definition command
* @param str variable definition command string
* @return 0 on success
*/
int PmuppScript::var_cmd(const QString str)
{
@ -831,9 +834,9 @@ int PmuppScript::var_cmd(const QString str)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::foundLabel
* @param coll
* @return
* @brief PmuppScript::foundLabel find label in collection coll.
* @param coll collection object
* @return true if found
*/
bool PmuppScript::foundLabel(PmuppCollection *coll, const QString label)
{
@ -850,9 +853,10 @@ bool PmuppScript::foundLabel(PmuppCollection *coll, const QString label)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::foundVariable
* @param var
* @return
* @brief PmuppScript::foundVariable. Check if a variable is found in the
* variable handler.
* @param var variable name
* @return true if found
*/
bool PmuppScript::foundVariable(const QString var)
{
@ -869,9 +873,10 @@ bool PmuppScript::foundVariable(const QString var)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::getVarIndex
* @param var
* @return
* @brief PmuppScript::getVarIndex. Get index of the variable object given by
* its name.
* @param var variable name searched for
* @return idx of found, -1 otherwise
*/
int PmuppScript::getVarIndex(const QString var)
{
@ -888,9 +893,10 @@ int PmuppScript::getVarIndex(const QString var)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::minMax
* @param min
* @param max
* @brief PmuppScript::minMax get minimum and maximum of the data set.
* @param dvec data set vector
* @param min resulting minimum
* @param max resulting maximum
*/
void PmuppScript::minMax(QVector<double> dvec, double &min, double &max)
{
@ -906,9 +912,9 @@ void PmuppScript::minMax(QVector<double> dvec, double &min, double &max)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::getNicerLabel
* @param label
* @return
* @brief PmuppScript::getNicerLabel. Prettify the labels.
* @param label to be prettified
* @return prettified label
*/
QString PmuppScript::getNicerLabel(const QString label)
{
@ -956,9 +962,9 @@ QString PmuppScript::getNicerLabel(const QString label)
//--------------------------------------------------------------------------
/**
* @brief PmuppScript::getCollectionIndex
* @param var_name
* @return
* @brief PmuppScript::getCollectionIndex. Get the index of a collection.
* @param var_name name of the collection
* @return idx on success, -1 otherwise
*/
int PmuppScript::getCollectionIndex(const QString var_name)
{

View File

@ -37,12 +37,18 @@
#include "Pmupp.h"
#include "PVarHandler.h"
//----------------------------------------------------------------------------
typedef struct {
int collIdx;
QString xLabel;
QVector<QString> yLabel;
int collIdx; ///< collection index
QString xLabel; ///< x-axis label
QVector<QString> yLabel; ///< y-axis label(s)
} PmuppPlotEntry;
//----------------------------------------------------------------------------
/**
* @brief The PmuppScript class. mupp script class which is used as a scripting
* interface for mupp.
*/
class PmuppScript : public QObject
{
Q_OBJECT
@ -73,20 +79,20 @@ class PmuppScript : public QObject
void finished();
private:
PmuppAdmin *fAdmin;
PmuppAdmin *fAdmin; ///< admin object
QStringList fScript;
PParamDataHandler *fParamDataHandler;
QStringList fScript; ///< script source
PParamDataHandler *fParamDataHandler; ///< parameter data handler
int fSelected; ///< -2=nothing selected, -1=all selected, >=0 is the index if the selected collection
PmuppPlotEntry fPlotEntry;
QVector<PmuppPlotEntry> fPlotInfo;
PmuppPlotEntry fPlotEntry; ///< plot entry object
QVector<PmuppPlotEntry> fPlotInfo; ///< vector of all plot entry objects
bool fNorm;
QString fLoadPath;
QString fSavePath;
bool fNorm; ///< normalization flag, true -> normalize y-data before plotting.
QString fLoadPath; ///< load path specifying where to look for data.
QString fSavePath; ///< save path specifying where to save data.
QVector<PVarHandler> fVarHandler;
QVector<PVarHandler> fVarHandler; ///< variable handler vector
bool foundLabel(PmuppCollection *coll, const QString label);
bool foundVariable(const QString var);

View File

@ -44,7 +44,7 @@
//------------------------------------------------------------------------
/**
* @brief mupp_script_syntax
* <p>mupp script help.
*/
void mupp_script_syntax()
{
@ -84,7 +84,7 @@ void mupp_script_syntax()
//------------------------------------------------------------------------
/**
* @brief mupp_syntax
* <p>mupp syntax help.
*/
void mupp_syntax()
{
@ -103,10 +103,12 @@ void mupp_syntax()
//------------------------------------------------------------------------
/**
* @brief mupp_scrript_read
* @param fln
* @param list
* @return
* <p>Reads a mupp script and feeds its content to list.
*
* @param fln mupp script file name
* @param list content of the mupp script
*
* @return 0 if success, otherwise -1
*/
int mupp_script_read(const char *fln, QStringList &list)
{
@ -149,9 +151,11 @@ int mupp_script_read(const char *fln, QStringList &list)
//------------------------------------------------------------------------
/**
* @brief mupp_bash_variable_exists
* @param str
* @return
* <p>check if a bash environment variable exists.
*
* @param str name of bash variable to be checked.
*
* @return true if the bash variable exists, false otherwise.
*/
bool mupp_bash_variable_exists(const QString str)
{
@ -168,9 +172,11 @@ bool mupp_bash_variable_exists(const QString str)
//------------------------------------------------------------------------
/**
* @brief mupp_script_syntax_check
* @param list
* @return
* <p>checks the mupp script syntax.
*
* @param list mupp script content.
*
* @return 0 on success, negative numbers otherwise.
*/
int mupp_script_syntax_check(QStringList &list)
{
@ -428,11 +434,14 @@ int mupp_script_syntax_check(QStringList &list)
//------------------------------------------------------------------------
/**
* @brief createApplication
* <p>Depending on whether a script or gui application is wished, select
* the proper Qt application class.
*
* @param argc
* @param argv
* @param gui
* @return
* @param gui if true, the gui is wanted, otherwise the script is called.
*
* @return the request qt application
*/
QCoreApplication* createApplication(int &argc, char *argv[], bool gui)
{
@ -444,10 +453,15 @@ QCoreApplication* createApplication(int &argc, char *argv[], bool gui)
//------------------------------------------------------------------------
/**
* @brief main
* <p>Main mupp application. mupp stands for muon parameter plotter. It allows
* to plot the parameters of db- or dat-files. The typical use case is e.g.
* plotting parameters of muSR fits as function of temperature, pressure,
* energy, etc.
*
* @param argc
* @param argv
* @return
*
* @return return value of the Qt application
*/
int main(int argc, char *argv[])
{