Changed default behaviour if path to multisize measurements or templates doesn't
exist. If the path doesn't exist Valentina will create and return path to user localized default folder. (grafted from 722c37544c26fe3f406d222b7f344ddf7b3602a0) --HG-- branch : develop
This commit is contained in:
parent
65c98f6a39
commit
7a9b2e34bd
|
@ -17,6 +17,7 @@
|
||||||
- [#697] Incomplete Internal Path for Waist Dart.
|
- [#697] Incomplete Internal Path for Waist Dart.
|
||||||
- [#698] Problem typing in new axis point for new piece.
|
- [#698] Problem typing in new axis point for new piece.
|
||||||
- [#702] Valentina produces broken shortcut (.lnk) files on Windows.
|
- [#702] Valentina produces broken shortcut (.lnk) files on Windows.
|
||||||
|
- Changed default behaviour if path to multisize measurements or templates doesn't exist.
|
||||||
|
|
||||||
# Version 0.5.0 May 9, 2017
|
# Version 0.5.0 May 9, 2017
|
||||||
- [#581] User can now filter input lists by keyword in function wizard.
|
- [#581] User can now filter input lists by keyword in function wizard.
|
||||||
|
|
|
@ -104,7 +104,7 @@ void TapePreferencesPathPage::EditPath()
|
||||||
break;
|
break;
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
path = qApp->TapeSettings()->GetPathStandardMeasurements();
|
path = qApp->TapeSettings()->GetPathStandardMeasurements();
|
||||||
VCommonSettings::PrepareStandardTables(path);
|
path = VCommonSettings::PrepareStandardTables(path);
|
||||||
break;
|
break;
|
||||||
case 2: // templates
|
case 2: // templates
|
||||||
path = qApp->TapeSettings()->GetPathTemplate();
|
path = qApp->TapeSettings()->GetPathTemplate();
|
||||||
|
|
|
@ -417,8 +417,8 @@ void TMainWindow::OpenStandard()
|
||||||
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst);;") + tr("Individual measurements") +
|
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst);;") + tr("Individual measurements") +
|
||||||
QLatin1String(" (*.vit);;") + tr("All files") + QLatin1String(" (*.*)");
|
QLatin1String(" (*.vit);;") + tr("All files") + QLatin1String(" (*.*)");
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathStandardMeasurements();
|
QString pathTo = qApp->TapeSettings()->GetPathStandardMeasurements();
|
||||||
VCommonSettings::PrepareStandardTables(pathTo);
|
pathTo = VCommonSettings::PrepareStandardTables(pathTo);
|
||||||
|
|
||||||
Open(pathTo, filter);
|
Open(pathTo, filter);
|
||||||
}
|
}
|
||||||
|
@ -429,8 +429,8 @@ void TMainWindow::OpenTemplate()
|
||||||
const QString filter = tr("Measurements") + QLatin1String(" (*.vst *.vit);;") + tr("All files") +
|
const QString filter = tr("Measurements") + QLatin1String(" (*.vst *.vit);;") + tr("All files") +
|
||||||
QLatin1String(" (*.*)");
|
QLatin1String(" (*.*)");
|
||||||
//Use standard path to template files
|
//Use standard path to template files
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
||||||
VCommonSettings::PrepareStandardTemplates(pathTo);
|
pathTo = VCommonSettings::PrepareStandardTemplates(pathTo);
|
||||||
Open(pathTo, filter);
|
Open(pathTo, filter);
|
||||||
|
|
||||||
if (m != nullptr)
|
if (m != nullptr)
|
||||||
|
@ -826,7 +826,7 @@ bool TMainWindow::FileSaveAs()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dir = qApp->TapeSettings()->GetPathStandardMeasurements();
|
dir = qApp->TapeSettings()->GetPathStandardMeasurements();
|
||||||
VCommonSettings::PrepareStandardTables(dir);
|
dir = VCommonSettings::PrepareStandardTables(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1342,8 +1342,8 @@ void TMainWindow::ImportFromPattern()
|
||||||
|
|
||||||
const QString filter(tr("Pattern files (*.val)"));
|
const QString filter(tr("Pattern files (*.val)"));
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
||||||
VCommonSettings::PrepareStandardTemplates(pathTo);
|
pathTo = VCommonSettings::PrepareStandardTemplates(pathTo);
|
||||||
|
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter);
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter);
|
||||||
if (mPath.isEmpty())
|
if (mPath.isEmpty())
|
||||||
|
|
|
@ -114,7 +114,7 @@ void PreferencesPathPage::EditPath()
|
||||||
break;
|
break;
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||||
VCommonSettings::PrepareStandardTables(path);
|
path = VCommonSettings::PrepareStandardTables(path);
|
||||||
break;
|
break;
|
||||||
case 2: // pattern path
|
case 2: // pattern path
|
||||||
path = qApp->ValentinaSettings()->GetPathPattern();
|
path = qApp->ValentinaSettings()->GetPathPattern();
|
||||||
|
|
|
@ -1521,8 +1521,8 @@ void MainWindow::LoadStandard()
|
||||||
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst);;") + tr("Individual measurements") +
|
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst);;") + tr("Individual measurements") +
|
||||||
QLatin1String("(*.vit)");
|
QLatin1String("(*.vit)");
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||||
VCommonSettings::PrepareStandardTables(path);
|
path = VCommonSettings::PrepareStandardTables(path);
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
|
@ -4472,8 +4472,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
|
||||||
{
|
{
|
||||||
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst)");
|
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst)");
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||||
VCommonSettings::PrepareStandardTables(path);
|
path = VCommonSettings::PrepareStandardTables(path);
|
||||||
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
}
|
}
|
||||||
else if (patternType == MeasurementsType::Individual)
|
else if (patternType == MeasurementsType::Individual)
|
||||||
|
@ -4502,8 +4502,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
|
||||||
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") +
|
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") +
|
||||||
tr("Multisize measurements") + QLatin1String(" (*.vst)");
|
tr("Multisize measurements") + QLatin1String(" (*.vst)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||||
VCommonSettings::PrepareStandardTables(VCommonSettings::GetDefPathStandardMeasurements());
|
path = VCommonSettings::PrepareStandardTables(VCommonSettings::GetDefPathStandardMeasurements());
|
||||||
|
|
||||||
bool usedNotExistedDir = false;
|
bool usedNotExistedDir = false;
|
||||||
QDir directory(path);
|
QDir directory(path);
|
||||||
|
|
|
@ -153,6 +153,23 @@ void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool
|
||||||
SymlinkCopyDirRecursive(from, to, replaceOnConflit);
|
SymlinkCopyDirRecursive(from, to, replaceOnConflit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString PrepareStandardFiles(const QString ¤tPath, const QString &standardPath, const QString &defPath)
|
||||||
|
{
|
||||||
|
QDir standardPathDir(standardPath);
|
||||||
|
QDir currentPathDir(currentPath);
|
||||||
|
if ((currentPath == defPath || not currentPathDir.exists()) && standardPathDir.exists())
|
||||||
|
{
|
||||||
|
const QDir localdata (defPath);
|
||||||
|
if (localdata.mkpath("."))
|
||||||
|
{
|
||||||
|
SymlinkCopyDirRecursive(standardPath, defPath, false);
|
||||||
|
}
|
||||||
|
return defPath;
|
||||||
|
}
|
||||||
|
return currentPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -218,33 +235,15 @@ QString VCommonSettings::StandardTemplatesPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VCommonSettings::PrepareStandardTemplates(const QString & currentPath)
|
QString VCommonSettings::PrepareStandardTemplates(const QString & currentPath)
|
||||||
{
|
{
|
||||||
QDir standardPath(VCommonSettings::StandardTemplatesPath());
|
return PrepareStandardFiles(currentPath, StandardTemplatesPath(), GetDefPathTemplate());
|
||||||
const QDir localdata (VCommonSettings::GetDefPathTemplate());
|
|
||||||
if (currentPath == VCommonSettings::GetDefPathTemplate() && standardPath.exists())
|
|
||||||
{
|
|
||||||
if (localdata.mkpath("."))
|
|
||||||
{
|
|
||||||
SymlinkCopyDirRecursive(VCommonSettings::StandardTemplatesPath(), VCommonSettings::GetDefPathTemplate(),
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VCommonSettings::PrepareStandardTables(const QString ¤tPath)
|
QString VCommonSettings::PrepareStandardTables(const QString ¤tPath)
|
||||||
{
|
{
|
||||||
QDir standardPath(VCommonSettings::StandardTablesPath());
|
return PrepareStandardFiles(currentPath, StandardTablesPath(), GetDefPathStandardMeasurements());
|
||||||
const QDir localdata (VCommonSettings::GetDefPathStandardMeasurements());
|
|
||||||
if (currentPath == VCommonSettings::GetDefPathStandardMeasurements() && standardPath.exists())
|
|
||||||
{
|
|
||||||
if (localdata.mkpath("."))
|
|
||||||
{
|
|
||||||
SymlinkCopyDirRecursive(VCommonSettings::StandardTablesPath(),
|
|
||||||
VCommonSettings::GetDefPathStandardMeasurements(), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -51,8 +51,8 @@ public:
|
||||||
static QString StandardTablesPath();
|
static QString StandardTablesPath();
|
||||||
static QString StandardTemplatesPath();
|
static QString StandardTemplatesPath();
|
||||||
|
|
||||||
static void PrepareStandardTemplates(const QString ¤tPath);
|
static QString PrepareStandardTemplates(const QString ¤tPath);
|
||||||
static void PrepareStandardTables(const QString ¤tPath);
|
static QString PrepareStandardTables(const QString ¤tPath);
|
||||||
|
|
||||||
static QString GetDefPathIndividualMeasurements();
|
static QString GetDefPathIndividualMeasurements();
|
||||||
QString GetPathIndividualMeasurements() const;
|
QString GetPathIndividualMeasurements() const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user