Skip to content
Snippets Groups Projects
Commit 2bff4967 authored by Wuttke, Joachim's avatar Wuttke, Joachim Committed by Wuttke, Joachim
Browse files

rm namespace GUI::Project::DocumentXML

parent affa8959
No related branches found
No related tags found
1 merge request!135Bring namespaces under hierarchy
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/Models/DataViewUtils.h //! @file GUI/Models/DataViewUtils.h
//! @brief Defines namespace DataViewUtils //! @brief Defines namespace GUI::Model::DataViewUtils
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -28,6 +28,6 @@ void updateAxesTitle(Data1DViewItem* view_item); ...@@ -28,6 +28,6 @@ void updateAxesTitle(Data1DViewItem* view_item);
std::unique_ptr<OutputData<double>> getTranslatedData(Data1DViewItem* view_item, std::unique_ptr<OutputData<double>> getTranslatedData(Data1DViewItem* view_item,
DataItem* data_item); DataItem* data_item);
}; // namespace DataViewUtils }; // namespace GUI::Model::DataViewUtils
#endif // BORNAGAIN_GUI_MODELS_DATAVIEWUTILS_H #endif // BORNAGAIN_GUI_MODELS_DATAVIEWUTILS_H
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/Models/MaterialItemUtils.h //! @file GUI/Models/MaterialItemUtils.h
//! @brief Defines class MaterialItemUtils //! @brief Defines namespace GUI::Model::MaterialItemUtils
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -47,6 +47,7 @@ ExternalProperty colorProperty(const QColor& color); ...@@ -47,6 +47,7 @@ ExternalProperty colorProperty(const QColor& color);
//! Gather material property items from a given item //! Gather material property items from a given item
QVector<SessionItem*> materialPropertyItems(SessionItem* item); QVector<SessionItem*> materialPropertyItems(SessionItem* item);
} // namespace MaterialItemUtils
} // namespace GUI::Model::MaterialItemUtils
#endif // BORNAGAIN_GUI_MODELS_MATERIALITEMUTILS_H #endif // BORNAGAIN_GUI_MODELS_MATERIALITEMUTILS_H
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/Models/ParameterTreeUtils.h //! @file GUI/Models/ParameterTreeUtils.h
//! @brief Defines ParameterTreeUtils namespace //! @brief Defines namespace GUI::Model::ParameterTreeUtils
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -31,6 +31,6 @@ namespace GUI::Model::ParameterTreeUtils { ...@@ -31,6 +31,6 @@ namespace GUI::Model::ParameterTreeUtils {
void createParameterTree(JobItem* jobItem); void createParameterTree(JobItem* jobItem);
} // namespace ParameterTreeUtils } // namespace GUI::Model::ParameterTreeUtils
#endif // BORNAGAIN_GUI_MODELS_PARAMETERTREEUTILS_H #endif // BORNAGAIN_GUI_MODELS_PARAMETERTREEUTILS_H
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/mainwindow/ProjectManagerStore.h //! @file GUI/mainwindow/ProjectManagerStore.h
//! @brief Defines namespace ProjectManagerStore //! @brief Defines namespace GUI::Project::Manager
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -24,6 +24,7 @@ namespace GUI::Project::Manager { ...@@ -24,6 +24,7 @@ namespace GUI::Project::Manager {
ProjectManager* projectManager(); ProjectManager* projectManager();
void subscribe(ProjectManager* projectManager); void subscribe(ProjectManager* projectManager);
void unsubscribe(ProjectManager* projectManager); void unsubscribe(ProjectManager* projectManager);
} // namespace ProjectManagerStore
} // namespace GUI::Project::Manager
#endif // BORNAGAIN_GUI_MAINWINDOW_PROJECTMANAGERSTORE_H #endif // BORNAGAIN_GUI_MAINWINDOW_PROJECTMANAGERSTORE_H
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/mainwindow/ProjectUtils.h //! @file GUI/mainwindow/ProjectUtils.h
//! @brief Defines ProjectUtils namespace //! @brief Defines namespace GUI::Project::Utils
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -65,6 +65,6 @@ QString readTextFile(const QString& fileName); ...@@ -65,6 +65,6 @@ QString readTextFile(const QString& fileName);
//! Returns directory which user is normally using to export files. //! Returns directory which user is normally using to export files.
QString userExportDir(); QString userExportDir();
} // namespace ProjectUtils } // namespace GUI::Project::Utils
#endif // BORNAGAIN_GUI_MAINWINDOW_PROJECTUTILS_H #endif // BORNAGAIN_GUI_MAINWINDOW_PROJECTUTILS_H
...@@ -25,8 +25,15 @@ ...@@ -25,8 +25,15 @@
#include <QXmlStreamReader> #include <QXmlStreamReader>
namespace { namespace {
const QString minimal_supported_version = "1.6.0"; const QString minimal_supported_version = "1.6.0";
} const QString BornAgainTag("BornAgain");
const QString BornAgainVersionAttribute("Version");
const QString InfoTag("DocumentInfo");
const QString InfoNameAttribute("ProjectName");
} // namespace
ProjectDocument::ProjectDocument(const QString& projectFileName) ProjectDocument::ProjectDocument(const QString& projectFileName)
: m_applicationModels(nullptr) : m_applicationModels(nullptr)
...@@ -231,9 +238,9 @@ void ProjectDocument::readProject(QIODevice* device) ...@@ -231,9 +238,9 @@ void ProjectDocument::readProject(QIODevice* device)
while (!reader.atEnd()) { while (!reader.atEnd()) {
reader.readNext(); reader.readNext();
if (reader.isStartElement()) { if (reader.isStartElement()) {
if (reader.name() == GUI::Project::DocumentXML::BornAgainTag) { if (reader.name() == BornAgainTag) {
m_currentVersion = reader.attributes() m_currentVersion = reader.attributes()
.value(GUI::Project::DocumentXML::BornAgainVersionAttribute) .value(BornAgainVersionAttribute)
.toString(); .toString();
if (!GUI::Helpers::isVersionMatchMinimal(m_currentVersion, if (!GUI::Helpers::isVersionMatchMinimal(m_currentVersion,
...@@ -248,7 +255,7 @@ void ProjectDocument::readProject(QIODevice* device) ...@@ -248,7 +255,7 @@ void ProjectDocument::readProject(QIODevice* device)
} }
while (reader.readNextStartElement()) while (reader.readNextStartElement())
if (reader.name() == GUI::Project::DocumentXML::InfoTag) if (reader.name() == InfoTag)
reader.skipCurrentElement(); reader.skipCurrentElement();
else else
m_applicationModels->readFrom(&reader, m_messageService); m_applicationModels->readFrom(&reader, m_messageService);
...@@ -272,12 +279,12 @@ void ProjectDocument::writeTo(QIODevice* device) ...@@ -272,12 +279,12 @@ void ProjectDocument::writeTo(QIODevice* device)
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);
writer.setAutoFormatting(true); writer.setAutoFormatting(true);
writer.writeStartDocument(); writer.writeStartDocument();
writer.writeStartElement(GUI::Project::DocumentXML::BornAgainTag); writer.writeStartElement(BornAgainTag);
QString version_string = GUI::Helpers::getBornAgainVersionString(); QString version_string = GUI::Helpers::getBornAgainVersionString();
writer.writeAttribute(GUI::Project::DocumentXML::BornAgainVersionAttribute, version_string); writer.writeAttribute(BornAgainVersionAttribute, version_string);
writer.writeStartElement(GUI::Project::DocumentXML::InfoTag); writer.writeStartElement(InfoTag);
writer.writeAttribute(GUI::Project::DocumentXML::InfoNameAttribute, projectName()); writer.writeAttribute(InfoNameAttribute, projectName());
writer.writeEndElement(); // InfoTag writer.writeEndElement(); // InfoTag
m_applicationModels->writeTo(&writer); m_applicationModels->writeTo(&writer);
......
...@@ -23,13 +23,6 @@ class ApplicationModels; ...@@ -23,13 +23,6 @@ class ApplicationModels;
class MessageService; class MessageService;
class OutputDataIOService; class OutputDataIOService;
namespace GUI::Project::DocumentXML {
const QString BornAgainTag("BornAgain");
const QString BornAgainVersionAttribute("Version");
const QString InfoTag("DocumentInfo");
const QString InfoNameAttribute("ProjectName");
} // namespace ProjectDocumentXML
//! Project document class handles all data related to the opened project //! Project document class handles all data related to the opened project
//! (sample, jobModel, project specific windows settings) //! (sample, jobModel, project specific windows settings)
//! //!
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/utils/LayoutUtils.h //! @file GUI/utils/LayoutUtils.h
//! @brief Defines namespace LayoutUtils //! @brief Defines namespace GUI::Utils::Layout
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -39,6 +39,6 @@ void clearGridLayout(QGridLayout* layout, bool deleteWidgets = true); ...@@ -39,6 +39,6 @@ void clearGridLayout(QGridLayout* layout, bool deleteWidgets = true);
//! Returns empty widget to occupy place in layout. //! Returns empty widget to occupy place in layout.
QWidget* placeHolder(); QWidget* placeHolder();
} // namespace LayoutUtils } // namespace GUI::Utils::Layout
#endif // BORNAGAIN_GUI_UTILS_LAYOUTUTILS_H #endif // BORNAGAIN_GUI_UTILS_LAYOUTUTILS_H
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/utils/OutputDataUtils.h //! @file GUI/utils/OutputDataUtils.h
//! @brief Defines namespace OutputDataUtils //! @brief Defines namespace GUI::Utils::Output
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -26,6 +26,6 @@ namespace GUI::Utils::Output { ...@@ -26,6 +26,6 @@ namespace GUI::Utils::Output {
//! Creates OutputData with bin-valued axes. //! Creates OutputData with bin-valued axes.
std::unique_ptr<OutputData<double>> binifyAxes(const OutputData<double>& data); std::unique_ptr<OutputData<double>> binifyAxes(const OutputData<double>& data);
}; // namespace OutputDataUtils } // namespace GUI::Utils::Output
#endif // BORNAGAIN_GUI_UTILS_OUTPUTDATAUTILS_H #endif // BORNAGAIN_GUI_UTILS_OUTPUTDATAUTILS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment