New option Export text as paths.
--HG-- branch : feature
This commit is contained in:
parent
53502e3dd9
commit
f94967d02e
2
dist/OBS_debian/debian.valentina.1
vendored
2
dist/OBS_debian/debian.valentina.1
vendored
|
@ -72,6 +72,8 @@ The path to output destination folder. By default the directory at which the app
|
|||
.RE
|
||||
.IP "--bdxf"
|
||||
.RB "Export dxf in binary form."
|
||||
.IP "--text2paths"
|
||||
.RB "Export text as paths."
|
||||
.IP "-x, --gsize <The size value>"
|
||||
.RB "Set size value a pattern file, that was opened with standard measurements " "(export mode)" ". Valid values: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56cm."
|
||||
.IP "-e, --gheight <The height value>"
|
||||
|
|
2
dist/debian/valentina.1
vendored
2
dist/debian/valentina.1
vendored
|
@ -72,6 +72,8 @@ The path to output destination folder. By default the directory at which the app
|
|||
.RE
|
||||
.IP "--bdxf"
|
||||
.RB "Export dxf in binary form."
|
||||
.IP "--text2paths"
|
||||
.RB "Export text as paths."
|
||||
.IP "-x, --gsize <The size value>"
|
||||
.RB "Set size value a pattern file, that was opened with standard measurements " "(export mode)" ". Valid values: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56cm."
|
||||
.IP "-e, --gheight <The height value>"
|
||||
|
|
|
@ -104,6 +104,10 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
|||
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_BINARYDXF,
|
||||
translate("VCommandLine", "Export dxf in binary form.")));
|
||||
|
||||
optionsIndex.insert(LONG_OPTION_TEXT2PATHS, index++);
|
||||
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TEXT2PATHS,
|
||||
translate("VCommandLine", "Export text as paths.")));
|
||||
|
||||
optionsIndex.insert(LONG_OPTION_GRADATIONSIZE, index++);
|
||||
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE,
|
||||
translate("VCommandLine", "Set size value a pattern file, that was opened "
|
||||
|
@ -624,10 +628,13 @@ int VCommandLine::OptExportType() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommandLine::IsBinaryDXF() const
|
||||
{
|
||||
if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_BINARYDXF))))
|
||||
{
|
||||
return true;
|
||||
return parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_BINARYDXF)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommandLine::IsTextAsPaths() const
|
||||
{
|
||||
return parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_TEXT2PATHS)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -76,6 +76,7 @@ public:
|
|||
int OptExportType() const;
|
||||
|
||||
int IsBinaryDXF() const;
|
||||
int IsTextAsPaths() const;
|
||||
|
||||
//generator creation is moved here ... because most options are for it only, so no need to create extra getters...
|
||||
//@brief creates VLayoutGenerator
|
||||
|
|
|
@ -337,6 +337,18 @@ void DialogLayoutSettings::SetIgnoreAllFields(bool value)
|
|||
ui->checkBoxIgnoreFileds->setChecked(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogLayoutSettings::IsTextAsPaths() const
|
||||
{
|
||||
return ui->checkBoxTextAsPaths->isChecked();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutSettings::SetTextAsPaths(bool value)
|
||||
{
|
||||
ui->checkBoxTextAsPaths->setChecked(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogLayoutSettings::SelectedPrinter() const
|
||||
{
|
||||
|
@ -568,6 +580,7 @@ void DialogLayoutSettings::DialogAccepted()
|
|||
generator->SetUnitePages(IsUnitePages());
|
||||
generator->SetStripOptimization(IsStripOptimization());
|
||||
generator->SetMultiplier(GetMultiplier());
|
||||
generator->SetTestAsPaths(IsTextAsPaths());
|
||||
|
||||
if (IsIgnoreAllFields())
|
||||
{
|
||||
|
@ -659,6 +672,8 @@ void DialogLayoutSettings::RestoreDefaults()
|
|||
|
||||
CorrectMaxFileds();
|
||||
IgnoreAllFields(ui->checkBoxIgnoreFileds->isChecked());
|
||||
|
||||
ui->checkBoxTextAsPaths->setChecked(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1070,6 +1085,7 @@ void DialogLayoutSettings::ReadSettings()
|
|||
SetIgnoreAllFields(settings->GetIgnoreAllFields());
|
||||
SetStripOptimization(settings->GetStripOptimization());
|
||||
SetMultiplier(settings->GetMultiplier());
|
||||
SetTextAsPaths(settings->GetTextAsPaths());
|
||||
|
||||
FindTemplate();
|
||||
|
||||
|
@ -1095,6 +1111,7 @@ void DialogLayoutSettings::WriteSettings() const
|
|||
settings->SetIgnoreAllFields(IsIgnoreAllFields());
|
||||
settings->SetStripOptimization(IsStripOptimization());
|
||||
settings->SetMultiplier(GetMultiplier());
|
||||
settings->SetTextAsPaths(IsTextAsPaths());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -110,6 +110,9 @@ public:
|
|||
bool IsIgnoreAllFields() const;
|
||||
void SetIgnoreAllFields(bool value);
|
||||
|
||||
bool IsTextAsPaths() const;
|
||||
void SetTextAsPaths(bool value);
|
||||
|
||||
QString SelectedPrinter() const;
|
||||
|
||||
//support functions for the command line parser which uses invisible dialog to properly build layout generator
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>531</height>
|
||||
<height>533</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -17,7 +17,7 @@
|
|||
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
|
||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
|
@ -308,6 +308,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxText">
|
||||
<property name="title">
|
||||
<string>Text</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxTextAsPaths">
|
||||
<property name="toolTip">
|
||||
<string>Text will be converted to paths</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export text as paths</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -732,7 +755,7 @@
|
|||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroupPrinciple"/>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
<buttongroup name="buttonGroupPrinciple"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
|
@ -4678,8 +4678,6 @@ void MainWindow::ZoomFirstShow()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::DoExport(const VCommandLinePtr &expParams)
|
||||
{
|
||||
auto settings = expParams->DefaultGenerator();
|
||||
|
||||
const QHash<quint32, VPiece> *details = pattern->DataPieces();
|
||||
if(not qApp->getOpeningPattern())
|
||||
{
|
||||
|
@ -4691,6 +4689,10 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
|
|||
}
|
||||
}
|
||||
PrepareDetailsForLayout(details);
|
||||
|
||||
auto settings = expParams->DefaultGenerator();
|
||||
settings->SetTestAsPaths(expParams->IsTextAsPaths());
|
||||
|
||||
if (LayoutSettings(*settings.get()))
|
||||
{
|
||||
try
|
||||
|
|
|
@ -61,7 +61,8 @@ VLayoutGenerator::VLayoutGenerator(QObject *parent)
|
|||
unitePages(false),
|
||||
stripOptimizationEnabled(false),
|
||||
multiplier(1),
|
||||
stripOptimization(false)
|
||||
stripOptimization(false),
|
||||
textAsPaths(false)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -209,7 +210,7 @@ QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
|
|||
QList<QGraphicsItem *> list;
|
||||
for (int i=0; i < papers.count(); ++i)
|
||||
{
|
||||
list.append(papers.at(i).GetPaperItem(autoCrop));
|
||||
list.append(papers.at(i).GetPaperItem(autoCrop, IsTestAsPaths()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -220,7 +221,7 @@ QList<QList<QGraphicsItem *> > VLayoutGenerator::GetAllDetails() const
|
|||
QList<QList<QGraphicsItem *> > list;
|
||||
for (int i=0; i < papers.count(); ++i)
|
||||
{
|
||||
list.append(papers.at(i).GetItemDetails());
|
||||
list.append(papers.at(i).GetItemDetails(IsTestAsPaths()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -245,6 +246,18 @@ void VLayoutGenerator::SetStripOptimization(bool value)
|
|||
stripOptimization = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VLayoutGenerator::IsTestAsPaths() const
|
||||
{
|
||||
return textAsPaths;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutGenerator::SetTestAsPaths(bool value)
|
||||
{
|
||||
textAsPaths = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint8 VLayoutGenerator::GetMultiplier() const
|
||||
{
|
||||
|
|
|
@ -106,6 +106,9 @@ public:
|
|||
bool IsStripOptimization() const;
|
||||
void SetStripOptimization(bool value);
|
||||
|
||||
bool IsTestAsPaths() const;
|
||||
void SetTestAsPaths(bool value);
|
||||
|
||||
signals:
|
||||
void Start();
|
||||
void Arranged(int count);
|
||||
|
@ -134,6 +137,7 @@ private:
|
|||
bool stripOptimizationEnabled;
|
||||
quint8 multiplier;
|
||||
bool stripOptimization;
|
||||
bool textAsPaths;
|
||||
|
||||
int PageHeight() const;
|
||||
int PageWidth() const;
|
||||
|
|
|
@ -315,13 +315,13 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop) const
|
||||
QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop, bool textAsPaths) const
|
||||
{
|
||||
QGraphicsRectItem *paper;
|
||||
if (autoCrop)
|
||||
{
|
||||
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
|
||||
QList<QGraphicsItem *> list = GetItemDetails();
|
||||
QList<QGraphicsItem *> list = GetItemDetails(textAsPaths);
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
scene->addItem(list.at(i));
|
||||
|
@ -346,12 +346,12 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QList<QGraphicsItem *> VLayoutPaper::GetItemDetails() const
|
||||
QList<QGraphicsItem *> VLayoutPaper::GetItemDetails(bool textAsPaths) const
|
||||
{
|
||||
QList<QGraphicsItem *> list;
|
||||
for (int i=0; i < d->details.count(); ++i)
|
||||
{
|
||||
list.append(d->details.at(i).GetItem());
|
||||
list.append(d->details.at(i).GetItem(textAsPaths));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ public:
|
|||
|
||||
bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop);
|
||||
int Count() const;
|
||||
QGraphicsRectItem *GetPaperItem(bool autoCrop) const Q_REQUIRED_RESULT;
|
||||
QList<QGraphicsItem *> GetItemDetails() const Q_REQUIRED_RESULT;
|
||||
QGraphicsRectItem *GetPaperItem(bool autoCrop, bool textAsPaths) const Q_REQUIRED_RESULT;
|
||||
QList<QGraphicsItem *> GetItemDetails(bool textAsPaths) const Q_REQUIRED_RESULT;
|
||||
|
||||
QVector<VLayoutPiece> GetDetails() const;
|
||||
void SetDetails(const QList<VLayoutPiece>& details);
|
||||
|
|
|
@ -923,7 +923,7 @@ QPainterPath VLayoutPiece::LayoutAllowancePath() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGraphicsItem *VLayoutPiece::GetItem() const
|
||||
QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||
{
|
||||
QGraphicsPathItem *item = GetMainItem();
|
||||
|
||||
|
@ -932,8 +932,8 @@ QGraphicsItem *VLayoutPiece::GetItem() const
|
|||
CreateInternalPathItem(i, item);
|
||||
}
|
||||
|
||||
CreateLabelStrings(item, d->detailLabel, d->m_tmDetail);
|
||||
CreateLabelStrings(item, d->patternInfo, d->m_tmPattern);
|
||||
CreateLabelStrings(item, d->detailLabel, d->m_tmDetail, textAsPaths);
|
||||
CreateLabelStrings(item, d->patternInfo, d->m_tmPattern, textAsPaths);
|
||||
CreateGrainlineItem(item);
|
||||
|
||||
return item;
|
||||
|
@ -941,7 +941,7 @@ QGraphicsItem *VLayoutPiece::GetItem() const
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape,
|
||||
const VTextManager &tm) const
|
||||
const VTextManager &tm, bool textAsPaths) const
|
||||
{
|
||||
SCASSERT(parent != nullptr)
|
||||
|
||||
|
@ -963,6 +963,11 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPoin
|
|||
|
||||
QFontMetrics fm(fnt);
|
||||
|
||||
if (textAsPaths)
|
||||
{
|
||||
dY += fm.height();
|
||||
}
|
||||
|
||||
if (dY > dH)
|
||||
{
|
||||
break;
|
||||
|
@ -1004,6 +1009,20 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPoin
|
|||
|
||||
labelMatrix *= d->matrix;
|
||||
|
||||
if (textAsPaths)
|
||||
{
|
||||
QPainterPath path;
|
||||
path.addText(0, - static_cast<qreal>(fm.ascent())/6., fnt, qsText);
|
||||
|
||||
QGraphicsPathItem* item = new QGraphicsPathItem(parent);
|
||||
item->setPath(path);
|
||||
item->setBrush(QBrush(Qt::black));
|
||||
item->setTransform(labelMatrix);
|
||||
|
||||
dY += tm.GetSpacing();
|
||||
}
|
||||
else
|
||||
{
|
||||
QGraphicsSimpleTextItem* item = new QGraphicsSimpleTextItem(parent);
|
||||
item->setFont(fnt);
|
||||
item->setText(qsText);
|
||||
|
@ -1013,6 +1032,7 @@ void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPoin
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
QPainterPath ContourPath() const;
|
||||
|
||||
QPainterPath LayoutAllowancePath() const;
|
||||
QGraphicsItem *GetItem() const Q_REQUIRED_RESULT;
|
||||
QGraphicsItem *GetItem(bool textAsPaths) const Q_REQUIRED_RESULT;
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VLayoutPieceData> d;
|
||||
|
@ -136,7 +136,8 @@ private:
|
|||
QGraphicsPathItem *GetMainItem() const Q_REQUIRED_RESULT;
|
||||
|
||||
void CreateInternalPathItem(int i, QGraphicsItem *parent) const;
|
||||
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm) const;
|
||||
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
||||
bool textAsPaths) const;
|
||||
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -50,6 +50,7 @@ const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format");
|
|||
const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f");
|
||||
|
||||
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf");
|
||||
const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths");
|
||||
|
||||
const QString LONG_OPTION_ROTATE = QStringLiteral("rotate");
|
||||
const QString SINGLE_OPTION_ROTATE = QStringLiteral("r");
|
||||
|
|
|
@ -47,6 +47,7 @@ extern const QString LONG_OPTION_EXP2FORMAT;
|
|||
extern const QString SINGLE_OPTION_EXP2FORMAT;
|
||||
|
||||
extern const QString LONG_OPTION_BINARYDXF;
|
||||
extern const QString LONG_OPTION_TEXT2PATHS;
|
||||
|
||||
extern const QString LONG_OPTION_ROTATE;
|
||||
extern const QString SINGLE_OPTION_ROTATE;
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
|
||||
Q_DECLARE_METATYPE(QMarginsF)
|
||||
|
||||
namespace
|
||||
{
|
||||
const QString settingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
|
||||
|
||||
const QString settingPathsPattern = QStringLiteral("paths/pattern");
|
||||
|
@ -76,6 +78,8 @@ const QString settingFields = QStringLiteral("layout/fields");
|
|||
const QString settingIgnoreFields = QStringLiteral("layout/ignoreFields");
|
||||
const QString settingStripOptimization = QStringLiteral("layout/stripOptimization");
|
||||
const QString settingMultiplier = QStringLiteral("layout/multiplier");
|
||||
const QString settingTextAsPaths = QStringLiteral("layout/textAsPaths");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||
|
@ -584,3 +588,21 @@ void VSettings::SetMultiplier(quint8 value)
|
|||
setValue(settingMultiplier, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetTextAsPaths() const
|
||||
{
|
||||
return value(settingTextAsPaths, GetDefTextAsPaths()).toBool();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VSettings::GetDefTextAsPaths()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSettings::SetTextAsPaths(bool value)
|
||||
{
|
||||
setValue(settingTextAsPaths, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,10 @@ public:
|
|||
static quint8 GetDefMultiplier();
|
||||
void SetMultiplier(quint8 value);
|
||||
|
||||
bool GetTextAsPaths() const;
|
||||
static bool GetDefTextAsPaths();
|
||||
void SetTextAsPaths(bool value);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VSettings)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user