diff --git a/src/musrgui/PPrefsDialog.cpp b/src/musrgui/PPrefsDialog.cpp new file mode 100644 index 00000000..a473e173 --- /dev/null +++ b/src/musrgui/PPrefsDialog.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** + + PPrefsDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "PPrefsDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag) +{ + if (keep_mn2_output) + fKeepMn2Output_checkBox->setChecked(true); + else + fKeepMn2Output_checkBox->setChecked(false); + + if (dump_tag == 1) { + fDumpAscii_checkBox->setChecked(true); + fDumpRoot_checkBox->setChecked(false); + } else if (dump_tag == 2) { + fDumpAscii_checkBox->setChecked(false); + fDumpRoot_checkBox->setChecked(true); + } else { + fDumpAscii_checkBox->setChecked(false); + fDumpRoot_checkBox->setChecked(false); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +int PPrefsDialog::getDump() +{ + int result = 0; + + if (fDumpAscii_checkBox->isChecked()) + result = 1; + else if (fDumpRoot_checkBox->isChecked()) + result = 2; + + return result; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PPrefsDialog::dumpAscii() +{ + if (fDumpAscii_checkBox->isChecked()) + fDumpRoot_checkBox->setChecked(false); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PPrefsDialog::dumpRoot() +{ + if (fDumpRoot_checkBox->isChecked()) + fDumpAscii_checkBox->setChecked(false); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musrgui/PPrefsDialog.h b/src/musrgui/PPrefsDialog.h new file mode 100644 index 00000000..0b67289d --- /dev/null +++ b/src/musrgui/PPrefsDialog.h @@ -0,0 +1,52 @@ +/**************************************************************************** + + PPrefsDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PPREFSDIALOG_H_ +#define _PPREFSDIALOG_H_ + +#include + +#include "forms/PPrefsDialogBase.h" + +class PPrefsDialog : public PPrefsDialogBase +{ + public: + PPrefsDialog(const bool keep_mn2_output, const int dump_tag); + + bool keepMinuit2Output() { return fKeepMn2Output_checkBox->isChecked(); } + int getDump(); + + public slots: + void dumpAscii(); + void dumpRoot(); +}; + +#endif // _PPREFSDIALOG_H_ diff --git a/src/musrgui/PTextEdit.cpp b/src/musrgui/PTextEdit.cpp index e1a9ee8f..f335297f 100644 --- a/src/musrgui/PTextEdit.cpp +++ b/src/musrgui/PTextEdit.cpp @@ -29,9 +29,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -using namespace std; - #include #include #include @@ -58,6 +55,7 @@ using namespace std; #include "PSubTextEdit.h" #include "PAdmin.h" #include "PFitOutputHandler.h" +#include "PPrefsDialog.h" #include "PGetDefaultDialog.h" #include "forms/PMusrGuiAbout.h" @@ -71,6 +69,8 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name ) fAdmin = new PAdmin(); fShowMlog = fAdmin->getShowMlog(); + fKeepMinuit2Output = false; + fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump setupFileActions(); setupEditActions(); @@ -773,6 +773,25 @@ void PTextEdit::musrFit() cmd.append(str); cmd.append(*fFilenames.find( currentEditor())); + + // check if keep minuit2 output is wished + if (fKeepMinuit2Output) + cmd.append("--keep-mn2-output"); + + // check if dump files are wished + switch (fDump) { + case 1: // ascii dump + cmd.append("--dump"); + cmd.append("ascii"); + break; + case 2: // root dump + cmd.append("--dump"); + cmd.append("root"); + break; + default: + break; + } + PFitOutputHandler fitOutputHandler(cmd); fitOutputHandler.setModal(true); fitOutputHandler.exec(); @@ -825,8 +844,6 @@ void PTextEdit::musrView() } cmd += str + " &"; -cout << endl << "str = " << str << endl; - system(cmd.latin1()); } @@ -850,9 +867,12 @@ void PTextEdit::musrT0() */ void PTextEdit::musrPrefs() { - QMessageBox::information( this, "musrPrefs", - "Will call musr related perferences dialog.\n" - "NOT IMPLEMENTED YET :-(" ); + PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump); + + if (dlg->exec() == QDialog::Accepted) { + fKeepMinuit2Output = dlg->keepMinuit2Output(); + fDump = dlg->getDump(); + } } //---------------------------------------------------------------------------------------------------- diff --git a/src/musrgui/PTextEdit.h b/src/musrgui/PTextEdit.h index bda28648..b7b80c80 100644 --- a/src/musrgui/PTextEdit.h +++ b/src/musrgui/PTextEdit.h @@ -100,6 +100,8 @@ private: PAdmin *fAdmin; bool fShowMlog; + bool fKeepMinuit2Output; + int fDump; QComboBox *fComboFont; QComboBox *fComboSize; diff --git a/src/musrgui/forms/PPrefsDialogBase.ui b/src/musrgui/forms/PPrefsDialogBase.ui new file mode 100644 index 00000000..f5e0debc --- /dev/null +++ b/src/musrgui/forms/PPrefsDialogBase.ui @@ -0,0 +1,217 @@ + +PPrefsDialogBase + + + PPrefsDialogBase + + + + 0 + 0 + 541 + 186 + + + + Preferences + + + true + + + + fTabWidget + + + + 10 + 20 + 520 + 110 + + + + + tab + + + musrfit + + + + fKeepMn2Output_checkBox + + + + 10 + 10 + 160 + 22 + + + + keep minuit2 output + + + + + fDumpAscii_checkBox + + + + 10 + 30 + 95 + 22 + + + + dump ascii + + + + + fDumpRoot_checkBox + + + + 10 + 50 + 95 + 22 + + + + dump root + + + + + + + Layout1 + + + + 10 + 140 + 520 + 33 + + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + F1 + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + + buttonOk + clicked() + PPrefsDialogBase + accept() + + + buttonCancel + clicked() + PPrefsDialogBase + reject() + + + fDumpAscii_checkBox + toggled(bool) + PPrefsDialogBase + dumpAscii() + + + fDumpRoot_checkBox + toggled(bool) + PPrefsDialogBase + dumpRoot() + + + + fTabWidget + fKeepMn2Output_checkBox + fDumpAscii_checkBox + fDumpRoot_checkBox + buttonOk + buttonCancel + buttonHelp + + + dumpAscii() + dumpRoot() + + + diff --git a/src/musrgui/musrgui.pro b/src/musrgui/musrgui.pro index 2948a295..0f0a42ad 100644 --- a/src/musrgui/musrgui.pro +++ b/src/musrgui/musrgui.pro @@ -17,6 +17,7 @@ HEADERS = PTextEdit.h \ PSubTextEdit.h \ PAdmin.h \ PFitOutputHandler.h \ + PPrefsDialog.h \ PGetDefaultDialog.h \ PGetParameterDialog.h \ PGetFourierDialog.h \ @@ -26,6 +27,7 @@ SOURCES = PTextEdit.cpp \ PSubTextEdit.cpp \ PAdmin.cpp \ PFitOutputHandler.cpp \ + PPrefsDialog.cpp \ PGetDefaultDialog.cpp \ PGetParameterDialog.cpp \ PGetFourierDialog.cpp \ @@ -34,6 +36,7 @@ SOURCES = PTextEdit.cpp \ FORMS = forms/PGetDefaultDialogBase.ui \ forms/PMusrGuiAbout.ui \ + forms/PPrefsDialogBase.ui \ forms/PGetTitleDialog.ui \ forms/PGetParameterDialogBase.ui \ forms/PGetFourierDialogBase.ui \ diff --git a/src/musrgui/musrgui_startup.xml b/src/musrgui/musrgui_startup.xml index 191fecfb..c0aa8aff 100644 --- a/src/musrgui/musrgui_startup.xml +++ b/src/musrgui/musrgui_startup.xml @@ -14,25 +14,6 @@ mue4 psi root-npp - - - - y - - - n - - - n - - - - - - - - -