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

rename namespace

parent b17e9b7f
No related branches found
No related tags found
1 merge request!470decouple GUI/Model/From from rest of GUI/Model
Pipeline #50052 passed
......@@ -2,8 +2,8 @@
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Model/From/GUIExamplesFactory.cpp
//! @brief Implements class GUIExamplesFactory
//! @file GUI/Model/From/GUI::ExamplesFactory.cpp
//! @brief Implements class GUI::ExamplesFactory
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -63,13 +63,13 @@ const QMap<QString, std::tuple<QString, QString, std::function<MultiLayer*()>>>
} // namespace
bool GUIExamplesFactory::isValidExampleName(const QString& name)
bool GUI::ExamplesFactory::isValidExampleName(const QString& name)
{
return builders.find(name) != builders.end();
}
//! Populate sample model with
SessionItem* GUIExamplesFactory::createSampleItems(const QString& name, SampleModel* sampleModel,
SessionItem* GUI::ExamplesFactory::createSampleItems(const QString& name, SampleModel* sampleModel,
MaterialModel* materialModel)
{
ASSERT(isValidExampleName(name));
......@@ -78,12 +78,12 @@ SessionItem* GUIExamplesFactory::createSampleItems(const QString& name, SampleMo
return GUIDomainSampleVisitor().populateSampleModel(sampleModel, materialModel, *sample, name);
}
QStringList GUIExamplesFactory::exampleNames()
QStringList GUI::ExamplesFactory::exampleNames()
{
return builders.keys();
}
std::tuple<QString, QString> GUIExamplesFactory::exampleInfo(const QString& name)
std::tuple<QString, QString> GUI::ExamplesFactory::exampleInfo(const QString& name)
{
ASSERT(isValidExampleName(name));
auto [title, description, builder] = builders[name];
......
......@@ -3,7 +3,7 @@
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Model/From/GUIExamplesFactory.h
//! @brief Defines class GUIExamplesFactory
//! @brief Defines class GUI::ExamplesFactory
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -22,7 +22,7 @@ class SampleModel;
class MaterialModel;
//! Class that generates GUI model from
namespace GUIExamplesFactory {
namespace GUI::ExamplesFactory {
bool isValidExampleName(const QString& name);
......@@ -35,6 +35,6 @@ namespace GUIExamplesFactory {
//! Returns human readable name and description
std::tuple<QString, QString> exampleInfo(const QString& name);
} // namespace GUIExamplesFactory
} // namespace GUI::ExamplesFactory
#endif // BORNAGAIN_GUI_MODEL_FROM_GUIEXAMPLESFACTORY_H
......@@ -146,7 +146,7 @@ QModelIndex SampleListModel::createSampleFromExamples(const QString& className,
beginInsertRows(QModelIndex(), row, row);
auto* sample = dynamic_cast<MultiLayerItem*>(
GUIExamplesFactory::createSampleItems(className, m_sampleModel, materialModel));
GUI::ExamplesFactory::createSampleItems(className, m_sampleModel, materialModel));
sample->setItemName(title);
sample->setDescription(description);
......
......@@ -96,9 +96,9 @@ SampleListView::SampleListView(QWidget* parent, SampleModel* sampleModel) : QLis
auto* menu = new QMenu(this);
m_chooseFromLibraryAction->setMenu(menu);
for (const auto& exampleName : GUIExamplesFactory::exampleNames()) {
for (const auto& exampleName : GUI::ExamplesFactory::exampleNames()) {
QString title, description;
std::tie(title, description) = GUIExamplesFactory::exampleInfo(exampleName);
std::tie(title, description) = GUI::ExamplesFactory::exampleInfo(exampleName);
auto icon = QIcon(":/SampleDesignerToolbox/images/sample_layers2.png");
auto* action = menu->addAction(icon, title);
action->setToolTip(description);
......
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