diff --git a/App/main.cpp b/App/main.cpp index da08f2e2c09cefb089ed027c9828ab5d6e458471..a4acd80dced7ecb27a1ca11de6b10de8c2dd346c 100644 --- a/App/main.cpp +++ b/App/main.cpp @@ -17,7 +17,7 @@ #include "GUI/Application/GlobalSettings.h" #include "GUI/Model/State/SessionData.h" #include "GUI/Util/Path.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include "GUI/View/Loaders/DataLoaderUtil.h" #include "GUI/View/Main/MainWindow.h" #include "config_build.h" diff --git a/GUI/Util/hostosinfo.h b/GUI/Model/IO/hostosinfo.h similarity index 94% rename from GUI/Util/hostosinfo.h rename to GUI/Model/IO/hostosinfo.h index 52a09d7ed0eb6c1dcfcea300743dec6465d26c83..5aa6857e0762615d364a8aae3b0148bea3538b2d 100644 --- a/GUI/Util/hostosinfo.h +++ b/GUI/Model/IO/hostosinfo.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Util/hostosinfo.h +//! @file GUI/Model/IO/hostosinfo.h //! @brief Defines namespace GUI::Util::OS //! //! @homepage http://www.bornagainproject.org @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_UTILS_HOSTOSINFO_H -#define BORNAGAIN_GUI_UTILS_HOSTOSINFO_H +#ifndef BORNAGAIN_GUI_MODEL_IO_HOSTOSINFO_H +#define BORNAGAIN_GUI_MODEL_IO_HOSTOSINFO_H #include <QString> @@ -113,4 +113,4 @@ bool HostOsInfo::isAnyUnixHost() } // namespace GUI::Util::OS -#endif // BORNAGAIN_GUI_UTILS_HOSTOSINFO_H +#endif // BORNAGAIN_GUI_MODEL_IO_HOSTOSINFO_H diff --git a/GUI/Model/Types/DoubleDescriptor.h b/GUI/Model/Types/DoubleDescriptor.h index b8a22600363227e6d4c582c314e5a410a3055df8..f28f4499d642775116c24dcc97b9c05c5b10a5c8 100644 --- a/GUI/Model/Types/DoubleDescriptor.h +++ b/GUI/Model/Types/DoubleDescriptor.h @@ -16,7 +16,7 @@ #define BORNAGAIN_GUI_MODELS_TYPES_DOUBLEDESCRIPTOR_H #include "Fit/Param/RealLimits.h" -#include "GUI/Util/Unit.h" +#include "GUI/Model/Types/Unit.h" #include <QString> #include <functional> #include <variant> diff --git a/GUI/Model/Types/UIntDescriptor.h b/GUI/Model/Types/UIntDescriptor.h index d6dad12d97bf6c495dd0fb2219f1b9e927b99361..6ff3a5d6a567156aaf4e7660f44865c453d1c309 100644 --- a/GUI/Model/Types/UIntDescriptor.h +++ b/GUI/Model/Types/UIntDescriptor.h @@ -16,7 +16,7 @@ #define BORNAGAIN_GUI_MODELS_TYPES_UINTDESCRIPTOR_H #include "Fit/Param/RealLimits.h" -#include "GUI/Util/Unit.h" +#include "GUI/Model/Types/Unit.h" #include <QString> #include <functional> #include <variant> diff --git a/GUI/Util/Unit.cpp b/GUI/Model/Types/Unit.cpp similarity index 97% rename from GUI/Util/Unit.cpp rename to GUI/Model/Types/Unit.cpp index 46a037f6819692a4165ad3f77387f0b4e6f195f6..c362830360eb6581b42d718fa40fde3fbbca48c6 100644 --- a/GUI/Util/Unit.cpp +++ b/GUI/Model/Types/Unit.cpp @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Util/Unit.cpp +//! @file GUI/Model/Types/Unit.cpp //! @brief Implements class Unit //! //! @homepage http://www.bornagainproject.org @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "GUI/Util/Unit.h" +#include "GUI/Model/Types/Unit.h" #include "Base/Const/Units.h" #include "Base/Utils/Assert.h" #include <QString> diff --git a/GUI/Util/Unit.h b/GUI/Model/Types/Unit.h similarity index 89% rename from GUI/Util/Unit.h rename to GUI/Model/Types/Unit.h index fb37a6edef797069bdf27f5cac1a716f4b16bfa8..98f30ec0c713dc36d61d91078aa34777bae2fcc1 100644 --- a/GUI/Util/Unit.h +++ b/GUI/Model/Types/Unit.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Util/Unit.h +//! @file GUI/Model/Types/Unit.h //! @brief Defines class Unit //! //! @homepage http://www.bornagainproject.org @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_UTILS_UNIT_H -#define BORNAGAIN_GUI_UTILS_UNIT_H +#ifndef BORNAGAIN_GUI_MODEL_TYPES_UNIT_H +#define BORNAGAIN_GUI_MODEL_TYPES_UNIT_H class QString; @@ -43,4 +43,4 @@ double convert(double d, Unit from, Unit to); //! Returns the string for the given unit QString unitAsString(const Unit& unit); -#endif // BORNAGAIN_GUI_UTILS_UNIT_H +#endif // BORNAGAIN_GUI_MODEL_TYPES_UNIT_H diff --git a/GUI/Util/ItemIDFactory.cpp b/GUI/Util/ItemIDFactory.cpp deleted file mode 100644 index 48e54cd34df67608ef232c20c2b97c4e5405e9d8..0000000000000000000000000000000000000000 --- a/GUI/Util/ItemIDFactory.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/Util/ItemIDFactory.cpp -//! @brief Implements class ItemIDFactory -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#include "GUI/Util/ItemIDFactory.h" - -ItemIDFactory& ItemIDFactory::instance() -{ - static ItemIDFactory instance; - return instance; -} - -QString ItemIDFactory::createID(SessionItem* toBeInsertedItem) -{ - - QUuid id = QUuid::createUuid(); - QString id_String = id.toString(); - - // prevent duplicates (very improbable that this ever happens though) - while (instance().IDtoItemMap.contains(id_String)) { - id = QUuid::createUuid(); - id_String = id.toString(); - } - instance().ItemtoIDMap.insert(toBeInsertedItem, id_String); - instance().IDtoItemMap.insert(id_String, toBeInsertedItem); - - return id_String; -} - -QString ItemIDFactory::getID(SessionItem* existingItem) -{ - if (instance().ItemtoIDMap.contains(existingItem)) - return instance().ItemtoIDMap.value(existingItem); - return ""; -} - -SessionItem* ItemIDFactory::getItem(QString existingID) -{ - if (instance().IDtoItemMap.contains(existingID)) - return instance().IDtoItemMap.value(existingID); - return nullptr; -} - -int ItemIDFactory::IDSize() -{ - static QUuid id = QUuid::createUuid(); - return id.toString().size(); -} diff --git a/GUI/Util/ItemIDFactory.h b/GUI/Util/ItemIDFactory.h deleted file mode 100644 index a800b6d9647a58600cbb9866c3ea46b353c6c5be..0000000000000000000000000000000000000000 --- a/GUI/Util/ItemIDFactory.h +++ /dev/null @@ -1,48 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/Util/ItemIDFactory.h -//! @brief Defines class ItemIDFactory -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#ifndef BORNAGAIN_GUI_UTILS_ITEMIDFACTORY_H -#define BORNAGAIN_GUI_UTILS_ITEMIDFACTORY_H - -#include <QMap> -#include <QUuid> - -class SessionItem; - -class ItemIDFactory { -public: - // delete copy/move constructor/assignment: - ItemIDFactory(const ItemIDFactory&) = delete; - ItemIDFactory(ItemIDFactory&&) = delete; - ItemIDFactory& operator=(const ItemIDFactory&) = delete; - ItemIDFactory& operator=(ItemIDFactory&&) = delete; - - static ItemIDFactory& instance(); - - static QString createID(SessionItem* toBeInsertedItem); - - static QString getID(SessionItem* existingItem); - - static SessionItem* getItem(QString existingID); - - static int IDSize(); - -private: - ItemIDFactory() = default; - - QMap<QString, SessionItem*> IDtoItemMap; - QMap<SessionItem*, QString> ItemtoIDMap; -}; - -#endif // BORNAGAIN_GUI_UTILS_ITEMIDFACTORY_H diff --git a/GUI/Util/Path.cpp b/GUI/Util/Path.cpp index 5047f48a814f86f64d13bead756990ea93057a84..b63cd4e9502b5d1c5cab4ae00e06e7cdd22ba957 100644 --- a/GUI/Util/Path.cpp +++ b/GUI/Util/Path.cpp @@ -14,7 +14,7 @@ #include "GUI/Util/Path.h" #include "BAVersion.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include <QDateTime> #include <QDir> #include <QFileInfo> diff --git a/GUI/Util/String.cpp b/GUI/Util/String.cpp index 1d76bea7ddd64e6b732f32382941800145b39308..27726a74c25b4f9472b1c08f74a2b946a7452df2 100644 --- a/GUI/Util/String.cpp +++ b/GUI/Util/String.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "GUI/Util/String.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include <QDir> QStringList GUI::Util::String::fromStdStrings(const std::vector<std::string>& container) diff --git a/GUI/View/Main/ActionManager.cpp b/GUI/View/Main/ActionManager.cpp index 62d00b0e315d3e655a23626ade66e1820c281c20..2e433fc3ffe979f1740efe73b11f5a0f6c10b970 100644 --- a/GUI/View/Main/ActionManager.cpp +++ b/GUI/View/Main/ActionManager.cpp @@ -18,7 +18,7 @@ #include "GUI/Application/GlobalSettings.h" #include "GUI/Model/State/SessionData.h" #include "GUI/Util/Path.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include "GUI/Util/mainwindow_constants.h" #include "GUI/View/JobWidgets/JobView.h" #include "GUI/View/Main/AboutDialog.h" diff --git a/GUI/View/Main/MainWindow.cpp b/GUI/View/Main/MainWindow.cpp index 1295af14885f01a6c9758edbfc9f653510fa04d8..4576223f849ad2b4eb9a3e9fb3928184effaa8b6 100644 --- a/GUI/View/Main/MainWindow.cpp +++ b/GUI/View/Main/MainWindow.cpp @@ -17,7 +17,7 @@ #include "GUI/Model/Job/JobModel.h" #include "GUI/Model/State/SessionData.h" #include "GUI/Util/Path.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include "GUI/Util/mainwindow_constants.h" #include "GUI/View/InstrumentWidgets/InstrumentView.h" #include "GUI/View/JobWidgets/JobView.h" diff --git a/GUI/View/PropertyEditor/GroupInfoBox.cpp b/GUI/View/PropertyEditor/GroupInfoBox.cpp index 6763e2dd4bdd712a3d1ff70b03f46c81b3798fdc..4cd47020e3e3a62bd9932ae6f2b6478c28d3b8fb 100644 --- a/GUI/View/PropertyEditor/GroupInfoBox.cpp +++ b/GUI/View/PropertyEditor/GroupInfoBox.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "GUI/View/PropertyEditor/GroupInfoBox.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include <QApplication> #include <QMouseEvent> #include <QPainter> diff --git a/GUI/Widget/Common/StyleUtils.cpp b/GUI/Widget/Common/StyleUtils.cpp index 8ee5b649a8c5546fffa81e64e96874c86be69b59..fc52e0450ea289798dd49b9763fda740aeecab95 100644 --- a/GUI/Widget/Common/StyleUtils.cpp +++ b/GUI/Widget/Common/StyleUtils.cpp @@ -14,7 +14,7 @@ #include "GUI/Widget/Common/StyleUtils.h" #include "Base/Utils/Assert.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include "GUI/Widget/Common/DesignerHelper.h" #include "GUI/Widget/Common/detailswidget.h" #include <QApplication> diff --git a/GUI/Widget/Common/detailsbutton.cpp b/GUI/Widget/Common/detailsbutton.cpp index 35049de301e666e363988bce23e2fc7f362ec4e5..1a00cc74184a1eeac38531a05a0ff40b1204d7dc 100644 --- a/GUI/Widget/Common/detailsbutton.cpp +++ b/GUI/Widget/Common/detailsbutton.cpp @@ -24,7 +24,7 @@ ****************************************************************************/ #include "GUI/Widget/Common/detailsbutton.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include <QGraphicsOpacityEffect> #include <QPaintEvent> diff --git a/GUI/Widget/Common/detailswidget.cpp b/GUI/Widget/Common/detailswidget.cpp index 1460c594d8e784078b8e1d21fa4bb30726377aeb..3b74ef6cfa0fc0be1dc2d1356c6334c3b11aaa8c 100644 --- a/GUI/Widget/Common/detailswidget.cpp +++ b/GUI/Widget/Common/detailswidget.cpp @@ -24,7 +24,7 @@ ****************************************************************************/ #include "GUI/Widget/Common/detailswidget.h" -#include "GUI/Util/hostosinfo.h" +#include "GUI/Model/IO/hostosinfo.h" #include "GUI/Widget/Common/detailsbutton.h" #include <QApplication>