improved recent file handling for macos.

This commit is contained in:
Andreas Suter 2025-03-30 17:09:04 +02:00 committed by Andreas Suter
parent 7556a2e243
commit a895903a58
3 changed files with 6 additions and 15 deletions

View File

@ -775,13 +775,13 @@ PAdmin::PAdmin() : QObject()
// XML Parser part
// 1st: check local directory
QString path = QString("./");
QString path = QDir::currentPath();
QString fln = QString("musredit_startup.xml");
QString pathFln = path + fln;
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
if (!QFile::exists(pathFln)) {
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
path = procEnv.value("HOME", "");
path = QDir::homePath();
pathFln = path + "/.musrfit/musredit/" + fln;
if (!QFile::exists(pathFln)) {
// 3rd: check $MUSRFITPATH/musredit_startup.xml
@ -833,15 +833,6 @@ PAdmin::PAdmin() : QObject()
}
}
//--------------------------------------------------------------------------
/**
* <p>Destructor
*/
PAdmin::~PAdmin()
{
saveRecentFiles();
}
//--------------------------------------------------------------------------
/**
* <p>returns the help url corresponding the the tag.

View File

@ -65,7 +65,6 @@ class PAdminXMLParser
{
public:
PAdminXMLParser(const QString &fln, PAdmin*);
virtual ~PAdminXMLParser() {}
virtual bool isValid() { return fValid; }
@ -113,7 +112,6 @@ class PAdmin : public QObject
{
public:
PAdmin();
virtual ~PAdmin();
int getTimeout() { return fTimeout; }
QString getFontName() { return fFontName; }
@ -173,6 +171,7 @@ class PAdmin : public QObject
int loadPrefs(QString fln);
int savePrefs(QString pref_fln);
void saveRecentFiles(); ///< save recent file list
protected:
void setExecPath(const QString str) { fExecPath = str; }
@ -228,7 +227,6 @@ class PAdmin : public QObject
QVector<PTheory> fTheory; ///< stores all known theories. Needed when generating theory blocks from within musredit.
void saveRecentFiles(); ///< save recent file list
void createMusreditStartupFile(); ///< create default musredit_startup.xml
};

View File

@ -1673,6 +1673,8 @@ void PTextEdit::fileExit()
}
}
fAdmin->saveRecentFiles();
qApp->quit();
}