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 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Models/DataViewUtils.h
//! @brief Defines namespace DataViewUtils
//! @brief Defines namespace GUI::Model::DataViewUtils
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -28,6 +28,6 @@ void updateAxesTitle(Data1DViewItem* view_item);
std::unique_ptr<OutputData<double>> getTranslatedData(Data1DViewItem* view_item,
DataItem* data_item);
}; // namespace DataViewUtils
}; // namespace GUI::Model::DataViewUtils
#endif // BORNAGAIN_GUI_MODELS_DATAVIEWUTILS_H
......@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Models/MaterialItemUtils.h
//! @brief Defines class MaterialItemUtils
//! @brief Defines namespace GUI::Model::MaterialItemUtils
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -47,6 +47,7 @@ ExternalProperty colorProperty(const QColor& color);
//! Gather material property items from a given item
QVector<SessionItem*> materialPropertyItems(SessionItem* item);
} // namespace MaterialItemUtils
} // namespace GUI::Model::MaterialItemUtils
#endif // BORNAGAIN_GUI_MODELS_MATERIALITEMUTILS_H
......@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Models/ParameterTreeUtils.h
//! @brief Defines ParameterTreeUtils namespace
//! @brief Defines namespace GUI::Model::ParameterTreeUtils
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -31,6 +31,6 @@ namespace GUI::Model::ParameterTreeUtils {
void createParameterTree(JobItem* jobItem);
} // namespace ParameterTreeUtils
} // namespace GUI::Model::ParameterTreeUtils
#endif // BORNAGAIN_GUI_MODELS_PARAMETERTREEUTILS_H
......@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/mainwindow/ProjectManagerStore.h
//! @brief Defines namespace ProjectManagerStore
//! @brief Defines namespace GUI::Project::Manager
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -24,6 +24,7 @@ namespace GUI::Project::Manager {
ProjectManager* projectManager();
void subscribe(ProjectManager* projectManager);
void unsubscribe(ProjectManager* projectManager);
} // namespace ProjectManagerStore
} // namespace GUI::Project::Manager
#endif // BORNAGAIN_GUI_MAINWINDOW_PROJECTMANAGERSTORE_H
......@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/mainwindow/ProjectUtils.h
//! @brief Defines ProjectUtils namespace
//! @brief Defines namespace GUI::Project::Utils
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -65,6 +65,6 @@ QString readTextFile(const QString& fileName);
//! Returns directory which user is normally using to export files.
QString userExportDir();
} // namespace ProjectUtils
} // namespace GUI::Project::Utils
#endif // BORNAGAIN_GUI_MAINWINDOW_PROJECTUTILS_H
......@@ -25,8 +25,15 @@
#include <QXmlStreamReader>
namespace {
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)
: m_applicationModels(nullptr)
......@@ -231,9 +238,9 @@ void ProjectDocument::readProject(QIODevice* device)
while (!reader.atEnd()) {
reader.readNext();
if (reader.isStartElement()) {
if (reader.name() == GUI::Project::DocumentXML::BornAgainTag) {
if (reader.name() == BornAgainTag) {
m_currentVersion = reader.attributes()
.value(GUI::Project::DocumentXML::BornAgainVersionAttribute)
.value(BornAgainVersionAttribute)
.toString();
if (!GUI::Helpers::isVersionMatchMinimal(m_currentVersion,
......@@ -248,7 +255,7 @@ void ProjectDocument::readProject(QIODevice* device)
}
while (reader.readNextStartElement())
if (reader.name() == GUI::Project::DocumentXML::InfoTag)
if (reader.name() == InfoTag)
reader.skipCurrentElement();
else
m_applicationModels->readFrom(&reader, m_messageService);
......@@ -272,12 +279,12 @@ void ProjectDocument::writeTo(QIODevice* device)
QXmlStreamWriter writer(device);
writer.setAutoFormatting(true);
writer.writeStartDocument();
writer.writeStartElement(GUI::Project::DocumentXML::BornAgainTag);
writer.writeStartElement(BornAgainTag);
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.writeAttribute(GUI::Project::DocumentXML::InfoNameAttribute, projectName());
writer.writeStartElement(InfoTag);
writer.writeAttribute(InfoNameAttribute, projectName());
writer.writeEndElement(); // InfoTag
m_applicationModels->writeTo(&writer);
......
......@@ -23,13 +23,6 @@ class ApplicationModels;
class MessageService;
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
//! (sample, jobModel, project specific windows settings)
//!
......
......@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/utils/LayoutUtils.h
//! @brief Defines namespace LayoutUtils
//! @brief Defines namespace GUI::Utils::Layout
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -39,6 +39,6 @@ void clearGridLayout(QGridLayout* layout, bool deleteWidgets = true);
//! Returns empty widget to occupy place in layout.
QWidget* placeHolder();
} // namespace LayoutUtils
} // namespace GUI::Utils::Layout
#endif // BORNAGAIN_GUI_UTILS_LAYOUTUTILS_H
......@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/utils/OutputDataUtils.h
//! @brief Defines namespace OutputDataUtils
//! @brief Defines namespace GUI::Utils::Output
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -26,6 +26,6 @@ namespace GUI::Utils::Output {
//! Creates OutputData with bin-valued axes.
std::unique_ptr<OutputData<double>> binifyAxes(const OutputData<double>& data);
}; // namespace OutputDataUtils
} // namespace GUI::Utils::Output
#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