added enable/disable feature for musrt0 in musrgui

This commit is contained in:
nemu
2009-06-26 05:31:33 +00:00
parent 215a9afa04
commit d2229dcc81
8 changed files with 183 additions and 122 deletions

View File

@ -73,6 +73,10 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eExecPath; fKeyWord = eExecPath;
} else if (qName == "default_save_path") { } else if (qName == "default_save_path") {
fKeyWord = eDefaultSavePath; fKeyWord = eDefaultSavePath;
} else if (qName == "title_from_data_file") {
fKeyWord = eTitleFromDataFile;
} else if (qName == "enable_musrt0") {
fKeyWord = eEnableMusrT0;
} else if (qName == "beamline") { } else if (qName == "beamline") {
fKeyWord = eBeamline; fKeyWord = eBeamline;
} else if (qName == "institute") { } else if (qName == "institute") {
@ -81,8 +85,6 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eFileFormat; fKeyWord = eFileFormat;
} else if (qName == "lifetime_correction") { } else if (qName == "lifetime_correction") {
fKeyWord = eLifetimeCorrection; fKeyWord = eLifetimeCorrection;
} else if (qName == "title_from_data_file") {
fKeyWord = eTitleFromDataFile;
} else if (qName == "msr_default_file_path") { } else if (qName == "msr_default_file_path") {
fKeyWord = eMsrDefaultFilePath; fKeyWord = eMsrDefaultFilePath;
} else if (qName == "help_main") { } else if (qName == "help_main") {
@ -148,6 +150,20 @@ bool PAdminXMLParser::characters(const QString& str)
case eDefaultSavePath: case eDefaultSavePath:
fAdmin->setDefaultSavePath(QString(str.ascii()).stripWhiteSpace()); fAdmin->setDefaultSavePath(QString(str.ascii()).stripWhiteSpace());
break; 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: case eBeamline:
fAdmin->setBeamline(QString(str.ascii()).stripWhiteSpace()); fAdmin->setBeamline(QString(str.ascii()).stripWhiteSpace());
break; break;
@ -164,13 +180,6 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false; flag = false;
fAdmin->setLifetimeCorrectionFlag(flag); fAdmin->setLifetimeCorrectionFlag(flag);
break; break;
case eTitleFromDataFile:
if (str == "y")
flag = true;
else
flag = false;
fAdmin->setTitleFromDataFileFlag(flag);
break;
case eMsrDefaultFilePath: case eMsrDefaultFilePath:
fAdmin->setMsrDefaultFilePath(QString(str.ascii()).stripWhiteSpace()); fAdmin->setMsrDefaultFilePath(QString(str.ascii()).stripWhiteSpace());
break; break;
@ -303,8 +312,9 @@ PAdmin::PAdmin()
fHelpMain = QString(""); fHelpMain = QString("");
fLifetimeCorrection = true;
fTitleFromDataFile = false; fTitleFromDataFile = false;
fEnableMusrT0 = false;
fLifetimeCorrection = true;
// XML Parser part // XML Parser part
QString fln = "./musrgui_startup.xml"; QString fln = "./musrgui_startup.xml";

View File

@ -57,9 +57,10 @@ class PAdminXMLParser : public QXmlDefaultHandler
virtual ~PAdminXMLParser() {} virtual ~PAdminXMLParser() {}
private: private:
enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eBeamline, eInstitute, eFileFormat, enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0,
eLifetimeCorrection, eTitleFromDataFile, eMsrDefaultFilePath, eHelpMain, eTheoFuncPixmapPath, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
eFunc, eFuncName, eFuncComment, eFuncLabel, eFuncPixmap, eFuncParams}; eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
eFuncPixmap, eFuncParams};
bool startDocument(); bool startDocument();
bool startElement( const QString&, const QString&, const QString& , bool startElement( const QString&, const QString&, const QString& ,
@ -86,11 +87,12 @@ class PAdmin
QString getExecPath() { return fExecPath; } QString getExecPath() { return fExecPath; }
QString getDefaultSavePath() { return fDefaultSavePath; } QString getDefaultSavePath() { return fDefaultSavePath; }
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
bool getEnableMusrT0Flag() { return fEnableMusrT0; }
QString getBeamline() { return fBeamline; } QString getBeamline() { return fBeamline; }
QString getInstitute() { return fInstitute; } QString getInstitute() { return fInstitute; }
QString getFileFormat() { return fFileFormat; } QString getFileFormat() { return fFileFormat; }
bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; } bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; }
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; } QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; }
QString getHelpMain() { return fHelpMain; } QString getHelpMain() { return fHelpMain; }
QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; } QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; }
@ -100,11 +102,12 @@ class PAdmin
protected: protected:
void setExecPath(const QString str) { fExecPath = str; } void setExecPath(const QString str) { fExecPath = str; }
void setDefaultSavePath(const QString str) { fDefaultSavePath = 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 setBeamline(const QString str) { fBeamline = str; }
void setInstitute(const QString str) { fInstitute = str; } void setInstitute(const QString str) { fInstitute = str; }
void setFileFormat(const QString str) { fFileFormat = str; } void setFileFormat(const QString str) { fFileFormat = str; }
void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; } void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; }
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; } void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; }
void setHelpMain(const QString str) { fHelpMain = str; } void setHelpMain(const QString str) { fHelpMain = str; }
void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; } void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; }
@ -118,11 +121,13 @@ class PAdmin
QString fMsrDefaultFilePath; QString fMsrDefaultFilePath;
QString fTheoFuncPixmapPath; QString fTheoFuncPixmapPath;
bool fTitleFromDataFile;
bool fEnableMusrT0;
QString fBeamline; QString fBeamline;
QString fInstitute; QString fInstitute;
QString fFileFormat; QString fFileFormat;
bool fLifetimeCorrection; bool fLifetimeCorrection;
bool fTitleFromDataFile;
QString fHelpMain; QString fHelpMain;

