help url's are now found in the XML startup file and are not hardcoded anymore.
This commit is contained in:
parent
f51b136df4
commit
ae38aaf583
@ -91,8 +91,26 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
|
||||
fKeyWord = eLifetimeCorrection;
|
||||
} else if (qName == "msr_default_file_path") {
|
||||
fKeyWord = eMsrDefaultFilePath;
|
||||
} else if (qName == "help_main") {
|
||||
} else if (qName == "musr_web_main") {
|
||||
fKeyWord = eHelpMain;
|
||||
} else if (qName == "musr_web_title") {
|
||||
fKeyWord = eHelpTitle;
|
||||
} else if (qName == "musr_web_parameters") {
|
||||
fKeyWord = eHelpParameters;
|
||||
} else if (qName == "musr_web_theory") {
|
||||
fKeyWord = eHelpTheory;
|
||||
} else if (qName == "musr_web_functions") {
|
||||
fKeyWord = eHelpFunctions;
|
||||
} else if (qName == "musr_web_run") {
|
||||
fKeyWord = eHelpRun;
|
||||
} else if (qName == "musr_web_command") {
|
||||
fKeyWord = eHelpCommand;
|
||||
} else if (qName == "musr_web_fourier") {
|
||||
fKeyWord = eHelpFourier;
|
||||
} else if (qName == "musr_web_plot") {
|
||||
fKeyWord = eHelpPlot;
|
||||
} else if (qName == "musr_web_statistic") {
|
||||
fKeyWord = eHelpStatistic;
|
||||
} else if (qName == "func_pixmap_path") {
|
||||
fKeyWord = eTheoFuncPixmapPath;
|
||||
} else if (qName == "func") {
|
||||
@ -124,6 +142,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
|
||||
/**
|
||||
* <p>Routine called when the end XML tag is found. It is used to
|
||||
* put the filtering tag to 'empty'.
|
||||
*
|
||||
* \param qName name of the element.
|
||||
*/
|
||||
bool PAdminXMLParser::endElement( const QString&, const QString&, const QString &qName )
|
||||
{
|
||||
@ -141,6 +161,8 @@ bool PAdminXMLParser::endElement( const QString&, const QString&, const QString
|
||||
/**
|
||||
* <p>This routine delivers the content of an XML tag. It fills the
|
||||
* content into the load data structure.
|
||||
*
|
||||
* \param str keeps the content of the XML tag.
|
||||
*/
|
||||
bool PAdminXMLParser::characters(const QString& str)
|
||||
{
|
||||
@ -197,10 +219,34 @@ bool PAdminXMLParser::characters(const QString& str)
|
||||
fAdmin->setMsrDefaultFilePath(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eHelpMain:
|
||||
help = str;
|
||||
help.replace(">", ">");
|
||||
help.replace("<", "<");
|
||||
fAdmin->setHelpMain(help);
|
||||
fAdmin->setHelpUrl("main", str);
|
||||
break;
|
||||
case eHelpTitle:
|
||||
fAdmin->setHelpUrl("title", str);
|
||||
break;
|
||||
case eHelpParameters:
|
||||
fAdmin->setHelpUrl("parameters", str);
|
||||
break;
|
||||
case eHelpTheory:
|
||||
fAdmin->setHelpUrl("theory", str);
|
||||
break;
|
||||
case eHelpFunctions:
|
||||
fAdmin->setHelpUrl("functions", str);
|
||||
break;
|
||||
case eHelpRun:
|
||||
fAdmin->setHelpUrl("run", str);
|
||||
break;
|
||||
case eHelpCommand:
|
||||
fAdmin->setHelpUrl("command", str);
|
||||
break;
|
||||
case eHelpFourier:
|
||||
fAdmin->setHelpUrl("fourier", str);
|
||||
break;
|
||||
case eHelpPlot:
|
||||
fAdmin->setHelpUrl("plot", str);
|
||||
break;
|
||||
case eHelpStatistic:
|
||||
fAdmin->setHelpUrl("statistic", str);
|
||||
break;
|
||||
case eTheoFuncPixmapPath:
|
||||
fAdmin->setTheoFuncPixmapPath(QString(str.toLatin1()).trimmed());
|
||||
@ -275,7 +321,9 @@ bool PAdminXMLParser::endDocument()
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Called at the end of the XML parse process.
|
||||
* <p>Expands system variables to full path, e.g. $HOME -> \home\user
|
||||
*
|
||||
* \param str path string with none expanded system variables.
|
||||
*/
|
||||
QString PAdminXMLParser::expandPath(const QString &str)
|
||||
{
|
||||
@ -310,7 +358,8 @@ QString PAdminXMLParser::expandPath(const QString &str)
|
||||
// implementation of PAdmin class
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Initializes that PAdmin object, and calls the XML parser which feeds
|
||||
* the object variables.
|
||||
*/
|
||||
PAdmin::PAdmin()
|
||||
{
|
||||
@ -326,8 +375,6 @@ PAdmin::PAdmin()
|
||||
fInstitute = QString("");
|
||||
fFileFormat = QString("");
|
||||
|
||||
fHelpMain = QString("");
|
||||
|
||||
fTitleFromDataFile = false;
|
||||
fEnableMusrT0 = false;
|
||||
fLifetimeCorrection = true;
|
||||
@ -357,9 +404,25 @@ PAdmin::PAdmin()
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// implementation of PAdmin class
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>returns the help url corresponding the the tag.
|
||||
*
|
||||
* \param tag to map the help url. At the moment the following tags should be present:
|
||||
* main, title, parameters, theory, functions, run, command, fourier, plot, statistic
|
||||
*/
|
||||
QString PAdmin::getHelpUrl(QString tag)
|
||||
{
|
||||
return fHelpUrl[tag];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns a theory item from position idx. If idx is out of the range, a null pointer is returned.
|
||||
*
|
||||
* \param idx position of the theory item.
|
||||
*/
|
||||
PTheory* PAdmin::getTheoryItem(const unsigned int idx)
|
||||
{
|
||||
@ -369,6 +432,19 @@ PTheory* PAdmin::getTheoryItem(const unsigned int idx)
|
||||
return &fTheory[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>set the help url, addressed via a tag. At the moment the following tags should be present:
|
||||
* main, title, parameters, theory, functions, run, command, fourier, plot, statistic
|
||||
*
|
||||
* \param tag to address the help url
|
||||
* \param url help url corresponding to the tag.
|
||||
*/
|
||||
void PAdmin::setHelpUrl(const QString tag, const QString url)
|
||||
{
|
||||
fHelpUrl[tag] = url;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// END
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QMap>
|
||||
#include <QPixmap>
|
||||
#include <QtXml>
|
||||
|
||||
@ -59,8 +60,9 @@ class PAdminXMLParser : public QXmlDefaultHandler
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eFontName, eFontSize, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0,
|
||||
eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
|
||||
eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
|
||||
eFuncPixmap, eFuncParams};
|
||||
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
|
||||
eFuncPixmap, eFuncParams, eHelpMain, eHelpTitle, eHelpParameters, eHelpTheory, eHelpFunctions,
|
||||
eHelpRun, eHelpCommand, eHelpFourier, eHelpPlot, eHelpStatistic};
|
||||
|
||||
bool startDocument();
|
||||
bool startElement( const QString&, const QString&, const QString& ,
|
||||
@ -96,7 +98,7 @@ class PAdmin
|
||||
QString getFileFormat() { return fFileFormat; }
|
||||
bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; }
|
||||
QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; }
|
||||
QString getHelpMain() { return fHelpMain; }
|
||||
QString getHelpUrl(QString tag);
|
||||
QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; }
|
||||
unsigned int getTheoryCounts() { return fTheory.size(); }
|
||||
PTheory* getTheoryItem(const unsigned int idx);
|
||||
@ -114,7 +116,7 @@ class PAdmin
|
||||
void setFileFormat(const QString str) { fFileFormat = str; }
|
||||
void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; }
|
||||
void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; }
|
||||
void setHelpMain(const QString str) { fHelpMain = str; }
|
||||
void setHelpUrl(const QString tag, const QString url);
|
||||
void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; }
|
||||
void addTheoryItem(const PTheory theo) { fTheory.push_back(theo); }
|
||||
|
||||
@ -137,7 +139,7 @@ class PAdmin
|
||||
QString fFileFormat;
|
||||
bool fLifetimeCorrection;
|
||||
|
||||
QString fHelpMain;
|
||||
QMap<QString, QString> fHelpUrl; ///< maps tag to help url
|
||||
|
||||
QVector<PTheory> fTheory;
|
||||
};
|
||||
|
@ -56,7 +56,7 @@
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
PGetDefaultDialog::PGetDefaultDialog()
|
||||
PGetDefaultDialog::PGetDefaultDialog(const QString helpUrl) : fHelpUrl(helpUrl)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@ -101,7 +101,7 @@ void PGetDefaultDialog::setFileFormat(const QString &str)
|
||||
*/
|
||||
void PGetDefaultDialog::helpContent()
|
||||
{
|
||||
PHelp *help = new PHelp("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block");
|
||||
PHelp *help = new PHelp(fHelpUrl);
|
||||
|
||||
help->show();
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class PGetDefaultDialog : public QDialog, private Ui::PGetDefaultDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PGetDefaultDialog();
|
||||
PGetDefaultDialog(const QString helpUrl = "");
|
||||
virtual ~PGetDefaultDialog() {}
|
||||
|
||||
virtual const QString getRunFileName() const { return fRunFileName_lineEdit->text(); }
|
||||
@ -58,6 +58,9 @@ class PGetDefaultDialog : public QDialog, private Ui::PGetDefaultDialog
|
||||
|
||||
protected slots:
|
||||
virtual void helpContent();
|
||||
|
||||
private:
|
||||
QString fHelpUrl;
|
||||
};
|
||||
|
||||
#endif // _PGETDEFAULTDIALOG_H_
|
||||
|
@ -151,7 +151,7 @@ QMenu* PSubTextEdit::createPopupMenu(const QPoint &pos)
|
||||
void PSubTextEdit::insertTitle()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetTitleBlockDialog *dlg = new PGetTitleBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_1_The_Title");
|
||||
PGetTitleBlockDialog *dlg = new PGetTitleBlockDialog(fAdmin->getHelpUrl("title"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -171,7 +171,7 @@ void PSubTextEdit::insertTitle()
|
||||
void PSubTextEdit::insertParameterBlock()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetParameterBlockDialog *dlg = new PGetParameterBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_2_The_FITPARAMETER_Block");
|
||||
PGetParameterBlockDialog *dlg = new PGetParameterBlockDialog(fAdmin->getHelpUrl("parameters"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -229,7 +229,7 @@ void PSubTextEdit::insertTheoryFunction(int idx)
|
||||
void PSubTextEdit::insertTheoryBlock()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetTheoryBlockDialog *dlg = new PGetTheoryBlockDialog(fAdmin, "https://wiki.intranet.psi.ch/MUSR/MusrFit#4_3_The_THEORY_Block");
|
||||
PGetTheoryBlockDialog *dlg = new PGetTheoryBlockDialog(fAdmin, fAdmin->getHelpUrl("theory"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -249,7 +249,7 @@ void PSubTextEdit::insertTheoryBlock()
|
||||
void PSubTextEdit::insertFunctionBlock()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetFunctionsBlockDialog *dlg = new PGetFunctionsBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_4_The_FUNCTIONS_Block");
|
||||
PGetFunctionsBlockDialog *dlg = new PGetFunctionsBlockDialog(fAdmin->getHelpUrl("functions"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -269,7 +269,7 @@ void PSubTextEdit::insertFunctionBlock()
|
||||
void PSubTextEdit::insertAsymRunBlock()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetAsymmetryRunBlockDialog *dlg = new PGetAsymmetryRunBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block");
|
||||
PGetAsymmetryRunBlockDialog *dlg = new PGetAsymmetryRunBlockDialog(fAdmin->getHelpUrl("run"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -376,7 +376,7 @@ void PSubTextEdit::insertAsymRunBlock()
|
||||
void PSubTextEdit::insertSingleHistRunBlock()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetSingleHistoRunBlockDialog *dlg = new PGetSingleHistoRunBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block");
|
||||
PGetSingleHistoRunBlockDialog *dlg = new PGetSingleHistoRunBlockDialog(fAdmin->getHelpUrl("run"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -482,7 +482,7 @@ void PSubTextEdit::insertSingleHistRunBlock()
|
||||
*/
|
||||
void PSubTextEdit::insertNonMusrRunBlock()
|
||||
{
|
||||
PGetNonMusrRunBlockDialog *dlg = new PGetNonMusrRunBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block");
|
||||
PGetNonMusrRunBlockDialog *dlg = new PGetNonMusrRunBlockDialog(fAdmin->getHelpUrl("run"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -562,7 +562,7 @@ void PSubTextEdit::insertCommandBlock()
|
||||
void PSubTextEdit::insertFourierBlock()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetFourierBlockDialog *dlg = new PGetFourierBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_7_The_FOURIER_Block");
|
||||
PGetFourierBlockDialog *dlg = new PGetFourierBlockDialog(fAdmin->getHelpUrl("fourier"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
@ -581,7 +581,7 @@ void PSubTextEdit::insertFourierBlock()
|
||||
void PSubTextEdit::insertPlotBlock()
|
||||
{
|
||||
// for the time being the url's are hard coded but should be transfered to the XML startup
|
||||
PGetPlotBlockDialog *dlg = new PGetPlotBlockDialog("https://wiki.intranet.psi.ch/MUSR/MusrFit#4_8_The_PLOT_Block");
|
||||
PGetPlotBlockDialog *dlg = new PGetPlotBlockDialog(fAdmin->getHelpUrl("plot"));
|
||||
|
||||
if (dlg == 0)
|
||||
return;
|
||||
|
@ -1397,7 +1397,7 @@ void PTextEdit::musrGetAsymmetryDefault()
|
||||
{
|
||||
QString runFileName, beamline, institute, fileFormat;
|
||||
|
||||
PGetDefaultDialog *dlg = new PGetDefaultDialog();
|
||||
PGetDefaultDialog *dlg = new PGetDefaultDialog(fAdmin->getHelpUrl("main"));
|
||||
|
||||
if (dlg == 0) {
|
||||
QMessageBox::critical(this, "**ERROR**", "Couldn't invoke get default dialog, sorry :-(", QMessageBox::Ok, QMessageBox::NoButton);
|
||||
@ -2098,7 +2098,7 @@ void PTextEdit::musrSwapMsrMlog()
|
||||
*/
|
||||
void PTextEdit::helpContents()
|
||||
{
|
||||
PHelp *help = new PHelp("https://wiki.intranet.psi.ch/MUSR/WebHome");
|
||||
PHelp *help = new PHelp(fAdmin->getHelpUrl("main"));
|
||||
|
||||
help->show();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<musredit_startup xmlns="https://wiki.intranet.psi.ch/MUSR/MusrGui">
|
||||
<musredit_startup xmlns="https://wiki.intranet.psi.ch/MUSR/MusrEdit">
|
||||
<comment>
|
||||
$Id$
|
||||
This is handling default setting parameters for the musredit.
|
||||
@ -11,6 +11,18 @@
|
||||
<title_from_data_file>n</title_from_data_file>
|
||||
<enable_musrt0>n</enable_musrt0>
|
||||
</general>
|
||||
<help_section>
|
||||
<musr_web_main>https://wiki.intranet.psi.ch/MUSR/WebHome</musr_web_main>
|
||||
<musr_web_title>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_1_The_Title</musr_web_title>
|
||||
<musr_web_parameters>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_2_The_FITPARAMETER_Block</musr_web_parameters>
|
||||
<musr_web_theory>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_3_The_THEORY_Block</musr_web_theory>
|
||||
<musr_web_functions>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_4_The_FUNCTIONS_Block</musr_web_functions>
|
||||
<musr_web_run>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block</musr_web_run>
|
||||
<musr_web_command>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_6_The_COMMANDS_Block</musr_web_command>
|
||||
<musr_web_fourier>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_7_The_FOURIER_Block</musr_web_fourier>
|
||||
<musr_web_plot>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_8_The_PLOT_Block</musr_web_plot>
|
||||
<musr_web_statistic>https://wiki.intranet.psi.ch/MUSR/MusrFit#4_9_The_STATISTIC_Block</musr_web_statistic>
|
||||
</help_section>
|
||||
<font_settings>
|
||||
<font_name>Courier</font_name>
|
||||
<font_size>12</font_size>
|
||||
@ -21,12 +33,6 @@
|
||||
<file_format>root-npp</file_format>
|
||||
<lifetime_correction>y</lifetime_correction>
|
||||
</msr_file_defaults>
|
||||
<help_section>
|
||||
<help_main>
|
||||
For a detailed description of the aim and structure of a msr-file see <b>https://wiki.intranet.psi.ch/MUSR/MusrFit</b>
|
||||
Starting with >= Qt4.2 this will be linked automatically but until then ...; sorry ;-)
|
||||
</help_main>
|
||||
</help_section>
|
||||
<func_pixmap_path>$HOME/analysis/musrfit/src/musredit/latex_images</func_pixmap_path>
|
||||
<theory_functions>
|
||||
<func>
|
||||
|
Loading…
x
Reference in New Issue
Block a user