Merge branch 'master' into root6
This commit is contained in:
commit
fe4c0ddede
@ -2,9 +2,16 @@
|
||||
# ChangeLog
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
changes since 0.17.0
|
||||
===================================
|
||||
|
||||
|
||||
changes since 0.16.0
|
||||
===================================
|
||||
NEW 2016-01-22 update of the docu which now describes the RRF option.
|
||||
CHANGED 2016-02-17 move the startup XML-files to $HOME/.musrfit
|
||||
rather than having it within $prefix/bin. Increase
|
||||
therefore the version number to 0.17.0
|
||||
CHANGED 2016-02-16 if the LEM file is created 2012 or later and the
|
||||
data-file-format tag is still ROOT-NPP or ROOT-PPC, it
|
||||
will automatically switched to MUSR-ROOT. This way red/green
|
||||
|
@ -29,4 +29,5 @@ For a more exhaustive user documentation see:
|
||||
|
||||
### Contact ###
|
||||
|
||||
<andreas.suter@psi.ch>
|
||||
<andreas.suter@psi.ch>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
AC_REVISION([m4_esyscmd_s([git describe --always])])
|
||||
|
||||
AC_PREREQ(2.63)
|
||||
AC_INIT([musrfit],[0.16.0],[andreas.suter@psi.ch])
|
||||
AC_INIT([musrfit],[0.17.0],[andreas.suter@psi.ch])
|
||||
AC_CONFIG_AUX_DIR(admin)
|
||||
AC_CANONICAL_HOST
|
||||
#AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}])
|
||||
@ -35,7 +35,7 @@ dnl -----------------------------------------------
|
||||
|
||||
#release versioning
|
||||
MUSR_MAJOR_VERSION=0
|
||||
MUSR_MINOR_VERSION=16
|
||||
MUSR_MINOR_VERSION=17
|
||||
MUSR_MICRO_VERSION=0
|
||||
|
||||
#release versioning
|
||||
@ -1404,6 +1404,7 @@ echo ""
|
||||
echo " Installation directories:"
|
||||
echo " -------------------------"
|
||||
echo ""
|
||||
echo " Programs and XML configuration files: ${INSTALLDIR}/bin"
|
||||
echo " Documentation: ${DOCDIR}"
|
||||
echo " Programs: ${INSTALLDIR}/bin"
|
||||
echo " XML configuration files: ${HOME}/.musrfit"
|
||||
echo " Documentation: ${DOCDIR}"
|
||||
echo ""
|
||||
|
@ -60,7 +60,7 @@ write_musrRoot_runHeader_SOURCES = write_musrRoot_runHeader.cpp
|
||||
musrRootValidation_SOURCES = musrRootValidation.cpp
|
||||
dump_header_SOURCES = dump_header.cpp
|
||||
|
||||
xmldir = $(bindir)
|
||||
xmldir = $(HOME)/.musrfit
|
||||
xml_DATA = musrfit_startup.xml
|
||||
|
||||
LIBADD = $(PMUSR_LIBS) $(MUSR_ROOT_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS)
|
||||
@ -82,7 +82,7 @@ install-xmlDATA: $(xml_DATA)
|
||||
DIFF="$$(diff "$(DESTDIR)$(xmldir)/$(xml_DATA)" "$(xml_DATA)" 2>&1)"; \
|
||||
if test "x$$DIFF" != "x"; then \
|
||||
echo " " && \
|
||||
echo " musrfit_startup.xml in $(bindir)" && \
|
||||
echo " musrfit_startup.xml in $(xmldir)" && \
|
||||
echo " is different from the distribution's version." && \
|
||||
echo " Do you want to overwrite it? [y/N]" && \
|
||||
read OVERWRITE && \
|
||||
@ -101,7 +101,7 @@ uninstall-xmlDATA:
|
||||
DIFF="$$(diff "$(DESTDIR)$(xmldir)/$(xml_DATA)" "$(xml_DATA)" 2>&1)"; \
|
||||
if test "x$$DIFF" != "x"; then \
|
||||
echo " " && \
|
||||
echo " musrfit_startup.xml in $(bindir)" && \
|
||||
echo " musrfit_startup.xml in $(xmldir)" && \
|
||||
echo " is different from the distribution's version." && \
|
||||
echo " Do you want to remove it? [y/N]" && \
|
||||
read REMOVE && \
|
||||
|
@ -93,11 +93,13 @@ PStartupHandler::PStartupHandler()
|
||||
fStartupFilePath = "";
|
||||
|
||||
// get default path (for the moment only linux like)
|
||||
Char_t *pmusrpath;
|
||||
Char_t *home;
|
||||
Char_t *pmusrpath=0;
|
||||
Char_t *home=0;
|
||||
Char_t musrpath[128];
|
||||
Char_t startup_path_name[128];
|
||||
Bool_t pmusrpathfound = false;
|
||||
Bool_t found = false;
|
||||
|
||||
strncpy(musrpath, "", sizeof(musrpath));
|
||||
|
||||
// check if the startup file is found in the current directory
|
||||
strcpy(startup_path_name, "./musrfit_startup.xml");
|
||||
@ -105,20 +107,27 @@ PStartupHandler::PStartupHandler()
|
||||
fStartupFileFound = true;
|
||||
fStartupFilePath = TString(startup_path_name);
|
||||
} else { // startup file is not found in the current directory
|
||||
// check if the MUSRFITPATH system variable is set
|
||||
// check if the startup file is found under $HOME/.musrfit
|
||||
home = getenv("HOME");
|
||||
if (home != 0) {
|
||||
sprintf(musrpath, "%s/.musrfit", home);
|
||||
found = true;
|
||||
}
|
||||
pmusrpath = getenv("MUSRFITPATH");
|
||||
if (pmusrpath != 0) {
|
||||
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
|
||||
pmusrpathfound = true;
|
||||
if (!found) {
|
||||
// check if the MUSRFITPATH system variable is set
|
||||
if (pmusrpath != 0) {
|
||||
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!pmusrpathfound) { // MUSRFITPATH not set or empty, will try default one
|
||||
if (!found) { // MUSRFITPATH not set or empty, will try default one
|
||||
home = getenv("ROOTSYS");
|
||||
sprintf(musrpath, "%s/bin", home);
|
||||
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
|
||||
} else {
|
||||
strncpy(musrpath, pmusrpath, sizeof(musrpath));
|
||||
}
|
||||
|
||||
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
|
||||
fStartupFilePath = TString(startup_path_name);
|
||||
if (StartupFileExists(startup_path_name)) {
|
||||
|
@ -603,6 +603,7 @@ PAdmin::PAdmin() : QObject()
|
||||
fFontName = QString("Courier"); // default font
|
||||
fFontSize = 11; // default font size
|
||||
|
||||
fPrefPathName = QString("");
|
||||
fExecPath = QString("");
|
||||
fDefaultSavePath = QString("");
|
||||
fMsrDefaultFilePath = QString("");
|
||||
@ -641,25 +642,28 @@ PAdmin::PAdmin() : QObject()
|
||||
fMsr2DataParam.globalPlus = false;
|
||||
|
||||
// XML Parser part
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_WS_MAC
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
// 1st: check local directory
|
||||
QString path = QString("./");
|
||||
QString fln = QString("musredit_startup.xml");
|
||||
QString pathFln = path + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
||||
path = std::getenv("HOME");
|
||||
pathFln = path + "/.musrfit/musredit/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
||||
path = std::getenv("MUSRFITPATH");
|
||||
pathFln = path + "/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 4th: check $ROOTSYS/bin/musredit_startup.xml
|
||||
path = std::getenv("ROOTSYS");
|
||||
pathFln = path + "/bin/" + fln;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
fPrefPathName = pathFln;
|
||||
|
||||
loadPrefs(fln);
|
||||
loadPrefs(fPrefPathName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -769,25 +773,10 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
{
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
QString str;
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_WS_MAC
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
@ -842,6 +831,12 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
else
|
||||
data[i] = " <estimate_n0>n</estimate_n0>";
|
||||
}
|
||||
if (data[i].contains("<musrview_show_fourier>") && data[i].contains("</musrview_show_fourier>")) {
|
||||
if (fMusrviewShowFourier)
|
||||
data[i] = " <musrview_show_fourier>y</musrview_show_fourier>";
|
||||
else
|
||||
data[i] = " <musrview_show_fourier>n</musrview_show_fourier>";
|
||||
}
|
||||
if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) {
|
||||
if (fEnableMusrT0)
|
||||
data[i] = " <enable_musrt0>y</enable_musrt0>";
|
||||
@ -853,13 +848,16 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
// write prefs
|
||||
file.setFileName(pref_fln);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << fln.toLatin1().data() << " for writing." << endl;
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << pref_fln.toLatin1().data() << " for writing." << endl;
|
||||
return 0;
|
||||
}
|
||||
fin.setDevice(&file);
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -894,25 +892,11 @@ void PAdmin::saveRecentFiles()
|
||||
{
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
QString str("");
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
QString str;
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_WS_MAC
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
@ -959,6 +943,9 @@ void PAdmin::saveRecentFiles()
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,7 @@ class PAdmin : public QObject
|
||||
PTheory* getTheoryItem(const unsigned int idx);
|
||||
PMsr2DataParam getMsr2DataParam() { return fMsr2DataParam; }
|
||||
int getNumRecentFiles() { return fRecentFile.size(); }
|
||||
QString getDefaultPrefPathName() { return fPrefPathName; }
|
||||
QString getRecentFile(int idx);
|
||||
|
||||
void setTimeout(const int ival) { fTimeout = ival; }
|
||||
@ -175,6 +176,7 @@ class PAdmin : public QObject
|
||||
QString fFontName; ///< default font name
|
||||
int fFontSize; ///< default font size
|
||||
|
||||
QString fPrefPathName; ///< path-name of the musredit_startup.xml
|
||||
QString fExecPath; ///< system path to the musrfit executables
|
||||
QString fDefaultSavePath; ///< default path where the msr-file should be saved
|
||||
QString fMsrDefaultFilePath; ///< path where to find musredit source
|
||||
|
@ -129,7 +129,7 @@ PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
|
||||
fileNew();
|
||||
}
|
||||
|
||||
connect( fTabWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( applyFontSettings(QWidget*) ));
|
||||
connect( fTabWidget, SIGNAL( currentChanged(int) ), this, SLOT( applyFontSettings(int) ));
|
||||
|
||||
fLastDirInUse = fAdmin->getDefaultSavePath();
|
||||
}
|
||||
@ -903,12 +903,31 @@ void PTextEdit::fileReload()
|
||||
*/
|
||||
void PTextEdit::fileOpenPrefs()
|
||||
{
|
||||
QString fln = QFileDialog::getOpenFileName( this, tr("Open Prefs"),
|
||||
QString fln("");
|
||||
QString msg("");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Which Preferences do you want to open?");
|
||||
msgBox.addButton("Default", QMessageBox::AcceptRole);
|
||||
msgBox.addButton("Custom", QMessageBox::AcceptRole);
|
||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
int result = msgBox.exec();
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (result == 0) { // default dir
|
||||
fln = fAdmin->getDefaultPrefPathName();
|
||||
msg = QString("Current Default Preferences Path-Name:\n") + fln;
|
||||
if (QMessageBox::information(this, "Info", msg, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
return;
|
||||
} else if (result == 1) { // custom dir
|
||||
fln = QFileDialog::getOpenFileName( this, tr("Open Prefs"),
|
||||
fLastDirInUse,
|
||||
tr( "xml-Files (*.xml);; All Files (*)" ));
|
||||
}
|
||||
|
||||
if (fAdmin->loadPrefs(fln))
|
||||
QMessageBox::information(0, "Prefs", "<b>Prefs Loaded.</b>");
|
||||
if (fAdmin->loadPrefs(fln)) {
|
||||
msg = QString("Prefs from '") + fln + QString("' loaded.");
|
||||
QMessageBox::information(0, "Info", msg);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -970,12 +989,31 @@ void PTextEdit::fileSaveAs()
|
||||
*/
|
||||
void PTextEdit::fileSavePrefs()
|
||||
{
|
||||
QString fn = QFileDialog::getSaveFileName( this,
|
||||
QString fln("");
|
||||
QString msg("");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Which Preferences do you want to open?");
|
||||
msgBox.addButton("Default", QMessageBox::AcceptRole);
|
||||
msgBox.addButton("Custom", QMessageBox::AcceptRole);
|
||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
int result = msgBox.exec();
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (result == 0) { // default dir
|
||||
fln = fAdmin->getDefaultPrefPathName();
|
||||
msg = QString("Current Default Preferences Path-Name:\n") + fln;
|
||||
if (QMessageBox::information(this, "Info", msg, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
return;
|
||||
} else if (result == 1) { // custom dir
|
||||
fln = QFileDialog::getSaveFileName( this,
|
||||
tr( "Save Prefs As" ), "musredit_startup.xml",
|
||||
tr( "xml-Files (*.xml);;All Files (*)" ) );
|
||||
}
|
||||
|
||||
if ( !fn.isEmpty() ) {
|
||||
fAdmin->savePrefs(fn);
|
||||
if ( !fln.isEmpty() ) {
|
||||
fAdmin->savePrefs(fln);
|
||||
msg = QString("Prefs to '") + fln + QString("' saved.");
|
||||
QMessageBox::information(0, "Info", msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2508,7 +2546,7 @@ void PTextEdit::replaceAll()
|
||||
/**
|
||||
* <p>SLOT: updates the fonts if the textedit tab has changed.
|
||||
*/
|
||||
void PTextEdit::applyFontSettings(QWidget*)
|
||||
void PTextEdit::applyFontSettings(int)
|
||||
{
|
||||
QFont font(fAdmin->getFontName(), fAdmin->getFontSize());
|
||||
fontChanged(font);
|
||||
|
@ -147,7 +147,7 @@ private slots:
|
||||
void replaceAndClose();
|
||||
void replaceAll();
|
||||
|
||||
void applyFontSettings(QWidget*);
|
||||
void applyFontSettings(int);
|
||||
void fileChanged(const QString &fileName);
|
||||
void setFileSystemWatcherActive();
|
||||
|
||||
|
@ -58,8 +58,8 @@ QMAKE_CXX = $${CXX}
|
||||
QMAKE_LINK = $${CXX}
|
||||
|
||||
# install path for the XML configuration file
|
||||
unix:xml.path = $${MUSREDIT_INSTALL_PATH}
|
||||
macx:xml.path = /Applications/musredit.app/Contents/Resources
|
||||
unix:xml.path = $$(HOME)/.musrfit/musredit
|
||||
macx:xml.path = $$(HOME)/.musrfit/musredit
|
||||
win32:xml.path = c:/musrfit/bin
|
||||
xml.files = musredit_startup.xml
|
||||
INSTALLS += xml
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<musredit_startup xmlns="http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrGui.html">
|
||||
<musredit_startup xmlns="http://lmu.web.psi.ch/musrfit/user/MUSR/MusrGui.html">
|
||||
<comment>
|
||||
This is handling default setting parameters for the musredit.
|
||||
</comment>
|
||||
@ -14,6 +14,7 @@
|
||||
<title_from_data_file>y</title_from_data_file>
|
||||
<chisq_per_run_block>n</chisq_per_run_block>
|
||||
<estimate_n0>y</estimate_n0>
|
||||
<musrview_show_fourier>n</musrview_show_fourier>
|
||||
<enable_musrt0>y</enable_musrt0>
|
||||
</general>
|
||||
<recent_files>
|
||||
|
@ -603,6 +603,7 @@ PAdmin::PAdmin() : QObject()
|
||||
fFontName = QString("Courier"); // default font
|
||||
fFontSize = 11; // default font size
|
||||
|
||||
fPrefPathName = QString("");
|
||||
fExecPath = QString("");
|
||||
fDefaultSavePath = QString("");
|
||||
fMsrDefaultFilePath = QString("");
|
||||
@ -641,25 +642,28 @@ PAdmin::PAdmin() : QObject()
|
||||
fMsr2DataParam.globalPlus = false;
|
||||
|
||||
// XML Parser part
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_OS_OSX
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
// 1st: check local directory
|
||||
QString path = QString("./");
|
||||
QString fln = QString("musredit_startup.xml");
|
||||
QString pathFln = path + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
||||
path = std::getenv("HOME");
|
||||
pathFln = path + "/.musrfit/musredit/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
||||
path = std::getenv("MUSRFITPATH");
|
||||
pathFln = path + "/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 4th: check $ROOTSYS/bin/musredit_startup.xml
|
||||
path = std::getenv("ROOTSYS");
|
||||
pathFln = path + "/bin/" + fln;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
fPrefPathName = pathFln;
|
||||
|
||||
loadPrefs(fln);
|
||||
loadPrefs(fPrefPathName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -769,25 +773,10 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
{
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
QString str;
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_OS_OSX
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
@ -842,6 +831,12 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
else
|
||||
data[i] = " <estimate_n0>n</estimate_n0>";
|
||||
}
|
||||
if (data[i].contains("<musrview_show_fourier>") && data[i].contains("</musrview_show_fourier>")) {
|
||||
if (fMusrviewShowFourier)
|
||||
data[i] = " <musrview_show_fourier>y</musrview_show_fourier>";
|
||||
else
|
||||
data[i] = " <musrview_show_fourier>n</musrview_show_fourier>";
|
||||
}
|
||||
if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) {
|
||||
if (fEnableMusrT0)
|
||||
data[i] = " <enable_musrt0>y</enable_musrt0>";
|
||||
@ -853,13 +848,16 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
// write prefs
|
||||
file.setFileName(pref_fln);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << fln.toLatin1().data() << " for writing." << endl;
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << pref_fln.toLatin1().data() << " for writing." << endl;
|
||||
return 0;
|
||||
}
|
||||
fin.setDevice(&file);
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -895,24 +893,11 @@ void PAdmin::saveRecentFiles()
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
|
||||
QString str;
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_OS_OSX
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
QString str("");
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
@ -959,6 +944,9 @@ void PAdmin::saveRecentFiles()
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,7 @@ class PAdmin : public QObject
|
||||
PTheory* getTheoryItem(const unsigned int idx);
|
||||
PMsr2DataParam getMsr2DataParam() { return fMsr2DataParam; }
|
||||
int getNumRecentFiles() { return fRecentFile.size(); }
|
||||
QString getDefaultPrefPathName() { return fPrefPathName; }
|
||||
QString getRecentFile(int idx);
|
||||
|
||||
void setTimeout(const int ival) { fTimeout = ival; }
|
||||
@ -153,7 +154,7 @@ class PAdmin : public QObject
|
||||
void addRecentFile(const QString str);
|
||||
|
||||
int loadPrefs(QString fln);
|
||||
int savePrefs(QString pref_fln);
|
||||
int savePrefs(QString pref_fln);
|
||||
|
||||
protected:
|
||||
void setExecPath(const QString str) { fExecPath = str; }
|
||||
@ -175,6 +176,7 @@ class PAdmin : public QObject
|
||||
QString fFontName; ///< default font name
|
||||
int fFontSize; ///< default font size
|
||||
|
||||
QString fPrefPathName; ///< path-name of the musredit_startup.xml
|
||||
QString fExecPath; ///< system path to the musrfit executables
|
||||
QString fDefaultSavePath; ///< default path where the msr-file should be saved
|
||||
QString fMsrDefaultFilePath; ///< path where to find musredit source
|
||||
|
@ -127,7 +127,7 @@ PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
|
||||
fileNew();
|
||||
}
|
||||
|
||||
connect( fTabWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( applyFontSettings(QWidget*) ));
|
||||
connect( fTabWidget, SIGNAL( currentChanged(int) ), this, SLOT( applyFontSettings(int) ));
|
||||
|
||||
fLastDirInUse = fAdmin->getDefaultSavePath();
|
||||
}
|
||||
@ -901,12 +901,31 @@ void PTextEdit::fileReload()
|
||||
*/
|
||||
void PTextEdit::fileOpenPrefs()
|
||||
{
|
||||
QString fln = QFileDialog::getOpenFileName( this, tr("Open Prefs"),
|
||||
QString fln("");
|
||||
QString msg("");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Which Preferences do you want to open?");
|
||||
msgBox.addButton("Default", QMessageBox::AcceptRole);
|
||||
msgBox.addButton("Custom", QMessageBox::AcceptRole);
|
||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
int result = msgBox.exec();
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (result == 0) { // default dir
|
||||
fln = fAdmin->getDefaultPrefPathName();
|
||||
msg = QString("Current Default Preferences Path-Name:\n") + fln;
|
||||
if (QMessageBox::information(this, "Info", msg, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
return;
|
||||
} else if (result == 1) { // custom dir
|
||||
fln = QFileDialog::getOpenFileName( this, tr("Open Prefs"),
|
||||
fLastDirInUse,
|
||||
tr( "xml-Files (*.xml);; All Files (*)" ));
|
||||
}
|
||||
|
||||
if (fAdmin->loadPrefs(fln))
|
||||
QMessageBox::information(0, "Prefs", "<b>Prefs Loaded.</b>");
|
||||
if (fAdmin->loadPrefs(fln)) {
|
||||
msg = QString("Prefs from '") + fln + QString("' loaded.");
|
||||
QMessageBox::information(0, "Info", msg);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -968,12 +987,31 @@ void PTextEdit::fileSaveAs()
|
||||
*/
|
||||
void PTextEdit::fileSavePrefs()
|
||||
{
|
||||
QString fn = QFileDialog::getSaveFileName( this,
|
||||
QString fln("");
|
||||
QString msg("");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Which Preferences do you want to open?");
|
||||
msgBox.addButton("Default", QMessageBox::AcceptRole);
|
||||
msgBox.addButton("Custom", QMessageBox::AcceptRole);
|
||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
int result = msgBox.exec();
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (result == 0) { // default dir
|
||||
fln = fAdmin->getDefaultPrefPathName();
|
||||
msg = QString("Current Default Preferences Path-Name:\n") + fln;
|
||||
if (QMessageBox::information(this, "Info", msg, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
return;
|
||||
} else if (result == 1) { // custom dir
|
||||
fln = QFileDialog::getSaveFileName( this,
|
||||
tr( "Save Prefs As" ), "musredit_startup.xml",
|
||||
tr( "xml-Files (*.xml);;All Files (*)" ) );
|
||||
}
|
||||
|
||||
if ( !fn.isEmpty() ) {
|
||||
fAdmin->savePrefs(fn);
|
||||
if ( !fln.isEmpty() ) {
|
||||
fAdmin->savePrefs(fln);
|
||||
msg = QString("Prefs to '") + fln + QString("' saved.");
|
||||
QMessageBox::information(0, "Info", msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2506,7 +2544,7 @@ void PTextEdit::replaceAll()
|
||||
/**
|
||||
* <p>SLOT: updates the fonts if the textedit tab has changed.
|
||||
*/
|
||||
void PTextEdit::applyFontSettings(QWidget*)
|
||||
void PTextEdit::applyFontSettings(int)
|
||||
{
|
||||
QFont font(fAdmin->getFontName(), fAdmin->getFontSize());
|
||||
fontChanged(font);
|
||||
|
@ -147,7 +147,7 @@ private slots:
|
||||
void replaceAndClose();
|
||||
void replaceAll();
|
||||
|
||||
void applyFontSettings(QWidget*);
|
||||
void applyFontSettings(int);
|
||||
void fileChanged(const QString &fileName);
|
||||
void setFileSystemWatcherActive();
|
||||
|
||||
|
@ -31,8 +31,8 @@ unix {
|
||||
|
||||
unix:target.path = $${MUSREDIT_INSTALL_PATH}
|
||||
macx:target.path = /Applications
|
||||
|
||||
win32:target.path = c:/musrfit/bin
|
||||
|
||||
INSTALLS += target
|
||||
|
||||
# This is only needed for SL5.1
|
||||
@ -58,8 +58,8 @@ QMAKE_CXX = $${CXX}
|
||||
QMAKE_LINK = $${CXX}
|
||||
|
||||
# install path for the XML configuration file
|
||||
unix:xml.path = $${MUSREDIT_INSTALL_PATH}
|
||||
macx:xml.path = /Applications/musredit.app/Contents/Resources
|
||||
unix:xml.path = $$(HOME)/.musrfit/musredit
|
||||
macx:xml.path = $$(HOME)/.musrfit/musredit
|
||||
win32:xml.path = c:/musrfit/bin
|
||||
xml.files = musredit_startup.xml
|
||||
INSTALLS += xml
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<musredit_startup xmlns="http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrGui.html">
|
||||
<musredit_startup xmlns="http://lmu.web.psi.ch/musrfit/user/MUSR/MusrGui.html">
|
||||
<comment>
|
||||
This is handling default setting parameters for the musredit.
|
||||
</comment>
|
||||
@ -14,6 +14,7 @@
|
||||
<title_from_data_file>y</title_from_data_file>
|
||||
<chisq_per_run_block>n</chisq_per_run_block>
|
||||
<estimate_n0>y</estimate_n0>
|
||||
<musrview_show_fourier>n</musrview_show_fourier>
|
||||
<enable_musrt0>y</enable_musrt0>
|
||||
</general>
|
||||
<recent_files>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<musrfit xmlns="http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrFit.html">
|
||||
<musrfit xmlns="http://lmu.web.psi.ch/musrfit/user/MUSR/WebHome.html">
|
||||
<comment>
|
||||
Defines default settings for the musrfit package
|
||||
</comment>
|
||||
|
Loading…
x
Reference in New Issue
Block a user