View File

@ -35,7 +35,8 @@
/** /**
* <p> * <p>
*/ */
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) if (keep_mn2_output)
fKeepMn2Output_checkBox->setChecked(true); 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); fTitleFromData_checkBox->setChecked(title_from_data_file);
fEnableMusrT0_checkBox->setChecked(enable_musrt0);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -39,10 +39,12 @@
class PPrefsDialog : public PPrefsDialogBase class PPrefsDialog : public PPrefsDialogBase
{ {
public: 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 getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); }
bool titleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); } bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); }
int getDump(); int getDump();
public slots: public slots:

View File

@ -108,6 +108,8 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
{ {
fAdmin = new PAdmin(); fAdmin = new PAdmin();
fMusrT0Action = 0;
fMsr2DataParam = 0; fMsr2DataParam = 0;
fFindReplaceData = 0, fFindReplaceData = 0,
@ -115,6 +117,7 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
fKeepMinuit2Output = false; fKeepMinuit2Output = false;
fTitleFromDataFile = fAdmin->getTitleFromDataFileFlag(); fTitleFromDataFile = fAdmin->getTitleFromDataFileFlag();
fEnableMusrT0 = fAdmin->getEnableMusrT0Flag();
fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump
setupFileActions(); setupFileActions();
@ -149,6 +152,14 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
*/ */
PTextEdit::~PTextEdit() PTextEdit::~PTextEdit()
{ {
if (fAdmin) {
delete fAdmin;
fAdmin = 0;
}
if (fMusrT0Action) {
delete fMusrT0Action;
fMusrT0Action = 0;
}
if (fMsr2DataParam) { if (fMsr2DataParam) {
delete fMsr2DataParam; delete fMsr2DataParam;
fMsr2DataParam = 0; fMsr2DataParam = 0;
@ -362,10 +373,11 @@ void PTextEdit::setupMusrActions()
a->addTo( tb ); a->addTo( tb );
a->addTo( menu ); a->addTo( menu );
a = new QAction( QPixmap::fromMimeSource( "musrt0.xpm" ), tr( "&T0" ), 0, this, "musrT0" ); fMusrT0Action = new QAction( QPixmap::fromMimeSource( "musrt0.xpm" ), tr( "&T0" ), 0, this, "musrT0" );
connect( a, SIGNAL( activated() ), this, SLOT( musrT0() ) ); connect( fMusrT0Action, SIGNAL( activated() ), this, SLOT( musrT0() ) );
a->addTo( tb ); fMusrT0Action->addTo( tb );
a->addTo( menu ); fMusrT0Action->addTo( menu );
fMusrT0Action->setEnabled(fEnableMusrT0);
a = new QAction( QPixmap::fromMimeSource( "musrprefs.xpm" ), tr( "&Preferences" ), 0, this, "musrPrefs" ); a = new QAction( QPixmap::fromMimeSource( "musrprefs.xpm" ), tr( "&Preferences" ), 0, this, "musrPrefs" );
connect( a, SIGNAL( activated() ), this, SLOT( musrPrefs() ) ); connect( a, SIGNAL( activated() ), this, SLOT( musrPrefs() ) );
@ -1691,11 +1703,13 @@ void PTextEdit::musrT0()
*/ */
void PTextEdit::musrPrefs() void PTextEdit::musrPrefs()
{ {
PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile); PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile, fEnableMusrT0);
if (dlg->exec() == QDialog::Accepted) { if (dlg->exec() == QDialog::Accepted) {
fKeepMinuit2Output = dlg->keepMinuit2Output(); fKeepMinuit2Output = dlg->getKeepMinuit2OutputFlag();
fTitleFromDataFile = dlg->titleFromDataFileFlag(); fTitleFromDataFile = dlg->getTitleFromDataFileFlag();
fEnableMusrT0 = dlg->getEnableMusrT0Flag();
fMusrT0Action->setEnabled(fEnableMusrT0);
fDump = dlg->getDump(); fDump = dlg->getDump();
} }
} }

View File

@ -122,8 +122,11 @@ private slots:
private: private:
PAdmin *fAdmin; PAdmin *fAdmin;
QAction *fMusrT0Action;
bool fKeepMinuit2Output; bool fKeepMinuit2Output;
bool fTitleFromDataFile; bool fTitleFromDataFile;
bool fEnableMusrT0;
int fDump; int fDump;
PMsr2DataParam *fMsr2DataParam; PMsr2DataParam *fMsr2DataParam;

View File

@ -24,100 +24,6 @@
<property name="modal"> <property name="modal">
<bool>true</bool> <bool>true</bool>
</property> </property>
<widget class="QTabWidget">
<property name="name">
<cstring>fTabWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>520</width>
<height>110</height>
</rect>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>musrfit</string>
</attribute>
<widget class="QCheckBox">
<property name="name">
<cstring>fKeepMn2Output_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>160</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>keep minuit2 output</string>
</property>
<property name="toolTip" stdset="0">
<string>will keep the Minuit2 output files (correlation matrix, etc.)</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fDumpAscii_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>95</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>dump ascii</string>
</property>
<property name="toolTip" stdset="0">
<string>will generate an ascii dump file after the fit with the data and the theory</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fDumpRoot_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>95</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>dump root</string>
</property>
<property name="toolTip" stdset="0">
<string>will generate a ROOT dump file after the fit with the data and the theory</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fTitleFromData_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>198</x>
<y>11</y>
<width>140</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>take data file title</string>
</property>
</widget>
</widget>
</widget>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
<cstring>Layout1</cstring> <cstring>Layout1</cstring>
@ -204,6 +110,124 @@
</widget> </widget>
</hbox> </hbox>
</widget> </widget>
<widget class="QTabWidget">
<property name="name">
<cstring>fTabWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>520</width>
<height>110</height>
</rect>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>musrfit</string>
</attribute>
<widget class="QCheckBox">
<property name="name">
<cstring>fDumpAscii_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>95</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>dump ascii</string>
</property>
<property name="toolTip" stdset="0">
<string>will generate an ascii dump file after the fit with the data and the theory</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fDumpRoot_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>95</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>dump root</string>
</property>
<property name="toolTip" stdset="0">
<string>will generate a ROOT dump file after the fit with the data and the theory</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fTitleFromData_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>198</x>
<y>11</y>
<width>140</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>take data file title</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fKeepMn2Output_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>160</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>keep minuit2 output</string>
</property>
<property name="toolTip" stdset="0">
<string>will keep the Minuit2 output files (correlation matrix, etc.)</string>
</property>
</widget>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
<attribute name="title">
<string>musrt0</string>
</attribute>
<widget class="QCheckBox">
<property name="name">
<cstring>fEnableMusrT0_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>95</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>enable it</string>
</property>
</widget>
</widget>
</widget>
</widget> </widget>
<images> <images>
<image name="image0"> <image name="image0">

View File

@ -8,13 +8,14 @@
<exec_path>$ROOTSYS/bin</exec_path> <exec_path>$ROOTSYS/bin</exec_path>
<default_save_path>./</default_save_path> <default_save_path>./</default_save_path>
<msr_default_file_path>$HOME/analysis/musrfit/src/musrgui</msr_default_file_path> <msr_default_file_path>$HOME/analysis/musrfit/src/musrgui</msr_default_file_path>
<title_from_data_file>n</title_from_data_file>
<enable_musrt0>n</enable_musrt0>
</general> </general>
<msr_file_defaults> <msr_file_defaults>
<beamline>mue4</beamline> <beamline>mue4</beamline>
<institute>psi</institute> <institute>psi</institute>
<file_format>root-npp</file_format> <file_format>root-npp</file_format>
<lifetime_correction>y</lifetime_correction> <lifetime_correction>y</lifetime_correction>
<title_from_data_file>n</title_from_data_file>
</msr_file_defaults> </msr_file_defaults>
<help_section> <help_section>
<help_main> <help_main>