diff --git a/src/musrgui/PAdmin.cpp b/src/musrgui/PAdmin.cpp index 98ad5e2a..a3868866 100644 --- a/src/musrgui/PAdmin.cpp +++ b/src/musrgui/PAdmin.cpp @@ -73,6 +73,10 @@ bool PAdminXMLParser::startElement( const QString&, const QString&, fKeyWord = eExecPath; } else if (qName == "default_save_path") { fKeyWord = eDefaultSavePath; + } else if (qName == "title_from_data_file") { + fKeyWord = eTitleFromDataFile; + } else if (qName == "enable_musrt0") { + fKeyWord = eEnableMusrT0; } else if (qName == "beamline") { fKeyWord = eBeamline; } else if (qName == "institute") { @@ -81,8 +85,6 @@ bool PAdminXMLParser::startElement( const QString&, const QString&, fKeyWord = eFileFormat; } else if (qName == "lifetime_correction") { fKeyWord = eLifetimeCorrection; - } else if (qName == "title_from_data_file") { - fKeyWord = eTitleFromDataFile; } else if (qName == "msr_default_file_path") { fKeyWord = eMsrDefaultFilePath; } else if (qName == "help_main") { @@ -148,6 +150,20 @@ bool PAdminXMLParser::characters(const QString& str) case eDefaultSavePath: fAdmin->setDefaultSavePath(QString(str.ascii()).stripWhiteSpace()); break; + case eTitleFromDataFile: + if (str == "y") + flag = true; + else + flag = false; + fAdmin->setTitleFromDataFileFlag(flag); + break; + case eEnableMusrT0: + if (str == "y") + flag = true; + else + flag = false; + fAdmin->setEnableMusrT0Flag(flag); + break; case eBeamline: fAdmin->setBeamline(QString(str.ascii()).stripWhiteSpace()); break; @@ -164,13 +180,6 @@ bool PAdminXMLParser::characters(const QString& str) flag = false; fAdmin->setLifetimeCorrectionFlag(flag); break; - case eTitleFromDataFile: - if (str == "y") - flag = true; - else - flag = false; - fAdmin->setTitleFromDataFileFlag(flag); - break; case eMsrDefaultFilePath: fAdmin->setMsrDefaultFilePath(QString(str.ascii()).stripWhiteSpace()); break; @@ -303,8 +312,9 @@ PAdmin::PAdmin() fHelpMain = QString(""); - fLifetimeCorrection = true; fTitleFromDataFile = false; + fEnableMusrT0 = false; + fLifetimeCorrection = true; // XML Parser part QString fln = "./musrgui_startup.xml"; diff --git a/src/musrgui/PAdmin.h b/src/musrgui/PAdmin.h index 4fd02cd4..7c60b182 100644 --- a/src/musrgui/PAdmin.h +++ b/src/musrgui/PAdmin.h @@ -57,9 +57,10 @@ class PAdminXMLParser : public QXmlDefaultHandler virtual ~PAdminXMLParser() {} private: - enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eBeamline, eInstitute, eFileFormat, - eLifetimeCorrection, eTitleFromDataFile, eMsrDefaultFilePath, eHelpMain, eTheoFuncPixmapPath, - eFunc, eFuncName, eFuncComment, eFuncLabel, eFuncPixmap, eFuncParams}; + enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0, + eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath, + eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel, + eFuncPixmap, eFuncParams}; bool startDocument(); bool startElement( const QString&, const QString&, const QString& , @@ -86,11 +87,12 @@ class PAdmin QString getExecPath() { return fExecPath; } QString getDefaultSavePath() { return fDefaultSavePath; } + bool getTitleFromDataFileFlag() { return fTitleFromDataFile; } + bool getEnableMusrT0Flag() { return fEnableMusrT0; } QString getBeamline() { return fBeamline; } QString getInstitute() { return fInstitute; } QString getFileFormat() { return fFileFormat; } bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; } - bool getTitleFromDataFileFlag() { return fTitleFromDataFile; } QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; } QString getHelpMain() { return fHelpMain; } QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; } @@ -100,11 +102,12 @@ class PAdmin protected: void setExecPath(const QString str) { fExecPath = str; } void setDefaultSavePath(const QString str) { fDefaultSavePath = str; } + void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; } + void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; } void setBeamline(const QString str) { fBeamline = str; } void setInstitute(const QString str) { fInstitute = str; } void setFileFormat(const QString str) { fFileFormat = str; } void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; } - void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; } void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; } void setHelpMain(const QString str) { fHelpMain = str; } void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; } @@ -118,11 +121,13 @@ class PAdmin QString fMsrDefaultFilePath; QString fTheoFuncPixmapPath; + bool fTitleFromDataFile; + bool fEnableMusrT0; + QString fBeamline; QString fInstitute; QString fFileFormat; bool fLifetimeCorrection; - bool fTitleFromDataFile; QString fHelpMain; diff --git a/src/musrgui/PPrefsDialog.cpp b/src/musrgui/PPrefsDialog.cpp index ea238d79..35ef4546 100644 --- a/src/musrgui/PPrefsDialog.cpp +++ b/src/musrgui/PPrefsDialog.cpp @@ -35,7 +35,8 @@ /** *

*/ -PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file) +PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file, + const bool enable_musrt0) { if (keep_mn2_output) fKeepMn2Output_checkBox->setChecked(true); @@ -54,6 +55,7 @@ PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const } fTitleFromData_checkBox->setChecked(title_from_data_file); + fEnableMusrT0_checkBox->setChecked(enable_musrt0); } //---------------------------------------------------------------------------------------------------- diff --git a/src/musrgui/PPrefsDialog.h b/src/musrgui/PPrefsDialog.h index 69144ec8..5bd23abc 100644 --- a/src/musrgui/PPrefsDialog.h +++ b/src/musrgui/PPrefsDialog.h @@ -39,10 +39,12 @@ class PPrefsDialog : public PPrefsDialogBase { public: - PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file); + PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file, + const bool enable_musrt0); - bool keepMinuit2Output() { return fKeepMn2Output_checkBox->isChecked(); } - bool titleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); } + bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); } + bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); } + bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); } int getDump(); public slots: diff --git a/src/musrgui/PTextEdit.cpp b/src/musrgui/PTextEdit.cpp index 442ceb84..efbad00b 100644 --- a/src/musrgui/PTextEdit.cpp +++ b/src/musrgui/PTextEdit.cpp @@ -108,6 +108,8 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name ) { fAdmin = new PAdmin(); + fMusrT0Action = 0; + fMsr2DataParam = 0; fFindReplaceData = 0, @@ -115,6 +117,7 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name ) fKeepMinuit2Output = false; fTitleFromDataFile = fAdmin->getTitleFromDataFileFlag(); + fEnableMusrT0 = fAdmin->getEnableMusrT0Flag(); fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump setupFileActions(); @@ -149,6 +152,14 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name ) */ PTextEdit::~PTextEdit() { + if (fAdmin) { + delete fAdmin; + fAdmin = 0; + } + if (fMusrT0Action) { + delete fMusrT0Action; + fMusrT0Action = 0; + } if (fMsr2DataParam) { delete fMsr2DataParam; fMsr2DataParam = 0; @@ -362,10 +373,11 @@ void PTextEdit::setupMusrActions() a->addTo( tb ); a->addTo( menu ); - a = new QAction( QPixmap::fromMimeSource( "musrt0.xpm" ), tr( "&T0" ), 0, this, "musrT0" ); - connect( a, SIGNAL( activated() ), this, SLOT( musrT0() ) ); - a->addTo( tb ); - a->addTo( menu ); + fMusrT0Action = new QAction( QPixmap::fromMimeSource( "musrt0.xpm" ), tr( "&T0" ), 0, this, "musrT0" ); + connect( fMusrT0Action, SIGNAL( activated() ), this, SLOT( musrT0() ) ); + fMusrT0Action->addTo( tb ); + fMusrT0Action->addTo( menu ); + fMusrT0Action->setEnabled(fEnableMusrT0); a = new QAction( QPixmap::fromMimeSource( "musrprefs.xpm" ), tr( "&Preferences" ), 0, this, "musrPrefs" ); connect( a, SIGNAL( activated() ), this, SLOT( musrPrefs() ) ); @@ -1691,11 +1703,13 @@ void PTextEdit::musrT0() */ void PTextEdit::musrPrefs() { - PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile); + PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile, fEnableMusrT0); if (dlg->exec() == QDialog::Accepted) { - fKeepMinuit2Output = dlg->keepMinuit2Output(); - fTitleFromDataFile = dlg->titleFromDataFileFlag(); + fKeepMinuit2Output = dlg->getKeepMinuit2OutputFlag(); + fTitleFromDataFile = dlg->getTitleFromDataFileFlag(); + fEnableMusrT0 = dlg->getEnableMusrT0Flag(); + fMusrT0Action->setEnabled(fEnableMusrT0); fDump = dlg->getDump(); } } diff --git a/src/musrgui/PTextEdit.h b/src/musrgui/PTextEdit.h index 103d93b5..3db968ab 100644 --- a/src/musrgui/PTextEdit.h +++ b/src/musrgui/PTextEdit.h @@ -122,8 +122,11 @@ private slots: private: PAdmin *fAdmin; + QAction *fMusrT0Action; + bool fKeepMinuit2Output; bool fTitleFromDataFile; + bool fEnableMusrT0; int fDump; PMsr2DataParam *fMsr2DataParam; diff --git a/src/musrgui/forms/PPrefsDialogBase.ui b/src/musrgui/forms/PPrefsDialogBase.ui index 205c4d0b..b9b34268 100644 --- a/src/musrgui/forms/PPrefsDialogBase.ui +++ b/src/musrgui/forms/PPrefsDialogBase.ui @@ -24,100 +24,6 @@ true - - - fTabWidget - - - - 10 - 20 - 520 - 110 - - - - - tab - - - musrfit - - - - fKeepMn2Output_checkBox - - - - 10 - 10 - 160 - 22 - - - - keep minuit2 output - - - will keep the Minuit2 output files (correlation matrix, etc.) - - - - - fDumpAscii_checkBox - - - - 10 - 30 - 95 - 22 - - - - dump ascii - - - will generate an ascii dump file after the fit with the data and the theory - - - - - fDumpRoot_checkBox - - - - 10 - 50 - 95 - 22 - - - - dump root - - - will generate a ROOT dump file after the fit with the data and the theory - - - - - fTitleFromData_checkBox - - - - 198 - 11 - 140 - 22 - - - - take data file title - - - - Layout1 @@ -204,6 +110,124 @@ + + + fTabWidget + + + + 10 + 20 + 520 + 110 + + + + + tab + + + musrfit + + + + fDumpAscii_checkBox + + + + 10 + 30 + 95 + 22 + + + + dump ascii + + + will generate an ascii dump file after the fit with the data and the theory + + + + + fDumpRoot_checkBox + + + + 10 + 50 + 95 + 22 + + + + dump root + + + will generate a ROOT dump file after the fit with the data and the theory + + + + + fTitleFromData_checkBox + + + + 198 + 11 + 140 + 22 + + + + take data file title + + + + + fKeepMn2Output_checkBox + + + + 10 + 10 + 160 + 22 + + + + keep minuit2 output + + + will keep the Minuit2 output files (correlation matrix, etc.) + + + + + + TabPage + + + musrt0 + + + + fEnableMusrT0_checkBox + + + + 10 + 10 + 95 + 22 + + + + enable it + + + + diff --git a/src/musrgui/musrgui_startup.xml b/src/musrgui/musrgui_startup.xml index 1681409e..ab36495a 100644 --- a/src/musrgui/musrgui_startup.xml +++ b/src/musrgui/musrgui_startup.xml @@ -8,13 +8,14 @@ $ROOTSYS/bin ./ $HOME/analysis/musrfit/src/musrgui + n + n mue4 psi root-npp y - n