Improve searching lost measurements.

Very usual users have a situation where they move a pattern and measurements and place them in one folder. If path to measurements is not correct anymore but in the pattern folder we can find measurements file with the same name as expected in the broken path we will propose it by default. This change brings another case. Telegram automatically replace all spaces with underscores. Such names also must be checked and proposed.
This commit is contained in:
Roman Telezhynskyi 2020-07-31 17:07:47 +03:00
parent eb04357f51
commit 2814ff073a
2 changed files with 9 additions and 2 deletions

View File

@ -51,6 +51,7 @@
- [smart-pattern/valentina#45] Optimize tool box position for big screen resolutions. - [smart-pattern/valentina#45] Optimize tool box position for big screen resolutions.
- [smart-pattern/valentina#40] Invalid name of arc in modeling mode. - [smart-pattern/valentina#40] Invalid name of arc in modeling mode.
- New warning. Error calculating segment of curve. - New warning. Error calculating segment of curve.
- Improve searching lost measurements. Additional case with underscores instead of regular spaces.
# Version 0.6.2 (unreleased) # Version 0.6.2 (unreleased)
- [#903] Bug in tool Cut Spline path. - [#903] Bug in tool Cut Spline path.

View File

@ -5359,9 +5359,15 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
{ {
QString dirPath; QString dirPath;
const QDir patternDir = QFileInfo(patternPath).absoluteDir(); const QDir patternDir = QFileInfo(patternPath).absoluteDir();
if (patternDir.exists(table.fileName())) QString measurements = table.fileName();
if (patternDir.exists(measurements))
{ {
selectedName = table.fileName(); selectedName = measurements;
dirPath = patternDir.absolutePath();
}
else if (patternDir.exists(measurements.replace(' ', '_')))
{
selectedName = measurements.replace(' ', '_');
dirPath = patternDir.absolutePath(); dirPath = patternDir.absolutePath();
} }
else else