Commit b773501f authored by Matthias Puchner's avatar Matthias Puchner
Browse files

changes for MR: docu for ErrorDefinition, use "sigma_R", const QString&

parent 57454346
Pipeline #33445 passed with stage
in 25 minutes and 36 seconds
...@@ -82,7 +82,7 @@ QREDataLoader::QREDataLoader() : m_propertiesWidget(nullptr) ...@@ -82,7 +82,7 @@ QREDataLoader::QREDataLoader() : m_propertiesWidget(nullptr)
QString QREDataLoader::name() const QString QREDataLoader::name() const
{ {
return "CSV file (Reflectometry - Q/R/E)"; return "CSV file (Reflectometry - Q/R/sigma_R)";
} }
QString QREDataLoader::persistentClassName() const QString QREDataLoader::persistentClassName() const
......
...@@ -75,6 +75,8 @@ private: ...@@ -75,6 +75,8 @@ private:
void deserialize(const QByteArray& data); void deserialize(const QByteArray& data);
} m_importSettings; } m_importSettings;
//! Contains a line related error (stored in the import result). Used for showing
//! line related errors in the import data table.
struct ErrorDefinition { struct ErrorDefinition {
// Attention: numbers are serialized! Do not change them! // Attention: numbers are serialized! Do not change them!
enum Type { enum Type {
...@@ -88,10 +90,13 @@ private: ...@@ -88,10 +90,13 @@ private:
ErrorDefinition(Type t = none, int d = 0); ErrorDefinition(Type t = none, int d = 0);
ErrorDefinition(Type t, double d); ErrorDefinition(Type t, double d);
//! Human readable error text
QString toString() const; QString toString() const;
Type type; Type type;
std::variant<int, double> data; std::variant<int, double> data; //!< Additional data; meaning depends on the error type (see
//!< implementation of toString() for more information)
}; };
//! Result of the file import. Some of the contained data is only relevant for showing the //! Result of the file import. Some of the contained data is only relevant for showing the
......
...@@ -318,7 +318,7 @@ ...@@ -318,7 +318,7 @@
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Read error</string> <string>Read sigma_R</string>
</property> </property>
</widget> </widget>
</item> </item>
......
...@@ -45,7 +45,7 @@ QString QREDataLoaderResultModel::headerTextOfCalculatedColumn(int column) const ...@@ -45,7 +45,7 @@ QString QREDataLoaderResultModel::headerTextOfCalculatedColumn(int column) const
case 1: case 1:
return "R"; return "R";
case 2: case 2:
return "E"; return "sigma_R";
} }
return QString(); return QString();
} }
......
...@@ -67,7 +67,8 @@ std::unique_ptr<OutputData<double>> ImportDataUtils::ImportKnownData(const QStri ...@@ -67,7 +67,8 @@ std::unique_ptr<OutputData<double>> ImportDataUtils::ImportKnownData(const QStri
return result; return result;
} }
std::unique_ptr<OutputData<double>> ImportDataUtils::ImportReflectometryData(QString& fileName) std::unique_ptr<OutputData<double>>
ImportDataUtils::ImportReflectometryData(const QString& fileName)
{ {
std::unique_ptr<OutputData<double>> result; std::unique_ptr<OutputData<double>> result;
try { try {
...@@ -83,7 +84,7 @@ std::unique_ptr<OutputData<double>> ImportDataUtils::ImportReflectometryData(QSt ...@@ -83,7 +84,7 @@ std::unique_ptr<OutputData<double>> ImportDataUtils::ImportReflectometryData(QSt
return result; return result;
} }
std::unique_ptr<OutputData<double>> ImportDataUtils::Import2dData(QString& fileName) std::unique_ptr<OutputData<double>> ImportDataUtils::Import2dData(const QString& fileName)
{ {
return ImportKnownData(fileName); return ImportKnownData(fileName);
} }
......
...@@ -29,7 +29,7 @@ class AbstractDataLoader; ...@@ -29,7 +29,7 @@ class AbstractDataLoader;
//! Provides utility methods to import data files. //! Provides utility methods to import data files.
namespace ImportDataUtils { namespace ImportDataUtils {
std::unique_ptr<OutputData<double>> Import2dData(QString& baseNameOfLoadedFile); std::unique_ptr<OutputData<double>> Import2dData(const QString& baseNameOfLoadedFile);
//! Import 1D data into the given item. //! Import 1D data into the given item.
//! Returns an error text if a fatal error occurred (discard item). "Empty string" means "no fatal //! Returns an error text if a fatal error occurred (discard item). "Empty string" means "no fatal
...@@ -39,7 +39,7 @@ std::unique_ptr<OutputData<double>> Import2dData(QString& baseNameOfLoadedFile); ...@@ -39,7 +39,7 @@ std::unique_ptr<OutputData<double>> Import2dData(QString& baseNameOfLoadedFile);
QString Import1dData(RealDataItem* realDataItem, const AbstractDataLoader* selectedLoader); QString Import1dData(RealDataItem* realDataItem, const AbstractDataLoader* selectedLoader);
std::unique_ptr<OutputData<double>> ImportKnownData(const QString& baseNameOfLoadedFile); std::unique_ptr<OutputData<double>> ImportKnownData(const QString& baseNameOfLoadedFile);
std::unique_ptr<OutputData<double>> ImportReflectometryData(QString& baseNameOfLoadedFile); std::unique_ptr<OutputData<double>> ImportReflectometryData(const QString& baseNameOfLoadedFile);
//! Creates OutputData with bin-valued axes. //! Creates OutputData with bin-valued axes.
std::unique_ptr<OutputData<double>> CreateSimplifiedOutputData(const OutputData<double>& data); std::unique_ptr<OutputData<double>> CreateSimplifiedOutputData(const OutputData<double>& data);
......
...@@ -240,7 +240,7 @@ void RealDataSelectorWidget::importData(int ndim) ...@@ -240,7 +240,7 @@ void RealDataSelectorWidget::importData(int ndim)
else else
AppSvc::projectManager()->setRecentlyUsedImportFilter2D(selectedFilter); AppSvc::projectManager()->setRecentlyUsedImportFilter2D(selectedFilter);
for (auto fileName : fileNames) { for (const auto& fileName : fileNames) {
QFileInfo info(fileName); QFileInfo info(fileName);
auto baseNameOfLoadedFile = info.baseName(); auto baseNameOfLoadedFile = info.baseName();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment