Merge with develop.
--HG-- branch : feature
This commit is contained in:
commit
5a0d9b0e00
|
@ -78,23 +78,24 @@ void TapePathPage::DefaultPath()
|
||||||
QTableWidgetItem *item = pathTable->item(row, 1);
|
QTableWidgetItem *item = pathTable->item(row, 1);
|
||||||
SCASSERT(item != nullptr)
|
SCASSERT(item != nullptr)
|
||||||
|
|
||||||
|
QString path;
|
||||||
switch (row)
|
switch (row)
|
||||||
{
|
{
|
||||||
case 0: // individual measurements
|
case 0: // individual measurements
|
||||||
item->setText(QDir::homePath());
|
path = VCommonSettings::GetDefPathIndividualMeasurements();
|
||||||
item->setToolTip(QDir::homePath());
|
|
||||||
break;
|
break;
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
item->setText(qApp->TapeSettings()->StandardTablesPath());
|
path = VCommonSettings::GetDefPathStandardMeasurements();
|
||||||
item->setToolTip(qApp->TapeSettings()->StandardTablesPath());
|
|
||||||
break;
|
break;
|
||||||
case 2: // templates
|
case 2: // templates
|
||||||
item->setText(qApp->TapeSettings()->TemplatesPath());
|
path = VCommonSettings::GetDefPathTemplate();
|
||||||
item->setToolTip(qApp->TapeSettings()->TemplatesPath());
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item->setText(path);
|
||||||
|
item->setToolTip(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -112,6 +113,7 @@ void TapePathPage::EditPath()
|
||||||
break;
|
break;
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
path = qApp->TapeSettings()->GetPathStandardMeasurements();
|
path = qApp->TapeSettings()->GetPathStandardMeasurements();
|
||||||
|
VCommonSettings::PrepareStandardTables(path);
|
||||||
break;
|
break;
|
||||||
case 2: // templates
|
case 2: // templates
|
||||||
path = qApp->TapeSettings()->GetPathTemplate();
|
path = qApp->TapeSettings()->GetPathTemplate();
|
||||||
|
@ -119,10 +121,24 @@ void TapePathPage::EditPath()
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(path);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
{
|
{
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(path);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
DefaultPath();
|
DefaultPath();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -188,21 +204,21 @@ void TapePathPage::InitTable()
|
||||||
const VTapeSettings *settings = qApp->TapeSettings();
|
const VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
||||||
item->setToolTip(settings->GetPathIndividualMeasurements());
|
item->setToolTip(settings->GetPathIndividualMeasurements());
|
||||||
pathTable->setItem(0, 1, item);
|
pathTable->setItem(0, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
pathTable->setItem(1, 0, new QTableWidgetItem(tr("My Multisize Measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
||||||
item->setToolTip(settings->GetPathStandardMeasurements());
|
item->setToolTip(settings->GetPathStandardMeasurements());
|
||||||
pathTable->setItem(1, 1, item);
|
pathTable->setItem(1, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Templates")));
|
pathTable->setItem(2, 0, new QTableWidgetItem(tr("My Templates")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
||||||
item->setToolTip(settings->GetPathTemplate());
|
item->setToolTip(settings->GetPathTemplate());
|
||||||
pathTable->setItem(2, 1, item);
|
pathTable->setItem(2, 1, item);
|
||||||
|
@ -233,7 +249,7 @@ void TapePathPage::RetranslateUi()
|
||||||
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
||||||
pathTable->setHorizontalHeaderLabels(tableHeader);
|
pathTable->setHorizontalHeaderLabels(tableHeader);
|
||||||
|
|
||||||
pathTable->item(0, 0)->setText(tr("Individual measurements"));
|
pathTable->item(0, 0)->setText(tr("My Individual Measurements"));
|
||||||
pathTable->item(1, 0)->setText(tr("Standard measurements"));
|
pathTable->item(1, 0)->setText(tr("My Multisize measurements"));
|
||||||
pathTable->item(2, 0)->setText(tr("Templates"));
|
pathTable->item(2, 0)->setText(tr("My Templates"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,21 +383,35 @@ void TMainWindow::FileNew()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::OpenIndividual()
|
void TMainWindow::OpenIndividual()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") + tr("Standard measurements") +
|
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") + tr("Multisize measurements") +
|
||||||
QLatin1String(" (*.vst);;") + tr("All files") + QLatin1String(" (*.*)");
|
QLatin1String(" (*.vst);;") + tr("All files") + QLatin1String(" (*.*)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(pathTo);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
Open(pathTo, filter);
|
Open(pathTo, filter);
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(pathTo);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::OpenStandard()
|
void TMainWindow::OpenStandard()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Standard 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();
|
const QString pathTo = qApp->TapeSettings()->GetPathStandardMeasurements();
|
||||||
|
VCommonSettings::PrepareStandardTables(pathTo);
|
||||||
|
|
||||||
Open(pathTo, filter);
|
Open(pathTo, filter);
|
||||||
}
|
}
|
||||||
|
@ -409,7 +423,7 @@ void TMainWindow::OpenTemplate()
|
||||||
QLatin1String(" (*.*)");
|
QLatin1String(" (*.*)");
|
||||||
//Use standard path to template files
|
//Use standard path to template files
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
const QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
||||||
|
VCommonSettings::PrepareStandardTemplates(pathTo);
|
||||||
Open(pathTo, filter);
|
Open(pathTo, filter);
|
||||||
|
|
||||||
if (m != nullptr)
|
if (m != nullptr)
|
||||||
|
@ -425,6 +439,14 @@ void TMainWindow::CreateFromExisting()
|
||||||
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit)");
|
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit)");
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(pathTo);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter);
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter);
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
|
@ -438,6 +460,12 @@ void TMainWindow::CreateFromExisting()
|
||||||
qApp->NewMainWindow()->CreateFromExisting();
|
qApp->NewMainWindow()->CreateFromExisting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(pathTo);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -482,7 +510,7 @@ void TMainWindow::changeEvent(QEvent *event)
|
||||||
|
|
||||||
if (mType == MeasurementsType::Standard)
|
if (mType == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
ui->labelMType->setText(tr("Standard measurements"));
|
ui->labelMType->setText(tr("Multisize measurements"));
|
||||||
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + QLatin1String(" ") +
|
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + QLatin1String(" ") +
|
||||||
VDomDocument::UnitsToStr(m->MUnit(), true));
|
VDomDocument::UnitsToStr(m->MUnit(), true));
|
||||||
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + QLatin1String(" ") +
|
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + QLatin1String(" ") +
|
||||||
|
@ -691,7 +719,7 @@ bool TMainWindow::FileSaveAs()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filters = tr("Standard measurements") + QLatin1String(" (*.vst)");
|
filters = tr("Multisize measurements") + QLatin1String(" (*.vst)");
|
||||||
suffix = QLatin1String("vst");
|
suffix = QLatin1String("vst");
|
||||||
fName += QLatin1String(".") + suffix;
|
fName += QLatin1String(".") + suffix;
|
||||||
}
|
}
|
||||||
|
@ -701,23 +729,40 @@ bool TMainWindow::FileSaveAs()
|
||||||
{
|
{
|
||||||
if (mType == MeasurementsType::Individual)
|
if (mType == MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
dir = qApp->TapeSettings()->GetPathIndividualMeasurements() + QLatin1String("/") + fName;
|
dir = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dir = qApp->TapeSettings()->GetPathStandardMeasurements() + QLatin1String("/") + fName;
|
dir = qApp->TapeSettings()->GetPathStandardMeasurements();
|
||||||
|
VCommonSettings::PrepareStandardTables(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dir = QFileInfo(curFile).absolutePath() + QLatin1String("/") + fName;
|
dir = QFileInfo(curFile).absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir, filters);
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(dir);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QLatin1String("/") + fName, filters);
|
||||||
|
|
||||||
|
auto RemoveTempDir = [usedNotExistedDir, dir]()
|
||||||
|
{
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(dir);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
RemoveTempDir();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,6 +780,7 @@ bool TMainWindow::FileSaveAs()
|
||||||
{
|
{
|
||||||
qCCritical(tMainWindow, "%s",
|
qCCritical(tMainWindow, "%s",
|
||||||
qUtf8Printable(tr("Failed to lock. This file already opened in another window.")));
|
qUtf8Printable(tr("Failed to lock. This file already opened in another window.")));
|
||||||
|
RemoveTempDir();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -760,6 +806,7 @@ bool TMainWindow::FileSaveAs()
|
||||||
// Restore previous state
|
// Restore previous state
|
||||||
m->SetReadOnly(readOnly);
|
m->SetReadOnly(readOnly);
|
||||||
mIsReadOnly = readOnly;
|
mIsReadOnly = readOnly;
|
||||||
|
RemoveTempDir();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,8 +818,10 @@ bool TMainWindow::FileSaveAs()
|
||||||
{
|
{
|
||||||
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("Failed to lock. This file already opened in another window. "
|
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("Failed to lock. This file already opened in another window. "
|
||||||
"Expect collissions when run 2 copies of the program.")));
|
"Expect collissions when run 2 copies of the program.")));
|
||||||
|
RemoveTempDir();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
RemoveTempDir();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1283,6 +1332,7 @@ 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();
|
const QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
||||||
|
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())
|
||||||
|
@ -1913,7 +1963,7 @@ void TMainWindow::InitWindow()
|
||||||
|
|
||||||
if (mType == MeasurementsType::Standard)
|
if (mType == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
ui->labelMType->setText(tr("Standard measurements"));
|
ui->labelMType->setText(tr("Multisize measurements"));
|
||||||
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + " " +
|
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + " " +
|
||||||
VDomDocument::UnitsToStr(m->MUnit(), true));
|
VDomDocument::UnitsToStr(m->MUnit(), true));
|
||||||
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + " " +
|
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + " " +
|
||||||
|
|
|
@ -77,25 +77,31 @@ void PathPage::DefaultPath()
|
||||||
QTableWidgetItem *item = pathTable->item(row, 1);
|
QTableWidgetItem *item = pathTable->item(row, 1);
|
||||||
SCASSERT(item != nullptr)
|
SCASSERT(item != nullptr)
|
||||||
|
|
||||||
|
QString path;
|
||||||
|
|
||||||
switch (row)
|
switch (row)
|
||||||
{
|
{
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
item->setText(qApp->ValentinaSettings()->StandardTablesPath());
|
path = VCommonSettings::GetDefPathStandardMeasurements();
|
||||||
item->setToolTip(qApp->ValentinaSettings()->StandardTablesPath());
|
break;
|
||||||
|
case 2: // pattern path
|
||||||
|
path = VSettings::GetDefPathPattern();
|
||||||
break;
|
break;
|
||||||
case 0: // individual measurements
|
case 0: // individual measurements
|
||||||
case 2: // pattern path
|
path = VCommonSettings::GetDefPathIndividualMeasurements();
|
||||||
|
break;
|
||||||
case 3: // layout path
|
case 3: // layout path
|
||||||
item->setText(QDir::homePath());
|
path = VSettings::GetDefPathLayout();
|
||||||
item->setToolTip(QDir::homePath());
|
|
||||||
break;
|
break;
|
||||||
case 4: // templates
|
case 4: // templates
|
||||||
item->setText(qApp->ValentinaSettings()->TemplatesPath());
|
path = VCommonSettings::GetDefPathTemplate();
|
||||||
item->setToolTip(qApp->ValentinaSettings()->TemplatesPath());
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item->setText(path);
|
||||||
|
item->setToolTip(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -113,6 +119,7 @@ void PathPage::EditPath()
|
||||||
break;
|
break;
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||||
|
VCommonSettings::PrepareStandardTables(path);
|
||||||
break;
|
break;
|
||||||
case 2: // pattern path
|
case 2: // pattern path
|
||||||
path = qApp->ValentinaSettings()->GetPathPattern();
|
path = qApp->ValentinaSettings()->GetPathPattern();
|
||||||
|
@ -126,16 +133,35 @@ void PathPage::EditPath()
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(path);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
||||||
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
{
|
{
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(path);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
DefaultPath();
|
DefaultPath();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setText(dir);
|
item->setText(dir);
|
||||||
item->setToolTip(dir);
|
item->setToolTip(dir);
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(path);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -194,35 +220,35 @@ void PathPage::InitTable()
|
||||||
const VSettings *settings = qApp->ValentinaSettings();
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
||||||
item->setToolTip(settings->GetPathIndividualMeasurements());
|
item->setToolTip(settings->GetPathIndividualMeasurements());
|
||||||
pathTable->setItem(0, 1, item);
|
pathTable->setItem(0, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
pathTable->setItem(1, 0, new QTableWidgetItem(tr("My Multisize Measurements")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
||||||
item->setToolTip(settings->GetPathStandardMeasurements());
|
item->setToolTip(settings->GetPathStandardMeasurements());
|
||||||
pathTable->setItem(1, 1, item);
|
pathTable->setItem(1, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
|
pathTable->setItem(2, 0, new QTableWidgetItem(tr("My Patterns")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathPattern());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathPattern());
|
||||||
item->setToolTip(settings->GetPathPattern());
|
item->setToolTip(settings->GetPathPattern());
|
||||||
pathTable->setItem(2, 1, item);
|
pathTable->setItem(2, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
|
pathTable->setItem(3, 0, new QTableWidgetItem(tr("My Layouts")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathLayout());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathLayout());
|
||||||
item->setToolTip(settings->GetPathLayout());
|
item->setToolTip(settings->GetPathLayout());
|
||||||
pathTable->setItem(3, 1, item);
|
pathTable->setItem(3, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
pathTable->setItem(4, 0, new QTableWidgetItem(tr("Templates")));
|
pathTable->setItem(4, 0, new QTableWidgetItem(tr("My Templates")));
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
||||||
item->setToolTip(settings->GetPathTemplate());
|
item->setToolTip(settings->GetPathTemplate());
|
||||||
pathTable->setItem(4, 1, item);
|
pathTable->setItem(4, 1, item);
|
||||||
|
@ -253,9 +279,9 @@ void PathPage::RetranslateUi()
|
||||||
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
||||||
pathTable->setHorizontalHeaderLabels(tableHeader);
|
pathTable->setHorizontalHeaderLabels(tableHeader);
|
||||||
|
|
||||||
pathTable->item(0, 0)->setText(tr("Individual measurements"));
|
pathTable->item(0, 0)->setText(tr("My Individual Measurements"));
|
||||||
pathTable->item(1, 0)->setText(tr("Standard measurements"));
|
pathTable->item(1, 0)->setText(tr("My Multisize Measurements"));
|
||||||
pathTable->item(2, 0)->setText(tr("Patterns"));
|
pathTable->item(2, 0)->setText(tr("My Patterns"));
|
||||||
pathTable->item(3, 0)->setText(tr("Layout"));
|
pathTable->item(3, 0)->setText(tr("My Layouts"));
|
||||||
pathTable->item(4, 0)->setText(tr("Templates"));
|
pathTable->item(4, 0)->setText(tr("My Templates"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,13 +102,26 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
||||||
RECEIVER(this)ShowExample);
|
RECEIVER(this)ShowExample);
|
||||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, RECEIVER(this)[this]()
|
connect(ui->pushButtonBrowse, &QPushButton::clicked, RECEIVER(this)[this]()
|
||||||
{
|
{
|
||||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"),
|
const QString dirPath = qApp->ValentinaSettings()->GetPathLayout();
|
||||||
qApp->ValentinaSettings()->GetPathLayout(),
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(dirPath);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath,
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
if (not dir.isEmpty())
|
if (not dir.isEmpty())
|
||||||
{// If paths equal the signal will not be called, we will do this manually
|
{// If paths equal the signal will not be called, we will do this manually
|
||||||
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(dirPath);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
|
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
|
||||||
|
|
||||||
|
|
|
@ -1397,9 +1397,18 @@ void MainWindow::PrepareSceneList()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::LoadIndividual()
|
void MainWindow::LoadIndividual()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Individual measurements (*.vit);;Standard measurements (*.vst)");
|
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") + tr("Multisize measurements") +
|
||||||
|
QLatin1String(" (*.vst)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(path);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
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())
|
||||||
|
@ -1414,21 +1423,29 @@ void MainWindow::LoadIndividual()
|
||||||
doc->SetPath(RelativeMPath(curFile, mPath));
|
doc->SetPath(RelativeMPath(curFile, mPath));
|
||||||
watcher->addPath(mPath);
|
watcher->addPath(mPath);
|
||||||
PatternChangesWereSaved(false);
|
PatternChangesWereSaved(false);
|
||||||
ui->actionShowM->setEnabled(true);
|
ui->actionEditCurrent->setEnabled(true);
|
||||||
helpLabel->setText(tr("Measurements loaded"));
|
helpLabel->setText(tr("Measurements loaded"));
|
||||||
doc->LiteParseTree(Document::LiteParse);
|
doc->LiteParseTree(Document::LiteParse);
|
||||||
|
|
||||||
UpdateWindowTitle();
|
UpdateWindowTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(path);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::LoadStandard()
|
void MainWindow::LoadStandard()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Standard measurements (*.vst);;Individual measurements (*.vit)");
|
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst);;") + tr("Individual measurements") +
|
||||||
|
QLatin1String("(*.vit)");
|
||||||
//Use standard path to standard measurements
|
//Use standard path to standard measurements
|
||||||
const QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
const QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||||
|
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())
|
||||||
|
@ -1454,7 +1471,7 @@ void MainWindow::LoadStandard()
|
||||||
doc->SetPath(RelativeMPath(curFile, mPath));
|
doc->SetPath(RelativeMPath(curFile, mPath));
|
||||||
watcher->addPath(mPath);
|
watcher->addPath(mPath);
|
||||||
PatternChangesWereSaved(false);
|
PatternChangesWereSaved(false);
|
||||||
ui->actionShowM->setEnabled(true);
|
ui->actionEditCurrent->setEnabled(true);
|
||||||
helpLabel->setText(tr("Measurements loaded"));
|
helpLabel->setText(tr("Measurements loaded"));
|
||||||
doc->LiteParseTree(Document::LiteParse);
|
doc->LiteParseTree(Document::LiteParse);
|
||||||
|
|
||||||
|
@ -1490,7 +1507,7 @@ void MainWindow::UnloadMeasurements()
|
||||||
watcher->removePath(AbsoluteMPath(curFile, doc->MPath()));
|
watcher->removePath(AbsoluteMPath(curFile, doc->MPath()));
|
||||||
doc->SetPath(QString());
|
doc->SetPath(QString());
|
||||||
PatternChangesWereSaved(false);
|
PatternChangesWereSaved(false);
|
||||||
ui->actionShowM->setEnabled(false);
|
ui->actionEditCurrent->setEnabled(false);
|
||||||
ui->actionUnloadMeasurements->setDisabled(true);
|
ui->actionUnloadMeasurements->setDisabled(true);
|
||||||
helpLabel->setText(tr("Measurements unloaded"));
|
helpLabel->setText(tr("Measurements unloaded"));
|
||||||
|
|
||||||
|
@ -1540,7 +1557,7 @@ void MainWindow::ShowMeasurements()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->actionShowM->setEnabled(false);
|
ui->actionEditCurrent->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2388,29 +2405,43 @@ void MainWindow::ActionLayout(bool checked)
|
||||||
*/
|
*/
|
||||||
bool MainWindow::SaveAs()
|
bool MainWindow::SaveAs()
|
||||||
{
|
{
|
||||||
QString filters(tr("Pattern files (*.val)"));
|
QString filters(tr("Pattern files") + QLatin1String("(*.val)"));
|
||||||
QString dir;
|
QString dir;
|
||||||
if (curFile.isEmpty())
|
curFile.isEmpty() ? dir = qApp->ValentinaSettings()->GetPathPattern() : dir = QFileInfo(curFile).absolutePath();
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(dir);
|
||||||
|
if (not directory.exists())
|
||||||
{
|
{
|
||||||
dir = qApp->ValentinaSettings()->GetPathPattern() + "/" + tr("pattern") + ".val";
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
||||||
|
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
|
||||||
|
filters);
|
||||||
|
|
||||||
|
auto RemoveTempDir = [usedNotExistedDir, dir]()
|
||||||
{
|
{
|
||||||
dir = QFileInfo(curFile).absolutePath() + "/" + tr("pattern") + ".val";
|
if (usedNotExistedDir)
|
||||||
}
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir, filters);
|
QDir directory(dir);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
RemoveTempDir();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo f( fileName );
|
QFileInfo f( fileName );
|
||||||
if (f.suffix().isEmpty() && f.suffix() != "val")
|
if (f.suffix().isEmpty() && f.suffix() != QLatin1String("val"))
|
||||||
{
|
{
|
||||||
fileName += ".val";
|
fileName += QLatin1String(".val");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QFileInfo(fileName).exists())
|
if (f.exists())
|
||||||
{
|
{
|
||||||
// Temporary try to lock the file before saving
|
// Temporary try to lock the file before saving
|
||||||
// Also help to rewite current read-only pattern
|
// Also help to rewite current read-only pattern
|
||||||
|
@ -2419,6 +2450,7 @@ bool MainWindow::SaveAs()
|
||||||
{
|
{
|
||||||
qCCritical(vMainWindow, "%s",
|
qCCritical(vMainWindow, "%s",
|
||||||
qUtf8Printable(tr("Failed to lock. This file already opened in another window.")));
|
qUtf8Printable(tr("Failed to lock. This file already opened in another window.")));
|
||||||
|
RemoveTempDir();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2444,6 +2476,7 @@ bool MainWindow::SaveAs()
|
||||||
doc->SetReadOnly(readOnly);
|
doc->SetReadOnly(readOnly);
|
||||||
doc->SetModified(wasModified);
|
doc->SetModified(wasModified);
|
||||||
|
|
||||||
|
RemoveTempDir();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2465,6 +2498,7 @@ bool MainWindow::SaveAs()
|
||||||
"collissions when run 2 copies of the program.")));
|
"collissions when run 2 copies of the program.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RemoveTempDir();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2619,7 +2653,7 @@ void MainWindow::Clear()
|
||||||
ui->actionLoadIndividual->setEnabled(false);
|
ui->actionLoadIndividual->setEnabled(false);
|
||||||
ui->actionLoadStandard->setEnabled(false);
|
ui->actionLoadStandard->setEnabled(false);
|
||||||
ui->actionUnloadMeasurements->setEnabled(false);
|
ui->actionUnloadMeasurements->setEnabled(false);
|
||||||
ui->actionShowM->setEnabled(false);
|
ui->actionEditCurrent->setEnabled(false);
|
||||||
SetEnableTool(false);
|
SetEnableTool(false);
|
||||||
qApp->setPatternUnit(Unit::Cm);
|
qApp->setPatternUnit(Unit::Cm);
|
||||||
qApp->setPatternType(MeasurementsType::Unknown);
|
qApp->setPatternType(MeasurementsType::Unknown);
|
||||||
|
@ -3812,7 +3846,7 @@ void MainWindow::CreateActions()
|
||||||
connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual);
|
connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual);
|
||||||
connect(ui->actionLoadStandard, &QAction::triggered, this, &MainWindow::LoadStandard);
|
connect(ui->actionLoadStandard, &QAction::triggered, this, &MainWindow::LoadStandard);
|
||||||
|
|
||||||
connect(ui->actionCreateNew, &QAction::triggered, RECEIVER(this)[this]()
|
connect(ui->actionOpenTape, &QAction::triggered, RECEIVER(this)[this]()
|
||||||
{
|
{
|
||||||
const QString tape = qApp->TapeFilePath();
|
const QString tape = qApp->TapeFilePath();
|
||||||
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
|
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
|
||||||
|
@ -3826,7 +3860,7 @@ void MainWindow::CreateActions()
|
||||||
QProcess::startDetached(tape, arguments, workingDirectory);
|
QProcess::startDetached(tape, arguments, workingDirectory);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->actionShowM, &QAction::triggered, this, &MainWindow::ShowMeasurements);
|
connect(ui->actionEditCurrent, &QAction::triggered, this, &MainWindow::ShowMeasurements);
|
||||||
connect(ui->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
|
connect(ui->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
|
||||||
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
|
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
|
||||||
connect(ui->actionPrintPreviewTiled, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);
|
connect(ui->actionPrintPreviewTiled, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);
|
||||||
|
@ -4038,7 +4072,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu
|
||||||
{
|
{
|
||||||
ui->actionUnloadMeasurements->setEnabled(true);
|
ui->actionUnloadMeasurements->setEnabled(true);
|
||||||
watcher->addPath(path);
|
watcher->addPath(path);
|
||||||
ui->actionShowM->setEnabled(true);
|
ui->actionEditCurrent->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4338,24 +4372,55 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
|
||||||
QString mPath;
|
QString mPath;
|
||||||
if (patternType == MeasurementsType::Standard)
|
if (patternType == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
const QString filter = tr("Standard measurements (*.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();
|
const QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
const QString filter = tr("Individual measurements (*.vit)");
|
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(path);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(path);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QString filter = tr("Individual measurements (*.vit);;Standard measurements (*.vst)");
|
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") +
|
||||||
|
tr("Multisize measurements") + QLatin1String(" (*.vst)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||||
|
VCommonSettings::PrepareStandardTables(VCommonSettings::GetDefPathStandardMeasurements());
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(path);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(path);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPath.isEmpty())
|
if (mPath.isEmpty())
|
||||||
|
|
|
@ -1642,13 +1642,13 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Measurements</string>
|
<string>Measurements</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionTable"/>
|
<addaction name="actionOpenTape"/>
|
||||||
|
<addaction name="actionEditCurrent"/>
|
||||||
|
<addaction name="actionUnloadMeasurements"/>
|
||||||
<addaction name="actionLoadIndividual"/>
|
<addaction name="actionLoadIndividual"/>
|
||||||
<addaction name="actionLoadStandard"/>
|
<addaction name="actionLoadStandard"/>
|
||||||
<addaction name="actionUnloadMeasurements"/>
|
|
||||||
<addaction name="actionCreateNew"/>
|
|
||||||
<addaction name="actionShowM"/>
|
|
||||||
<addaction name="actionSyncMeasurements"/>
|
<addaction name="actionSyncMeasurements"/>
|
||||||
|
<addaction name="actionTable"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuWindow">
|
<widget class="QMenu" name="menuWindow">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -2098,10 +2098,10 @@
|
||||||
<normaloff>:/icon/32x32/table.png</normaloff>:/icon/32x32/table.png</iconset>
|
<normaloff>:/icon/32x32/table.png</normaloff>:/icon/32x32/table.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Table of variables</string>
|
<string>Variables Table</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Tables of variables</string>
|
<string>Contains information about increments and internal variables</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true">Ctrl+T</string>
|
<string notr="true">Ctrl+T</string>
|
||||||
|
@ -2501,7 +2501,10 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Individual ...</string>
|
<string>Load Individual</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Load Individual measurements file</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
|
@ -2515,21 +2518,13 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Standard ...</string>
|
<string>Load Multisize</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="iconText">
|
||||||
<string notr="true"/>
|
<string>Load Multisize</string>
|
||||||
</property>
|
|
||||||
<property name="menuRole">
|
|
||||||
<enum>QAction::NoRole</enum>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionCreateNew">
|
|
||||||
<property name="text">
|
|
||||||
<string>Create/Edit</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Create/edit measurements</string>
|
<string>Load multisize measurements file</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
|
@ -2538,15 +2533,29 @@
|
||||||
<enum>QAction::NoRole</enum>
|
<enum>QAction::NoRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionShowM">
|
<action name="actionOpenTape">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open Tape</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Open Tape app for creating or editing measurements file </string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="menuRole">
|
||||||
|
<enum>QAction::NoRole</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionEditCurrent">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show ...</string>
|
<string>Edit Current</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Show measurements</string>
|
<string>Edit linked to the pattern measurements</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
|
@ -2564,7 +2573,10 @@
|
||||||
<normaloff>:/icon/32x32/syncM.png</normaloff>:/icon/32x32/syncM.png</iconset>
|
<normaloff>:/icon/32x32/syncM.png</normaloff>:/icon/32x32/syncM.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sync measurements</string>
|
<string>Sync</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Synchronize linked to the pattern measurements after change</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
|
@ -2578,10 +2590,10 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Unload measurements</string>
|
<string>Unload Current</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Unload measurements if they was not used in a pattern file.</string>
|
<string>Unload measurements if they were not used in a pattern file</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
|
|
|
@ -853,8 +853,16 @@ void MainWindowsNoGUI::SaveLayoutAs()
|
||||||
qWarning()<<tr("Pages will be cropped because they do not fit printer paper size.");
|
qWarning()<<tr("Pages will be cropped because they do not fit printer paper size.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString dir = qApp->ValentinaSettings()->GetPathLayout();
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(dir);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
||||||
qApp->ValentinaSettings()->GetPathLayout()+"/"+FileName()+".pdf",
|
dir + QLatin1String("/") + FileName() + QLatin1String(".pdf"),
|
||||||
tr("PDF file (*.pdf)"));
|
tr("PDF file (*.pdf)"));
|
||||||
if (not fileName.isEmpty())
|
if (not fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -869,6 +877,12 @@ void MainWindowsNoGUI::SaveLayoutAs()
|
||||||
printer.setResolution(static_cast<int>(PrintDPI));
|
printer.setResolution(static_cast<int>(PrintDPI));
|
||||||
PrintPages( &printer );
|
PrintPages( &printer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(dir);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -75,9 +75,59 @@ const QString VCommonSettings::SettingUserDefinedMaterials = QStringLitera
|
||||||
|
|
||||||
static const QString commonIniFilename = QStringLiteral("common");
|
static const QString commonIniFilename = QStringLiteral("common");
|
||||||
|
|
||||||
#if !defined(Q_OS_WIN)
|
namespace
|
||||||
const QString VCommonSettings::unixStandardSharePath = QStringLiteral("/usr/share/valentina");
|
{
|
||||||
#endif
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool replaceOnConflit)
|
||||||
|
{
|
||||||
|
QDir dir;
|
||||||
|
dir.setPath(fromDir);
|
||||||
|
|
||||||
|
foreach (QString copyFile, dir.entryList(QDir::Files))
|
||||||
|
{
|
||||||
|
const QString from = fromDir + QDir::separator() + copyFile;
|
||||||
|
const QString to = toDir + QDir::separator() + copyFile;
|
||||||
|
|
||||||
|
if (QFile::exists(to))
|
||||||
|
{
|
||||||
|
if (replaceOnConflit)
|
||||||
|
{
|
||||||
|
if (QFile::remove(to) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QFile::link(from, to) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (QString copyDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||||
|
{
|
||||||
|
const QString from = fromDir + QDir::separator() + copyDir;
|
||||||
|
const QString to = toDir + QDir::separator() + copyDir;
|
||||||
|
|
||||||
|
if (dir.mkpath(to) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SymlinkCopyDirRecursive(from, to, replaceOnConflit) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization,
|
VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization,
|
||||||
|
@ -136,16 +186,54 @@ QString VCommonSettings::StandardTablesPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VCommonSettings::TemplatesPath()
|
QString VCommonSettings::StandardTemplatesPath()
|
||||||
{
|
{
|
||||||
return SharePath(QStringLiteral("/tables/templates"));
|
return SharePath(QStringLiteral("/tables/templates"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::PrepareStandardTemplates(const QString & currentPath)
|
||||||
|
{
|
||||||
|
QDir standardPath(VCommonSettings::StandardTemplatesPath());
|
||||||
|
const QDir localdata (VCommonSettings::GetDefPathTemplate());
|
||||||
|
if (currentPath == VCommonSettings::GetDefPathTemplate() && standardPath.exists() && not localdata.exists())
|
||||||
|
{
|
||||||
|
if (localdata.mkpath("."))
|
||||||
|
{
|
||||||
|
SymlinkCopyDirRecursive(VCommonSettings::StandardTemplatesPath(), VCommonSettings::GetDefPathTemplate(),
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::PrepareStandardTables(const QString ¤tPath)
|
||||||
|
{
|
||||||
|
QDir standardPath(VCommonSettings::StandardTablesPath());
|
||||||
|
const QDir localdata (VCommonSettings::GetDefPathStandardMeasurements());
|
||||||
|
if (currentPath == VCommonSettings::GetDefPathStandardMeasurements()
|
||||||
|
&& standardPath.exists()
|
||||||
|
&& not localdata.exists())
|
||||||
|
{
|
||||||
|
if (localdata.mkpath("."))
|
||||||
|
{
|
||||||
|
SymlinkCopyDirRecursive(VCommonSettings::StandardTablesPath(),
|
||||||
|
VCommonSettings::GetDefPathStandardMeasurements(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VCommonSettings::GetDefPathIndividualMeasurements()
|
||||||
|
{
|
||||||
|
return QDir::homePath() + QLatin1String("/valentina/") + tr("measurements") + QLatin1String("/") + tr("individual");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VCommonSettings::GetPathIndividualMeasurements() const
|
QString VCommonSettings::GetPathIndividualMeasurements() const
|
||||||
{
|
{
|
||||||
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
||||||
return settings.value(SettingPathsIndividualMeasurements, QDir::homePath()).toString();
|
return settings.value(SettingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -156,11 +244,17 @@ void VCommonSettings::SetPathIndividualMeasurements(const QString &value)
|
||||||
settings.sync();
|
settings.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VCommonSettings::GetDefPathStandardMeasurements()
|
||||||
|
{
|
||||||
|
return QDir::homePath() + QLatin1String("/valentina/") + tr("measurements") + QLatin1String("/") + tr("multisize");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VCommonSettings::GetPathStandardMeasurements() const
|
QString VCommonSettings::GetPathStandardMeasurements() const
|
||||||
{
|
{
|
||||||
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
||||||
return settings.value(SettingPathsStandardMeasurements, StandardTablesPath()).toString();
|
return settings.value(SettingPathsStandardMeasurements, GetDefPathStandardMeasurements()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -171,12 +265,17 @@ void VCommonSettings::SetPathStandardMeasurements(const QString &value)
|
||||||
settings.sync();
|
settings.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VCommonSettings::GetDefPathTemplate()
|
||||||
|
{
|
||||||
|
return QDir::homePath() + QLatin1String("/valentina/") + tr("templates");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VCommonSettings::GetPathTemplate() const
|
QString VCommonSettings::GetPathTemplate() const
|
||||||
{
|
{
|
||||||
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
||||||
return settings.value(SettingPathsTemplates, TemplatesPath()).toString();
|
return settings.value(SettingPathsTemplates, GetDefPathTemplate()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -51,14 +51,20 @@ public:
|
||||||
|
|
||||||
static QString SharePath(const QString &shareItem);
|
static QString SharePath(const QString &shareItem);
|
||||||
static QString StandardTablesPath();
|
static QString StandardTablesPath();
|
||||||
static QString TemplatesPath();
|
static QString StandardTemplatesPath();
|
||||||
|
|
||||||
|
static void PrepareStandardTemplates(const QString ¤tPath);
|
||||||
|
static void PrepareStandardTables(const QString ¤tPath);
|
||||||
|
|
||||||
|
static QString GetDefPathIndividualMeasurements();
|
||||||
QString GetPathIndividualMeasurements() const;
|
QString GetPathIndividualMeasurements() const;
|
||||||
void SetPathIndividualMeasurements(const QString &value);
|
void SetPathIndividualMeasurements(const QString &value);
|
||||||
|
|
||||||
|
static QString GetDefPathStandardMeasurements();
|
||||||
QString GetPathStandardMeasurements() const;
|
QString GetPathStandardMeasurements() const;
|
||||||
void SetPathStandardMeasurements(const QString &value);
|
void SetPathStandardMeasurements(const QString &value);
|
||||||
|
|
||||||
|
static QString GetDefPathTemplate();
|
||||||
QString GetPathTemplate() const;
|
QString GetPathTemplate() const;
|
||||||
void SetPathTemplate(const QString &value);
|
void SetPathTemplate(const QString &value);
|
||||||
|
|
||||||
|
@ -126,10 +132,6 @@ public:
|
||||||
bool GetForbidWorkpieceFlipping() const;
|
bool GetForbidWorkpieceFlipping() const;
|
||||||
void SetForbidWorkpieceFlipping(bool value);
|
void SetForbidWorkpieceFlipping(bool value);
|
||||||
|
|
||||||
#if !defined(Q_OS_WIN)
|
|
||||||
static const QString unixStandardSharePath;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VCommonSettings)
|
Q_DISABLE_COPY(VCommonSettings)
|
||||||
|
|
||||||
|
|
|
@ -99,11 +99,17 @@ void VSettings::SetLabelLanguage(const QString &value)
|
||||||
setValue(SettingConfigurationLabelLanguage, value);
|
setValue(SettingConfigurationLabelLanguage, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VSettings::GetDefPathPattern()
|
||||||
|
{
|
||||||
|
return QDir::homePath() + QLatin1String("/valentina/") + tr("patterns");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VSettings::GetPathPattern() const
|
QString VSettings::GetPathPattern() const
|
||||||
{
|
{
|
||||||
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
||||||
return settings.value(SettingPathsPattern, QDir::homePath()).toString();
|
return settings.value(SettingPathsPattern, GetDefPathPattern()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -114,11 +120,17 @@ void VSettings::SetPathPattern(const QString &value)
|
||||||
settings.sync();
|
settings.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VSettings::GetDefPathLayout()
|
||||||
|
{
|
||||||
|
return QDir::homePath() + QLatin1String("/valentina/") + tr("layouts");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VSettings::GetPathLayout() const
|
QString VSettings::GetPathLayout() const
|
||||||
{
|
{
|
||||||
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
||||||
return settings.value(SettingPathsLayout, QDir::homePath()).toString();
|
return settings.value(SettingPathsLayout, GetDefPathLayout()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -58,9 +58,11 @@ public:
|
||||||
QString GetLabelLanguage() const;
|
QString GetLabelLanguage() const;
|
||||||
void SetLabelLanguage(const QString &value);
|
void SetLabelLanguage(const QString &value);
|
||||||
|
|
||||||
|
static QString GetDefPathPattern();
|
||||||
QString GetPathPattern() const;
|
QString GetPathPattern() const;
|
||||||
void SetPathPattern(const QString &value);
|
void SetPathPattern(const QString &value);
|
||||||
|
|
||||||
|
static QString GetDefPathLayout();
|
||||||
QString GetPathLayout() const;
|
QString GetPathLayout() const;
|
||||||
void SetPathLayout(const QString &value);
|
void SetPathLayout(const QString &value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user