start moving startup XML-files to /home/nemu/.musrfit
This commit is contained in:
parent
4fec25e423
commit
bd05f57523
@ -5,6 +5,8 @@
|
||||
changes since 0.16.0
|
||||
===================================
|
||||
NEW 2016-01-22 update of the docu which now describes the RRF option.
|
||||
CHANGED 2016-02-17 start to move the startup XML-files to $HOME/.musrfit
|
||||
rather than having it within $prefix/bin.
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user