Redesign standard path system.
This commit is contained in:
parent
02a92a4c49
commit
2219985f6e
|
@ -40,6 +40,7 @@
|
|||
- Fix GUI freezing while nesting.
|
||||
- New option: Use Tool Groups.
|
||||
- Redesign notch context menu to allow quick selection of the notch type.
|
||||
- Redesign standard path system.
|
||||
|
||||
# Valentina 0.7.52 September 12, 2022
|
||||
- Fix crash when default locale is ru.
|
||||
|
|
|
@ -62,8 +62,8 @@ PuzzlePreferencesPathPage::~PuzzlePreferencesPathPage()
|
|||
void PuzzlePreferencesPathPage::Apply()
|
||||
{
|
||||
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||
settings->SetPathManualLayouts(ui->pathTable->item(0, 1)->text());
|
||||
settings->SetPathSVGFonts(ui->pathTable->item(1, 1)->text());
|
||||
settings->SetPathSVGFonts(ui->pathTable->item(0, 1)->text());
|
||||
settings->SetPathFontCorrections(ui->pathTable->item(1, 1)->text());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -89,12 +89,12 @@ void PuzzlePreferencesPathPage::DefaultPath()
|
|||
QString path;
|
||||
switch (row)
|
||||
{
|
||||
case 0: // layouts
|
||||
path = VCommonSettings::GetDefPathManualLayouts();
|
||||
break;
|
||||
case 1: // svg fonts
|
||||
case 0: // svg fonts
|
||||
path = VCommonSettings::GetDefPathSVGFonts();
|
||||
break;
|
||||
case 1: // font corrections
|
||||
path = VCommonSettings::GetDefPathFontCorrections();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -113,12 +113,12 @@ void PuzzlePreferencesPathPage::EditPath()
|
|||
QString path;
|
||||
switch (row)
|
||||
{
|
||||
case 0: // layouts
|
||||
path = VPApplication::VApp()->PuzzleSettings()->GetPathManualLayouts();
|
||||
break;
|
||||
case 1: // svg fonts
|
||||
case 0: // svg fonts
|
||||
path = VPApplication::VApp()->PuzzleSettings()->GetPathSVGFonts();
|
||||
break;
|
||||
case 1: // font corrections
|
||||
path = VPApplication::VApp()->PuzzleSettings()->GetPathFontCorrections();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -158,16 +158,16 @@ void PuzzlePreferencesPathPage::InitTable()
|
|||
const VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Layouts")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathManualLayouts());
|
||||
item->setToolTip(settings->GetPathManualLayouts());
|
||||
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My SVG Fonts")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathSVGFonts());
|
||||
item->setToolTip(settings->GetPathSVGFonts());
|
||||
ui->pathTable->setItem(0, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(1, 0, new QTableWidgetItem(tr("My SVG Fonts")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathSVGFonts());
|
||||
item->setToolTip(settings->GetPathSVGFonts());
|
||||
ui->pathTable->setItem(1, 0, new QTableWidgetItem(tr("My font corrections")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathFontCorrections());
|
||||
item->setToolTip(settings->GetPathFontCorrections());
|
||||
ui->pathTable->setItem(1, 1, item);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,12 +117,6 @@ DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExpo
|
|||
[this]()
|
||||
{
|
||||
const QString dirPath = VPApplication::VApp()->PuzzleSettings()->GetPathManualLayouts();
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(dirPath);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
const QString dir = QFileDialog::getExistingDirectory(
|
||||
this, tr("Select folder"), dirPath,
|
||||
|
@ -131,12 +125,8 @@ DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExpo
|
|||
if (not dir.isEmpty())
|
||||
{ // If paths equal the signal will not be called, we will do this manually
|
||||
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
||||
}
|
||||
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir directory(dirPath);
|
||||
directory.rmpath(QChar('.'));
|
||||
VPApplication::VApp()->PuzzleSettings()->SetPathManualLayouts(dir);
|
||||
}
|
||||
});
|
||||
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveManualLayout::PathChanged);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <QtMath>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../ifc/xml/vlayoutconverter.h"
|
||||
|
@ -3437,24 +3438,13 @@ void VPMainWindow::on_actionOpen_triggered()
|
|||
// Use standard path to individual measurements
|
||||
const QString pathTo = VPApplication::VApp()->PuzzleSettings()->GetPathManualLayouts();
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(pathTo);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
if (not mPath.isEmpty())
|
||||
{
|
||||
VPApplication::VApp()->NewMainWindow()->LoadFile(mPath);
|
||||
}
|
||||
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir(pathTo).rmpath(QChar('.'));
|
||||
VPApplication::VApp()->PuzzleSettings()->SetPathManualLayouts(QFileInfo(mPath).absolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3513,25 +3503,9 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
|
|||
dir = QFileInfo(curFile).absolutePath();
|
||||
}
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(dir);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
auto RemoveTempDir = qScopeGuard(
|
||||
[usedNotExistedDir, dir]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir(dir).rmpath(QChar('.'));
|
||||
}
|
||||
});
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return false;
|
||||
|
@ -3543,6 +3517,11 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
|
|||
fileName += QChar('.') + suffix;
|
||||
}
|
||||
|
||||
if (curFile.isEmpty())
|
||||
{
|
||||
VPApplication::VApp()->PuzzleSettings()->SetPathManualLayouts(QFileInfo(fileName).absolutePath());
|
||||
}
|
||||
|
||||
if (not CheckFilePermissions(fileName, this))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template>
|
||||
<version>1.0.0</version>
|
||||
<lines>
|
||||
<line alignment="0" bold="true" italic="false" sfIncrement="4" text="%author%"/>
|
||||
<line alignment="0" bold="false" italic="false" sfIncrement="2" text="%patternName%"/>
|
||||
<line alignment="0" bold="false" italic="false" sfIncrement="0" text="%patternNumber%"/>
|
||||
<line alignment="0" bold="false" italic="true" sfIncrement="0" text="%customer%"/>
|
||||
<line alignment="0" bold="false" italic="true" sfIncrement="0" text="%date%"/>
|
||||
</lines>
|
||||
</template>
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template>
|
||||
<version>1.0.0</version>
|
||||
<lines>
|
||||
<line alignment="4" bold="true" italic="false" sfIncrement="6" text="%pLetter%"/>
|
||||
<line alignment="4" bold="true" italic="false" sfIncrement="2" text="%pName%"/>
|
||||
<line alignment="4" bold="false" italic="false" sfIncrement="0" text="%mFabric%, %wCut% %pQuantity%"/>
|
||||
</lines>
|
||||
</template>
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vit>
|
||||
<!--Measurements created with Valentina (http://www.valentina-project.org/).-->
|
||||
<version>0.3.3</version>
|
||||
<read-only>true</read-only>
|
||||
<notes/>
|
||||
<unit>cm</unit>
|
||||
<pm_system>998</pm_system>
|
||||
<personal>
|
||||
<family-name/>
|
||||
<given-name/>
|
||||
<birth-date>1800-01-01</birth-date>
|
||||
<gender>unknown</gender>
|
||||
<email/>
|
||||
</personal>
|
||||
<body-measurements>
|
||||
<m name="height_knee" value="0"/>
|
||||
<m name="neck_circ" value="0"/>
|
||||
<m name="bust_circ" value="0"/>
|
||||
<m name="waist_circ" value="0"/>
|
||||
<m name="highhip_circ" value="0"/>
|
||||
<m name="hip_circ" value="0"/>
|
||||
<m name="neck_back_to_waist_b" value="0"/>
|
||||
<m name="neck_back_to_highbust_b" value="0"/>
|
||||
<m name="waist_to_hip_f" value="0"/>
|
||||
<m name="shoulder_length" value="0"/>
|
||||
<m name="across_chest_f" value="0"/>
|
||||
<m name="across_back_b" value="0"/>
|
||||
<m name="bustpoint_to_waist" value="0"/>
|
||||
<m name="arm_shoulder_tip_to_wrist_bent" value="0"/>
|
||||
<m name="arm_upper_circ" value="0"/>
|
||||
<m name="arm_wrist_circ" value="0"/>
|
||||
<m name="leg_knee_circ" value="0"/>
|
||||
<m name="leg_ankle_high_circ" value="0"/>
|
||||
<m name="leg_ankle_circ" value="0"/>
|
||||
<m name="rise_length_side_sitting" value="0"/>
|
||||
<m name="dart_width_shoulder" value="0"/>
|
||||
<m name="height_waist_back" value="0"/>
|
||||
<m name="bustpoint_to_shoulder_center" value="0"/>
|
||||
<m name="@M_1" value="@M_J10 + bustpoint_to_waist" full_name="Front Shoulder to Waist"/>
|
||||
<m name="@M_2" value="@M_A23 - height_knee" full_name="Waist to Knee"/>
|
||||
<m name="@M_3" value="(0.91*leg_ankle_circ) " full_name="Trouser Bottom"/>
|
||||
<m name="@M_4" value="(0.8*leg_ankle_circ) " full_name="Jeans Bottom"/>
|
||||
<m name="@M_5" value="(1.41*arm_wrist_circ)" full_name="Cuff Size, Shirt"/>
|
||||
<m name="@M_6" value="(0.9*arm_wrist_circ)" full_name="Cuff Size, Two Piece Sleeve"/>
|
||||
<m name="@M_7" value="(0.93*arm_shoulder_tip_to_wrist_bent)" full_name="Sleeve Length, Jersey"/>
|
||||
</body-measurements>
|
||||
</vit>
|
|
@ -1,262 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vit>
|
||||
<!--Measurements created with Valentina (http://www.valentina-project.org/).-->
|
||||
<version>0.3.3</version>
|
||||
<read-only>true</read-only>
|
||||
<notes/>
|
||||
<unit>cm</unit>
|
||||
<pm_system>998</pm_system>
|
||||
<personal>
|
||||
<family-name/>
|
||||
<given-name/>
|
||||
<birth-date>1800-01-01</birth-date>
|
||||
<gender>unknown</gender>
|
||||
<email/>
|
||||
</personal>
|
||||
<body-measurements>
|
||||
<m name="height" value="0"/>
|
||||
<m name="height_neck_back" value="0"/>
|
||||
<m name="height_scapula" value="0"/>
|
||||
<m name="height_armpit" value="0"/>
|
||||
<m name="height_waist_side" value="0"/>
|
||||
<m name="height_hip" value="0"/>
|
||||
<m name="height_gluteal_fold" value="0"/>
|
||||
<m name="height_knee" value="0"/>
|
||||
<m name="height_calf" value="0"/>
|
||||
<m name="height_ankle_high" value="0"/>
|
||||
<m name="height_ankle" value="0"/>
|
||||
<m name="height_highhip" value="0"/>
|
||||
<m name="height_waist_front" value="0"/>
|
||||
<m name="height_bustpoint" value="0"/>
|
||||
<m name="height_shoulder_tip" value="0"/>
|
||||
<m name="height_neck_front" value="0"/>
|
||||
<m name="height_neck_side" value="0"/>
|
||||
<m name="height_neck_back_to_knee" value="(height_neck_back - height_knee)"/>
|
||||
<m name="height_waist_side_to_knee" value="(height_waist_side - height_knee)"/>
|
||||
<m name="height_waist_side_to_hip" value="(height_waist_side - height_hip)"/>
|
||||
<m name="height_knee_to_ankle" value="(height_knee - height_ankle)"/>
|
||||
<m name="height_neck_back_to_waist_side" value="(height_neck_back - height_waist_side)"/>
|
||||
<m name="height_waist_back" value="(height_waist_front - leg_crotch_to_floor)"/>
|
||||
<m name="width_shoulder" value="0"/>
|
||||
<m name="width_bust" value="0"/>
|
||||
<m name="width_waist" value="0"/>
|
||||
<m name="width_hip" value="0"/>
|
||||
<m name="width_abdomen_to_hip" value="0"/>
|
||||
<m name="indent_neck_back" value="0"/>
|
||||
<m name="indent_waist_back" value="0"/>
|
||||
<m name="indent_ankle_high" value="0"/>
|
||||
<m name="hand_palm_length" value="0"/>
|
||||
<m name="hand_length" value="0"/>
|
||||
<m name="hand_palm_width" value="0"/>
|
||||
<m name="hand_palm_circ" value="0"/>
|
||||
<m name="hand_circ" value="0"/>
|
||||
<m name="foot_width" value="0"/>
|
||||
<m name="foot_length" value="0"/>
|
||||
<m name="foot_circ" value="0"/>
|
||||
<m name="foot_instep_circ" value="0"/>
|
||||
<m name="head_circ" value="0"/>
|
||||
<m name="head_length" value="0"/>
|
||||
<m name="head_depth" value="0"/>
|
||||
<m name="head_width" value="0"/>
|
||||
<m name="head_crown_to_neck_back" value="(height - height_neck_back)"/>
|
||||
<m name="head_chin_to_neck_back" value="(height - height_neck_back - head_length)"/>
|
||||
<m name="neck_mid_circ" value="0"/>
|
||||
<m name="neck_circ" value="0"/>
|
||||
<m name="highbust_circ" value="0"/>
|
||||
<m name="bust_circ" value="0"/>
|
||||
<m name="lowbust_circ" value="0"/>
|
||||
<m name="rib_circ" value="0"/>
|
||||
<m name="waist_circ" value="0"/>
|
||||
<m name="highhip_circ" value="0"/>
|
||||
<m name="hip_circ" value="0"/>
|
||||
<m name="neck_arc_f" value="0"/>
|
||||
<m name="highbust_arc_f" value="0"/>
|
||||
<m name="bust_arc_f" value="0"/>
|
||||
<m name="lowbust_arc_f" value="0"/>
|
||||
<m name="rib_arc_f" value="0"/>
|
||||
<m name="waist_arc_f" value="0"/>
|
||||
<m name="highhip_arc_f" value="0"/>
|
||||
<m name="hip_arc_f" value="0"/>
|
||||
<m name="neck_arc_half_f" value="(neck_arc_f/2)"/>
|
||||
<m name="highbust_arc_half_f" value="(highbust_arc_f/2)"/>
|
||||
<m name="bust_arc_half_f" value="(bust_arc_f/2)"/>
|
||||
<m name="lowbust_arc_half_f" value="(lowbust_arc_f/2)"/>
|
||||
<m name="rib_arc_half_f" value="(rib_arc_f/2)"/>
|
||||
<m name="waist_arc_half_f" value="(waist_arc_f/2)"/>
|
||||
<m name="highhip_arc_half_f" value="(highhip_arc_f/2)"/>
|
||||
<m name="hip_arc_half_f" value="(hip_arc_f/2)"/>
|
||||
<m name="neck_arc_b" value="(neck_circ - neck_arc_f)"/>
|
||||
<m name="highbust_arc_b" value="(highbust_circ - highbust_arc_f)"/>
|
||||
<m name="bust_arc_b" value="(bust_circ - bust_arc_f)"/>
|
||||
<m name="lowbust_arc_b" value="(lowbust_circ - lowbust_arc_f)"/>
|
||||
<m name="rib_arc_b" value="(rib_circ - rib_arc_f)"/>
|
||||
<m name="waist_arc_b" value="(waist_circ - waist_arc_f)"/>
|
||||
<m name="highhip_arc_b" value="(highhip_circ - highhip_arc_f)"/>
|
||||
<m name="hip_arc_b" value="(hip_circ - hip_arc_f)"/>
|
||||
<m name="neck_arc_half_b" value="(neck_arc_b/2)"/>
|
||||
<m name="highbust_arc_half_b" value="(highbust_arc_b/2)"/>
|
||||
<m name="bust_arc_half_b" value="(bust_arc_b/2)"/>
|
||||
<m name="lowbust_arc_half_b" value="(lowbust_arc_b/2)"/>
|
||||
<m name="rib_arc_half_b" value="(rib_arc_b/2)"/>
|
||||
<m name="waist_arc_half_b" value="(waist_arc_b/2)"/>
|
||||
<m name="highhip_arc_half_b" value="(highhip_arc_b/2)"/>
|
||||
<m name="hip_arc_half_b" value="(hip_arc_b/2)"/>
|
||||
<m name="hip_with_abdomen_arc_f" value="0"/>
|
||||
<m name="body_armfold_circ" value="0"/>
|
||||
<m name="body_bust_circ" value="0"/>
|
||||
<m name="body_torso_circ" value="0"/>
|
||||
<m name="hip_circ_with_abdomen" value="(hip_arc_b + hip_with_abdomen_arc_f)"/>
|
||||
<m name="neck_front_to_waist_f" value="0"/>
|
||||
<m name="neck_front_to_waist_flat_f" value="0"/>
|
||||
<m name="armpit_to_waist_side" value="0"/>
|
||||
<m name="shoulder_tip_to_waist_side_f" value="0"/>
|
||||
<m name="neck_side_to_waist_f" value="0"/>
|
||||
<m name="neck_side_to_waist_bustpoint_f" value="0"/>
|
||||
<m name="neck_front_to_highbust_f" value="0"/>
|
||||
<m name="highbust_to_waist_f" value="(neck_front_to_waist_f - neck_front_to_highbust_f)"/>
|
||||
<m name="neck_front_to_bust_f" value="0"/>
|
||||
<m name="bust_to_waist_f" value="(neck_front_to_waist_f - neck_front_to_bust_f)"/>
|
||||
<m name="lowbust_to_waist_f" value="0"/>
|
||||
<m name="rib_to_waist_side" value="0"/>
|
||||
<m name="shoulder_tip_to_armfold_f" value="0"/>
|
||||
<m name="neck_side_to_bust_f" value="0"/>
|
||||
<m name="neck_side_to_highbust_f" value="0"/>
|
||||
<m name="shoulder_center_to_highbust_f" value="0"/>
|
||||
<m name="shoulder_tip_to_waist_side_b" value="0"/>
|
||||
<m name="neck_side_to_waist_b" value="0"/>
|
||||
<m name="neck_back_to_waist_b" value="0"/>
|
||||
<m name="neck_side_to_waist_scapula_b" value="0"/>
|
||||
<m name="neck_back_to_highbust_b" value="0"/>
|
||||
<m name="highbust_to_waist_b" value="(neck_back_to_waist_b - neck_back_to_highbust_b)"/>
|
||||
<m name="neck_back_to_bust_b" value="0"/>
|
||||
<m name="bust_to_waist_b" value="(neck_back_to_waist_b - neck_back_to_bust_b)"/>
|
||||
<m name="lowbust_to_waist_b" value="0"/>
|
||||
<m name="shoulder_tip_to_armfold_b" value="0"/>
|
||||
<m name="neck_side_to_bust_b" value="0"/>
|
||||
<m name="neck_side_to_highbust_b" value="0"/>
|
||||
<m name="shoulder_center_to_highbust_b" value="0"/>
|
||||
<m name="waist_to_highhip_f" value="0"/>
|
||||
<m name="waist_to_hip_f" value="0"/>
|
||||
<m name="waist_to_highhip_side" value="0"/>
|
||||
<m name="waist_to_highhip_b" value="0"/>
|
||||
<m name="waist_to_hip_b" value="0"/>
|
||||
<m name="waist_to_hip_side" value="0"/>
|
||||
<m name="shoulder_slope_neck_side_angle" value="0"/>
|
||||
<m name="shoulder_slope_neck_side_length" value="0"/>
|
||||
<m name="shoulder_slope_neck_back_angle" value="0"/>
|
||||
<m name="shoulder_slope_neck_back_height" value="0"/>
|
||||
<m name="shoulder_slope_shoulder_tip_angle" value="0"/>
|
||||
<m name="neck_back_to_across_back" value="0"/>
|
||||
<m name="across_back_to_waist_b" value="(neck_back_to_waist_b - neck_back_to_across_back)"/>
|
||||
<m name="shoulder_length" value="0"/>
|
||||
<m name="shoulder_tip_to_shoulder_tip_f" value="0"/>
|
||||
<m name="across_chest_f" value="0"/>
|
||||
<m name="armfold_to_armfold_f" value="0"/>
|
||||
<m name="shoulder_tip_to_shoulder_tip_half_f" value="(shoulder_tip_to_shoulder_tip_f/2)"/>
|
||||
<m name="across_chest_half_f" value="(across_chest_f/2)"/>
|
||||
<m name="shoulder_tip_to_shoulder_tip_b" value="0"/>
|
||||
<m name="across_back_b" value="0"/>
|
||||
<m name="armfold_to_armfold_b" value="0"/>
|
||||
<m name="shoulder_tip_to_shoulder_tip_half_b" value="(shoulder_tip_to_shoulder_tip_b/2)"/>
|
||||
<m name="across_back_half_b" value="(across_back_b/2)"/>
|
||||
<m name="neck_front_to_shoulder_tip_f" value="0"/>
|
||||
<m name="neck_back_to_shoulder_tip_b" value="0"/>
|
||||
<m name="neck_width" value="0"/>
|
||||
<m name="bustpoint_to_bustpoint" value="0"/>
|
||||
<m name="bustpoint_to_neck_side" value="0"/>
|
||||
<m name="bustpoint_to_lowbust" value="0"/>
|
||||
<m name="bustpoint_to_waist" value="0"/>
|
||||
<m name="bustpoint_to_bustpoint_half" value="(bustpoint_to_bustpoint/2)"/>
|
||||
<m name="bustpoint_neck_side_to_waist" value="(bustpoint_to_neck_side + bustpoint_to_waist)"/>
|
||||
<m name="bustpoint_to_shoulder_tip" value="0"/>
|
||||
<m name="bustpoint_to_waist_front" value="0"/>
|
||||
<m name="bustpoint_to_bustpoint_halter" value="0"/>
|
||||
<m name="bustpoint_to_shoulder_center" value="0"/>
|
||||
<m name="shoulder_tip_to_waist_front" value="0"/>
|
||||
<m name="neck_front_to_waist_side" value="0"/>
|
||||
<m name="neck_side_to_waist_side_f" value="0"/>
|
||||
<m name="shoulder_tip_to_waist_back" value="0"/>
|
||||
<m name="shoulder_tip_to_waist_b_1in_offset" value="0"/>
|
||||
<m name="neck_back_to_waist_side" value="0"/>
|
||||
<m name="neck_side_to_waist_side_b" value="0"/>
|
||||
<m name="neck_side_to_armfold_f" value="0"/>
|
||||
<m name="neck_side_to_armpit_f" value="0"/>
|
||||
<m name="neck_side_to_bust_side_f" value="0"/>
|
||||
<m name="neck_side_to_armfold_b" value="0"/>
|
||||
<m name="neck_side_to_armpit_b" value="0"/>
|
||||
<m name="neck_side_to_bust_side_b" value="0"/>
|
||||
<m name="arm_shoulder_tip_to_wrist_bent" value="0"/>
|
||||
<m name="arm_shoulder_tip_to_elbow_bent" value="0"/>
|
||||
<m name="arm_elbow_to_wrist_bent" value="(arm_shoulder_tip_to_wrist_bent - arm_shoulder_tip_to_elbow_bent)"/>
|
||||
<m name="arm_elbow_circ_bent" value="0"/>
|
||||
<m name="arm_shoulder_tip_to_wrist" value="0"/>
|
||||
<m name="arm_shoulder_tip_to_elbow" value="0"/>
|
||||
<m name="arm_elbow_to_wrist" value="(arm_shoulder_tip_to_wrist - arm_shoulder_tip_to_elbow)"/>
|
||||
<m name="arm_armpit_to_wrist" value="0"/>
|
||||
<m name="arm_armpit_to_elbow" value="0"/>
|
||||
<m name="arm_elbow_to_wrist_inside" value="(arm_armpit_to_wrist - arm_armpit_to_elbow)"/>
|
||||
<m name="arm_upper_circ" value="0"/>
|
||||
<m name="arm_above_elbow_circ" value="0"/>
|
||||
<m name="arm_elbow_circ" value="0"/>
|
||||
<m name="arm_lower_circ" value="0"/>
|
||||
<m name="arm_wrist_circ" value="0"/>
|
||||
<m name="arm_shoulder_tip_to_armfold_line" value="0"/>
|
||||
<m name="arm_neck_side_to_wrist" value="(shoulder_length + arm_shoulder_tip_to_wrist)"/>
|
||||
<m name="arm_neck_side_to_finger_tip" value="(shoulder_length + arm_shoulder_tip_to_wrist + hand_length)"/>
|
||||
<m name="armscye_circ" value="0"/>
|
||||
<m name="armscye_length" value="0"/>
|
||||
<m name="armscye_width" value="0"/>
|
||||
<m name="arm_neck_side_to_outer_elbow" value="(shoulder_length + arm_shoulder_tip_to_elbow)"/>
|
||||
<m name="leg_crotch_to_floor" value="0"/>
|
||||
<m name="leg_waist_side_to_floor" value="0"/>
|
||||
<m name="leg_thigh_upper_circ" value="0"/>
|
||||
<m name="leg_thigh_mid_circ" value="0"/>
|
||||
<m name="leg_knee_circ" value="0"/>
|
||||
<m name="leg_knee_small_circ" value="0"/>
|
||||
<m name="leg_calf_circ" value="0"/>
|
||||
<m name="leg_ankle_high_circ" value="0"/>
|
||||
<m name="leg_ankle_circ" value="0"/>
|
||||
<m name="leg_knee_circ_bent" value="0"/>
|
||||
<m name="leg_ankle_diag_circ" value="0"/>
|
||||
<m name="leg_crotch_to_ankle" value="(leg_crotch_to_floor - height_ankle)"/>
|
||||
<m name="leg_waist_side_to_ankle" value="(leg_waist_side_to_floor - height_ankle)"/>
|
||||
<m name="leg_waist_side_to_knee" value="(leg_waist_side_to_floor - height_knee)"/>
|
||||
<m name="crotch_length" value="0"/>
|
||||
<m name="crotch_length_b" value="0"/>
|
||||
<m name="crotch_length_f" value="(crotch_length - crotch_length_b)"/>
|
||||
<m name="rise_length_side_sitting" value="0"/>
|
||||
<m name="rise_length_diag" value="0"/>
|
||||
<m name="rise_length_b" value="(height_waist_back - leg_crotch_to_floor)"/>
|
||||
<m name="rise_length_f" value="(height_waist_front - leg_crotch_to_floor)"/>
|
||||
<m name="rise_length_side" value="0"/>
|
||||
<m name="neck_back_to_waist_front" value="0"/>
|
||||
<m name="waist_to_waist_halter" value="0"/>
|
||||
<m name="waist_natural_circ" value="0"/>
|
||||
<m name="waist_natural_arc_f" value="0"/>
|
||||
<m name="waist_natural_arc_b" value="(waist_natural_circ - waist_natural_arc_f)"/>
|
||||
<m name="waist_to_natural_waist_f" value="0"/>
|
||||
<m name="waist_to_natural_waist_b" value="0"/>
|
||||
<m name="arm_neck_back_to_elbow_bent" value="0"/>
|
||||
<m name="arm_neck_back_to_wrist_bent" value="0"/>
|
||||
<m name="arm_neck_side_to_elbow_bent" value="0"/>
|
||||
<m name="arm_neck_side_to_wrist_bent" value="0"/>
|
||||
<m name="arm_across_back_center_to_elbow_bent" value="0"/>
|
||||
<m name="arm_across_back_center_to_wrist_bent" value="0"/>
|
||||
<m name="arm_armscye_back_center_to_wrist_bent" value="0"/>
|
||||
<m name="neck_back_to_bust_front" value="0"/>
|
||||
<m name="neck_back_to_armfold_front" value="0"/>
|
||||
<m name="neck_back_to_armfold_front_to_waist_side" value="0"/>
|
||||
<m name="highbust_back_over_shoulder_to_armfold_front" value="0"/>
|
||||
<m name="highbust_back_over_shoulder_to_waist_front" value="0"/>
|
||||
<m name="neck_back_to_armfold_front_to_neck_back" value="0"/>
|
||||
<m name="across_back_center_to_armfold_front_to_across_back_center" value="0"/>
|
||||
<m name="neck_back_to_armfold_front_to_highbust_back" value="0"/>
|
||||
<m name="armfold_to_armfold_bust" value="0"/>
|
||||
<m name="armfold_to_bust_front" value="0"/>
|
||||
<m name="highbust_b_over_shoulder_to_highbust_f" value="0"/>
|
||||
<m name="armscye_arc" value="0"/>
|
||||
<m name="dart_width_shoulder" value="0"/>
|
||||
<m name="dart_width_bust" value="0"/>
|
||||
<m name="dart_width_waist" value="0"/>
|
||||
</body-measurements>
|
||||
</vit>
|
|
@ -1,14 +0,0 @@
|
|||
# Keep path to all files with multisize measurements we support right now
|
||||
INSTALL_MULTISIZE_MEASUREMENTS += $$PWD/share/tables/multisize/GOST_man_ru.vst
|
||||
|
||||
# Keep path to all template files we have right now
|
||||
INSTALL_STANDARD_TEMPLATES += \
|
||||
$$PWD/share/tables/templates/template_all_measurements.vit \
|
||||
$$PWD/share/tables/templates/t_Aldrich_Women.vit
|
||||
|
||||
# Keep path to all label templates we provide right now
|
||||
INSTALL_LABEL_TEMPLATES += $$PWD/share/labels/def_pattern_label.xml \
|
||||
$$PWD/share/labels/def_piece_label.xml
|
||||
|
||||
copyToDestdir($$INSTALL_MULTISIZE_MEASUREMENTS, $$shell_path($${OUT_PWD}/$$DESTDIR/tables/multisize))
|
||||
copyToDestdir($$INSTALL_LABEL_TEMPLATES, $$shell_path($${OUT_PWD}/$$DESTDIR/labels))
|
|
@ -1,212 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file tapepreferencespathpage.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 12 4, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2017 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "tapepreferencespathpage.h"
|
||||
#include "../../mapplication.h"
|
||||
#include "../../vtapesettings.h"
|
||||
#include "ui_tapepreferencespathpage.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::TapePreferencesPathPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
InitTable();
|
||||
|
||||
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this,
|
||||
[this]()
|
||||
{
|
||||
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||
ui->defaultButton->setDefault(false);
|
||||
|
||||
ui->editButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||
ui->editButton->setDefault(true);
|
||||
});
|
||||
|
||||
connect(ui->defaultButton, &QPushButton::clicked, this, &TapePreferencesPathPage::DefaultPath);
|
||||
connect(ui->editButton, &QPushButton::clicked, this, &TapePreferencesPathPage::EditPath);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
TapePreferencesPathPage::~TapePreferencesPathPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TapePreferencesPathPage::Apply()
|
||||
{
|
||||
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
||||
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
|
||||
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
|
||||
settings->SetPathTemplate(ui->pathTable->item(3, 1)->text());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TapePreferencesPathPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
InitTable();
|
||||
}
|
||||
// remember to call base class implementation
|
||||
QWidget::changeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TapePreferencesPathPage::DefaultPath()
|
||||
{
|
||||
const int row = ui->pathTable->currentRow();
|
||||
QTableWidgetItem *item = ui->pathTable->item(row, 1);
|
||||
SCASSERT(item != nullptr)
|
||||
|
||||
QString path;
|
||||
switch (row)
|
||||
{
|
||||
case 0: // individual measurements
|
||||
path = VCommonSettings::GetDefPathIndividualMeasurements();
|
||||
break;
|
||||
case 1: // multisize measurements
|
||||
path = VCommonSettings::GetDefPathMultisizeMeasurements();
|
||||
break;
|
||||
case 2: // pattern path
|
||||
path = VCommonSettings::GetDefPathPattern();
|
||||
break;
|
||||
case 3: // templates
|
||||
path = VTapeSettings::GetDefPathTemplate();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
item->setText(path);
|
||||
item->setToolTip(path);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TapePreferencesPathPage::EditPath()
|
||||
{
|
||||
const int row = ui->pathTable->currentRow();
|
||||
QTableWidgetItem *item = ui->pathTable->item(row, 1);
|
||||
SCASSERT(item != nullptr)
|
||||
|
||||
QString path;
|
||||
switch (row)
|
||||
{
|
||||
case 0: // individual measurements
|
||||
path = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||
break;
|
||||
case 1: // multisize measurements
|
||||
path = VCommonSettings::PrepareMultisizeTables(
|
||||
MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements());
|
||||
break;
|
||||
case 2: // pattern path
|
||||
path = MApplication::VApp()->TapeSettings()->GetPathPattern();
|
||||
break;
|
||||
case 3: // templates
|
||||
path = MApplication::VApp()->TapeSettings()->GetPathTemplate();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(path);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
const QString dir = QFileDialog::getExistingDirectory(
|
||||
this, tr("Open Directory"), path,
|
||||
VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
||||
if (dir.isEmpty())
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir(path).rmpath(QChar('.'));
|
||||
}
|
||||
|
||||
DefaultPath();
|
||||
return;
|
||||
}
|
||||
|
||||
item->setText(dir);
|
||||
item->setToolTip(dir);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TapePreferencesPathPage::InitTable()
|
||||
{
|
||||
ui->pathTable->clearContents();
|
||||
ui->pathTable->setRowCount(4);
|
||||
ui->pathTable->setColumnCount(2);
|
||||
|
||||
const VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
||||
item->setToolTip(settings->GetPathIndividualMeasurements());
|
||||
ui->pathTable->setItem(0, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(1, 0, new QTableWidgetItem(tr("My Multisize Measurements")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathMultisizeMeasurements());
|
||||
item->setToolTip(settings->GetPathMultisizeMeasurements());
|
||||
ui->pathTable->setItem(1, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(2, 0, new QTableWidgetItem(tr("My Patterns")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathPattern());
|
||||
item->setToolTip(settings->GetPathPattern());
|
||||
ui->pathTable->setItem(2, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(3, 0, new QTableWidgetItem(tr("My Templates")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathTemplate());
|
||||
item->setToolTip(settings->GetPathTemplate());
|
||||
ui->pathTable->setItem(3, 1, item);
|
||||
}
|
||||
|
||||
ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
|
||||
ui->pathTable->resizeColumnsToContents();
|
||||
ui->pathTable->resizeRowsToContents();
|
||||
ui->pathTable->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file tapepreferencespathpage.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 12 4, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2017 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef TAPEPREFERENCESPATHPAGE_H
|
||||
#define TAPEPREFERENCESPATHPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TapePreferencesPathPage;
|
||||
}
|
||||
|
||||
class TapePreferencesPathPage : public QWidget
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
explicit TapePreferencesPathPage(QWidget *parent = nullptr);
|
||||
~TapePreferencesPathPage() override;
|
||||
|
||||
void Apply();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *event) override;
|
||||
private slots:
|
||||
void DefaultPath();
|
||||
void EditPath();
|
||||
|
||||
private:
|
||||
// cppcheck-suppress unknownMacro
|
||||
Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT
|
||||
Ui::TapePreferencesPathPage *ui;
|
||||
|
||||
void InitTable();
|
||||
};
|
||||
|
||||
#endif // TAPEPREFERENCESPATHPAGE_H
|
|
@ -1,111 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TapePreferencesPathPage</class>
|
||||
<widget class="QWidget" name="TapePreferencesPathPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>375</width>
|
||||
<height>276</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Paths</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Paths that Valentina uses</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="pathTable">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Path</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="defaultButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -30,7 +30,6 @@
|
|||
#include "../mapplication.h"
|
||||
#include "../vtools/dialogs/dialogtoolbox.h"
|
||||
#include "configpages/tapepreferencesconfigurationpage.h"
|
||||
#include "configpages/tapepreferencespathpage.h"
|
||||
#include "ui_dialogtapepreferences.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
@ -41,8 +40,7 @@
|
|||
DialogTapePreferences::DialogTapePreferences(QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DialogTapePreferences),
|
||||
m_configurationPage(new TapePreferencesConfigurationPage),
|
||||
m_pathPage(new TapePreferencesPathPage)
|
||||
m_configurationPage(new TapePreferencesConfigurationPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -61,7 +59,6 @@ DialogTapePreferences::DialogTapePreferences(QWidget *parent)
|
|||
connect(bApply, &QPushButton::clicked, this, &DialogTapePreferences::Apply);
|
||||
|
||||
ui->pagesWidget->insertWidget(0, m_configurationPage);
|
||||
ui->pagesWidget->insertWidget(1, m_pathPage);
|
||||
|
||||
connect(ui->contentsWidget, &QListWidget::currentItemChanged, this, &DialogTapePreferences::PageChanged);
|
||||
ui->pagesWidget->setCurrentIndex(0);
|
||||
|
@ -134,7 +131,6 @@ void DialogTapePreferences::Apply()
|
|||
QStringList preferences;
|
||||
|
||||
preferences += m_configurationPage->Apply();
|
||||
m_pathPage->Apply();
|
||||
|
||||
if (not preferences.isEmpty())
|
||||
{
|
||||
|
|
|
@ -41,7 +41,6 @@ class DialogTapePreferences;
|
|||
}
|
||||
|
||||
class TapePreferencesConfigurationPage;
|
||||
class TapePreferencesPathPage;
|
||||
class QListWidgetItem;
|
||||
|
||||
class DialogTapePreferences : public QDialog
|
||||
|
@ -69,7 +68,6 @@ private:
|
|||
Ui::DialogTapePreferences *ui;
|
||||
bool m_isInitialized{false};
|
||||
TapePreferencesConfigurationPage *m_configurationPage;
|
||||
TapePreferencesPathPage *m_pathPage;
|
||||
};
|
||||
|
||||
#endif // DIALOGTAPEPREFERENCES_H
|
||||
|
|
|
@ -70,21 +70,6 @@
|
|||
<set>ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled</set>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Paths</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
|
||||
<normaloff>:/icon/path_config.png</normaloff>:/icon/path_config.png</iconset>
|
||||
</property>
|
||||
<property name="flags">
|
||||
<set>ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled</set>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -15,7 +15,6 @@ SOURCES += \
|
|||
$$PWD/vlitepattern.cpp \
|
||||
$$PWD/dialogs/dialogtapepreferences.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp \
|
||||
$$PWD/vtapesettings.cpp \
|
||||
$$PWD/dialogs/dialogsetupmultisize.cpp
|
||||
|
||||
|
@ -36,7 +35,6 @@ HEADERS += \
|
|||
$$PWD/vlitepattern.h \
|
||||
$$PWD/dialogs/dialogtapepreferences.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h \
|
||||
$$PWD/vtapesettings.h \
|
||||
$$PWD/dialogs/dialogsetupmultisize.h
|
||||
|
||||
|
@ -51,5 +49,4 @@ FORMS += \
|
|||
$$PWD/dialogs/dialogmdatabase.ui \
|
||||
$$PWD/dialogs/dialogtapepreferences.ui \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.ui \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.ui \
|
||||
$$PWD/dialogs/dialogsetupmultisize.ui
|
||||
|
|
|
@ -185,10 +185,6 @@ QMAKE_EXTRA_COMPILERS += diagrams
|
|||
}
|
||||
|
||||
QMAKE_CLEAN += $${OUT_PWD}/$${DESTDIR}/diagrams.rcc
|
||||
|
||||
# INSTALL_MULTISIZE_MEASUREMENTS and INSTALL_STANDARD_TEMPLATES inside tables.pri
|
||||
include(../tables.pri)
|
||||
copyToDestdir($$INSTALL_STANDARD_TEMPLATES, $$shell_path($${OUT_PWD}/$${DESTDIR}/tables/templates))
|
||||
include(../translations.pri)
|
||||
|
||||
# Set "make install" command for Unix-like systems.
|
||||
|
@ -235,10 +231,6 @@ unix{
|
|||
|
||||
QMAKE_INFO_PLIST = $$PWD/../../../dist/macx/tape/Info.plist
|
||||
|
||||
# Copy to bundle multisize measurements files
|
||||
multisize.path = $$RESOURCES_DIR/tables/multisize/
|
||||
multisize.files = $$INSTALL_MULTISIZE_MEASUREMENTS
|
||||
|
||||
# Copy to bundle templates files
|
||||
templates.path = $$RESOURCES_DIR/tables/templates/
|
||||
templates.files = $$INSTALL_STANDARD_TEMPLATES
|
||||
|
@ -253,7 +245,6 @@ unix{
|
|||
|
||||
QMAKE_BUNDLE_DATA += \
|
||||
templates \
|
||||
multisize \
|
||||
libraries \
|
||||
format
|
||||
}
|
||||
|
|
|
@ -77,7 +77,6 @@ VToolApp {
|
|||
"dialogmdatabase.cpp",
|
||||
"dialogtapepreferences.cpp",
|
||||
"configpages/tapepreferencesconfigurationpage.cpp",
|
||||
"configpages/tapepreferencespathpage.cpp",
|
||||
"dialogsetupmultisize.cpp",
|
||||
"dialogdimensioncustomnames.h",
|
||||
"dialogdimensionlabels.h",
|
||||
|
@ -88,7 +87,6 @@ VToolApp {
|
|||
"dialogmdatabase.h",
|
||||
"dialogtapepreferences.h",
|
||||
"configpages/tapepreferencesconfigurationpage.h",
|
||||
"configpages/tapepreferencespathpage.h",
|
||||
"dialogsetupmultisize.h",
|
||||
"dialogdimensioncustomnames.ui",
|
||||
"dialogdimensionlabels.ui",
|
||||
|
@ -99,7 +97,6 @@ VToolApp {
|
|||
"dialogmdatabase.ui",
|
||||
"dialogtapepreferences.ui",
|
||||
"configpages/tapepreferencesconfigurationpage.ui",
|
||||
"configpages/tapepreferencespathpage.ui",
|
||||
"dialogsetupmultisize.ui",
|
||||
]
|
||||
}
|
||||
|
@ -122,43 +119,6 @@ VToolApp {
|
|||
}
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "Multisize tables"
|
||||
prefix: project.sourceDirectory + "/src/app/share/tables/multisize/"
|
||||
files: [
|
||||
"GOST_man_ru.vst"
|
||||
]
|
||||
qbs.install: true
|
||||
qbs.installDir: {
|
||||
if (qbs.targetOS.contains("macos") && !buildconfig.enableMultiBundle)
|
||||
return buildconfig.installAppPath + "/Valentina.app/Contents/Resources/tables/multisize"
|
||||
|
||||
if (qbs.targetOS.contains("linux"))
|
||||
return "share/valentina/tables/multisize"
|
||||
|
||||
return buildconfig.installDataPath + "/tables/multisize"
|
||||
}
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "Measurements templates"
|
||||
prefix: project.sourceDirectory + "/src/app/share/tables/templates/"
|
||||
files: [
|
||||
"template_all_measurements.vit",
|
||||
"t_Aldrich_Women.vit"
|
||||
]
|
||||
qbs.install: true
|
||||
qbs.installDir: {
|
||||
if (qbs.targetOS.contains("macos") && !buildconfig.enableMultiBundle)
|
||||
return buildconfig.installAppPath + "/Valentina.app/Contents/Resources/tables/templates"
|
||||
|
||||
if (qbs.targetOS.contains("linux"))
|
||||
return "share/valentina/tables/templates"
|
||||
|
||||
return buildconfig.installDataPath + "/tables/templates"
|
||||
}
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "48x48/apps"
|
||||
prefix: project.sourceDirectory + "/share/icons/48x48/apps/"
|
||||
|
|
|
@ -136,15 +136,9 @@ auto SaveDirPath(const QString &curFile, MeasurementsType mType) -> QString
|
|||
QString dir;
|
||||
if (curFile.isEmpty())
|
||||
{
|
||||
if (mType == MeasurementsType::Individual)
|
||||
{
|
||||
dir = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
|
||||
dir = VCommonSettings::PrepareMultisizeTables(dir);
|
||||
}
|
||||
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||
dir = (mType == MeasurementsType::Individual ? settings->GetPathIndividualMeasurements()
|
||||
: settings->GetPathMultisizeMeasurements());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -614,20 +608,13 @@ void TMainWindow::OpenIndividual()
|
|||
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit);;") + tr("Multisize measurements") +
|
||||
QStringLiteral(" (*.vst);;") + tr("All files") + QStringLiteral(" (*.*)");
|
||||
// Use standard path to individual measurements
|
||||
const QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(pathTo);
|
||||
if (not directory.exists())
|
||||
pathTo = Open(pathTo, filter);
|
||||
|
||||
if (!pathTo.isEmpty())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
Open(pathTo, filter);
|
||||
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir(pathTo).rmpath(QChar('.'));
|
||||
MApplication::VApp()->TapeSettings()->SetPathIndividualMeasurements(pathTo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -638,9 +625,13 @@ void TMainWindow::OpenMultisize()
|
|||
QStringLiteral(" (*.vit);;") + tr("All files") + QStringLiteral(" (*.*)");
|
||||
// Use standard path to multisize measurements
|
||||
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
|
||||
pathTo = VCommonSettings::PrepareMultisizeTables(pathTo);
|
||||
|
||||
Open(pathTo, filter);
|
||||
pathTo = Open(pathTo, filter);
|
||||
|
||||
if (!pathTo.isEmpty())
|
||||
{
|
||||
MApplication::VApp()->TapeSettings()->SetPathMultisizeMeasurements(pathTo);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -650,8 +641,12 @@ void TMainWindow::OpenTemplate()
|
|||
tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") + QStringLiteral(" (*.*)");
|
||||
// Use standard path to template files
|
||||
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathTemplate();
|
||||
pathTo = VTapeSettings::PrepareStandardTemplates(pathTo);
|
||||
Open(pathTo, filter);
|
||||
pathTo = Open(pathTo, filter);
|
||||
|
||||
if (!pathTo.isEmpty())
|
||||
{
|
||||
MApplication::VApp()->TapeSettings()->SetPathTemplate(pathTo);
|
||||
}
|
||||
|
||||
if (m_m != nullptr)
|
||||
{ // The file was opened.
|
||||
|
@ -991,12 +986,6 @@ auto TMainWindow::FileSaveAs() -> bool
|
|||
fName += QChar('.') + suffix;
|
||||
|
||||
const QString dir = SaveDirPath(m_curFile, m_mType);
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(dir);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
if (not m_curFile.isEmpty())
|
||||
{
|
||||
|
@ -1006,15 +995,6 @@ auto TMainWindow::FileSaveAs() -> bool
|
|||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
auto RemoveTempDir = qScopeGuard(
|
||||
[usedNotExistedDir, dir]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir(dir).rmpath(QChar('.'));
|
||||
}
|
||||
});
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return false;
|
||||
|
@ -1026,6 +1006,14 @@ auto TMainWindow::FileSaveAs() -> bool
|
|||
fileName += QChar('.') + suffix;
|
||||
}
|
||||
|
||||
if (m_curFile.isEmpty())
|
||||
{
|
||||
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||
m_mType == MeasurementsType::Individual
|
||||
? settings->SetPathIndividualMeasurements(QFileInfo(fileName).absolutePath())
|
||||
: settings->SetPathMultisizeMeasurements(QFileInfo(fileName).absolutePath());
|
||||
}
|
||||
|
||||
if (QFileInfo::exists(fileName) && m_curFile != fileName)
|
||||
{
|
||||
// Temporary try to lock the file before saving
|
||||
|
@ -2371,27 +2359,11 @@ void TMainWindow::ExportToIndividual()
|
|||
dir = QFileInfo(m_curFile).absolutePath();
|
||||
}
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(dir);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
||||
QString fName = tr("measurements.vit");
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName, filters,
|
||||
nullptr, VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
auto RemoveTempDir = qScopeGuard(
|
||||
[usedNotExistedDir, dir]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir(dir).rmpath(QChar('.'));
|
||||
}
|
||||
});
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
|
@ -2404,6 +2376,11 @@ void TMainWindow::ExportToIndividual()
|
|||
fileName += QChar('.') + suffix;
|
||||
}
|
||||
|
||||
if (m_curFile.isEmpty())
|
||||
{
|
||||
MApplication::VApp()->TapeSettings()->SetPathIndividualMeasurements(QFileInfo(fileName).absolutePath());
|
||||
}
|
||||
|
||||
QScopedPointer<VContainer> tmpData(
|
||||
new VContainer(VAbstractApplication::VApp()->TrVars(), &m_mUnit, VContainer::UniqueNamespace()));
|
||||
|
||||
|
@ -3633,7 +3610,7 @@ auto TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::Open(const QString &pathTo, const QString &filter)
|
||||
auto TMainWindow::Open(const QString &pathTo, const QString &filter) -> QString
|
||||
{
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
@ -3649,6 +3626,8 @@ void TMainWindow::Open(const QString &pathTo, const QString &filter)
|
|||
MApplication::VApp()->NewMainWindow()->LoadFile(mPath);
|
||||
}
|
||||
}
|
||||
|
||||
return mPath;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -237,7 +237,7 @@ private:
|
|||
auto EvalFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label, bool specialUnits) -> bool;
|
||||
void ShowMDiagram(const QString &name);
|
||||
|
||||
void Open(const QString &pathTo, const QString &filter);
|
||||
auto Open(const QString &pathTo, const QString &filter) -> QString;
|
||||
void UpdatePadlock(bool ro);
|
||||
void MeasurementGUI();
|
||||
void Controls();
|
||||
|
|
|
@ -63,22 +63,10 @@ VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organiza
|
|||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VTapeSettings::PrepareStandardTemplates(const QString ¤tPath) -> QString
|
||||
{
|
||||
return PrepareStandardFiles(currentPath, StandardTemplatesPath(), GetDefPathTemplate());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VTapeSettings::GetDefPathTemplate() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("templates");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VTapeSettings::GetPathTemplate() const -> QString
|
||||
{
|
||||
return value(*settingPathsTemplates, GetDefPathTemplate()).toString();
|
||||
return value(*settingPathsTemplates, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -48,9 +48,6 @@ public:
|
|||
QObject *parent = nullptr);
|
||||
~VTapeSettings() override = default;
|
||||
|
||||
static auto PrepareStandardTemplates(const QString ¤tPath) -> QString;
|
||||
|
||||
static auto GetDefPathTemplate() -> QString;
|
||||
auto GetPathTemplate() const -> QString;
|
||||
void SetPathTemplate(const QString &value);
|
||||
|
||||
|
|
|
@ -67,16 +67,10 @@ PreferencesPathPage::~PreferencesPathPage()
|
|||
auto PreferencesPathPage::Apply() -> QStringList
|
||||
{
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
||||
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
|
||||
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
|
||||
settings->SetPathLayout(ui->pathTable->item(3, 1)->text());
|
||||
settings->SetPathLabelTemplate(ui->pathTable->item(4, 1)->text());
|
||||
settings->SetPathManualLayouts(ui->pathTable->item(5, 1)->text());
|
||||
settings->SetPathSVGFonts(ui->pathTable->item(6, 1)->text());
|
||||
settings->SetPathFontCorrections(ui->pathTable->item(7, 1)->text());
|
||||
settings->SetPathSVGFonts(ui->pathTable->item(0, 1)->text());
|
||||
settings->SetPathFontCorrections(ui->pathTable->item(1, 1)->text());
|
||||
|
||||
return {}; // No changes those require restart.
|
||||
return {}; // No changes which require restart.
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -103,28 +97,10 @@ void PreferencesPathPage::DefaultPath()
|
|||
|
||||
switch (row)
|
||||
{
|
||||
case 1: // multisize measurements
|
||||
path = VCommonSettings::GetDefPathMultisizeMeasurements();
|
||||
break;
|
||||
case 2: // pattern path
|
||||
path = VValentinaSettings::GetDefPathPattern();
|
||||
break;
|
||||
case 0: // individual measurements
|
||||
path = VCommonSettings::GetDefPathIndividualMeasurements();
|
||||
break;
|
||||
case 3: // layout path
|
||||
path = VValentinaSettings::GetDefPathLayout();
|
||||
break;
|
||||
case 4: // label templates
|
||||
path = VValentinaSettings::GetDefPathLabelTemplate();
|
||||
break;
|
||||
case 5: // manual layouts
|
||||
path = VCommonSettings::GetDefPathManualLayouts();
|
||||
break;
|
||||
case 6: // svg fonts
|
||||
case 0: // svg fonts
|
||||
path = VCommonSettings::GetDefPathSVGFonts();
|
||||
break;
|
||||
case 7: // font corrections
|
||||
case 1: // font corrections
|
||||
path = VCommonSettings::GetDefPathFontCorrections();
|
||||
break;
|
||||
default:
|
||||
|
@ -145,29 +121,10 @@ void PreferencesPathPage::EditPath()
|
|||
QString path;
|
||||
switch (row)
|
||||
{
|
||||
case 0: // individual measurements
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||
break;
|
||||
case 1: // multisize measurements
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements();
|
||||
path = VCommonSettings::PrepareMultisizeTables(path);
|
||||
break;
|
||||
case 2: // pattern path
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathPattern();
|
||||
break;
|
||||
case 3: // layout path
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout();
|
||||
break;
|
||||
case 4: // label templates
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate();
|
||||
break;
|
||||
case 5: // manual layouts
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathManualLayouts();
|
||||
break;
|
||||
case 6: // svg fonts
|
||||
case 0: // svg fonts
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathSVGFonts();
|
||||
break;
|
||||
case 7: // font corrections
|
||||
case 1: // font corrections
|
||||
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathFontCorrections();
|
||||
break;
|
||||
default:
|
||||
|
@ -207,65 +164,23 @@ void PreferencesPathPage::EditPath()
|
|||
void PreferencesPathPage::InitTable()
|
||||
{
|
||||
ui->pathTable->clearContents();
|
||||
ui->pathTable->setRowCount(8);
|
||||
ui->pathTable->setRowCount(2);
|
||||
ui->pathTable->setColumnCount(2);
|
||||
|
||||
const VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
||||
item->setToolTip(settings->GetPathIndividualMeasurements());
|
||||
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My SVG Fonts")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathSVGFonts());
|
||||
item->setToolTip(settings->GetPathSVGFonts());
|
||||
ui->pathTable->setItem(0, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(1, 0, new QTableWidgetItem(tr("My Multisize Measurements")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathMultisizeMeasurements());
|
||||
item->setToolTip(settings->GetPathMultisizeMeasurements());
|
||||
ui->pathTable->setItem(1, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(2, 0, new QTableWidgetItem(tr("My Patterns")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathPattern());
|
||||
item->setToolTip(settings->GetPathPattern());
|
||||
ui->pathTable->setItem(2, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(3, 0, new QTableWidgetItem(tr("My Layouts")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathLayout());
|
||||
item->setToolTip(settings->GetPathLayout());
|
||||
ui->pathTable->setItem(3, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(4, 0, new QTableWidgetItem(tr("My label templates")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathLabelTemplate());
|
||||
item->setToolTip(settings->GetPathLabelTemplate());
|
||||
ui->pathTable->setItem(4, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(5, 0, new QTableWidgetItem(tr("My manual layouts")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathManualLayouts());
|
||||
item->setToolTip(settings->GetPathManualLayouts());
|
||||
ui->pathTable->setItem(5, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(6, 0, new QTableWidgetItem(tr("My SVG Fonts")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathSVGFonts());
|
||||
item->setToolTip(settings->GetPathSVGFonts());
|
||||
ui->pathTable->setItem(6, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
ui->pathTable->setItem(7, 0, new QTableWidgetItem(tr("My font corrections")));
|
||||
ui->pathTable->setItem(1, 0, new QTableWidgetItem(tr("My font corrections")));
|
||||
auto *item = new QTableWidgetItem(settings->GetPathFontCorrections());
|
||||
item->setToolTip(settings->GetPathFontCorrections());
|
||||
ui->pathTable->setItem(7, 1, item);
|
||||
ui->pathTable->setItem(1, 1, item);
|
||||
}
|
||||
|
||||
ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
|
||||
|
|
|
@ -506,11 +506,12 @@ void DialogPatternProperties::ShowImage()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::BrowseLabelPath()
|
||||
{
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
|
||||
QString path = ui->lineEditPieceLabelPath->text();
|
||||
if (path.isEmpty())
|
||||
{
|
||||
path = VValentinaSettings::PrepareLabelTemplates(
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate());
|
||||
path = settings->GetPathLabelTemplate();
|
||||
}
|
||||
|
||||
QString filters(tr("Label template") + QLatin1String("(*.xml)"));
|
||||
|
@ -519,6 +520,11 @@ void DialogPatternProperties::BrowseLabelPath()
|
|||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
ui->lineEditPieceLabelPath->setText(filePath);
|
||||
|
||||
if (!filePath.isEmpty() && QFileInfo::exists(filePath))
|
||||
{
|
||||
settings->SetPathLabelTemplate(QFileInfo(filePath).absolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -130,13 +130,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
|||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
const QString dirPath = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout();
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(dirPath);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
const QString dirPath = settings->GetPathLayout();
|
||||
|
||||
const QString dir = QFileDialog::getExistingDirectory(
|
||||
this, tr("Select folder"), dirPath,
|
||||
|
@ -145,12 +140,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
|||
if (not dir.isEmpty())
|
||||
{ // If paths equal the signal will not be called, we will do this manually
|
||||
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
||||
}
|
||||
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir directory(dirPath);
|
||||
directory.rmpath(QChar('.'));
|
||||
settings->SetPathLayout(dir);
|
||||
}
|
||||
});
|
||||
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
|
||||
|
@ -396,6 +387,12 @@ void DialogSaveLayout::Save()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (QFile::exists(Path()))
|
||||
{
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->SetPathLayout(Path());
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "../ifc/exception/vexceptionconversionerror.h"
|
||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||
|
@ -2008,17 +2009,11 @@ void MainWindow::ScaleChanged(qreal scale)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::LoadIndividual()
|
||||
{
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit);;") + tr("Multisize measurements") +
|
||||
QStringLiteral(" (*.vst)");
|
||||
// Use standard path to individual measurements
|
||||
const QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(path);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
const QString path = settings->GetPathIndividualMeasurements();
|
||||
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
@ -2041,12 +2036,8 @@ void MainWindow::LoadIndividual()
|
|||
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir directory(path);
|
||||
directory.rmpath(QChar('.'));
|
||||
settings->SetPathIndividualMeasurements(QFileInfo(mPath).absolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2057,29 +2048,32 @@ void MainWindow::LoadMultisize()
|
|||
QStringLiteral("(*.vit)");
|
||||
// Use standard path to multisize measurements
|
||||
QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements();
|
||||
path = VCommonSettings::PrepareMultisizeTables(path);
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
if (not mPath.isEmpty())
|
||||
if (mPath.isEmpty())
|
||||
{
|
||||
if (LoadMeasurements(mPath))
|
||||
{
|
||||
if (not doc->MPath().isEmpty())
|
||||
{
|
||||
m_watcher->removePath(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
|
||||
}
|
||||
ui->actionUnloadMeasurements->setEnabled(true);
|
||||
doc->SetMPath(RelativeMPath(VAbstractValApplication::VApp()->GetPatternPath(), mPath));
|
||||
m_watcher->addPath(mPath);
|
||||
PatternChangesWereSaved(false);
|
||||
ui->actionEditCurrent->setEnabled(true);
|
||||
statusBar()->showMessage(tr("Measurements loaded"), 5000);
|
||||
doc->LiteParseTree(Document::FullLiteParse);
|
||||
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!LoadMeasurements(mPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (not doc->MPath().isEmpty())
|
||||
{
|
||||
m_watcher->removePath(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
|
||||
}
|
||||
ui->actionUnloadMeasurements->setEnabled(true);
|
||||
doc->SetMPath(RelativeMPath(VAbstractValApplication::VApp()->GetPatternPath(), mPath));
|
||||
m_watcher->addPath(mPath);
|
||||
PatternChangesWereSaved(false);
|
||||
ui->actionEditCurrent->setEnabled(true);
|
||||
statusBar()->showMessage(tr("Measurements loaded"), 5000);
|
||||
doc->LiteParseTree(Document::FullLiteParse);
|
||||
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -4082,43 +4076,20 @@ void MainWindow::ActionLayout(bool checked)
|
|||
*/
|
||||
auto MainWindow::on_actionSaveAs_triggered() -> bool
|
||||
{
|
||||
QString dir;
|
||||
if (VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
|
||||
{
|
||||
dir = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathPattern();
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).absolutePath();
|
||||
}
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(dir);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
QString patternPath = VAbstractValApplication::VApp()->GetPatternPath();
|
||||
QString dir = patternPath.isEmpty() ? settings->GetPathPattern() : QFileInfo(patternPath).absolutePath();
|
||||
|
||||
QString newFileName = tr("pattern") + QStringLiteral(".val");
|
||||
if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
|
||||
if (not patternPath.isEmpty())
|
||||
{
|
||||
newFileName = StrippedName(VAbstractValApplication::VApp()->GetPatternPath());
|
||||
newFileName = StrippedName(patternPath);
|
||||
}
|
||||
|
||||
QString filters(tr("Pattern files") + QStringLiteral("(*.val)"));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + newFileName, filters,
|
||||
nullptr, VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
auto RemoveTempDir = qScopeGuard(
|
||||
[usedNotExistedDir, dir]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir directory(dir);
|
||||
directory.rmpath(QChar('.'));
|
||||
}
|
||||
});
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return false;
|
||||
|
@ -4130,7 +4101,12 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool
|
|||
fileName += QLatin1String(".val");
|
||||
}
|
||||
|
||||
if (f.exists() && VAbstractValApplication::VApp()->GetPatternPath() != fileName)
|
||||
if (patternPath.isEmpty())
|
||||
{
|
||||
settings->SetPathPattern(QFileInfo(fileName).absolutePath());
|
||||
}
|
||||
|
||||
if (f.exists() && patternPath != fileName)
|
||||
{
|
||||
// Temporary try to lock the file before saving
|
||||
// Also help to rewite current read-only pattern
|
||||
|
@ -4294,25 +4270,10 @@ void MainWindow::on_actionUpdateManualLayout_triggered()
|
|||
{
|
||||
const QString filter(tr("Manual layout files") + QStringLiteral(" (*.vlt)"));
|
||||
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
|
||||
// Use standard path to manual layouts
|
||||
const QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathManualLayouts();
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(path);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
auto RemoveUnsuded = qScopeGuard(
|
||||
[usedNotExistedDir, path]()
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir directory(path);
|
||||
directory.rmpath(QChar('.'));
|
||||
}
|
||||
});
|
||||
const QString path = settings->GetPathManualLayouts();
|
||||
|
||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Select manual layout"), path, filter, nullptr);
|
||||
|
||||
|
@ -4321,6 +4282,8 @@ void MainWindow::on_actionUpdateManualLayout_triggered()
|
|||
return;
|
||||
}
|
||||
|
||||
settings->SetPathManualLayouts(QFileInfo(filePath).absolutePath());
|
||||
|
||||
QTemporaryFile rldFile(QDir::tempPath() + "/puzzle.rld.XXXXXX");
|
||||
rldFile.setAutoRemove(false);
|
||||
if (rldFile.open())
|
||||
|
@ -6848,145 +6811,132 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri
|
|||
|
||||
auto FindLocation = [this](const QString &filter, const QString &dirPath, const QString &selectedName)
|
||||
{
|
||||
VCommonSettings::PrepareMultisizeTables(VCommonSettings::GetDefPathMultisizeMeasurements());
|
||||
|
||||
bool usedNotExistedDir = false;
|
||||
QDir directory(dirPath);
|
||||
if (not directory.exists())
|
||||
{
|
||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||
}
|
||||
|
||||
QString mPath;
|
||||
|
||||
QFileDialog dialog(this, tr("Open file"), dirPath, filter);
|
||||
dialog.selectFile(selectedName);
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setOption(QFileDialog::DontUseNativeDialog,
|
||||
VAbstractApplication::VApp()->Settings()->IsDontUseNativeDialog());
|
||||
|
||||
QString mPath;
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
mPath = dialog.selectedFiles().value(0);
|
||||
}
|
||||
|
||||
if (usedNotExistedDir)
|
||||
{
|
||||
QDir(dirPath).rmpath(QChar('.'));
|
||||
}
|
||||
|
||||
return mPath;
|
||||
};
|
||||
|
||||
QFileInfo table(path);
|
||||
if (not table.exists())
|
||||
if (table.exists())
|
||||
{
|
||||
if (not VApplication::IsGUIMode())
|
||||
{
|
||||
return {}; // console mode doesn't support fixing path to a measurement file
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
const QString text = tr("The measurements file <br/><br/> <b>%1</b> <br/><br/> could not be found. Do you "
|
||||
"want to update the file location?")
|
||||
.arg(path);
|
||||
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Loading measurements file"), text,
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
if (res == QMessageBox::No)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
if (not VApplication::IsGUIMode())
|
||||
{
|
||||
return {}; // console mode doesn't support fixing path to a measurement file
|
||||
}
|
||||
|
||||
MeasurementsType patternType;
|
||||
if (table.suffix() == QLatin1String("vst"))
|
||||
const QString text = tr("The measurements file <br/><br/> <b>%1</b> <br/><br/> could not be found. Do you "
|
||||
"want to update the file location?")
|
||||
.arg(path);
|
||||
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Loading measurements file"), text,
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
if (res == QMessageBox::No)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
MeasurementsType patternType;
|
||||
if (table.suffix() == QLatin1String("vst"))
|
||||
{
|
||||
patternType = MeasurementsType::Multisize;
|
||||
}
|
||||
else
|
||||
{
|
||||
patternType = MeasurementsType::Individual; // or Unknown
|
||||
}
|
||||
|
||||
auto DirPath = [patternPath, table](const QString &defPath, QString &selectedName)
|
||||
{
|
||||
QString dirPath;
|
||||
const QDir patternDir = QFileInfo(patternPath).absoluteDir();
|
||||
QString measurements = table.fileName();
|
||||
if (patternDir.exists(measurements))
|
||||
{
|
||||
patternType = MeasurementsType::Multisize;
|
||||
selectedName = measurements;
|
||||
dirPath = patternDir.absolutePath();
|
||||
}
|
||||
else if (patternDir.exists(measurements.replace(' ', '_')))
|
||||
{
|
||||
selectedName = measurements.replace(' ', '_');
|
||||
dirPath = patternDir.absolutePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
patternType = MeasurementsType::Individual; // or Unknown
|
||||
dirPath = defPath;
|
||||
}
|
||||
return dirPath;
|
||||
};
|
||||
|
||||
auto DirPath = [patternPath, table](const QString &defPath, QString &selectedName)
|
||||
{
|
||||
QString dirPath;
|
||||
const QDir patternDir = QFileInfo(patternPath).absoluteDir();
|
||||
QString measurements = table.fileName();
|
||||
if (patternDir.exists(measurements))
|
||||
{
|
||||
selectedName = measurements;
|
||||
dirPath = patternDir.absolutePath();
|
||||
}
|
||||
else if (patternDir.exists(measurements.replace(' ', '_')))
|
||||
{
|
||||
selectedName = measurements.replace(' ', '_');
|
||||
dirPath = patternDir.absolutePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
dirPath = defPath;
|
||||
}
|
||||
return dirPath;
|
||||
};
|
||||
QString mPath;
|
||||
if (patternType == MeasurementsType::Multisize)
|
||||
{
|
||||
const QString filter = tr("Multisize measurements") + QStringLiteral(" (*.vst);;") +
|
||||
tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
||||
// Use standard path to multisize measurements
|
||||
QString selectedName;
|
||||
const QString dirPath =
|
||||
DirPath(VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements(), selectedName);
|
||||
mPath = FindLocation(filter, dirPath, selectedName);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit);;") +
|
||||
tr("Multisize measurements") + QStringLiteral(" (*.vst)");
|
||||
// Use standard path to individual measurements
|
||||
QString selectedName;
|
||||
const QString dirPath = DirPath(
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetPathIndividualMeasurements(), selectedName);
|
||||
mPath = FindLocation(filter, dirPath, selectedName);
|
||||
}
|
||||
|
||||
QString mPath;
|
||||
if (patternType == MeasurementsType::Multisize)
|
||||
{
|
||||
const QString filter = tr("Multisize measurements") + QStringLiteral(" (*.vst);;") +
|
||||
tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
||||
// Use standard path to multisize measurements
|
||||
QString selectedName;
|
||||
const QString dirPath = DirPath(
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements(), selectedName);
|
||||
mPath = FindLocation(filter, dirPath, selectedName);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit);;") +
|
||||
tr("Multisize measurements") + QStringLiteral(" (*.vst)");
|
||||
// Use standard path to individual measurements
|
||||
QString selectedName;
|
||||
const QString dirPath = DirPath(
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetPathIndividualMeasurements(), selectedName);
|
||||
mPath = FindLocation(filter, dirPath, selectedName);
|
||||
}
|
||||
|
||||
if (mPath.isEmpty())
|
||||
{
|
||||
return mPath;
|
||||
}
|
||||
|
||||
QScopedPointer<VMeasurements> m(new VMeasurements(pattern));
|
||||
m->setXMLContent(mPath);
|
||||
|
||||
patternType = m->Type();
|
||||
|
||||
if (patternType == MeasurementsType::Unknown)
|
||||
{
|
||||
throw VException(tr("Measurement file has unknown format."));
|
||||
}
|
||||
|
||||
if (patternType == MeasurementsType::Multisize)
|
||||
{
|
||||
VVSTConverter converter(mPath);
|
||||
m->setXMLContent(converter.Convert()); // Read again after conversion
|
||||
}
|
||||
else
|
||||
{
|
||||
VVITConverter converter(mPath);
|
||||
m->setXMLContent(converter.Convert()); // Read again after conversion
|
||||
}
|
||||
|
||||
if (not m->IsDefinedKnownNamesValid())
|
||||
{
|
||||
throw VException(tr("Measurement file contains invalid known measurement(s)."));
|
||||
}
|
||||
|
||||
CheckRequiredMeasurements(m.data());
|
||||
|
||||
VAbstractValApplication::VApp()->SetMeasurementsType(patternType);
|
||||
doc->SetMPath(RelativeMPath(patternPath, mPath));
|
||||
if (mPath.isEmpty())
|
||||
{
|
||||
return mPath;
|
||||
}
|
||||
return path;
|
||||
|
||||
QScopedPointer<VMeasurements> m(new VMeasurements(pattern));
|
||||
m->setXMLContent(mPath);
|
||||
|
||||
patternType = m->Type();
|
||||
|
||||
if (patternType == MeasurementsType::Unknown)
|
||||
{
|
||||
throw VException(tr("Measurement file has unknown format."));
|
||||
}
|
||||
|
||||
if (patternType == MeasurementsType::Multisize)
|
||||
{
|
||||
VVSTConverter converter(mPath);
|
||||
m->setXMLContent(converter.Convert()); // Read again after conversion
|
||||
}
|
||||
else
|
||||
{
|
||||
VVITConverter converter(mPath);
|
||||
m->setXMLContent(converter.Convert()); // Read again after conversion
|
||||
}
|
||||
|
||||
if (not m->IsDefinedKnownNamesValid())
|
||||
{
|
||||
throw VException(tr("Measurement file contains invalid known measurement(s)."));
|
||||
}
|
||||
|
||||
CheckRequiredMeasurements(m.data());
|
||||
|
||||
VAbstractValApplication::VApp()->SetMeasurementsType(patternType);
|
||||
doc->SetMPath(RelativeMPath(patternPath, mPath));
|
||||
return mPath;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -133,9 +133,6 @@ message(Examples: $$[QT_INSTALL_EXAMPLES])
|
|||
# Path to recource file.
|
||||
win32:RC_FILE = share/resources/valentina.rc
|
||||
|
||||
# INSTALL_MULTISIZE_MEASUREMENTS and INSTALL_STANDARD_TEMPLATES inside tables.pri
|
||||
include(../tables.pri)
|
||||
|
||||
include(../svgfont.pri)
|
||||
|
||||
win32 {
|
||||
|
@ -236,18 +233,10 @@ unix{
|
|||
translations.path = $$PKGDATADIR/translations/
|
||||
translations.files = $$INSTALL_TRANSLATIONS
|
||||
|
||||
# Path to multisize measurement after installation
|
||||
multisize.path = $$PKGDATADIR/tables/multisize/
|
||||
multisize.files = $$INSTALL_MULTISIZE_MEASUREMENTS
|
||||
|
||||
# Path to templates after installation
|
||||
templates.path = $$PKGDATADIR/tables/templates/
|
||||
templates.files = $$INSTALL_STANDARD_TEMPLATES
|
||||
|
||||
# Path to label templates after installation
|
||||
label.path = $$PKGDATADIR/labels/
|
||||
label.files = $$INSTALL_LABEL_TEMPLATES
|
||||
|
||||
svgfonts.path = $$PKGDATADIR/svgfonts/
|
||||
svgfonts.files = $$INSTALL_SVG_FONTS
|
||||
|
||||
|
@ -268,9 +257,7 @@ unix{
|
|||
hicolor_512_apps \
|
||||
hicolor_512_mimetypes \
|
||||
translations \
|
||||
multisize \
|
||||
templates \
|
||||
label \
|
||||
svgfonts
|
||||
}
|
||||
macx{
|
||||
|
@ -313,18 +300,10 @@ unix{
|
|||
|
||||
QMAKE_INFO_PLIST = $$PWD/../../../dist/macx/valentina/Info.plist
|
||||
|
||||
# Copy to bundle multisize measurements files
|
||||
multisize.path = $$RESOURCES_DIR/tables/multisize/
|
||||
multisize.files = $$INSTALL_MULTISIZE_MEASUREMENTS
|
||||
|
||||
# Copy to bundle templates files
|
||||
templates.path = $$RESOURCES_DIR/tables/templates/
|
||||
templates.files = $$INSTALL_STANDARD_TEMPLATES
|
||||
|
||||
# Path to label templates after installation
|
||||
label.path = $$RESOURCES_DIR/labels/
|
||||
label.files = $$INSTALL_LABEL_TEMPLATES
|
||||
|
||||
svgfonts.path = $$RESOURCES_DIR/svgfonts/
|
||||
svgfonts.files = $$INSTALL_SVG_FONTS
|
||||
|
||||
|
@ -340,8 +319,6 @@ unix{
|
|||
|
||||
QMAKE_BUNDLE_DATA += \
|
||||
templates \
|
||||
multisize \
|
||||
label \
|
||||
svgfonts \
|
||||
libraries \
|
||||
tape \
|
||||
|
@ -442,18 +419,10 @@ win32:*g++* {
|
|||
package.CONFIG = no_check_exist
|
||||
INSTALLS += package
|
||||
|
||||
package_tables.path = $${OUT_PWD}/../../../package/valentina/tables/multisize
|
||||
package_tables.files += $$INSTALL_MULTISIZE_MEASUREMENTS
|
||||
INSTALLS += package_tables
|
||||
|
||||
package_templates.path = $${OUT_PWD}/../../../package/valentina/tables/templates
|
||||
package_templates.files += $$INSTALL_STANDARD_TEMPLATES
|
||||
INSTALLS += package_templates
|
||||
|
||||
package_labels.path = $${OUT_PWD}/../../../package/valentina/labels
|
||||
package_labels.files += $$INSTALL_LABEL_TEMPLATES
|
||||
INSTALLS += package_labels
|
||||
|
||||
package_svgfonts.path = $${OUT_PWD}/../../../package/valentina/svgfonts
|
||||
package_svgfonts.files += $$INSTALL_SVG_FONTS
|
||||
INSTALLS += package_svgfonts
|
||||
|
|
|
@ -196,38 +196,6 @@ VToolApp {
|
|||
}
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "Label templates"
|
||||
prefix: project.sourceDirectory + "/src/app/share/labels/"
|
||||
files: [
|
||||
"def_pattern_label.xml",
|
||||
"def_piece_label.xml"
|
||||
]
|
||||
qbs.install: true
|
||||
qbs.installDir: buildconfig.installDataPath + "/labels"
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "Multisize tables"
|
||||
prefix: project.sourceDirectory + "/src/app/share/tables/multisize/"
|
||||
files: [
|
||||
"GOST_man_ru.vst"
|
||||
]
|
||||
qbs.install: true
|
||||
qbs.installDir: buildconfig.installDataPath + "/tables/multisize"
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "Measurements templates"
|
||||
prefix: project.sourceDirectory + "/src/app/share/tables/templates/"
|
||||
files: [
|
||||
"template_all_measurements.vit",
|
||||
"t_Aldrich_Women.vit"
|
||||
]
|
||||
qbs.install: true
|
||||
qbs.installDir: buildconfig.installDataPath + "/tables/templates"
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "SVG Fonts"
|
||||
prefix: project.sourceDirectory + "/src/app/share/svgfonts/"
|
||||
|
|
|
@ -265,89 +265,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, commonIniFilename, (QLatin1String("comm
|
|||
const QString VCommonSettings::unixStandardSharePath = QStringLiteral(PKGDATADIR); // NOLINT(cert-err58-cpp)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool replaceOnConflit)
|
||||
{
|
||||
QDir dir;
|
||||
dir.setPath(fromDir);
|
||||
|
||||
const QStringList list = dir.entryList(QDir::Files);
|
||||
for (const QString ©File : list)
|
||||
{
|
||||
const QString from = fromDir + QDir::separator() + copyFile;
|
||||
QString to = toDir + QDir::separator() + copyFile;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
{
|
||||
// To fix issue #702 check each not symlink if it is actually broken symlink.
|
||||
// Also trying to mimic Unix symlink. If a file eaxists do not create a symlink and remove it if exists.
|
||||
QFile fileTo(to);
|
||||
if (fileTo.exists())
|
||||
{
|
||||
if (not fileTo.rename(to + QLatin1String(".lnk")))
|
||||
{
|
||||
QFile::remove(to + QLatin1String(".lnk"));
|
||||
fileTo.rename(to + QLatin1String(".lnk"));
|
||||
}
|
||||
|
||||
QFileInfo info(to + QLatin1String(".lnk"));
|
||||
if (info.symLinkTarget().isEmpty())
|
||||
{
|
||||
fileTo.copy(to);
|
||||
fileTo.remove();
|
||||
continue; // The file already exists, skip creating shortcut
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
to = to + QLatin1String(".lnk");
|
||||
#endif
|
||||
|
||||
QFileInfo fileTo(to);
|
||||
if (not fileTo.isSymLink() && fileTo.exists())
|
||||
{
|
||||
if (replaceOnConflit)
|
||||
{
|
||||
QFile::remove(to);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (fileTo.isSymLink())
|
||||
{
|
||||
if (not fileTo.exists() || replaceOnConflit)
|
||||
{ // automatically fix broken symlink
|
||||
QFile::remove(to);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
QFile::link(from, to);
|
||||
}
|
||||
|
||||
const QStringList dirList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
for (const QString ©Dir : dirList)
|
||||
{
|
||||
const QString from = fromDir + QDir::separator() + copyDir;
|
||||
const QString to = toDir + QDir::separator() + copyDir;
|
||||
|
||||
if (not dir.mkpath(to))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SymlinkCopyDirRecursive(from, to, replaceOnConflit);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -363,64 +280,6 @@ VCommonSettings::VCommonSettings(const QString &fileName, QSettings::Format form
|
|||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::SharePath(const QString &shareItem) -> QString
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return QCoreApplication::applicationDirPath() + shareItem;
|
||||
#elif defined(Q_OS_MAC)
|
||||
QDir dirBundle(QCoreApplication::applicationDirPath() + QStringLiteral("/../Resources") + shareItem);
|
||||
if (dirBundle.exists())
|
||||
{
|
||||
return dirBundle.absolutePath();
|
||||
}
|
||||
|
||||
QDir appDir = QDir(qApp->applicationDirPath());
|
||||
appDir.cdUp();
|
||||
appDir.cdUp();
|
||||
appDir.cdUp();
|
||||
QDir dir(appDir.absolutePath() + shareItem);
|
||||
if (dir.exists())
|
||||
{
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
return VCommonSettings::unixStandardSharePath + shareItem;
|
||||
#else // Unix
|
||||
QDir dir(QCoreApplication::applicationDirPath() + shareItem);
|
||||
if (dir.exists())
|
||||
{
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
return VCommonSettings::unixStandardSharePath + shareItem;
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::MultisizeTablesPath() -> QString
|
||||
{
|
||||
return SharePath(QStringLiteral("/tables/multisize"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::StandardTemplatesPath() -> QString
|
||||
{
|
||||
return SharePath(QStringLiteral("/tables/templates"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::LabelTemplatesPath() -> QString
|
||||
{
|
||||
return SharePath(QStringLiteral("/labels"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::PrepareMultisizeTables(const QString ¤tPath) -> QString
|
||||
{
|
||||
return PrepareStandardFiles(currentPath, MultisizeTablesPath(), GetDefPathMultisizeMeasurements());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::CastToLayoutExportFormat(qint8 f) -> qint8
|
||||
{
|
||||
|
@ -437,18 +296,11 @@ auto VCommonSettings::CastToLayoutExportFormat(qint8 f) -> qint8
|
|||
return format;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetDefPathIndividualMeasurements() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("measurements") + QStringLiteral("/") +
|
||||
tr("individual");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetPathIndividualMeasurements() const -> QString
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return settings.value(*settingPathsIndividualMeasurements, GetDefPathIndividualMeasurements()).toString();
|
||||
return settings.value(*settingPathsIndividualMeasurements, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -459,17 +311,11 @@ void VCommonSettings::SetPathIndividualMeasurements(const QString &value)
|
|||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetDefPathMultisizeMeasurements() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("measurements") + QChar('/') + tr("multisize");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetPathMultisizeMeasurements() const -> QString
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return settings.value(*settingPathsMultisizeMeasurements, GetDefPathMultisizeMeasurements()).toString();
|
||||
return settings.value(*settingPathsMultisizeMeasurements, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -480,17 +326,11 @@ void VCommonSettings::SetPathMultisizeMeasurements(const QString &value)
|
|||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetDefPathPattern() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("patterns");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetPathPattern() const -> QString
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return settings.value(*settingPathsPattern, GetDefPathPattern()).toString();
|
||||
return settings.value(*settingPathsPattern, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -501,17 +341,11 @@ void VCommonSettings::SetPathPattern(const QString &value)
|
|||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetDefPathManualLayouts() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("manual layouts");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetPathManualLayouts() const -> QString
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||
return settings.value(*settingPathsManualLayouts, GetDefPathManualLayouts()).toString();
|
||||
return settings.value(*settingPathsManualLayouts, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -525,7 +359,7 @@ void VCommonSettings::SetPathManualLayouts(const QString &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetDefPathSVGFonts() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("svg fonts");
|
||||
return QDir::homePath() + QStringLiteral("/valentina/svg fonts");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -551,7 +385,7 @@ void VCommonSettings::SetPathSVGFonts(const QString &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::GetDefPathFontCorrections() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("font corrections");
|
||||
return QDir::homePath() + QStringLiteral("/valentina/font corrections");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1797,21 +1631,3 @@ void VCommonSettings::SetClientID(const QString &clientID)
|
|||
settings.setValue(*settingsStatistictClientID, clientID);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VCommonSettings::PrepareStandardFiles(const QString ¤tPath, const QString &standardPath,
|
||||
const QString &defPath) -> QString
|
||||
{
|
||||
QDir standardPathDir(standardPath);
|
||||
QDir currentPathDir(currentPath);
|
||||
if ((currentPath == defPath || not currentPathDir.exists()) && standardPathDir.exists())
|
||||
{
|
||||
const QDir localdata(defPath);
|
||||
if (localdata.mkpath(QChar('.')))
|
||||
{
|
||||
SymlinkCopyDirRecursive(standardPath, defPath, false);
|
||||
}
|
||||
return defPath;
|
||||
}
|
||||
return currentPath;
|
||||
}
|
||||
|
|
|
@ -60,28 +60,17 @@ public:
|
|||
VCommonSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||
~VCommonSettings() override = default;
|
||||
|
||||
static auto SharePath(const QString &shareItem) -> QString;
|
||||
static auto MultisizeTablesPath() -> QString;
|
||||
static auto StandardTemplatesPath() -> QString;
|
||||
static auto LabelTemplatesPath() -> QString;
|
||||
|
||||
static auto PrepareMultisizeTables(const QString ¤tPath) -> QString;
|
||||
|
||||
static auto CastToLayoutExportFormat(qint8 f) -> qint8;
|
||||
|
||||
static auto GetDefPathIndividualMeasurements() -> QString;
|
||||
auto GetPathIndividualMeasurements() const -> QString;
|
||||
void SetPathIndividualMeasurements(const QString &value);
|
||||
|
||||
static auto GetDefPathMultisizeMeasurements() -> QString;
|
||||
auto GetPathMultisizeMeasurements() const -> QString;
|
||||
void SetPathMultisizeMeasurements(const QString &value);
|
||||
|
||||
static auto GetDefPathPattern() -> QString;
|
||||
auto GetPathPattern() const -> QString;
|
||||
void SetPathPattern(const QString &value);
|
||||
|
||||
static auto GetDefPathManualLayouts() -> QString;
|
||||
auto GetPathManualLayouts() const -> QString;
|
||||
void SetPathManualLayouts(const QString &value);
|
||||
|
||||
|
@ -351,9 +340,6 @@ protected:
|
|||
template <class T>
|
||||
static auto ValueOrDef(const QSettings &settings, const QString &setting, const T &defValue) -> T;
|
||||
|
||||
static auto PrepareStandardFiles(const QString ¤tPath, const QString &standardPath, const QString &defPath)
|
||||
-> QString;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY_MOVE(VCommonSettings) // NOLINT
|
||||
};
|
||||
|
|
|
@ -204,12 +204,6 @@ VValentinaSettings::VValentinaSettings(const QString &fileName, QSettings::Forma
|
|||
REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VValentinaSettings::PrepareLabelTemplates(const QString ¤tPath) -> QString
|
||||
{
|
||||
return PrepareStandardFiles(currentPath, LabelTemplatesPath(), GetDefPathLabelTemplate());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VValentinaSettings::GetLabelLanguage() const -> QString
|
||||
{
|
||||
|
@ -222,17 +216,11 @@ void VValentinaSettings::SetLabelLanguage(const QString &value)
|
|||
setValue(*settingConfigurationLabelLanguage, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VValentinaSettings::GetDefPathLayout() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("layouts");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VValentinaSettings::GetPathLayout() const -> QString
|
||||
{
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), this->applicationName());
|
||||
return settings.value(*settingPathsLayout, GetDefPathLayout()).toString();
|
||||
return settings.value(*settingPathsLayout, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -243,16 +231,10 @@ void VValentinaSettings::SetPathLayout(const QString &value)
|
|||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VValentinaSettings::GetDefPathLabelTemplate() -> QString
|
||||
{
|
||||
return QDir::homePath() + QStringLiteral("/valentina/") + tr("label templates");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VValentinaSettings::GetPathLabelTemplate() const -> QString
|
||||
{
|
||||
return value(*settingPathsLabelTemplate, GetDefPathLabelTemplate()).toString();
|
||||
return value(*settingPathsLabelTemplate, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -52,16 +52,12 @@ public:
|
|||
QObject *parent = nullptr);
|
||||
VValentinaSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||
|
||||
static auto PrepareLabelTemplates(const QString ¤tPath) -> QString;
|
||||
|
||||
auto GetLabelLanguage() const -> QString;
|
||||
void SetLabelLanguage(const QString &value);
|
||||
|
||||
static auto GetDefPathLayout() -> QString;
|
||||
auto GetPathLayout() const -> QString;
|
||||
void SetPathLayout(const QString &value);
|
||||
|
||||
static auto GetDefPathLabelTemplate() -> QString;
|
||||
auto GetPathLabelTemplate() const -> QString;
|
||||
void SetPathLabelTemplate(const QString &value);
|
||||
|
||||
|
|
|
@ -302,9 +302,10 @@ void DialogEditLabel::NewTemplate()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEditLabel::ExportTemplate()
|
||||
{
|
||||
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||
|
||||
QString filters(tr("Label template") + QLatin1String("(*.xml)"));
|
||||
const QString path = VValentinaSettings::PrepareLabelTemplates(
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate());
|
||||
const QString path = settings->GetPathLabelTemplate();
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"),
|
||||
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
|
||||
|
@ -321,6 +322,8 @@ void DialogEditLabel::ExportTemplate()
|
|||
fileName += QLatin1String(".xml");
|
||||
}
|
||||
|
||||
settings->SetPathLabelTemplate(QFileInfo(fileName).absolutePath());
|
||||
|
||||
VLabelTemplate ltemplate;
|
||||
ltemplate.CreateEmptyTemplate();
|
||||
ltemplate.AddLines(GetTemplate());
|
||||
|
@ -357,8 +360,7 @@ void DialogEditLabel::ImportTemplate()
|
|||
|
||||
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
|
||||
// Use standard path to label templates
|
||||
const QString path = VValentinaSettings::PrepareLabelTemplates(
|
||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate());
|
||||
const QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate();
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
if (fileName.isEmpty())
|
||||
|
|
Loading…
Reference in New Issue
Block a user