Improve error messages while import CSV data.
Show correct row number.
This commit is contained in:
parent
db2b6b865b
commit
376152da8c
|
@ -10,6 +10,7 @@
|
|||
- Export area of piece in Final measurements.
|
||||
- New option Show accuracy radius.
|
||||
- New option Interactive tools.
|
||||
- Improve error messages while import CSV data.
|
||||
|
||||
# Valentina 0.7.52 September 12, 2022
|
||||
- Fix crash when default locale is ru.
|
||||
|
|
|
@ -1112,11 +1112,11 @@ void TMainWindow::ImportDataFromCSV()
|
|||
|
||||
if (m_m->Type() == MeasurementsType::Individual)
|
||||
{
|
||||
ImportIndividualMeasurements(csv, map);
|
||||
ImportIndividualMeasurements(csv, map, dialog.IsWithHeader());
|
||||
}
|
||||
else
|
||||
{
|
||||
ImportMultisizeMeasurements(csv, map);
|
||||
ImportMultisizeMeasurements(csv, map, dialog.IsWithHeader());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3930,7 +3930,7 @@ void TMainWindow::RefreshDataAfterImport()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVector<int> &map)
|
||||
void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader)
|
||||
{
|
||||
const int columns = csv.columnCount();
|
||||
const int rows = csv.rowCount();
|
||||
|
@ -3999,7 +3999,12 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVe
|
|||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
ShowError(tr("Error in row %1.").arg(i) + QLatin1Char(' ') + e.ErrorMessage());
|
||||
int rowIndex = i+1;
|
||||
if (withHeader)
|
||||
{
|
||||
++rowIndex;
|
||||
}
|
||||
ShowError(tr("Error in row %1. %2").arg(rowIndex).arg(e.ErrorMessage()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4023,7 +4028,7 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVe
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVector<int> &map)
|
||||
void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader)
|
||||
{
|
||||
const int columns = csv.columnCount();
|
||||
|
||||
|
@ -4047,7 +4052,12 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
|
|||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
ShowError(tr("Error in row %1.").arg(i) + QLatin1Char(' ') + e.ErrorMessage());
|
||||
int rowIndex = i+1;
|
||||
if (withHeader)
|
||||
{
|
||||
++rowIndex;
|
||||
}
|
||||
ShowError(tr("Error in row %1. %2").arg(rowIndex).arg(e.ErrorMessage()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,8 +263,8 @@ private:
|
|||
void ShowError(const QString &text);
|
||||
void RefreshDataAfterImport();
|
||||
|
||||
void ImportIndividualMeasurements(const QxtCsvModel &csv, const QVector<int> &map);
|
||||
void ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVector<int> &map);
|
||||
void ImportIndividualMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader);
|
||||
void ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader);
|
||||
auto ImportMultisizeMeasurement(const QxtCsvModel &csv, int i, const QVector<int> &map,
|
||||
int dimensionsCount, QSet<QString> &importedNames) -> MultisizeMeasurement;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user