diff --git a/GUI/Application/GlobalSettings.cpp b/GUI/Application/GlobalSettings.cpp index bb1be6813f050361630f0fb425e75333edca1583..87dc13f493946b350da42c1824df6d8fa59a3ae1 100644 --- a/GUI/Application/GlobalSettings.cpp +++ b/GUI/Application/GlobalSettings.cpp @@ -97,11 +97,6 @@ InstrumentLibrary& GlobalSettings::instrumentLibrary() return m_instrumentLibrary; } -QString GlobalSettings::instrumentLibraryFilePath() const -{ - return appDataFolder() + "/BornAgainInstrumentLibrary.balib"; -} - QString GlobalSettings::appDataFolder() const { return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); diff --git a/GUI/Application/GlobalSettings.h b/GUI/Application/GlobalSettings.h index 3b09ec595f27768eac5601280cb0344098585848..97b6fa9e4b10b924c09db8981af91289bbac4e22 100644 --- a/GUI/Application/GlobalSettings.h +++ b/GUI/Application/GlobalSettings.h @@ -39,8 +39,6 @@ public: InstrumentLibrary& instrumentLibrary(); - QString instrumentLibraryFilePath() const; - //! The folder where persistent application data shall be stored. E.g. in Windows this is the //! AppData/Roaming location. //! Used e.g. for storing the instrument library. diff --git a/GUI/Models/Instrument/InstrumentLibrary.cpp b/GUI/Models/Instrument/InstrumentLibrary.cpp index f548e4b4291c394a19a246808ecd83ece122ab57..0d7569f5a4f3c3ef17a4d68910cddb75b95417cc 100644 --- a/GUI/Models/Instrument/InstrumentLibrary.cpp +++ b/GUI/Models/Instrument/InstrumentLibrary.cpp @@ -22,6 +22,11 @@ namespace { const QString XML_ROOT_TAG = "BornAgainInstrumentLibrary"; const QString XML_VERSION_TAG = "Version"; + +QString instrumentLibraryFilePath() { + return baApp->appDataFolder() + "/BornAgainInstrumentLibrary.balib"; +} + } // namespace InstrumentLibrary::InstrumentLibrary() : m_modified(false) @@ -57,8 +62,7 @@ bool InstrumentLibrary::saveIfModified() if (!m_modified) return true; - const QString& filepath = baApp->instrumentLibraryFilePath(); - QFile file(filepath); + QFile file(instrumentLibraryFilePath()); if (!file.open(QFile::ReadWrite | QIODevice::Truncate | QFile::Text)) return false; @@ -83,8 +87,7 @@ bool InstrumentLibrary::load() m_modified = false; m_model.clear(); - const QString& filepath = baApp->instrumentLibraryFilePath(); - QFile file(filepath); + QFile file(instrumentLibraryFilePath()); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return false;