some more work on the documentation. Added a menu such that theory functions are more easy accessible.

This commit is contained in:
nemu 2010-05-20 05:53:57 +00:00
parent 795bb1c23e
commit cd3127050c
11 changed files with 214 additions and 216 deletions

View File

@ -33,7 +33,7 @@
//---------------------------------------------------------------------------
/**
* <p>
* <p>Handles the musredit about popup.
*/
PMusrEditAbout::PMusrEditAbout(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{

View File

@ -33,7 +33,15 @@
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Constructor.
*
* \param keep_mn2_output if true, keep the minuit2 output for each fitted msr-file, i.e.
* MINUIT2.OUTPUT -> <msr-file-name>-mn2.output, and MINUIT2.root -> <msr-file-name>-mn2.root.
* See the '-k' option of musrfit.
* \param dump_tag tag telling if dumps ('ascii' == 1, 'root' == 2) are wanted. See '--dump' option of musrfit.
* \param title_from_data_file flag telling if musrfit shall, by default, take the title from the data file.
* See the '-t' option of musrfit.
* \param enable_musrt0 if true, musrt0 is enabled from within musredit.
*/
PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file,
const bool enable_musrt0)
@ -64,7 +72,7 @@ PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>returns the dump flag (see the '--dump' option of musrfit). 0 == no dump, 1 == ascii dump, 2 == root dump
*/
int PPrefsDialog::getDump()
{
@ -80,7 +88,8 @@ int PPrefsDialog::getDump()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>SLOT: called when the QCheckBox 'dump ascii' is selected. Will uncheck 'dump root' since these
* two options are mutually exclusive.
*/
void PPrefsDialog::dumpAscii()
{
@ -90,7 +99,8 @@ void PPrefsDialog::dumpAscii()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>SLOT: called when the QCheckBox 'dump root' is selected. Will uncheck 'dump ascii' since these
* two options are mutually exclusive.
*/
void PPrefsDialog::dumpRoot()
{

View File

@ -36,6 +36,9 @@
#include "ui_PPrefsDialog.h"
/**
* <p>Class handling the content of the MusrFit/Preferences.
*/
class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
{
Q_OBJECT

View File

@ -33,7 +33,10 @@
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Constructor.
*
* \param parent pointer to the parent object
* \param f qt windows flags
*/
PReplaceConfirmationDialog::PReplaceConfirmationDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{

View File

@ -37,7 +37,12 @@
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Constructor.
*
* \param data find/replace data structure
* \param selection if true, find/replace only of the selection
* \param parent pointer to the parent object
* \param f qt windows flag
*/
PReplaceDialog::PReplaceDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) :
QDialog(parent, f), fData(data)
@ -72,7 +77,7 @@ PReplaceDialog::PReplaceDialog(PFindReplaceData *data, const bool selection, QWi
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>returns the pointer to the find/replace data structure which is updated from the GUI content.
*/
PFindReplaceData* PReplaceDialog::getData()
{
@ -91,7 +96,7 @@ PFindReplaceData* PReplaceDialog::getData()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>SLOT: called on find text available.
*/
void PReplaceDialog::onFindTextAvailable(const QString&)
{

View File

@ -49,7 +49,7 @@ class PReplaceDialog : public QDialog, private Ui::PReplaceDialog
virtual void onFindTextAvailable(const QString&);
private:
PFindReplaceData *fData;
PFindReplaceData *fData; ///< pointer to the find/replace data
};
#endif // _PREPLACEDIALOG_H_

View File

@ -53,100 +53,20 @@
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Constructor.
*
* \param admin pointer to the musredit internal administration object.
* \param parent pointer to the parent object.
*/
PSubTextEdit::PSubTextEdit(PAdmin *admin, QWidget *parent) :
QPlainTextEdit(parent),
fAdmin(admin)
{
// fLastModified = QDateTime::fromString("1900-01-01 00:00:00");
}
//----------------------------------------------------------------------------------------------------
/**
* <p>
*/
QMenu* PSubTextEdit::createPopupMenu(const QPoint &pos)
{
QMenu *menu = new QMenu( this );
QMenu *theoryFunctions = new QMenu( menu );
QAction *a;
a = new QAction( tr("insert Title"), this);
a->setStatusTip( tr("insert a title") );
connect(a, SIGNAL( activated() ), this, SLOT( insertTitle() ));
menu->addAction(a);
a = new QAction(tr("insert Parameter Block"), this);
a->setStatusTip( tr("insert a parameter block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertParameterBlock() ));
menu->addAction(a);
// feed the theoryFunctions popup menu
for (unsigned int i=0; i<fAdmin->getTheoryCounts(); i++) {
PTheory *theoryItem = fAdmin->getTheoryItem(i);
a = new QAction( theoryItem->label, this);
theoryFunctions->addAction(a);
}
theoryFunctions->setTitle( tr("insert theory function") );
menu->addMenu(theoryFunctions);
connect(theoryFunctions, SIGNAL( activated(int) ), this, SLOT( insertTheoryFunction(int) ));
a = new QAction(tr("insert Theory Block"), this);
a->setStatusTip( tr("insert a theory block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertTheoryBlock() ));
menu->addAction(a);
a = new QAction(tr("insert Function Block"), this);
a->setStatusTip( tr("insert a function block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertFunctionBlock() ));
menu->addAction(a);
menu->addSeparator();
a = new QAction(tr("insert Asymmetry Run Block"), this);
a->setStatusTip( tr("insert an asymmetry run block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertAsymRunBlock() ));
menu->addAction(a);
a = new QAction(tr("insert Single Histo Run Block"), this);
a->setStatusTip( tr("insert a single histo run block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertSingleHistRunBlock() ));
menu->addAction(a);
a = new QAction(tr("insert NonMusr Block"), this);
a->setStatusTip( tr("insert a NonMusr run block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertNonMusrRunBlock() ));
menu->addAction(a);
menu->addSeparator();
a = new QAction(tr("insert Command Block"), this);
a->setStatusTip( tr("insert a command block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertCommandBlock() ));
menu->addAction(a);
a = new QAction(tr("insert Fourier Block"), this);
a->setStatusTip( tr("insert a Fourier block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertFourierBlock() ));
menu->addAction(a);
a = new QAction(tr("insert Plot Block"), this);
a->setStatusTip( tr("insert a plot block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertPlotBlock() ));
menu->addAction(a);
a = new QAction(tr("insert Statistic Block"), this);
a->setStatusTip( tr("insert a statistic block") );
connect(a, SIGNAL( activated() ), this, SLOT( insertStatisticBlock() ));
menu->addAction(a);
return menu;
}
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-title input dialog window.
*/
void PSubTextEdit::insertTitle()
{
@ -166,7 +86,7 @@ void PSubTextEdit::insertTitle()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-fit-parameter input dialog window.
*/
void PSubTextEdit::insertParameterBlock()
{
@ -185,20 +105,26 @@ void PSubTextEdit::insertParameterBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Inserts the selected theory item.
*
* \param name of the theory item to be added.
*/
void PSubTextEdit::insertTheoryFunction(int idx)
void PSubTextEdit::insertTheoryFunction(QString name)
{
if (idx < 300)
return;
int index = idx - 300;
if (index >= (int)fAdmin->getTheoryCounts())
return;
QString str = "????";
PTheory *theoItem = fAdmin->getTheoryItem(index);
int idx = -1;
for (unsigned int i=0; i<fAdmin->getTheoryCounts(); i++) {
if (name == fAdmin->getTheoryItem(i)->label) {
idx = i;
break;
}
}
if (idx == -1)
return;
PTheory *theoItem = fAdmin->getTheoryItem(idx);
if (theoItem == 0)
return;
@ -224,7 +150,7 @@ void PSubTextEdit::insertTheoryFunction(int idx)
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-theory input dialog window.
*/
void PSubTextEdit::insertTheoryBlock()
{
@ -244,7 +170,7 @@ void PSubTextEdit::insertTheoryBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-functions input dialog window.
*/
void PSubTextEdit::insertFunctionBlock()
{
@ -264,7 +190,7 @@ void PSubTextEdit::insertFunctionBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-asymmetry-run input dialog window.
*/
void PSubTextEdit::insertAsymRunBlock()
{
@ -371,7 +297,7 @@ void PSubTextEdit::insertAsymRunBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-single-historgram-run input dialog window.
*/
void PSubTextEdit::insertSingleHistRunBlock()
{
@ -478,7 +404,7 @@ void PSubTextEdit::insertSingleHistRunBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-nonMusr-run input dialog window.
*/
void PSubTextEdit::insertNonMusrRunBlock()
{
@ -541,7 +467,7 @@ void PSubTextEdit::insertNonMusrRunBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Insert the command block.
*/
void PSubTextEdit::insertCommandBlock()
{
@ -557,7 +483,7 @@ void PSubTextEdit::insertCommandBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-Fourier input dialog window.
*/
void PSubTextEdit::insertFourierBlock()
{
@ -576,7 +502,7 @@ void PSubTextEdit::insertFourierBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the msr-plot input dialog window.
*/
void PSubTextEdit::insertPlotBlock()
{
@ -595,7 +521,7 @@ void PSubTextEdit::insertPlotBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Insert a default msr-statistics block.
*/
void PSubTextEdit::insertStatisticBlock()
{

View File

@ -37,6 +37,10 @@
#include "PAdmin.h"
//------------------------------------------------------------------------------------------
/**
* <p>Class handling a single text edit tab within musredit.
*/
class PSubTextEdit : public QPlainTextEdit
{
Q_OBJECT
@ -45,13 +49,10 @@ class PSubTextEdit : public QPlainTextEdit
PSubTextEdit(PAdmin *admin = 0, QWidget *parent = 0);
virtual ~PSubTextEdit() {}
// void setLastModified(const QDateTime &lastModified) { fLastModified = lastModified; }
// QDateTime getLastModified() const { return fLastModified; }
public slots:
void insertTitle();
void insertParameterBlock();
void insertTheoryFunction(int idx);
void insertTheoryFunction(QString name);
void insertTheoryBlock();
void insertFunctionBlock();
void insertAsymRunBlock();
@ -62,12 +63,8 @@ class PSubTextEdit : public QPlainTextEdit
void insertPlotBlock();
void insertStatisticBlock();
protected:
virtual QMenu *createPopupMenu( const QPoint &pos);
private:
PAdmin *fAdmin;
// QDateTime fLastModified;
PAdmin *fAdmin; ///< pointer to the administration object which holds working-, executable-paths etc.
};
#endif // _PSUBTEXTEDIT_H_

View File

@ -75,13 +75,18 @@ using namespace std;
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Constructor
*
* \param parent pointer to the parent object
* \param f qt windows flags
*/
PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
: QMainWindow( parent, f )
{
// reads and manages the conents of the xml-startup (musredit_startup.xml) file
fAdmin = new PAdmin();
// enable file system watcher. Needed to get notification if the msr-file is changed outside of musrfit at runtime
fFileSystemWatcherActive = true;
fFileSystemWatcher = new QFileSystemWatcher();
if (fFileSystemWatcher == 0) {
@ -90,6 +95,7 @@ PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
connect( fFileSystemWatcher, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(const QString&)));
}
// initialize stuff
fMusrT0Action = 0;
fMsr2DataParam = 0;
@ -100,6 +106,7 @@ PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
fEnableMusrT0 = fAdmin->getEnableMusrT0Flag();
fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump
// setup menus
setupFileActions();
setupEditActions();
setupTextActions();
@ -116,6 +123,7 @@ PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
QPixmap image0(":/images/musrfit.xpm");
setWindowIcon( image0 );
// if arguments are give, try to load those files, otherwise create an empty new file
if ( qApp->argc() != 1 ) {
for ( int i = 1; i < qApp->argc(); ++i )
load( qApp->argv()[ i ] );
@ -128,7 +136,7 @@ PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Destructor
*/
PTextEdit::~PTextEdit()
{
@ -158,7 +166,7 @@ PTextEdit::~PTextEdit()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Setup the file menu and the necessary actions.
*/
void PTextEdit::setupFileActions()
{
@ -244,7 +252,7 @@ void PTextEdit::setupFileActions()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Setup the edit menu and the necessary actions.
*/
void PTextEdit::setupEditActions()
{
@ -355,6 +363,15 @@ void PTextEdit::setupEditActions()
connect( a, SIGNAL( triggered() ), this, SLOT( insertFunctionBlock() ));
addSubMenu->addAction(a);
// feed the theoryFunctions popup menu
QMenu *theoryFunctions = new QMenu( tr("Add Theory Function"), this );
for (unsigned int i=0; i<fAdmin->getTheoryCounts(); i++) {
PTheory *theoryItem = fAdmin->getTheoryItem(i);
a = new QAction( theoryItem->label, this);
theoryFunctions->addAction(a);
}
connect( theoryFunctions, SIGNAL( triggered(QAction*)), this, SLOT( insertTheoryFunction(QAction*) ) );
a = new QAction( tr("Asymmetry Run Block"), this );
a->setStatusTip( tr("Invokes MSR Asymmetry Run Block Dialog") );
connect( a, SIGNAL( triggered() ), this, SLOT( insertAsymRunBlock() ));
@ -391,6 +408,7 @@ void PTextEdit::setupEditActions()
addSubMenu->addAction(a);
menu->addMenu(addSubMenu);
menu->addMenu(theoryFunctions);
menu->addSeparator();
a = new QAction( tr( "Co&mment" ), this );
@ -408,7 +426,7 @@ void PTextEdit::setupEditActions()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Setup the font/font size menu.
*/
void PTextEdit::setupTextActions()
{
@ -449,7 +467,7 @@ void PTextEdit::setupTextActions()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Setup the musrfit menu and the necessary actions.
*/
void PTextEdit::setupMusrActions()
{
@ -534,7 +552,7 @@ void PTextEdit::setupMusrActions()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Setup the help menu and the necessary actions.
*/
void PTextEdit::setupHelpActions()
{
@ -560,18 +578,22 @@ void PTextEdit::setupHelpActions()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>load an msr-file.
*
* \param f filename
* \param index if == -1, add the file as a new tab, otherwise, replace the contents of the tab at index.
*/
void PTextEdit::load( const QString &f, const int index )
{
// check if the file exists
if ( !QFile::exists( f ) )
return;
// QFileInfo info(f);
// create a new text edit object
PSubTextEdit *edit = new PSubTextEdit( fAdmin );
edit->setFont(QFont(fAdmin->getFontName(), fAdmin->getFontSize()));
// place the text edit object at the appropriate tab position
if (index == -1)
fTabWidget->addTab( edit, QFileInfo( f ).fileName() );
else
@ -580,22 +602,27 @@ void PTextEdit::load( const QString &f, const int index )
if ( !file.open( QIODevice::ReadOnly ) )
return;
// add the msr-file to the file system watchersssss
fFileSystemWatcher->addPath(f);
// read the file
QTextStream ts( &file );
QString txt = ts.readAll();
edit->setPlainText( txt );
doConnections( edit );
doConnections( edit ); // add all necessary signal/slot connections
// set the tab widget to the current tab
fTabWidget->setCurrentIndex(fTabWidget->indexOf(edit));
edit->viewport()->setFocus();
// update the filename mapper
fFilenames.remove( edit );
fFilenames.insert( edit, f );
}
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>returns the currently tab selected textedit object.
*/
PSubTextEdit *PTextEdit::currentEditor() const
{
@ -610,7 +637,9 @@ PSubTextEdit *PTextEdit::currentEditor() const
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Setup the necessray signal/slot connections for the textedit object.
*
* \param e textedit object
*/
void PTextEdit::doConnections( PSubTextEdit *e )
{
@ -624,7 +653,9 @@ void PTextEdit::doConnections( PSubTextEdit *e )
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Validates a given runlist.
*
* \param runList run list string which should be a space separated list of run numbers.
*/
bool PTextEdit::validRunList(const QString runList)
{
@ -658,7 +689,7 @@ bool PTextEdit::validRunList(const QString runList)
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file title. See also https://intranet.psi.ch/MUSR/MusrFit#4_1_The_Title
*/
void PTextEdit::insertTitle()
{
@ -667,7 +698,7 @@ void PTextEdit::insertTitle()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file fit-parameter block. See also https://intranet.psi.ch/MUSR/MusrFit#4_2_The_FITPARAMETER_Block
*/
void PTextEdit::insertParameterBlock()
{
@ -676,7 +707,7 @@ void PTextEdit::insertParameterBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file theory block. See also https://intranet.psi.ch/MUSR/MusrFit#4_3_The_THEORY_Block
*/
void PTextEdit::insertTheoryBlock()
{
@ -685,7 +716,18 @@ void PTextEdit::insertTheoryBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Insert a selected theory function. See also https://intranet.psi.ch/MUSR/MusrFit#4_3_The_THEORY_Block
*
* \param a action of the selected theory function
*/
void PTextEdit::insertTheoryFunction(QAction *a)
{
currentEditor()->insertTheoryFunction(a->text());
}
//----------------------------------------------------------------------------------------------------
/**
* <p>Start the dialog to enter a msr-file function block. See also https://intranet.psi.ch/MUSR/MusrFit#4_4_The_FUNCTIONS_Block
*/
void PTextEdit::insertFunctionBlock()
{
@ -694,7 +736,7 @@ void PTextEdit::insertFunctionBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file asymmetry run block. See also https://intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block
*/
void PTextEdit::insertAsymRunBlock()
{
@ -703,7 +745,7 @@ void PTextEdit::insertAsymRunBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file single histogram run block. See also https://intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block
*/
void PTextEdit::insertSingleHistRunBlock()
{
@ -712,7 +754,7 @@ void PTextEdit::insertSingleHistRunBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file nonMusr run block. See also https://intranet.psi.ch/MUSR/MusrFit#4_5_The_RUN_Block
*/
void PTextEdit::insertNonMusrRunBlock()
{
@ -721,7 +763,7 @@ void PTextEdit::insertNonMusrRunBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Inserts a default command block. See also https://intranet.psi.ch/MUSR/MusrFit#4_6_The_COMMANDS_Block
*/
void PTextEdit::insertCommandBlock()
{
@ -730,7 +772,7 @@ void PTextEdit::insertCommandBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file Fourier block. See also https://intranet.psi.ch/MUSR/MusrFit#4_7_The_FOURIER_Block
*/
void PTextEdit::insertFourierBlock()
{
@ -739,7 +781,7 @@ void PTextEdit::insertFourierBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Start the dialog to enter a msr-file plot block. See also https://intranet.psi.ch/MUSR/MusrFit#4_7_The_PLOT_Block
*/
void PTextEdit::insertPlotBlock()
{
@ -748,7 +790,7 @@ void PTextEdit::insertPlotBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Inserts a default statistics block. See also https://intranet.psi.ch/MUSR/MusrFit#4_9_The_STATISTIC_Block
*/
void PTextEdit::insertStatisticBlock()
{
@ -757,7 +799,7 @@ void PTextEdit::insertStatisticBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>SLOT: called when File/New is selected. Will generate an empty tab-textedit field in musredit.
*/
void PTextEdit::fileNew()
{
@ -772,7 +814,9 @@ void PTextEdit::fileNew()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>SLOT: called when File/Open is selected. Will open an msr-/mlog-file. It checks if the file is
* already open, and if so will just select the current tab. If you want to reload the file use the
* fileReload() slot.
*/
void PTextEdit::fileOpen()
{
@ -810,7 +854,7 @@ void PTextEdit::fileOpen()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Will reload the currently selected msr-file.
*/
void PTextEdit::fileReload()
{
@ -826,7 +870,7 @@ void PTextEdit::fileReload()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Will save the currently selected file.
*/
void PTextEdit::fileSave()
{
@ -854,7 +898,8 @@ void PTextEdit::fileSave()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Will open a file selector dialog to obtain a file name, and then save the file under the newly
* selected file name.
*/
void PTextEdit::fileSaveAs()
{
@ -878,7 +923,7 @@ void PTextEdit::fileSaveAs()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Will call a print dialog and print the msr-file.
*/
void PTextEdit::filePrint()
{
@ -927,7 +972,10 @@ void PTextEdit::filePrint()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Will remove a textedit tab from musredit. Depending on check it will done with or without checking
* if the file has been saved before.
*
* \param check if set to true, a warning dialog will popup if the file is not saved yet.
*/
void PTextEdit::fileClose(const bool check)
{
@ -952,7 +1000,8 @@ void PTextEdit::fileClose(const bool check)
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Removes all textedit tabs from musredit. It checks if the files haven't been saved, and if so it will
* popup a warning dialog.
*/
void PTextEdit::fileCloseAll()
{
@ -988,7 +1037,8 @@ void PTextEdit::fileCloseAll()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Will close all textedit tabs but the selected one. It checks if the files haven't been saved, and if so it will
* popup a warning dialog.
*/
void PTextEdit::fileCloseAllOthers()
{
@ -1035,7 +1085,7 @@ void PTextEdit::fileCloseAllOthers()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Will quit musredit.
*/
void PTextEdit::fileExit()
{
@ -1056,7 +1106,7 @@ void PTextEdit::fileExit()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Text undo of the current textedit tab.
*/
void PTextEdit::editUndo()
{
@ -1067,7 +1117,7 @@ void PTextEdit::editUndo()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Text redo of the current textedit tab
*/
void PTextEdit::editRedo()
{
@ -1078,7 +1128,7 @@ void PTextEdit::editRedo()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Select all text of the current textedit tab.
*/
void PTextEdit::editSelectAll()
{
@ -1089,7 +1139,7 @@ void PTextEdit::editSelectAll()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Cut the selection of the current textedit tab.
*/
void PTextEdit::editCut()
{
@ -1100,7 +1150,7 @@ void PTextEdit::editCut()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Copy the selection of the current textedit tab.
*/
void PTextEdit::editCopy()
{
@ -1111,7 +1161,7 @@ void PTextEdit::editCopy()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Paste at the cursor position of the current textedit tab.
*/
void PTextEdit::editPaste()
{
@ -1122,7 +1172,7 @@ void PTextEdit::editPaste()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts a find dialog, and searches for a find string.
*/
void PTextEdit::editFind()
{
@ -1182,7 +1232,7 @@ void PTextEdit::editFind()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Searches for a find string in the forward direction.
*/
void PTextEdit::editFindNext()
{
@ -1197,7 +1247,7 @@ void PTextEdit::editFindNext()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Searches for a find string in the backward direction.
*/
void PTextEdit::editFindPrevious()
{
@ -1214,7 +1264,7 @@ void PTextEdit::editFindPrevious()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts a find/replace dialog, and searches for a find string and replaces it depending of the replace options.
*/
void PTextEdit::editFindAndReplace()
{
@ -1273,7 +1323,8 @@ void PTextEdit::editFindAndReplace()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Comment a selection, i.e. add a '#' character in front of each line of the selection.
* (Multiple selections not yet supported).
*/
void PTextEdit::editComment()
{
@ -1307,7 +1358,8 @@ void PTextEdit::editComment()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Uncomment a selection, i.e. remove a '#' character in front of each line of the selection.
* (Multiple selections not yet supported).
*/
void PTextEdit::editUncomment()
{
@ -1361,7 +1413,9 @@ void PTextEdit::editUncomment()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Chances the font.
*
* \param f font name
*/
void PTextEdit::textFamily( const QString &f )
{
@ -1376,7 +1430,9 @@ void PTextEdit::textFamily( const QString &f )
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Chances the font size.
*
* \param p font size in points.
*/
void PTextEdit::textSize( const QString &p )
{
@ -1391,7 +1447,7 @@ void PTextEdit::textSize( const QString &p )
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Loads a default asymmetry msr-file.
*/
void PTextEdit::musrGetAsymmetryDefault()
{
@ -1452,7 +1508,7 @@ void PTextEdit::musrGetAsymmetryDefault()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Loads a default single histogram msr-file.
*/
void PTextEdit::musrGetSingleHistoDefault()
{
@ -1513,7 +1569,7 @@ void PTextEdit::musrGetSingleHistoDefault()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>calls musrfit --chisq-only <msr-file>.
*/
void PTextEdit::musrCalcChisq()
{
@ -1544,7 +1600,7 @@ void PTextEdit::musrCalcChisq()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>calls musrfit <options> <msr-file>. <options> can be set in the MusrFit/Preferences.
*/
void PTextEdit::musrFit()
{
@ -1642,7 +1698,7 @@ void PTextEdit::musrFit()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts a msr2data input dialog which collects all the necessary data before calling msr2data.
*/
void PTextEdit::musrMsr2Data()
{
@ -1930,7 +1986,7 @@ cout << endl;
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Calls musrview <msr-file>.
*/
void PTextEdit::musrView()
{
@ -1961,7 +2017,7 @@ void PTextEdit::musrView()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Callse musrt0 <msr-file>.
*/
void PTextEdit::musrT0()
{
@ -1994,7 +2050,7 @@ void PTextEdit::musrT0()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Calls the preferences dialog which is used to set some global options.
*/
void PTextEdit::musrPrefs()
{
@ -2018,7 +2074,7 @@ void PTextEdit::musrPrefs()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Swaps the currently open msr-file with its mlog-file (if present) and updates musredit accordingly.
*/
void PTextEdit::musrSwapMsrMlog()
{
@ -2094,7 +2150,7 @@ void PTextEdit::musrSwapMsrMlog()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the help content browser.
*/
void PTextEdit::helpContents()
{
@ -2105,7 +2161,7 @@ void PTextEdit::helpContents()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the help about info box.
*/
void PTextEdit::helpAbout()
{
@ -2115,7 +2171,7 @@ void PTextEdit::helpAbout()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>Starts the help about Qt info box.
*/
void PTextEdit::helpAboutQt()
{
@ -2124,7 +2180,9 @@ void PTextEdit::helpAboutQt()
//----------------------------------------------------------------------------------------------------
/**
* <p>
* <p>SLOT: called when the font shall be changed.
*
* \param f font object
*/
void PTextEdit::fontChanged( const QFont &f )
{
@ -2144,6 +2202,8 @@ void PTextEdit::fontChanged( const QFont &f )
//----------------------------------------------------------------------------------------------------
/**
* <p>
*
* \param forced
*/
void PTextEdit::textChanged(const bool forced)
{
@ -2284,14 +2344,14 @@ void PTextEdit::fileChanged(const QString &fileName)
//----------------------------------------------------------------------------------------------------
/**
* <p>.Delayed reactivation of file system watcher, needed when saving files. At the moment the delay
* is set to 1000 ms.
* is set to 2000 ms.
*/
void PTextEdit::fileSystemWatcherActivation()
{
if (fFileSystemWatcherTimeout.isActive())
return;
fFileSystemWatcherTimeout.singleShot(1000, this, SLOT(setFileSystemWatcherActive()));
fFileSystemWatcherTimeout.singleShot(2000, this, SLOT(setFileSystemWatcherActive()));
}
//----------------------------------------------------------------------------------------------------

View File

@ -47,6 +47,10 @@ class QTabWidget;
class QTextEdit;
class QMenu;
//----------------------------------------------------------------------------------------------
/**
* <p>Main class for musredit.
*/
class PTextEdit : public QMainWindow
{
Q_OBJECT
@ -74,6 +78,7 @@ private slots:
void insertTitle();
void insertParameterBlock();
void insertTheoryBlock();
void insertTheoryFunction(QAction *a);
void insertFunctionBlock();
void insertAsymRunBlock();
void insertSingleHistRunBlock();
@ -137,27 +142,27 @@ private slots:
void setFileSystemWatcherActive();
private:
PAdmin *fAdmin;
QFileSystemWatcher *fFileSystemWatcher;
bool fFileSystemWatcherActive;
QTimer fFileSystemWatcherTimeout;
PAdmin *fAdmin; ///< pointer to the xml-startup file informations. Needed for different purposes like default working- and executable directories etc.
QFileSystemWatcher *fFileSystemWatcher; ///< checks if msr-files are changing on the disk while being open in musredit.
bool fFileSystemWatcherActive; ///< flag to enable/disable the file system watcher
QTimer fFileSystemWatcherTimeout; ///< timer used to re-enable file system watcher. Needed to delay the re-enabling
QAction *fMusrT0Action;
bool fKeepMinuit2Output;
bool fTitleFromDataFile;
bool fEnableMusrT0;
int fDump;
bool fKeepMinuit2Output; ///< 'global' flag, if set to true, musrfit calls will keep the minuit2 output files.
bool fTitleFromDataFile; ///< 'global' flag, if set to true, musrfit will take the title from the data file instead of the msr-file.
bool fEnableMusrT0; ///< 'global' flag, if set to true, musrt0 will be enabled
int fDump; ///< 'global' tag for musrfit calls: 0 == no dump, 1 == ascii dump, 2 == root dump
PMsr2DataParam *fMsr2DataParam;
PFindReplaceData *fFindReplaceData;
PMsr2DataParam *fMsr2DataParam; ///< structure holding the necessary input information for msr2data
PFindReplaceData *fFindReplaceData; ///< structure holding the ncessary input for find/replace
QComboBox *fComboFont;
QComboBox *fComboSize;
QComboBox *fComboFont; ///< combo box for the font selector
QComboBox *fComboSize; ///< combo box for the font size
bool fFontChanging; ///< flag needed to prevent some textChanged feature to occure when only the font changed
QTabWidget *fTabWidget;
QMap<PSubTextEdit*, QString> fFilenames;
QTabWidget *fTabWidget; ///< tab widget in which the text editor(s) are placed
QMap<PSubTextEdit*, QString> fFilenames; ///< mapper between tab widget object and filename
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>395</width>
<height>176</height>
<height>187</height>
</rect>
</property>
<property name="windowTitle">
@ -23,7 +23,7 @@
<x>11</x>
<y>11</y>
<width>371</width>
<height>161</height>
<height>169</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -60,17 +60,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fSvn_label">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;$Id$&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fOk_pushButton">
<property name="text">