added a first version of the preferences which allows to set the musrfit options like keep-mn2-output
This commit is contained in:
parent
bbabeee8d9
commit
dc70607474
95
src/musrgui/PPrefsDialog.cpp
Normal file
95
src/musrgui/PPrefsDialog.cpp
Normal file
@ -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"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
int PPrefsDialog::getDump()
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (fDumpAscii_checkBox->isChecked())
|
||||
result = 1;
|
||||
else if (fDumpRoot_checkBox->isChecked())
|
||||
result = 2;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void PPrefsDialog::dumpAscii()
|
||||
{
|
||||
if (fDumpAscii_checkBox->isChecked())
|
||||
fDumpRoot_checkBox->setChecked(false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void PPrefsDialog::dumpRoot()
|
||||
{
|
||||
if (fDumpRoot_checkBox->isChecked())
|
||||
fDumpAscii_checkBox->setChecked(false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
52
src/musrgui/PPrefsDialog.h
Normal file
52
src/musrgui/PPrefsDialog.h
Normal file
@ -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 <qcheckbox.h>
|
||||
|
||||
#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_
|
@ -29,9 +29,6 @@
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <qtextedit.h>
|
||||
#include <qaction.h>
|
||||
#include <qmenubar.h>
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -100,6 +100,8 @@ private:
|
||||
PAdmin *fAdmin;
|
||||
|
||||
bool fShowMlog;
|
||||
bool fKeepMinuit2Output;
|
||||
int fDump;
|
||||
|
||||
QComboBox *fComboFont;
|
||||
QComboBox *fComboSize;
|
||||
|
217
src/musrgui/forms/PPrefsDialogBase.ui
Normal file
217
src/musrgui/forms/PPrefsDialogBase.ui
Normal file
@ -0,0 +1,217 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>PPrefsDialogBase</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>PPrefsDialogBase</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>541</width>
|
||||
<height>186</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>Layout1</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>520</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonHelp</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string>F1</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>Horizontal Spacing2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonOk</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonCancel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonOk</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PPrefsDialogBase</receiver>
|
||||
<slot>accept()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonCancel</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PPrefsDialogBase</receiver>
|
||||
<slot>reject()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fDumpAscii_checkBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>PPrefsDialogBase</receiver>
|
||||
<slot>dumpAscii()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fDumpRoot_checkBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>PPrefsDialogBase</receiver>
|
||||
<slot>dumpRoot()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>fTabWidget</tabstop>
|
||||
<tabstop>fKeepMn2Output_checkBox</tabstop>
|
||||
<tabstop>fDumpAscii_checkBox</tabstop>
|
||||
<tabstop>fDumpRoot_checkBox</tabstop>
|
||||
<tabstop>buttonOk</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
<tabstop>buttonHelp</tabstop>
|
||||
</tabstops>
|
||||
<slots>
|
||||
<slot>dumpAscii()</slot>
|
||||
<slot>dumpRoot()</slot>
|
||||
</slots>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -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 \
|
||||
|
@ -14,25 +14,6 @@
|
||||
<beamline>mue4</beamline>
|
||||
<institute>psi</institute>
|
||||
<file_format>root-npp</file_format>
|
||||
<msr_parameters>
|
||||
<asymmetry>
|
||||
<fittype>
|
||||
<required>y</required>
|
||||
</fittype>
|
||||
<alpha>
|
||||
<required>n</required>
|
||||
</alpha>
|
||||
<beta>
|
||||
<required>n</required>
|
||||
</beta>
|
||||
</asymmetry>
|
||||
<single_histo>
|
||||
</single_histo>
|
||||
<rrf>
|
||||
</rrf>
|
||||
<nonMusr>
|
||||
</nonMusr>
|
||||
</msr_parameters>
|
||||
</msr_file_defaults>
|
||||
</musrgui_startup>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user