Merge branch 'multisize-measurements-tables-improvement' into develop
This commit is contained in:
commit
49d3ad1f80
|
@ -52,6 +52,7 @@
|
|||
- [smart-pattern/valentina#40] Invalid name of arc in modeling mode.
|
||||
- New warning. Error calculating segment of curve.
|
||||
- Improve searching lost measurements. Additional case with underscores instead of regular spaces.
|
||||
- Redesign multisize measurements.
|
||||
|
||||
# Version 0.6.2 (unreleased)
|
||||
- [#903] Bug in tool Cut Spline path.
|
||||
|
|
20
dist/debian/tape.1
vendored
20
dist/debian/tape.1
vendored
|
@ -1,6 +1,6 @@
|
|||
.\" Manpage for tape.
|
||||
.\" Contact dismine@gmail.com to correct errors.
|
||||
.TH tape 1 "10 March, 2017" "tape man page"
|
||||
.TH tape 1 "3 October, 2020" "tape man page"
|
||||
.SH NAME
|
||||
Tape \- Valentina's measurements editor.
|
||||
.SH SYNOPSIS
|
||||
|
@ -20,12 +20,14 @@ is a part of Valentina. And used for creating and editing measurement files.
|
|||
Displays this help.
|
||||
.IP "-v, --version"
|
||||
Displays version information.
|
||||
.IP "-e, --height <The base height>"
|
||||
Open with the base height. Valid values: 92, 98, 104, 110, 116, 122, 128, 134, 140, 146, 152, 158, 164, 170, 176, 182, 188, 194, 200cm.
|
||||
.IP "-s, --size <The base size>"
|
||||
Open with the base size. Valid values: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56cm.
|
||||
.IP "-u, --unit <The pattern unit>"
|
||||
Set pattern file unit: cm, mm, inch.
|
||||
.IP "-a, --dimensionA <The dimension A base>"
|
||||
Set base for dimension A in the table units.
|
||||
.IP "-b, --dimensionB <The dimension B base>"
|
||||
Set base for dimension B in the table units.
|
||||
.IP "-c, --dimensionA <The dimension C base>"
|
||||
Set base for dimension C in the table units.
|
||||
.IP "-u, --units <The pattern units>"
|
||||
Set pattern file units: cm, mm, inch.
|
||||
.IP "--test"
|
||||
Use for unit testing. Run the program and open a file without showing the main window.
|
||||
.IP "--no-scaling"
|
||||
|
@ -35,9 +37,5 @@ Disable high dpi scaling. Call this option if has problem with scaling (by defau
|
|||
\- the measurement file.
|
||||
.SH AUTHOR
|
||||
.RI "This manual page was written by Roman Telezhynskyi <" dismine@gmail.com ">"
|
||||
.SH "SEE ALSO"
|
||||
.RB "Full " "User Manual" " is availiable in"
|
||||
.UR https://bitbucket.org/dismine/valentina/wiki/manual/Content
|
||||
.UE
|
||||
|
||||
.BR valentina (1)
|
||||
|
|
10
dist/debian/valentina.1
vendored
10
dist/debian/valentina.1
vendored
|
@ -139,10 +139,12 @@ The path to output destination folder. By default the directory at which the app
|
|||
.RB "Export only details. Export details as they positioned in the details mode. Any layout related options will be ignored."
|
||||
.IP "--exportSuchDetails <The name regex>"
|
||||
.RB "Export only details that match a piece name regex."
|
||||
.IP "-x, --gsize <The size value>"
|
||||
.RB "Set size value a pattern file, that was opened with multisize 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>"
|
||||
.RB "Set height value a pattern file, that was opened with multisize measurements (" "export mode" "). Valid values: 92, 98, 104, 110, 116, 122, 128, 134, 140, 146, 152, 158, 164, 170, 176, 182, 188, 194, 200cm."
|
||||
.IP "--dimensionA <The dimension A base>"
|
||||
.RB "Set base for dimension A in the multisize measurements units " "(export mode)" "."
|
||||
.IP "--dimensionB <The dimension B base>"
|
||||
.RB "Set base for dimension B in the multisize measurements units " "(export mode)" "."
|
||||
.IP "--dimensionC <The dimension C base>"
|
||||
.RB "Set base for dimension C in the multisize measurements units " "(export mode)" "."
|
||||
.IP "--userMaterial <User material>"
|
||||
.RB "Use this option to override user material defined in pattern. The value must be in form <number>@<user matrial name>. The number should be in range from 1 to 20. For example, 1@Fabric2. The key can be used multiple times. Has no effect in GUI mode."
|
||||
.IP "-p, --pageformat <Template number>"
|
||||
|
|
|
@ -38,8 +38,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
|||
: QWidget(parent),
|
||||
ui(new Ui::TapePreferencesConfigurationPage),
|
||||
m_langChanged(false),
|
||||
m_systemChanged(false),
|
||||
m_defGradationChanged(false)
|
||||
m_systemChanged(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
RetranslateUi();
|
||||
|
@ -84,31 +83,6 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
|||
|
||||
//----------------------- Toolbar
|
||||
ui->toolBarStyleCheck->setChecked(qApp->TapeSettings()->GetToolBarStyle());
|
||||
|
||||
//---------------------------Default height and size
|
||||
// If change units don't forget about the label
|
||||
ui->defHeightCombo->addItems(VMeasurement::WholeListHeights(Unit::Cm));
|
||||
index = ui->defHeightCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefHeight()));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->defHeightCombo->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
auto DefGradationChanged = [this]()
|
||||
{
|
||||
m_defGradationChanged = true;
|
||||
};
|
||||
|
||||
connect(ui->defHeightCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
||||
|
||||
// If change units don't forget about the label
|
||||
ui->defSizeCombo->addItems(VMeasurement::WholeListSizes(Unit::Cm));
|
||||
index = ui->defSizeCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefSize()));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->defSizeCombo->setCurrentIndex(index);
|
||||
}
|
||||
connect(ui->defSizeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -150,13 +124,6 @@ QStringList TapePreferencesConfigurationPage::Apply()
|
|||
qApp->RetranslateGroups();
|
||||
}
|
||||
|
||||
if (m_defGradationChanged)
|
||||
{
|
||||
settings->SetDefHeight(ui->defHeightCombo->currentText().toInt());
|
||||
settings->SetDefSize(ui->defSizeCombo->currentText().toInt());
|
||||
m_defGradationChanged = false;
|
||||
}
|
||||
|
||||
return preferences;
|
||||
}
|
||||
|
||||
|
@ -187,7 +154,4 @@ void TapePreferencesConfigurationPage::RetranslateUi()
|
|||
ui->systemCombo->blockSignals(false);
|
||||
ui->systemCombo->setCurrentIndex(ui->systemCombo->findData(code));
|
||||
}
|
||||
|
||||
ui->labelHeightUnit->setText(UnitsToStr(Unit::Cm, true));
|
||||
ui->labelSizeUnit->setText(UnitsToStr(Unit::Cm, true));
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ private:
|
|||
Ui::TapePreferencesConfigurationPage *ui;
|
||||
bool m_langChanged;
|
||||
bool m_systemChanged;
|
||||
bool m_defGradationChanged;
|
||||
|
||||
void RetranslateUi();
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>544</width>
|
||||
<height>750</height>
|
||||
<height>648</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -25,7 +25,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>730</height>
|
||||
<height>628</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -165,89 +165,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Default height and size</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Default height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="defSizeCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="labelHeightUnit">
|
||||
<property name="text">
|
||||
<string notr="true">Height unit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="defHeightCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="labelSizeUnit">
|
||||
<property name="text">
|
||||
<string notr="true">Size unit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Default size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<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 row="1" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
|
|
223
src/app/tape/dialogs/dialogdimensionlabels.cpp
Normal file
223
src/app/tape/dialogs/dialogdimensionlabels.cpp
Normal file
|
@ -0,0 +1,223 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogdimensionlabels.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 8 10, 2020
|
||||
**
|
||||
** @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) 2020 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 "dialogdimensionlabels.h"
|
||||
#include "ui_dialogdimensionlabels.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions, bool fullCircumference,
|
||||
QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DialogDimensionLabels),
|
||||
m_dimensions(dimensions),
|
||||
m_fullCircumference(fullCircumference)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
InitLabels();
|
||||
|
||||
InitDimensions();
|
||||
InitTable();
|
||||
|
||||
connect(ui->comboBoxDimensionLabels, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogDimensionLabels::DimensionChanged);
|
||||
connect(ui->tableWidget, &QTableWidget::itemChanged, this, &DialogDimensionLabels::LabelChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogDimensionLabels::~DialogDimensionLabels()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDimensionLabels::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
|
||||
MeasurementDimension type =
|
||||
static_cast<MeasurementDimension>(ui->comboBoxDimensionLabels->currentData().toInt());
|
||||
|
||||
InitDimensions();
|
||||
|
||||
int index = ui->comboBoxDimensionLabels->findData(static_cast<int>(type));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxDimensionLabels->blockSignals(true);
|
||||
ui->comboBoxDimensionLabels->setCurrentIndex(index);
|
||||
ui->comboBoxDimensionLabels->blockSignals(false);
|
||||
}
|
||||
|
||||
const int row = ui->tableWidget->currentRow();
|
||||
InitTable();
|
||||
ui->tableWidget->blockSignals(true);
|
||||
ui->tableWidget->selectRow(row);
|
||||
ui->tableWidget->blockSignals(false);
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
QDialog::changeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDimensionLabels::DimensionChanged()
|
||||
{
|
||||
InitTable();
|
||||
ui->tableWidget->selectRow(0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDimensionLabels::LabelChanged(QTableWidgetItem *item)
|
||||
{
|
||||
if (item)
|
||||
{
|
||||
MeasurementDimension type =
|
||||
static_cast<MeasurementDimension>(ui->comboBoxDimensionLabels->currentData().toInt());
|
||||
int value = item->data(Qt::UserRole).toInt();
|
||||
|
||||
DimesionLabels labels = m_labels.value(type);
|
||||
labels.insert(value, item->text());
|
||||
|
||||
m_labels.insert(type, labels);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDimensionLabels::InitLabels()
|
||||
{
|
||||
m_labels.clear();
|
||||
|
||||
const QList<MeasurementDimension_p> dimensions = m_dimensions.values();
|
||||
|
||||
for(auto &dimension : dimensions)
|
||||
{
|
||||
m_labels.insert(dimension->Type(), dimension->Labels());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDimensionLabels::InitDimensions()
|
||||
{
|
||||
ui->comboBoxDimensionLabels->blockSignals(true);
|
||||
ui->comboBoxDimensionLabels->clear();
|
||||
|
||||
for(auto &dimension : m_dimensions)
|
||||
{
|
||||
ui->comboBoxDimensionLabels->addItem(VAbstartMeasurementDimension::DimensionName(dimension->Type()),
|
||||
static_cast<int>(dimension->Type()));
|
||||
}
|
||||
|
||||
ui->comboBoxDimensionLabels->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDimensionLabels::InitTable()
|
||||
{
|
||||
ui->tableWidget->blockSignals(true);
|
||||
ui->tableWidget->clearContents();
|
||||
|
||||
const MeasurementDimension type =
|
||||
static_cast<MeasurementDimension>(ui->comboBoxDimensionLabels->currentData().toInt());
|
||||
|
||||
MeasurementDimension_p dimension;
|
||||
|
||||
if (m_dimensions.contains(type))
|
||||
{
|
||||
dimension = m_dimensions.value(type);
|
||||
}
|
||||
|
||||
if (dimension.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QVector<int> bases = dimension->ValidBases();
|
||||
|
||||
ui->tableWidget->setRowCount(bases.size());
|
||||
|
||||
const DimesionLabels labels = m_labels.value(type);
|
||||
|
||||
for(int row = 0; row < bases.size(); ++row)
|
||||
{
|
||||
const int base = bases.at(row);
|
||||
|
||||
{
|
||||
auto *itemValue = new QTableWidgetItem(DimensionValue(dimension, base));
|
||||
itemValue->setData(Qt::UserRole, base);
|
||||
itemValue->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter);
|
||||
|
||||
// set the item non-editable (view only), and non-selectable
|
||||
Qt::ItemFlags flags = itemValue->flags();
|
||||
flags &= ~(Qt::ItemIsEditable); // reset/clear the flag
|
||||
itemValue->setFlags(flags);
|
||||
|
||||
ui->tableWidget->setItem(row, 0, itemValue);
|
||||
}
|
||||
|
||||
{
|
||||
auto *itemLabel = new QTableWidgetItem(labels.value(base));
|
||||
itemLabel->setData(Qt::UserRole, base);
|
||||
itemLabel->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter);
|
||||
|
||||
ui->tableWidget->setItem(row, 1, itemLabel);
|
||||
}
|
||||
}
|
||||
|
||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableWidget->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogDimensionLabels::DimensionValue(const MeasurementDimension_p &dimension, int value)
|
||||
{
|
||||
QStringList labels;
|
||||
|
||||
if (dimension->Type() == MeasurementDimension::X)
|
||||
{
|
||||
return QString::number(value);
|
||||
}
|
||||
else if (dimension->Type() == MeasurementDimension::Y)
|
||||
{
|
||||
if (dimension->IsCircumference())
|
||||
{
|
||||
return QString::number(m_fullCircumference ? value*2 : value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString::number(value);
|
||||
}
|
||||
}
|
||||
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
||||
{
|
||||
return QString::number(m_fullCircumference ? value*2 : value);
|
||||
}
|
||||
|
||||
return QString::number(value);
|
||||
}
|
82
src/app/tape/dialogs/dialogdimensionlabels.h
Normal file
82
src/app/tape/dialogs/dialogdimensionlabels.h
Normal file
|
@ -0,0 +1,82 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogdimensionlabels.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 8 10, 2020
|
||||
**
|
||||
** @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) 2020 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 DIALOGDIMENSIONLABELS_H
|
||||
#define DIALOGDIMENSIONLABELS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
|
||||
#include "../vformat/vdimensions.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogDimensionLabels;
|
||||
}
|
||||
|
||||
class QTableWidgetItem;
|
||||
|
||||
class DialogDimensionLabels : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p > &dimensions,
|
||||
bool fullCircumference, QWidget *parent = nullptr);
|
||||
virtual ~DialogDimensionLabels();
|
||||
|
||||
QMap<MeasurementDimension, DimesionLabels> Labels() const;
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
|
||||
private slots:
|
||||
void DimensionChanged();
|
||||
void LabelChanged(QTableWidgetItem *item);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogDimensionLabels)
|
||||
Ui::DialogDimensionLabels *ui;
|
||||
|
||||
QMap<MeasurementDimension, MeasurementDimension_p > m_dimensions;
|
||||
QMap<MeasurementDimension, DimesionLabels> m_labels{};
|
||||
bool m_fullCircumference;
|
||||
|
||||
void InitLabels();
|
||||
void InitDimensions();
|
||||
void InitTable();
|
||||
|
||||
QString DimensionValue(const MeasurementDimension_p &dimension, int value);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QMap<MeasurementDimension, DimesionLabels> DialogDimensionLabels::Labels() const
|
||||
{
|
||||
return m_labels;
|
||||
}
|
||||
|
||||
#endif // DIALOGDIMENSIONLABELS_H
|
136
src/app/tape/dialogs/dialogdimensionlabels.ui
Normal file
136
src/app/tape/dialogs/dialogdimensionlabels.ui
Normal file
|
@ -0,0 +1,136 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogDimensionLabels</class>
|
||||
<widget class="QDialog" name="DialogDimensionLabels">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>345</width>
|
||||
<height>424</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dimension labels</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../share/resources/tapeicon.qrc">
|
||||
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QLabel" name="labelDimension">
|
||||
<property name="text">
|
||||
<string notr="true">Dimension:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxDimensionLabels"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Label</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../share/resources/tapeicon.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogDimensionLabels</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogDimensionLabels</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
916
src/app/tape/dialogs/dialogmeasurementscsvcolumns.cpp
Normal file
916
src/app/tape/dialogs/dialogmeasurementscsvcolumns.cpp
Normal file
|
@ -0,0 +1,916 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogmeasurementscsvcolumns.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 9 10, 2020
|
||||
**
|
||||
** @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) 2020 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 "dialogmeasurementscsvcolumns.h"
|
||||
#include "ui_dialogmeasurementscsvcolumns.h"
|
||||
|
||||
#include "../vmisc/qxtcsvmodel.h"
|
||||
#include "../vtools/dialogs/dialogtoolbox.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QShowEvent>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogMeasurementsCSVColumns::DialogMeasurementsCSVColumns(const QString &filename, MeasurementsType type,
|
||||
QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogMeasurementsCSVColumns),
|
||||
m_fileName{filename},
|
||||
m_type(type)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
HackColumnControls();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogMeasurementsCSVColumns::DialogMeasurementsCSVColumns(const QString &filename, MeasurementsType type,
|
||||
const QList<MeasurementDimension_p> &dimensions,
|
||||
QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogMeasurementsCSVColumns),
|
||||
m_fileName{filename},
|
||||
m_type(type),
|
||||
m_dimensions{dimensions}
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
HackColumnControls();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogMeasurementsCSVColumns::~DialogMeasurementsCSVColumns()
|
||||
{
|
||||
qDeleteAll(m_hackedWidgets);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
|
||||
RetranslateLabels();
|
||||
InitColumnsControls();
|
||||
InitImportHeaders();
|
||||
ShowImportPreview();
|
||||
CheckStatus();
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
QDialog::changeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent( event );
|
||||
if ( event->spontaneous() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_isInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// do your init stuff here
|
||||
|
||||
if (not m_fileName.isEmpty())
|
||||
{
|
||||
InitColumnsMap();
|
||||
ShowInputPreview();
|
||||
InitColumnsControls();
|
||||
RetranslateLabels();
|
||||
InitColumnsControls();
|
||||
SetDefaultColumns();
|
||||
InitImportHeaders();
|
||||
ShowImportPreview();
|
||||
|
||||
connect(ui->comboBoxName, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogMeasurementsCSVColumns::ColumnChanged);
|
||||
connect(ui->comboBoxValue, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogMeasurementsCSVColumns::ColumnChanged);
|
||||
|
||||
if (m_type == MeasurementsType::Multisize)
|
||||
{
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
connect(ui->comboBoxShiftA, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogMeasurementsCSVColumns::ColumnChanged);
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
connect(ui->comboBoxShiftB, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogMeasurementsCSVColumns::ColumnChanged);
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
connect(ui->comboBoxShiftC, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogMeasurementsCSVColumns::ColumnChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
connect(ui->comboBoxFullName, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogMeasurementsCSVColumns::ColumnChanged);
|
||||
connect(ui->comboBoxDescription, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogMeasurementsCSVColumns::ColumnChanged);
|
||||
|
||||
CheckStatus();
|
||||
}
|
||||
|
||||
m_isInitialized = true;//first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::ColumnChanged()
|
||||
{
|
||||
auto *control = qobject_cast<QComboBox*>(sender());
|
||||
|
||||
auto SaveColum = [this, control](int column)
|
||||
{
|
||||
m_columnsMap[column] = control->currentData().toInt();
|
||||
ShowImportPreview();
|
||||
CheckStatus();
|
||||
};
|
||||
|
||||
if (control == ui->comboBoxName)
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
SaveColum(static_cast<int>(IndividualMeasurementsColumns::Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveColum(static_cast<int>(MultisizeMeasurementsColumns::Name));
|
||||
}
|
||||
}
|
||||
else if (control == ui->comboBoxValue)
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
SaveColum(static_cast<int>(IndividualMeasurementsColumns::Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveColum(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
|
||||
}
|
||||
}
|
||||
else if (control == ui->comboBoxShiftA)
|
||||
{
|
||||
SaveColum(static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
|
||||
}
|
||||
else if (control == ui->comboBoxShiftB)
|
||||
{
|
||||
SaveColum(static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
|
||||
}
|
||||
else if (control == ui->comboBoxShiftC)
|
||||
{
|
||||
SaveColum(static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
|
||||
}
|
||||
else if (control == ui->comboBoxFullName)
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
SaveColum(static_cast<int>(IndividualMeasurementsColumns::FullName));
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveColum(static_cast<int>(MultisizeMeasurementsColumns::FullName));
|
||||
}
|
||||
}
|
||||
else if (control == ui->comboBoxDescription)
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
SaveColum(static_cast<int>(IndividualMeasurementsColumns::Description));
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveColum(static_cast<int>(MultisizeMeasurementsColumns::Description));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogMeasurementsCSVColumns::ColumnMandatory(int column) const
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
return column < static_cast<int>(IndividualMeasurementsColumns::FullName);
|
||||
}
|
||||
else
|
||||
{
|
||||
int mandatory = 3;
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
mandatory += qMin(m_dimensions.size(), 2);
|
||||
}
|
||||
|
||||
return static_cast<int>(column) < mandatory;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogMeasurementsCSVColumns::ColumnHeader(int column) const
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
const auto individualColumn = static_cast<IndividualMeasurementsColumns>(column);
|
||||
switch(individualColumn)
|
||||
{
|
||||
case IndividualMeasurementsColumns::Name:
|
||||
return tr("Name");
|
||||
case IndividualMeasurementsColumns::Value:
|
||||
return tr("Value");
|
||||
case IndividualMeasurementsColumns::FullName:
|
||||
return tr("Full name");
|
||||
case IndividualMeasurementsColumns::Description:
|
||||
return tr("Description");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto multisizeColumn = static_cast<MultisizeMeasurementsColumns>(column);
|
||||
switch(multisizeColumn)
|
||||
{
|
||||
case MultisizeMeasurementsColumns::Name:
|
||||
return tr("Name");
|
||||
case MultisizeMeasurementsColumns::BaseValue:
|
||||
return tr("Base value");
|
||||
case MultisizeMeasurementsColumns::ShiftA:
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(0);
|
||||
return tr("Shift (%1):").arg(VAbstartMeasurementDimension::DimensionName(dimension->Type()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Shift A";
|
||||
}
|
||||
case MultisizeMeasurementsColumns::ShiftB:
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(1);
|
||||
return tr("Shift (%1):").arg(VAbstartMeasurementDimension::DimensionName(dimension->Type()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Shift B";
|
||||
}
|
||||
case MultisizeMeasurementsColumns::ShiftC:
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(2);
|
||||
return tr("Shift (%1):").arg(VAbstartMeasurementDimension::DimensionName(dimension->Type()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Shift C";
|
||||
}
|
||||
case MultisizeMeasurementsColumns::FullName:
|
||||
return tr("Full name");
|
||||
case MultisizeMeasurementsColumns::Description:
|
||||
return tr("Description");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int DialogMeasurementsCSVColumns::ImportColumnCount() const
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
return static_cast<int>(IndividualMeasurementsColumns::LAST_DO_NOT_USE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<int>(MultisizeMeasurementsColumns::LAST_DO_NOT_USE);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int DialogMeasurementsCSVColumns::MinimumColumns() const
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
int mandatory = 3;
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
mandatory += qMin(m_dimensions.size(), 2);
|
||||
}
|
||||
|
||||
return mandatory;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogMeasurementsCSVColumns::ColumnsValid()
|
||||
{
|
||||
ChangeColor(ui->labelName, OkColor(this));
|
||||
ChangeColor(ui->labelValue, OkColor(this));
|
||||
if (m_type == MeasurementsType::Multisize)
|
||||
{
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
ChangeColor(ui->labelShiftA, OkColor(this));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
ChangeColor(ui->labelShiftB, OkColor(this));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
ChangeColor(ui->labelShiftC, OkColor(this));
|
||||
}
|
||||
}
|
||||
ChangeColor(ui->labelFullName, OkColor(this));
|
||||
ChangeColor(ui->labelDescription, OkColor(this));
|
||||
|
||||
auto ColumnValid = [this](int column)
|
||||
{
|
||||
int value = m_columnsMap.at(column);
|
||||
|
||||
if (value == -1 && not ColumnMandatory(column))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int c=0; c < m_columnsMap.size(); ++c)
|
||||
{
|
||||
if (c == column)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value == m_columnsMap.at(c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
bool columnNameFlag = true;
|
||||
bool columnValueFlag = true;
|
||||
bool columnShiftAFlag = true;
|
||||
bool columnShiftBFlag = true;
|
||||
bool columnShiftCFlag = true;
|
||||
bool columnFullNameFlag = true;
|
||||
bool columnDescriptionFlag = true;
|
||||
|
||||
const QColor errorColor = Qt::red;
|
||||
|
||||
|
||||
if (m_type == MeasurementsType::Multisize)
|
||||
{
|
||||
if (not ColumnValid(static_cast<int>(MultisizeMeasurementsColumns::Name)))
|
||||
{
|
||||
ChangeColor(ui->labelName, errorColor);
|
||||
columnNameFlag = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not ColumnValid(static_cast<int>(IndividualMeasurementsColumns::Name)))
|
||||
{
|
||||
ChangeColor(ui->labelName, errorColor);
|
||||
columnNameFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_type == MeasurementsType::Multisize)
|
||||
{
|
||||
if (not ColumnValid(static_cast<int>(MultisizeMeasurementsColumns::BaseValue)))
|
||||
{
|
||||
ChangeColor(ui->labelValue, errorColor);
|
||||
columnValueFlag = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not ColumnValid(static_cast<int>(IndividualMeasurementsColumns::Value)))
|
||||
{
|
||||
ChangeColor(ui->labelValue, errorColor);
|
||||
columnValueFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_type == MeasurementsType::Multisize)
|
||||
{
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
if (not ColumnValid(static_cast<int>(MultisizeMeasurementsColumns::ShiftA)))
|
||||
{
|
||||
ChangeColor(ui->labelShiftA, errorColor);
|
||||
columnShiftAFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
if (not ColumnValid(static_cast<int>(MultisizeMeasurementsColumns::ShiftB)))
|
||||
{
|
||||
ChangeColor(ui->labelShiftB, errorColor);
|
||||
columnShiftBFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
if (not ColumnValid(static_cast<int>(MultisizeMeasurementsColumns::ShiftC)))
|
||||
{
|
||||
ChangeColor(ui->labelShiftC, errorColor);
|
||||
columnShiftCFlag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (not ColumnValid(m_type == MeasurementsType::Multisize
|
||||
? static_cast<int>(MultisizeMeasurementsColumns::FullName)
|
||||
: static_cast<int>(IndividualMeasurementsColumns::FullName)))
|
||||
{
|
||||
ChangeColor(ui->labelFullName, errorColor);
|
||||
columnFullNameFlag = false;
|
||||
}
|
||||
|
||||
if (not ColumnValid(m_type == MeasurementsType::Multisize
|
||||
? static_cast<int>(MultisizeMeasurementsColumns::Description)
|
||||
: static_cast<int>(IndividualMeasurementsColumns::Description)))
|
||||
{
|
||||
ChangeColor(ui->labelDescription, errorColor);
|
||||
columnDescriptionFlag = false;
|
||||
}
|
||||
|
||||
return columnNameFlag && columnValueFlag && columnShiftAFlag && columnShiftBFlag && columnShiftCFlag &&
|
||||
columnFullNameFlag && columnDescriptionFlag;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::InitColumnsMap()
|
||||
{
|
||||
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
|
||||
m_columnsMap.clear();
|
||||
|
||||
auto InitColumn = [this, csv](int column, bool forceSkip=false)
|
||||
{
|
||||
if (forceSkip)
|
||||
{
|
||||
m_columnsMap[column] = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ColumnMandatory(column))
|
||||
{
|
||||
m_columnsMap[column] = column;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_columnsMap[column] = csv->columnCount() >= column ? column : -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
m_columnsMap.resize(static_cast<int>(IndividualMeasurementsColumns::LAST_DO_NOT_USE));
|
||||
|
||||
for(int column = 0; column < static_cast<int>(IndividualMeasurementsColumns::LAST_DO_NOT_USE); ++column)
|
||||
{
|
||||
InitColumn(column);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_columnsMap.resize(static_cast<int>(MultisizeMeasurementsColumns::LAST_DO_NOT_USE));
|
||||
|
||||
InitColumn(static_cast<int>(MultisizeMeasurementsColumns::Name));
|
||||
InitColumn(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
|
||||
InitColumn(static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
|
||||
InitColumn(static_cast<int>(MultisizeMeasurementsColumns::ShiftB), m_dimensions.size() < 2);
|
||||
InitColumn(static_cast<int>(MultisizeMeasurementsColumns::ShiftC), m_dimensions.size() < 3);
|
||||
InitColumn(static_cast<int>(MultisizeMeasurementsColumns::FullName));
|
||||
InitColumn(static_cast<int>(MultisizeMeasurementsColumns::Description));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::InitColumnsControls()
|
||||
{
|
||||
const int inputColumnCount = CSVModel()->columnCount();
|
||||
|
||||
auto InitControl = [this, inputColumnCount](QComboBox *control, int column)
|
||||
{
|
||||
SCASSERT(control != nullptr)
|
||||
|
||||
int currentColumn = -2;
|
||||
int index = control->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
currentColumn = control->currentData().toInt();
|
||||
}
|
||||
|
||||
control->blockSignals(true);
|
||||
control->clear();
|
||||
|
||||
for(int i=0; i < inputColumnCount; ++i)
|
||||
{
|
||||
control->addItem(QString::number(i+1), i);
|
||||
}
|
||||
|
||||
if (not ColumnMandatory(column))
|
||||
{
|
||||
control->addItem(tr("Skip"), -1);
|
||||
}
|
||||
|
||||
control->setCurrentIndex(-1);
|
||||
|
||||
index = control->findData(currentColumn);
|
||||
if (index != -1)
|
||||
{
|
||||
control->setCurrentIndex(index);
|
||||
control->blockSignals(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
control->blockSignals(false);
|
||||
control->setCurrentIndex(0);
|
||||
}
|
||||
};
|
||||
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
InitControl(ui->comboBoxName, static_cast<int>(IndividualMeasurementsColumns::Name));
|
||||
InitControl(ui->comboBoxValue, static_cast<int>(IndividualMeasurementsColumns::Value));
|
||||
InitControl(ui->comboBoxFullName, static_cast<int>(IndividualMeasurementsColumns::FullName));
|
||||
InitControl(ui->comboBoxDescription, static_cast<int>(IndividualMeasurementsColumns::Description));
|
||||
}
|
||||
else
|
||||
{
|
||||
InitControl(ui->comboBoxName, static_cast<int>(MultisizeMeasurementsColumns::Name));
|
||||
InitControl(ui->comboBoxValue, static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
|
||||
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
InitControl(ui->comboBoxShiftA, static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
InitControl(ui->comboBoxShiftB, static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
InitControl(ui->comboBoxShiftC, static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
|
||||
}
|
||||
|
||||
InitControl(ui->comboBoxFullName, static_cast<int>(MultisizeMeasurementsColumns::FullName));
|
||||
InitControl(ui->comboBoxDescription, static_cast<int>(MultisizeMeasurementsColumns::Description));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::InitImportHeaders()
|
||||
{
|
||||
if (m_fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int columns = ImportColumnCount();
|
||||
|
||||
ui->tableWidgetImport->clear();
|
||||
ui->tableWidgetImport->setColumnCount(columns);
|
||||
|
||||
auto AddHeader = [this](int column, bool visible=true)
|
||||
{
|
||||
QTableWidgetItem *header = new QTableWidgetItem(ColumnHeader(column));
|
||||
ui->tableWidgetImport->setHorizontalHeaderItem(column, header);
|
||||
ui->tableWidgetImport->setColumnHidden(column, not visible);
|
||||
};
|
||||
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
AddHeader(static_cast<int>(IndividualMeasurementsColumns::Name));
|
||||
AddHeader(static_cast<int>(IndividualMeasurementsColumns::Value));
|
||||
AddHeader(static_cast<int>(IndividualMeasurementsColumns::FullName));
|
||||
AddHeader(static_cast<int>(IndividualMeasurementsColumns::Description));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHeader(static_cast<int>(MultisizeMeasurementsColumns::Name));
|
||||
AddHeader(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
|
||||
AddHeader(static_cast<int>(MultisizeMeasurementsColumns::ShiftA), m_dimensions.size() > 0);
|
||||
AddHeader(static_cast<int>(MultisizeMeasurementsColumns::ShiftB), m_dimensions.size() > 1);
|
||||
AddHeader(static_cast<int>(MultisizeMeasurementsColumns::ShiftC), m_dimensions.size() > 2);
|
||||
AddHeader(static_cast<int>(MultisizeMeasurementsColumns::FullName));
|
||||
AddHeader(static_cast<int>(MultisizeMeasurementsColumns::Description));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QSharedPointer<QxtCsvModel> DialogMeasurementsCSVColumns::CSVModel() const
|
||||
{
|
||||
return QSharedPointer<QxtCsvModel>::create(m_fileName, nullptr, m_withHeader, m_separator, m_codec);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::ShowInputPreview()
|
||||
{
|
||||
if (m_fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
|
||||
|
||||
const int columns = csv->columnCount();
|
||||
const int rows = csv->rowCount();
|
||||
|
||||
ui->tableWidgetInput->clear();
|
||||
ui->tableWidgetInput->setColumnCount(columns);
|
||||
ui->tableWidgetInput->setRowCount(rows);
|
||||
|
||||
ui->tableWidgetInput->horizontalHeader()->setVisible(m_withHeader);
|
||||
if (m_withHeader)
|
||||
{
|
||||
for(int column=0; column<columns; ++column)
|
||||
{
|
||||
QTableWidgetItem *header = new QTableWidgetItem(csv->headerText(column));
|
||||
header->setToolTip(QString::number(column+1));
|
||||
ui->tableWidgetInput->setHorizontalHeaderItem(column, header);
|
||||
}
|
||||
}
|
||||
|
||||
for (int row=0; row < rows; ++row)
|
||||
{
|
||||
for(int column=0; column<columns; ++column)
|
||||
{
|
||||
const QString text = csv->text(row, column);
|
||||
QTableWidgetItem *item = new QTableWidgetItem(text);
|
||||
item->setToolTip(text);
|
||||
|
||||
// set the item non-editable (view only), and non-selectable
|
||||
Qt::ItemFlags flags = item->flags();
|
||||
flags &= ~(Qt::ItemIsEditable); // reset/clear the flag
|
||||
item->setFlags(flags);
|
||||
|
||||
ui->tableWidgetInput->setItem(row, column, item);
|
||||
}
|
||||
}
|
||||
|
||||
ui->tableWidgetInput->resizeColumnsToContents();
|
||||
ui->tableWidgetInput->resizeRowsToContents();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::ShowImportPreview()
|
||||
{
|
||||
if (m_fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
|
||||
|
||||
const int importColumns = ImportColumnCount();
|
||||
const int columns = csv->columnCount();
|
||||
const int rows = csv->rowCount();
|
||||
|
||||
ui->tableWidgetImport->clearContents();
|
||||
ui->tableWidgetImport->setRowCount(rows);
|
||||
|
||||
for (int row=0; row < rows; ++row)
|
||||
{
|
||||
for(int column=0; column < importColumns; ++column)
|
||||
{
|
||||
const int tableColumn = m_columnsMap.at(column);
|
||||
if (tableColumn >= 0 && tableColumn < columns)
|
||||
{
|
||||
const QString text = csv->text(row, tableColumn);
|
||||
QTableWidgetItem *item = new QTableWidgetItem(text);
|
||||
item->setToolTip(text);
|
||||
|
||||
// set the item non-editable (view only), and non-selectable
|
||||
Qt::ItemFlags flags = item->flags();
|
||||
flags &= ~(Qt::ItemIsEditable); // reset/clear the flag
|
||||
item->setFlags(flags);
|
||||
|
||||
ui->tableWidgetImport->setItem(row, column, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui->tableWidgetImport->resizeColumnsToContents();
|
||||
ui->tableWidgetImport->resizeRowsToContents();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::HackColumnControls()
|
||||
{
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
HackWidget(&ui->labelShiftA);
|
||||
HackWidget(&ui->labelShiftB);
|
||||
HackWidget(&ui->labelShiftC);
|
||||
|
||||
HackWidget(&ui->comboBoxShiftA);
|
||||
HackWidget(&ui->comboBoxShiftB);
|
||||
HackWidget(&ui->comboBoxShiftC);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_dimensions.size() < 2)
|
||||
{
|
||||
HackWidget(&ui->labelShiftB);
|
||||
HackWidget(&ui->comboBoxShiftB);
|
||||
}
|
||||
|
||||
if (m_dimensions.size() < 3)
|
||||
{
|
||||
HackWidget(&ui->labelShiftC);
|
||||
HackWidget(&ui->comboBoxShiftC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::RetranslateLabels()
|
||||
{
|
||||
ui->labelName->setText(tr("Name") + "*:");
|
||||
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
ui->labelValue->setText(tr("Value") + "*:");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->labelValue->setText(tr("Base value") + "*:");
|
||||
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(0);
|
||||
ui->labelShiftA->setText(tr("Shift (%1)*:")
|
||||
.arg(VAbstartMeasurementDimension::DimensionName(dimension->Type())));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(1);
|
||||
ui->labelShiftB->setText(tr("Shift (%1)*:")
|
||||
.arg(VAbstartMeasurementDimension::DimensionName(dimension->Type())));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(2);
|
||||
ui->labelShiftC->setText(tr("Shift (%1)*:")
|
||||
.arg(VAbstartMeasurementDimension::DimensionName(dimension->Type())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::SetDefaultColumns()
|
||||
{
|
||||
auto SetDefault = [this](QComboBox *control, int column)
|
||||
{
|
||||
SCASSERT(control != nullptr)
|
||||
|
||||
int index = control->findData(m_columnsMap.at(column));
|
||||
if (index != -1)
|
||||
{
|
||||
control->setCurrentIndex(index);
|
||||
}
|
||||
};
|
||||
|
||||
if (m_type == MeasurementsType::Individual)
|
||||
{
|
||||
SetDefault(ui->comboBoxName, static_cast<int>(IndividualMeasurementsColumns::Name));
|
||||
SetDefault(ui->comboBoxValue, static_cast<int>(IndividualMeasurementsColumns::Value));
|
||||
SetDefault(ui->comboBoxFullName, static_cast<int>(IndividualMeasurementsColumns::FullName));
|
||||
SetDefault(ui->comboBoxDescription, static_cast<int>(IndividualMeasurementsColumns::Description));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDefault(ui->comboBoxName, static_cast<int>(MultisizeMeasurementsColumns::Name));
|
||||
SetDefault(ui->comboBoxValue, static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
|
||||
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
SetDefault(ui->comboBoxShiftA, static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
SetDefault(ui->comboBoxShiftB, static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
|
||||
}
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
SetDefault(ui->comboBoxShiftC, static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
|
||||
}
|
||||
|
||||
SetDefault(ui->comboBoxFullName, static_cast<int>(MultisizeMeasurementsColumns::FullName));
|
||||
SetDefault(ui->comboBoxDescription, static_cast<int>(MultisizeMeasurementsColumns::Description));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogMeasurementsCSVColumns::CheckStatus()
|
||||
{
|
||||
auto SetStatus = [this](bool status)
|
||||
{
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr)
|
||||
bOk->setEnabled(status);
|
||||
};
|
||||
|
||||
if (m_fileName.isEmpty())
|
||||
{
|
||||
SetStatus(false);
|
||||
ui->labelStatus->setText(tr("File path is empty"));
|
||||
return;
|
||||
}
|
||||
|
||||
QSharedPointer<QxtCsvModel> csv = DialogMeasurementsCSVColumns::CSVModel();
|
||||
|
||||
const int columns = csv->columnCount();
|
||||
if (columns < MinimumColumns())
|
||||
{
|
||||
SetStatus(false);
|
||||
ui->labelStatus->setText(tr("Not enough columns"));
|
||||
return;
|
||||
}
|
||||
|
||||
const int rows = csv->rowCount();
|
||||
if (rows < 1)
|
||||
{
|
||||
SetStatus(false);
|
||||
ui->labelStatus->setText(tr("Not enough data to import"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (not ColumnsValid())
|
||||
{
|
||||
SetStatus(false);
|
||||
ui->labelStatus->setText(tr("Please, select unique number for each column"));
|
||||
return;
|
||||
}
|
||||
|
||||
SetStatus(true);
|
||||
ui->labelStatus->setText(tr("Ready"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class T>
|
||||
void DialogMeasurementsCSVColumns::HackWidget(T **widget)
|
||||
{
|
||||
delete *widget;
|
||||
*widget = new T();
|
||||
m_hackedWidgets.append(*widget);
|
||||
}
|
149
src/app/tape/dialogs/dialogmeasurementscsvcolumns.h
Normal file
149
src/app/tape/dialogs/dialogmeasurementscsvcolumns.h
Normal file
|
@ -0,0 +1,149 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogmeasurementscsvcolumns.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 9 10, 2020
|
||||
**
|
||||
** @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) 2020 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 DIALOGMEASUREMENTSCSVCOLUMNS_H
|
||||
#define DIALOGMEASUREMENTSCSVCOLUMNS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "../vformat/vdimensions.h"
|
||||
|
||||
class QxtCsvModel;
|
||||
|
||||
enum class IndividualMeasurementsColumns: qint8
|
||||
{
|
||||
Name = 0,
|
||||
Value = 1,
|
||||
FullName = 2, // optional
|
||||
Description = 3, // optional
|
||||
LAST_DO_NOT_USE = 4
|
||||
};
|
||||
|
||||
enum class MultisizeMeasurementsColumns: qint8
|
||||
{
|
||||
Name = 0,
|
||||
BaseValue = 1,
|
||||
ShiftA = 2,
|
||||
ShiftB = 3, // optional if not required
|
||||
ShiftC = 4, // optional if not required
|
||||
FullName = 5, // optional
|
||||
Description = 6, // optional
|
||||
LAST_DO_NOT_USE = 7
|
||||
};
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class DialogMeasurementsCSVColumns;
|
||||
}
|
||||
|
||||
class DialogMeasurementsCSVColumns : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DialogMeasurementsCSVColumns(const QString &filename, MeasurementsType type, QWidget *parent = nullptr);
|
||||
DialogMeasurementsCSVColumns(const QString &filename, MeasurementsType type,
|
||||
const QList<MeasurementDimension_p> &dimensions, QWidget *parent = nullptr);
|
||||
virtual ~DialogMeasurementsCSVColumns();
|
||||
|
||||
QVector<int> ColumnsMap() const;
|
||||
|
||||
void SetWithHeader(bool withHeader);
|
||||
void SetSeparator(const QChar &separator);
|
||||
void SetCodec(QTextCodec *codec);
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void ColumnChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogMeasurementsCSVColumns)
|
||||
Ui::DialogMeasurementsCSVColumns *ui;
|
||||
bool m_isInitialized{false};
|
||||
QString m_fileName;
|
||||
bool m_withHeader{false};
|
||||
QChar m_separator{','};
|
||||
QTextCodec *m_codec{nullptr};
|
||||
QVector<int> m_columnsMap{};
|
||||
MeasurementsType m_type;
|
||||
QList<MeasurementDimension_p> m_dimensions{};
|
||||
QVector<QObject *> m_hackedWidgets{};
|
||||
|
||||
bool ColumnMandatory(int column) const;
|
||||
QString ColumnHeader(int column) const;
|
||||
int ImportColumnCount() const;
|
||||
int MinimumColumns() const;
|
||||
bool ColumnsValid();
|
||||
|
||||
void InitColumnsMap();
|
||||
void InitColumnsControls();
|
||||
void InitImportHeaders();
|
||||
|
||||
QSharedPointer<QxtCsvModel> CSVModel() const;
|
||||
|
||||
void ShowInputPreview();
|
||||
void ShowImportPreview();
|
||||
|
||||
template <class T>
|
||||
void HackWidget(T **widget);
|
||||
void HackColumnControls();
|
||||
|
||||
void RetranslateLabels();
|
||||
|
||||
void SetDefaultColumns();
|
||||
|
||||
void CheckStatus();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QVector<int> DialogMeasurementsCSVColumns::ColumnsMap() const
|
||||
{
|
||||
return m_columnsMap;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void DialogMeasurementsCSVColumns::SetWithHeader(bool withHeader)
|
||||
{
|
||||
m_withHeader = withHeader;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void DialogMeasurementsCSVColumns::SetSeparator(const QChar &separator)
|
||||
{
|
||||
m_separator = separator;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void DialogMeasurementsCSVColumns::SetCodec(QTextCodec *codec)
|
||||
{
|
||||
m_codec = codec;
|
||||
}
|
||||
|
||||
#endif // DIALOGMEASUREMENTSCSVCOLUMNS_H
|
204
src/app/tape/dialogs/dialogmeasurementscsvcolumns.ui
Normal file
204
src/app/tape/dialogs/dialogmeasurementscsvcolumns.ui
Normal file
|
@ -0,0 +1,204 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogMeasurementsCSVColumns</class>
|
||||
<widget class="QDialog" name="DialogMeasurementsCSVColumns">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>908</width>
|
||||
<height>703</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Setup columns</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../share/resources/tapeicon.qrc">
|
||||
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Input</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidgetInput">
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Import</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidgetImport">
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Columns</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelName">
|
||||
<property name="text">
|
||||
<string notr="true">Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelValue">
|
||||
<property name="text">
|
||||
<string notr="true">Value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxValue"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelShiftA">
|
||||
<property name="text">
|
||||
<string notr="true">ShiftA:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxShiftA"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelShiftB">
|
||||
<property name="text">
|
||||
<string notr="true">ShiftB:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxShiftB"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelShiftC">
|
||||
<property name="text">
|
||||
<string notr="true">ShiftC:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBoxShiftC"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelFullName">
|
||||
<property name="text">
|
||||
<string>Full name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxFullName"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="labelDescription">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="comboBoxDescription"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelStatus">
|
||||
<property name="text">
|
||||
<string>Ready</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../share/resources/tapeicon.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogMeasurementsCSVColumns</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogMeasurementsCSVColumns</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -44,31 +44,7 @@ DialogNewMeasurements::DialogNewMeasurements(QWidget *parent)
|
|||
ui->setupUi(this);
|
||||
|
||||
InitMTypes();
|
||||
InitUnits(MeasurementsType::Individual);
|
||||
InitHeightsList();
|
||||
InitSizesList();
|
||||
|
||||
const VTapeSettings *settings = qApp->TapeSettings();
|
||||
|
||||
const int height = static_cast<int>(UnitConvertor(settings->GetDefHeight(), Unit::Cm, MUnit()));
|
||||
int index = ui->comboBoxBaseHeight->findText(QString().setNum(height));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxBaseHeight->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
const int size = static_cast<int>(UnitConvertor(settings->GetDefSize(), Unit::Cm, MUnit()));
|
||||
index = ui->comboBoxBaseSize->findText(QString().setNum(size));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxBaseSize->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
connect(ui->comboBoxMType, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogNewMeasurements::CurrentTypeChanged);
|
||||
|
||||
connect(ui->comboBoxUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogNewMeasurements::CurrentUnitChanged);
|
||||
InitUnits();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -89,18 +65,6 @@ Unit DialogNewMeasurements::MUnit() const
|
|||
return static_cast<Unit>(ui->comboBoxUnit->currentData().toInt());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int DialogNewMeasurements::BaseSize() const
|
||||
{
|
||||
return ui->comboBoxBaseSize->currentText().toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int DialogNewMeasurements::BaseHeight() const
|
||||
{
|
||||
return ui->comboBoxBaseHeight->currentText().toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::changeEvent(QEvent *event)
|
||||
{
|
||||
|
@ -109,7 +73,7 @@ void DialogNewMeasurements::changeEvent(QEvent *event)
|
|||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
InitMTypes();
|
||||
InitUnits(static_cast<MeasurementsType>(ui->comboBoxMType->currentData().toInt()));
|
||||
InitUnits();
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
|
@ -137,40 +101,6 @@ void DialogNewMeasurements::showEvent(QShowEvent *event)
|
|||
isInitialized = true;//first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::CurrentTypeChanged(int index)
|
||||
{
|
||||
const MeasurementsType type = static_cast<MeasurementsType>(ui->comboBoxMType->itemData(index).toInt());
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
ui->comboBoxBaseSize->setEnabled(true);
|
||||
ui->comboBoxBaseHeight->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->comboBoxBaseSize->setEnabled(false);
|
||||
ui->comboBoxBaseHeight->setEnabled(false);
|
||||
}
|
||||
InitUnits(type);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::CurrentUnitChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
|
||||
if (MUnit() != Unit::Inch)
|
||||
{
|
||||
int i = ui->comboBoxBaseHeight->currentIndex();
|
||||
InitHeightsList();
|
||||
ui->comboBoxBaseHeight->setCurrentIndex(i);
|
||||
|
||||
i = ui->comboBoxBaseSize->currentIndex();
|
||||
InitSizesList();
|
||||
ui->comboBoxBaseSize->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitMTypes()
|
||||
{
|
||||
|
@ -194,23 +124,7 @@ void DialogNewMeasurements::InitMTypes()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitHeightsList()
|
||||
{
|
||||
const QStringList list = VMeasurement::WholeListHeights(MUnit());
|
||||
ui->comboBoxBaseHeight->clear();
|
||||
ui->comboBoxBaseHeight->addItems(list);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitSizesList()
|
||||
{
|
||||
const QStringList list = VMeasurement::WholeListSizes(MUnit());
|
||||
ui->comboBoxBaseSize->clear();
|
||||
ui->comboBoxBaseSize->addItems(list);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitUnits(const MeasurementsType &type)
|
||||
void DialogNewMeasurements::InitUnits()
|
||||
{
|
||||
int val = static_cast<int>(Unit::Cm);
|
||||
if (ui->comboBoxUnit->currentIndex() != -1)
|
||||
|
@ -220,12 +134,11 @@ void DialogNewMeasurements::InitUnits(const MeasurementsType &type)
|
|||
|
||||
ui->comboBoxUnit->blockSignals(true);
|
||||
ui->comboBoxUnit->clear();
|
||||
|
||||
ui->comboBoxUnit->addItem(tr("Centimeters"), static_cast<int>(Unit::Cm));
|
||||
ui->comboBoxUnit->addItem(tr("Millimiters"), static_cast<int>(Unit::Mm));
|
||||
if (type == MeasurementsType::Individual)
|
||||
{
|
||||
ui->comboBoxUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
|
||||
}
|
||||
ui->comboBoxUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
|
||||
|
||||
ui->comboBoxUnit->setCurrentIndex(-1);
|
||||
ui->comboBoxUnit->blockSignals(false);
|
||||
|
||||
|
|
|
@ -48,26 +48,18 @@ public:
|
|||
|
||||
MeasurementsType Type() const;
|
||||
Unit MUnit() const;
|
||||
int BaseSize() const;
|
||||
int BaseHeight() const;
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void CurrentTypeChanged(int index);
|
||||
void CurrentUnitChanged(int index);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogNewMeasurements)
|
||||
Ui::DialogNewMeasurements *ui;
|
||||
bool isInitialized;
|
||||
|
||||
void InitMTypes();
|
||||
void InitHeightsList();
|
||||
void InitSizesList();
|
||||
void InitUnits(const MeasurementsType &type);
|
||||
void InitUnits();
|
||||
};
|
||||
|
||||
#endif // DIALOGNEWMEASUREMENTS_H
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>244</width>
|
||||
<height>185</height>
|
||||
<width>220</width>
|
||||
<height>104</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -60,64 +60,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Base size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxBaseSize">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Base height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxBaseHeight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
655
src/app/tape/dialogs/dialogrestrictdimension.cpp
Normal file
655
src/app/tape/dialogs/dialogrestrictdimension.cpp
Normal file
|
@ -0,0 +1,655 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogrestrictdimension.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 5 10, 2020
|
||||
**
|
||||
** @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) 2020 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 "dialogrestrictdimension.h"
|
||||
#include "ui_dialogrestrictdimension.h"
|
||||
|
||||
#include <QTableWidgetItem>
|
||||
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vwidgets/vdecorationaligningdelegate.h"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<int> FilterByMinimum(const QVector<int> &base, int restriction)
|
||||
{
|
||||
if (restriction <= 0)
|
||||
{
|
||||
return base;
|
||||
}
|
||||
|
||||
QVector<int> filtered;
|
||||
filtered.reserve(base.size());
|
||||
for(auto &b : base)
|
||||
{
|
||||
if (b >= restriction)
|
||||
{
|
||||
filtered.append(b);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<int> FilterByMaximum(const QVector<int> &base, int restriction)
|
||||
{
|
||||
if (restriction <= 0)
|
||||
{
|
||||
return base;
|
||||
}
|
||||
|
||||
QVector<int> filtered;
|
||||
filtered.reserve(base.size());
|
||||
for(auto &b : base)
|
||||
{
|
||||
if (b <= restriction)
|
||||
{
|
||||
filtered.append(b);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogRestrictDimension::DialogRestrictDimension(const QList<MeasurementDimension_p> &dimensions,
|
||||
const QMap<QString, QPair<int, int>> &restrictions,
|
||||
bool oneDimesionRestriction, bool fullCircumference,
|
||||
QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogRestrictDimension),
|
||||
m_oneDimesionRestriction(oneDimesionRestriction),
|
||||
m_fullCircumference(fullCircumference),
|
||||
m_dimensions(dimensions),
|
||||
m_restrictions(restrictions)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableWidget->setItemDelegate(
|
||||
new VDecorationAligningDelegate(Qt::AlignHCenter | Qt::AlignCenter, ui->tableWidget));
|
||||
|
||||
connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, this, &DialogRestrictDimension::RowSelected);
|
||||
|
||||
connect(ui->comboBoxDimensionA, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogRestrictDimension::DimensionAChanged);
|
||||
|
||||
connect(ui->comboBoxMin, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogRestrictDimension::MinRestrictionChanged);
|
||||
connect(ui->comboBoxMax, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogRestrictDimension::MaxRestrictionChanged);
|
||||
|
||||
InitDimensionsBaseValues();
|
||||
InitTable();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogRestrictDimension::~DialogRestrictDimension()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
|
||||
auto RetranslateControls = [this](int index, QLabel *name, QComboBox *control)
|
||||
{
|
||||
SCASSERT(name != nullptr)
|
||||
SCASSERT(control != nullptr)
|
||||
|
||||
if (m_dimensions.size() > index)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(index);
|
||||
|
||||
name->setText(VAbstartMeasurementDimension::DimensionName(dimension->Type())+QChar(':'));
|
||||
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension->Type(),
|
||||
dimension->IsCircumference(),
|
||||
m_fullCircumference));
|
||||
|
||||
InitDimensionGradation(dimension, control);
|
||||
}
|
||||
};
|
||||
|
||||
if (not m_oneDimesionRestriction)
|
||||
{
|
||||
RetranslateControls(0, ui->labelDimensionA, ui->comboBoxDimensionA);
|
||||
}
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
QDialog::changeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::RowSelected()
|
||||
{
|
||||
EnableRestrictionControls(false);
|
||||
|
||||
QTableWidgetItem *item = ui->tableWidget->currentItem();
|
||||
|
||||
if (item)
|
||||
{
|
||||
int base1 = 0;
|
||||
int base2 = 0;
|
||||
MeasurementDimension_p dimension;
|
||||
|
||||
if (m_oneDimesionRestriction)
|
||||
{
|
||||
base1 = item->data(Qt::UserRole).toInt();
|
||||
|
||||
if (m_dimensions.size() > 1)
|
||||
{
|
||||
dimension = m_dimensions.at(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base1 = ui->comboBoxDimensionA->currentData().toInt();
|
||||
base2 = item->data(Qt::UserRole).toInt();
|
||||
|
||||
if (m_dimensions.size() > 2)
|
||||
{
|
||||
dimension = m_dimensions.at(2);
|
||||
}
|
||||
}
|
||||
|
||||
QPair<int, int> restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2),
|
||||
QPair<int, int>(0, 0));
|
||||
|
||||
if (dimension.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QVector<int> bases = dimension->ValidBases();
|
||||
|
||||
ui->comboBoxMin->blockSignals(true);
|
||||
ui->comboBoxMin->clear();
|
||||
QVector<int> filtered = FilterByMaximum(bases, restriction.second);
|
||||
FillBases(filtered, dimension, ui->comboBoxMin);
|
||||
int index = ui->comboBoxMin->findData(restriction.first);
|
||||
ui->comboBoxMin->setCurrentIndex(index != -1 ? index : 0);
|
||||
ui->comboBoxMin->blockSignals(false);
|
||||
|
||||
ui->comboBoxMax->blockSignals(true);
|
||||
ui->comboBoxMax->clear();
|
||||
filtered = FilterByMinimum(bases, restriction.first);
|
||||
FillBases(FilterByMinimum(bases, restriction.first), dimension, ui->comboBoxMax);
|
||||
index = ui->comboBoxMax->findData(restriction.second);
|
||||
ui->comboBoxMax->setCurrentIndex(index != -1 ? index : ui->comboBoxMax->count() - 1);
|
||||
ui->comboBoxMax->blockSignals(false);
|
||||
|
||||
EnableRestrictionControls(true);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::DimensionAChanged()
|
||||
{
|
||||
InitTable();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::MinRestrictionChanged()
|
||||
{
|
||||
QTableWidgetItem *item = ui->tableWidget->currentItem();
|
||||
|
||||
if (item)
|
||||
{
|
||||
int base1 = 0;
|
||||
int base2 = 0;
|
||||
|
||||
if (m_oneDimesionRestriction)
|
||||
{
|
||||
base1 = item->data(Qt::UserRole).toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
base1 = ui->comboBoxDimensionA->currentData().toInt();
|
||||
base2 = item->data(Qt::UserRole).toInt();
|
||||
}
|
||||
|
||||
const QString coordinates = VMeasurement::CorrectionHash(base1, base2);
|
||||
QPair<int, int> restriction = m_restrictions.value(coordinates, QPair<int, int>(0, 0));
|
||||
|
||||
restriction.first = ui->comboBoxMin->currentData().toInt();
|
||||
m_restrictions.insert(coordinates, restriction);
|
||||
|
||||
const int currentRow = ui->tableWidget->currentRow();
|
||||
RefreshTable();
|
||||
|
||||
ui->tableWidget->blockSignals(true);
|
||||
ui->tableWidget->selectRow(currentRow);
|
||||
ui->tableWidget->blockSignals(false);
|
||||
|
||||
RowSelected();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::MaxRestrictionChanged()
|
||||
{
|
||||
QTableWidgetItem *item = ui->tableWidget->currentItem();
|
||||
|
||||
if (item)
|
||||
{
|
||||
int base1 = 0;
|
||||
int base2 = 0;
|
||||
|
||||
if (m_oneDimesionRestriction)
|
||||
{
|
||||
base1 = item->data(Qt::UserRole).toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
base1 = ui->comboBoxDimensionA->currentData().toInt();
|
||||
base2 = item->data(Qt::UserRole).toInt();
|
||||
}
|
||||
|
||||
const QString coordinates = VMeasurement::CorrectionHash(base1, base2);
|
||||
QPair<int, int> restriction = m_restrictions.value(coordinates, QPair<int, int>(0, 0));
|
||||
|
||||
restriction.second = ui->comboBoxMax->currentData().toInt();
|
||||
m_restrictions.insert(coordinates, restriction);
|
||||
|
||||
const int currentRow = ui->tableWidget->currentRow();
|
||||
RefreshTable();
|
||||
|
||||
ui->tableWidget->blockSignals(true);
|
||||
ui->tableWidget->selectRow(currentRow);
|
||||
ui->tableWidget->blockSignals(false);
|
||||
|
||||
RowSelected();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::InitDimensionsBaseValues()
|
||||
{
|
||||
auto DimensionsBaseValue = [this](int index, QLabel *name, QComboBox *control)
|
||||
{
|
||||
SCASSERT(name != nullptr)
|
||||
SCASSERT(control != nullptr)
|
||||
|
||||
if (m_dimensions.size() > index)
|
||||
{
|
||||
MeasurementDimension_p dimension = m_dimensions.at(index);
|
||||
const QString unit = UnitsToStr(dimension->Units(), true);
|
||||
name->setText(VAbstartMeasurementDimension::DimensionName(dimension->Type())+QChar(':'));
|
||||
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension->Type(),
|
||||
dimension->IsCircumference(),
|
||||
m_fullCircumference));
|
||||
|
||||
InitDimensionGradation(dimension, control);
|
||||
}
|
||||
};
|
||||
|
||||
if (not m_oneDimesionRestriction)
|
||||
{
|
||||
if (m_dimensions.size() > 0)
|
||||
{
|
||||
DimensionsBaseValue(0, ui->labelDimensionA, ui->comboBoxDimensionA);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->labelDimensionA->setVisible(false);
|
||||
ui->comboBoxDimensionA->setVisible(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->labelDimensionA->setVisible(false);
|
||||
ui->comboBoxDimensionA->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::InitDimensionGradation(const MeasurementDimension_p &dimension, QComboBox *control)
|
||||
{
|
||||
SCASSERT(control != nullptr)
|
||||
|
||||
int current = -1;
|
||||
if (control->currentIndex() != -1)
|
||||
{
|
||||
current = control->currentData().toInt();
|
||||
}
|
||||
|
||||
control->blockSignals(true);
|
||||
control->clear();
|
||||
|
||||
FillBases(dimension->ValidBases(), dimension, control);
|
||||
|
||||
int i = control->findData(current);
|
||||
if (i != -1)
|
||||
{
|
||||
control->setCurrentIndex(i);
|
||||
control->blockSignals(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
control->blockSignals(false);
|
||||
control->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::InitTable()
|
||||
{
|
||||
ui->tableWidget->blockSignals(true);
|
||||
ui->tableWidget->clear();
|
||||
|
||||
auto InitHeaders = [this](int index)
|
||||
{
|
||||
if (m_dimensions.size() > index)
|
||||
{
|
||||
MeasurementDimension_p dimensionA = m_dimensions.at(index-1);
|
||||
const QVector<int> basesA = dimensionA->ValidBases();
|
||||
ui->tableWidget->setRowCount(basesA.size());
|
||||
ui->tableWidget->setVerticalHeaderLabels(DimensionLabels(basesA, dimensionA));
|
||||
|
||||
MeasurementDimension_p dimensionB = m_dimensions.at(index);
|
||||
const QVector<int> basesB = dimensionB->ValidBases();
|
||||
ui->tableWidget->setColumnCount(basesB.size());
|
||||
ui->tableWidget->setHorizontalHeaderLabels(DimensionLabels(basesB, dimensionB));
|
||||
}
|
||||
};
|
||||
|
||||
InitHeaders(m_oneDimesionRestriction ? 1 : 2);
|
||||
ui->tableWidget->blockSignals(false);
|
||||
|
||||
RefreshTable();
|
||||
ui->tableWidget->selectRow(0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::RefreshTable()
|
||||
{
|
||||
QVector<int> basesRow;
|
||||
QVector<int> basesColumn;
|
||||
|
||||
if (m_oneDimesionRestriction)
|
||||
{
|
||||
if (m_dimensions.size() >= 2)
|
||||
{
|
||||
MeasurementDimension_p dimensionA = m_dimensions.at(0);
|
||||
basesRow = dimensionA->ValidBases();
|
||||
|
||||
MeasurementDimension_p dimensionB = m_dimensions.at(1);
|
||||
basesColumn = dimensionB->ValidBases();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_dimensions.size() >= 3)
|
||||
{
|
||||
MeasurementDimension_p dimensionA = m_dimensions.at(1);
|
||||
basesRow = dimensionA->ValidBases();
|
||||
|
||||
MeasurementDimension_p dimensionB = m_dimensions.at(2);
|
||||
basesColumn = dimensionB->ValidBases();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ui->tableWidget->blockSignals(true);
|
||||
ui->tableWidget->clearContents();
|
||||
|
||||
for(int row=0; row < basesRow.size(); ++row)
|
||||
{
|
||||
for(int column=0; column < basesColumn.size(); ++column)
|
||||
{
|
||||
AddCell(row, column, basesRow.at(row), basesColumn.at(column));
|
||||
}
|
||||
}
|
||||
|
||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
|
||||
ui->tableWidget->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::AddCell(int row, int column, int rowValue, int columnValue)
|
||||
{
|
||||
auto *item = new QTableWidgetItem();
|
||||
item->setData(Qt::UserRole, rowValue);
|
||||
|
||||
int base1 = 0;
|
||||
int base2 = 0;
|
||||
MeasurementDimension_p dimension;
|
||||
QVector<int> bases;
|
||||
|
||||
if (m_oneDimesionRestriction)
|
||||
{
|
||||
base1 = rowValue;
|
||||
|
||||
if (m_dimensions.size() >= 2)
|
||||
{
|
||||
dimension = m_dimensions.at(1);
|
||||
bases = dimension->ValidBases();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base1 = ui->comboBoxDimensionA->currentData().toInt();
|
||||
base2 = rowValue;
|
||||
|
||||
if (m_dimensions.size() >= 3)
|
||||
{
|
||||
dimension = m_dimensions.at(2);
|
||||
bases = dimension->ValidBases();
|
||||
}
|
||||
}
|
||||
|
||||
QPair<int, int> restriction = m_restrictions.value(VMeasurement::CorrectionHash(base1, base2),
|
||||
QPair<int, int>(0, 0));
|
||||
int min = INT32_MIN;
|
||||
int max = INT32_MAX;
|
||||
|
||||
if (not dimension.isNull())
|
||||
{
|
||||
min = bases.indexOf(restriction.first) != -1 ? restriction.first : dimension->MinValue();
|
||||
max = bases.indexOf(restriction.second) != -1 ? restriction.second : dimension->MaxValue();
|
||||
|
||||
if (max < min)
|
||||
{
|
||||
min = dimension->MinValue();
|
||||
max = dimension->MaxValue();
|
||||
}
|
||||
}
|
||||
|
||||
const bool leftRestriction = columnValue >= min;
|
||||
const bool rightRestriction = columnValue <= max;
|
||||
|
||||
if (leftRestriction && rightRestriction)
|
||||
{
|
||||
item->setIcon(QIcon("://icon/24x24/star.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setIcon(QIcon("://icon/24x24/close.png"));
|
||||
}
|
||||
|
||||
// set the item non-editable (view only), and non-selectable
|
||||
Qt::ItemFlags flags = item->flags();
|
||||
flags &= ~(Qt::ItemIsEditable); // reset/clear the flag
|
||||
item->setFlags(flags);
|
||||
|
||||
ui->tableWidget->setItem(row, column, item);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::EnableRestrictionControls(bool enable)
|
||||
{
|
||||
if (not enable)
|
||||
{
|
||||
ui->comboBoxMin->blockSignals(true);
|
||||
ui->comboBoxMin->setCurrentIndex(-1);
|
||||
ui->comboBoxMin->blockSignals(false);
|
||||
|
||||
ui->comboBoxMax->blockSignals(true);
|
||||
ui->comboBoxMax->setCurrentIndex(-1);
|
||||
ui->comboBoxMax->blockSignals(false);
|
||||
}
|
||||
|
||||
ui->groupBoxRestriction->setEnabled(enable);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogRestrictDimension::FillBases(const QVector<int> &bases, const MeasurementDimension_p &dimension,
|
||||
QComboBox *control)
|
||||
{
|
||||
SCASSERT(control != nullptr)
|
||||
|
||||
const DimesionLabels labels = dimension->Labels();
|
||||
const QString units = UnitsToStr(dimension->Units(), true);
|
||||
|
||||
if (dimension->Type() == MeasurementDimension::X)
|
||||
{
|
||||
for(auto base : bases)
|
||||
{
|
||||
if (labels.contains(base) && not labels.value(base).isEmpty())
|
||||
{
|
||||
control->addItem(labels.value(base), base);
|
||||
}
|
||||
else
|
||||
{
|
||||
control->addItem(QString("%1 %2").arg(base).arg(units), base);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dimension->Type() == MeasurementDimension::Y)
|
||||
{
|
||||
for(auto base : bases)
|
||||
{
|
||||
if (labels.contains(base) && not labels.value(base).isEmpty())
|
||||
{
|
||||
control->addItem(labels.value(base), base);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dimension->IsCircumference())
|
||||
{
|
||||
control->addItem(QString("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units), base);
|
||||
}
|
||||
else
|
||||
{
|
||||
control->addItem(QString::number(base), base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
||||
{
|
||||
for(auto base : bases)
|
||||
{
|
||||
if (labels.contains(base) && not labels.value(base).isEmpty())
|
||||
{
|
||||
control->addItem(labels.value(base), base);
|
||||
}
|
||||
else
|
||||
{
|
||||
control->addItem(QString("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units), base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList DialogRestrictDimension::DimensionLabels(const QVector<int> &bases, const MeasurementDimension_p &dimension)
|
||||
{
|
||||
const bool showUnits = dimension->IsCircumference() || dimension->Type() == MeasurementDimension::X;
|
||||
const QString units = showUnits ? UnitsToStr(dimension->Units(), true) : QString();
|
||||
const DimesionLabels dimensionLabels = dimension->Labels();
|
||||
|
||||
QStringList labels;
|
||||
|
||||
if (dimension->Type() == MeasurementDimension::X)
|
||||
{
|
||||
for(auto base : bases)
|
||||
{
|
||||
if (dimensionLabels.contains(base) && not dimensionLabels.value(base).isEmpty())
|
||||
{
|
||||
labels.append(dimensionLabels.value(base));
|
||||
}
|
||||
else
|
||||
{
|
||||
labels.append(QString("%1 %2").arg(base).arg(units));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dimension->Type() == MeasurementDimension::Y)
|
||||
{
|
||||
for(auto base : bases)
|
||||
{
|
||||
if (dimensionLabels.contains(base) && not dimensionLabels.value(base).isEmpty())
|
||||
{
|
||||
labels.append(dimensionLabels.value(base));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dimension->IsCircumference())
|
||||
{
|
||||
labels.append(QString("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units));
|
||||
}
|
||||
else
|
||||
{
|
||||
labels.append(QString::number(base));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
||||
{
|
||||
for(auto base : bases)
|
||||
{
|
||||
if (dimensionLabels.contains(base) && not dimensionLabels.value(base).isEmpty())
|
||||
{
|
||||
labels.append(dimensionLabels.value(base));
|
||||
}
|
||||
else
|
||||
{
|
||||
labels.append(QString("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return labels;
|
||||
}
|
95
src/app/tape/dialogs/dialogrestrictdimension.h
Normal file
95
src/app/tape/dialogs/dialogrestrictdimension.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogrestrictdimension.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 5 10, 2020
|
||||
**
|
||||
** @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) 2020 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 DIALOGRESTRICTDIMENSION_H
|
||||
#define DIALOGRESTRICTDIMENSION_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
|
||||
#include "../vformat/vdimensions.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogRestrictDimension;
|
||||
}
|
||||
|
||||
class QTableWidgetItem;
|
||||
|
||||
|
||||
class DialogRestrictDimension : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DialogRestrictDimension(const QList<MeasurementDimension_p> &dimensions,
|
||||
const QMap<QString, QPair<int, int>> &restrictions, bool oneDimesionRestriction,
|
||||
bool fullCircumference, QWidget *parent = nullptr);
|
||||
virtual ~DialogRestrictDimension();
|
||||
|
||||
QMap<QString, QPair<int, int> > Restrictions() const;
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
|
||||
protected slots:
|
||||
void RowSelected();
|
||||
void DimensionAChanged();
|
||||
void MinRestrictionChanged();
|
||||
void MaxRestrictionChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogRestrictDimension)
|
||||
Ui::DialogRestrictDimension *ui;
|
||||
|
||||
bool m_oneDimesionRestriction;
|
||||
bool m_fullCircumference;
|
||||
QList<MeasurementDimension_p> m_dimensions;
|
||||
QMap<QString, QPair<int, int>> m_restrictions;
|
||||
|
||||
void InitDimensionsBaseValues();
|
||||
void InitDimensionGradation(const MeasurementDimension_p &dimension, QComboBox *control);
|
||||
void InitTable();
|
||||
|
||||
void RefreshTable();
|
||||
|
||||
void AddCell(int row, int column, int rowValue, int columnValue);
|
||||
|
||||
void EnableRestrictionControls(bool enable);
|
||||
|
||||
void FillBases(const QVector<int> &bases, const MeasurementDimension_p &dimension, QComboBox *control);
|
||||
|
||||
QStringList DimensionLabels(const QVector<int> &bases, const MeasurementDimension_p &dimension);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QMap<QString, QPair<int, int> > DialogRestrictDimension::Restrictions() const
|
||||
{
|
||||
return m_restrictions;
|
||||
}
|
||||
|
||||
#endif // DIALOGRESTRICTDIMENSION_H
|
180
src/app/tape/dialogs/dialogrestrictdimension.ui
Normal file
180
src/app/tape/dialogs/dialogrestrictdimension.ui
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogRestrictDimension</class>
|
||||
<widget class="QDialog" name="DialogRestrictDimension">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>699</width>
|
||||
<height>566</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Restrict dimension</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../share/resources/tapeicon.qrc">
|
||||
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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 row="0" column="1">
|
||||
<widget class="QLabel" name="labelDimensionA">
|
||||
<property name="text">
|
||||
<string>Dimension A:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboBoxDimensionA"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>4</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::CurrentChanged|QAbstractItemView::SelectedClicked</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxRestriction">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Restriction</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Min:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxMin"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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 row="0" column="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QComboBox" name="comboBoxMax"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../share/resources/tapeicon.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogRestrictDimension</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogRestrictDimension</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
604
src/app/tape/dialogs/dialogsetupmultisize.cpp
Normal file
604
src/app/tape/dialogs/dialogsetupmultisize.cpp
Normal file
|
@ -0,0 +1,604 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogsetupmultisize.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 26 9, 2020
|
||||
**
|
||||
** @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) 2020 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 "dialogsetupmultisize.h"
|
||||
#include "ui_dialogsetupmultisize.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QShowEvent>
|
||||
|
||||
#include "../mapplication.h"
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogSetupMultisize),
|
||||
m_xDimension(QSharedPointer<VXMeasurementDimension>::create(unit)),
|
||||
m_yDimension(QSharedPointer<VYMeasurementDimension>::create(unit)),
|
||||
m_wDimension(QSharedPointer<VWMeasurementDimension>::create(unit)),
|
||||
m_zDimension(QSharedPointer<VZMeasurementDimension>::create(unit))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->labelError->clear();
|
||||
ui->checkBoxYDimensionCircumference->setChecked(m_yDimension->IsCircumference());
|
||||
|
||||
InitXDimension();
|
||||
InitYDimension();
|
||||
InitWDimension();
|
||||
InitZDimension();
|
||||
|
||||
// height
|
||||
connect(ui->spinBoxXDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
|
||||
ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->spinBoxXDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxXDimensionMinValue, ui->comboBoxXDimensionStep,
|
||||
ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->comboBoxXDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxXDimensionStep, ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->comboBoxXDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
|
||||
// size
|
||||
connect(ui->spinBoxYDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->spinBoxYDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxYDimensionMinValue, ui->comboBoxYDimensionStep,
|
||||
ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->comboBoxYDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->comboBoxYDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
|
||||
// hip
|
||||
connect(ui->spinBoxWDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
|
||||
ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->spinBoxWDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxWDimensionMinValue, ui->comboBoxWDimensionStep,
|
||||
ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->comboBoxWDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->comboBoxWDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
|
||||
// waist
|
||||
connect(ui->spinBoxZDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
|
||||
ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->spinBoxZDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxZDimensionMinValue, ui->comboBoxZDimensionStep,
|
||||
ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->comboBoxZDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->comboBoxZDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
|
||||
|
||||
connect(ui->groupBoxXDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxYDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxWDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxZDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
|
||||
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::ShowFullCircumference);
|
||||
connect(ui->checkBoxYDimensionCircumference, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::YDimensionCircumferenceChanged);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSetupMultisize::~DialogSetupMultisize()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<MeasurementDimension_p> DialogSetupMultisize::Dimensions() const
|
||||
{
|
||||
QVector<MeasurementDimension_p> dimensions;
|
||||
|
||||
if (ui->groupBoxXDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_xDimension);
|
||||
}
|
||||
|
||||
if (ui->groupBoxYDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_yDimension);
|
||||
}
|
||||
|
||||
if (ui->groupBoxWDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_wDimension);
|
||||
}
|
||||
|
||||
if (ui->groupBoxZDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_zDimension);
|
||||
}
|
||||
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogSetupMultisize::FullCircumference() const
|
||||
{
|
||||
return ui->checkBoxFullCircumference->isChecked();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
QDialog::changeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent( event );
|
||||
if ( event->spontaneous() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_isInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// do your init stuff here
|
||||
|
||||
setMaximumSize(size());
|
||||
setMinimumSize(size());
|
||||
|
||||
m_isInitialized = true;//first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::ShowFullCircumference()
|
||||
{
|
||||
auto ShowDimensionFullCircumference = [this](QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue,
|
||||
QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMinValue != nullptr)
|
||||
SCASSERT(spinboxMaxValue != nullptr)
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
InitDimension(spinboxMinValue, spinboxMaxValue, comboBoxStep, dimension);
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
comboBoxBase->blockSignals(true);
|
||||
comboBoxBase->setCurrentIndex(-1);
|
||||
comboBoxBase->blockSignals(false);
|
||||
};
|
||||
|
||||
ShowDimensionFullCircumference(ui->spinBoxYDimensionMinValue, ui->spinBoxYDimensionMaxValue,
|
||||
ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
ShowDimensionFullCircumference(ui->spinBoxWDimensionMinValue, ui->spinBoxWDimensionMaxValue,
|
||||
ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
ShowDimensionFullCircumference(ui->spinBoxZDimensionMinValue, ui->spinBoxZDimensionMaxValue,
|
||||
ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::YDimensionCircumferenceChanged()
|
||||
{
|
||||
bool checked = ui->checkBoxYDimensionCircumference->isChecked();
|
||||
m_yDimension->SetCircumference(checked);
|
||||
|
||||
const bool c = m_yDimension->IsCircumference();
|
||||
const QString unitStr = c ? " " + UnitsToStr(m_yDimension->Units()) : QString();
|
||||
|
||||
ui->spinBoxYDimensionMinValue->setSuffix(unitStr);
|
||||
ui->spinBoxYDimensionMaxValue->setSuffix(unitStr);
|
||||
|
||||
InitDimension(ui->spinBoxYDimensionMinValue, ui->spinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
m_yDimension);
|
||||
|
||||
UpdateBase(ui->comboBoxYDimensionBase, m_yDimension);
|
||||
|
||||
ui->comboBoxYDimensionBase->blockSignals(true);
|
||||
ui->comboBoxYDimensionBase->setCurrentIndex(-1);
|
||||
ui->comboBoxYDimensionBase->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int base = ui->comboBoxYDimensionBase->currentData().toInt(&ok);
|
||||
m_yDimension->SetBaseValue(ok ? base : -1);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::CheckState()
|
||||
{
|
||||
ui->labelError->clear();
|
||||
|
||||
bool xDimensionValid = true;
|
||||
bool yDimensionValid = true;
|
||||
bool wDimensionValid = true;
|
||||
bool zDimensionValid = true;
|
||||
|
||||
int dimensions = 0;
|
||||
|
||||
auto CheckDimension = [this](QGroupBox *group, bool &dimensionValid, int &dimensions,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(group != nullptr)
|
||||
|
||||
if (group->isChecked())
|
||||
{
|
||||
dimensionValid = dimension->IsValid();
|
||||
++dimensions;
|
||||
|
||||
if (ui->labelError->text().isEmpty() && not dimensionValid)
|
||||
{
|
||||
ui->labelError->setText(tr("Please, provide correct data for dimensions"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CheckDimension(ui->groupBoxXDimension, xDimensionValid, dimensions, m_xDimension);
|
||||
CheckDimension(ui->groupBoxYDimension, yDimensionValid, dimensions, m_yDimension);
|
||||
CheckDimension(ui->groupBoxWDimension, wDimensionValid, dimensions, m_wDimension);
|
||||
CheckDimension(ui->groupBoxZDimension, zDimensionValid, dimensions, m_zDimension);
|
||||
|
||||
if (ui->labelError->text().isEmpty() && dimensions == 0)
|
||||
{
|
||||
ui->labelError->setText(tr("Please, select at least one dimension"));
|
||||
}
|
||||
else if (ui->labelError->text().isEmpty() && dimensions > 3)
|
||||
{
|
||||
ui->labelError->setText(tr("No more than 3 dimensions allowed"));
|
||||
}
|
||||
|
||||
const bool enough = dimensions > 0 && dimensions <= 3;
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr)
|
||||
bOk->setEnabled(enough && xDimensionValid && yDimensionValid && wDimensionValid && zDimensionValid);
|
||||
|
||||
if (ui->labelError->text().isEmpty())
|
||||
{
|
||||
ui->labelError->setText(tr("Ready"));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitDimensionMinMax(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMinValue != nullptr)
|
||||
SCASSERT(spinboxMaxValue != nullptr)
|
||||
|
||||
dimension->SetMinValue(dimension->RangeMin());
|
||||
dimension->SetMaxValue(dimension->RangeMax());
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
spinboxMinValue->blockSignals(true);
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
if (c || dimension->Type() == MeasurementDimension::X)
|
||||
{
|
||||
spinboxMinValue->setSuffix(unitStr);
|
||||
}
|
||||
|
||||
spinboxMinValue->setMinimum(c && fc ? dimension->RangeMin()*2 : dimension->RangeMin());
|
||||
spinboxMinValue->setMaximum(c && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||
spinboxMinValue->setValue(c && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||
spinboxMinValue->blockSignals(false);
|
||||
|
||||
spinboxMaxValue->blockSignals(true);
|
||||
if (c || dimension->Type() == MeasurementDimension::X)
|
||||
{
|
||||
spinboxMaxValue->setSuffix(unitStr);
|
||||
}
|
||||
spinboxMaxValue->setMinimum(c && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||
spinboxMaxValue->setMaximum(c && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||
spinboxMaxValue->setValue(c && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||
spinboxMaxValue->setValue(c && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||
spinboxMaxValue->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
|
||||
dimension->SetStep(-1);
|
||||
|
||||
comboBoxStep->blockSignals(true);
|
||||
const QVector<int> steps = dimension->ValidSteps();
|
||||
comboBoxStep->clear();
|
||||
for(auto step : steps)
|
||||
{
|
||||
comboBoxStep->addItem(QString("%1%2").arg(c && fc ? step*2 : step)
|
||||
.arg(c || dimension->Type() == MeasurementDimension::X ? unitStr : QString()), step);
|
||||
}
|
||||
|
||||
comboBoxStep->setCurrentIndex(-1); // force a user to select
|
||||
comboBoxStep->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int step = comboBoxStep->currentData().toInt(&ok);
|
||||
dimension->SetStep(ok ? step : -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitDimension(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
InitDimensionMinMax(spinboxMinValue, spinboxMaxValue, dimension);
|
||||
InitDimensionStep(comboBoxStep, dimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitXDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxXDimensionMinValue, ui->spinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
|
||||
m_xDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitYDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxYDimensionMinValue, ui->spinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
m_yDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitWDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxWDimensionMinValue, ui->spinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
|
||||
m_wDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitZDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxZDimensionMinValue, ui->spinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
|
||||
m_zDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionMinValueChanged(int value, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMaxValue != nullptr)
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
dimension->SetMinValue(c && fc ? value / 2 : value);
|
||||
|
||||
spinboxMaxValue->blockSignals(true);
|
||||
spinboxMaxValue->setMinimum(value);
|
||||
spinboxMaxValue->blockSignals(false);
|
||||
|
||||
dimension->SetMaxValue(c && fc ? spinboxMaxValue->value() / 2 : spinboxMaxValue->value());
|
||||
|
||||
UpdateSteps(comboBoxStep, dimension);
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionMaxValueChanged(int value, QSpinBox *spinboxMinValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMinValue != nullptr)
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
dimension->SetMaxValue(c && fc ? value / 2 : value);
|
||||
|
||||
spinboxMinValue->blockSignals(true);
|
||||
spinboxMinValue->setMaximum(value);
|
||||
spinboxMinValue->blockSignals(false);
|
||||
|
||||
dimension->SetMinValue(c && fc ? spinboxMinValue->value() / 2 : spinboxMinValue->value());
|
||||
|
||||
UpdateSteps(comboBoxStep, dimension);
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionStepChanged(int index, QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
bool ok = false;
|
||||
const int step = comboBoxStep->itemData(index).toInt(&ok);
|
||||
dimension->SetStep(ok ? step : -1);
|
||||
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionBaseChanged(int index, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
bool ok = false;
|
||||
const int base = comboBoxBase->itemData(index).toInt(&ok);
|
||||
dimension->SetBaseValue(ok ? base : -1);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
|
||||
int oldStep = -1;
|
||||
if (comboBoxStep->currentIndex() != -1)
|
||||
{
|
||||
oldStep = comboBoxStep->currentData().toInt();
|
||||
}
|
||||
|
||||
comboBoxStep->blockSignals(true);
|
||||
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
const QVector<int> steps = dimension->ValidSteps();
|
||||
comboBoxStep->clear();
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
for(auto step : steps)
|
||||
{
|
||||
comboBoxStep->addItem(QString("%1%2").arg(c && fc ? step * 2 : step)
|
||||
.arg(c ? unitStr : QString()), step);
|
||||
}
|
||||
|
||||
comboBoxStep->setCurrentIndex(comboBoxStep->findData(oldStep));
|
||||
comboBoxStep->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int step = comboBoxStep->currentData().toInt(&ok);
|
||||
dimension->SetStep(ok ? step : -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
int oldBase = -1;
|
||||
if (comboBoxBase->currentIndex() != -1)
|
||||
{
|
||||
oldBase = comboBoxBase->currentData().toInt();
|
||||
}
|
||||
|
||||
comboBoxBase->blockSignals(true);
|
||||
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
const QVector<int> bases = dimension->ValidBases();
|
||||
comboBoxBase->clear();
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
for(auto base : bases)
|
||||
{
|
||||
comboBoxBase->addItem(QString("%1%2").arg(c && fc ? base * 2 : base)
|
||||
.arg(c || dimension->Type() == MeasurementDimension::X ? unitStr : QString()), base);
|
||||
}
|
||||
|
||||
comboBoxBase->setCurrentIndex(comboBoxBase->findData(oldBase));
|
||||
comboBoxBase->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int base = comboBoxBase->currentData().toInt(&ok);
|
||||
dimension->SetBaseValue(ok ? base : -1);
|
||||
}
|
||||
|
101
src/app/tape/dialogs/dialogsetupmultisize.h
Normal file
101
src/app/tape/dialogs/dialogsetupmultisize.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogsetupmultisize.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 26 9, 2020
|
||||
**
|
||||
** @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) 2020 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 DIALOGSETUPMULTISIZE_H
|
||||
#define DIALOGSETUPMULTISIZE_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "../vformat/vdimensions.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
class QSpinBox;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogSetupMultisize;
|
||||
}
|
||||
|
||||
class DialogSetupMultisize : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogSetupMultisize(Unit unit, QWidget *parent = nullptr);
|
||||
~DialogSetupMultisize();
|
||||
|
||||
QVector<MeasurementDimension_p> Dimensions() const;
|
||||
|
||||
bool FullCircumference() const;
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void ShowFullCircumference();
|
||||
void YDimensionCircumferenceChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSetupMultisize)
|
||||
Ui::DialogSetupMultisize *ui;
|
||||
bool m_isInitialized{false};
|
||||
QSharedPointer<VXMeasurementDimension> m_xDimension;
|
||||
QSharedPointer<VYMeasurementDimension> m_yDimension;
|
||||
QSharedPointer<VWMeasurementDimension> m_wDimension;
|
||||
QSharedPointer<VZMeasurementDimension> m_zDimension;
|
||||
|
||||
void CheckState();
|
||||
|
||||
void InitDimensionMinMax(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue,
|
||||
const MeasurementDimension_p &dimension);
|
||||
void InitDimensionStep(QComboBox *comboBoxStep,const MeasurementDimension_p &dimension);
|
||||
|
||||
void InitDimension(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
const MeasurementDimension_p &dimension);
|
||||
void InitXDimension();
|
||||
void InitYDimension();
|
||||
void InitWDimension();
|
||||
void InitZDimension();
|
||||
|
||||
void DimensionMinValueChanged(int value, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension);
|
||||
void DimensionMaxValueChanged(int value, QSpinBox *spinboxMinValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension);
|
||||
|
||||
void DimensionStepChanged(int index, QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension);
|
||||
void DimensionBaseChanged(int index, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension);
|
||||
|
||||
void UpdateSteps(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension);
|
||||
void UpdateBase(QComboBox *comboBoxBase, const MeasurementDimension_p &dimension);
|
||||
};
|
||||
|
||||
#endif // DIALOGSETUPMULTISIZE_H
|
480
src/app/tape/dialogs/dialogsetupmultisize.ui
Normal file
480
src/app/tape/dialogs/dialogsetupmultisize.ui
Normal file
|
@ -0,0 +1,480 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogSetupMultisize</class>
|
||||
<widget class="QDialog" name="DialogSetupMultisize">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>734</width>
|
||||
<height>289</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Setup multisize measurements</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../share/resources/tapeicon.qrc">
|
||||
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxFullCircumference">
|
||||
<property name="text">
|
||||
<string>Use full circumference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxXDimension">
|
||||
<property name="title">
|
||||
<string>Height</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxXDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxXDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxXDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxXDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxYDimension">
|
||||
<property name="title">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxYDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxYDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxYDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxYDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxYDimensionCircumference">
|
||||
<property name="text">
|
||||
<string>Circumference</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxWDimension">
|
||||
<property name="title">
|
||||
<string>Hip</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_5">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxWDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxWDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxWDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxWDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxZDimension">
|
||||
<property name="title">
|
||||
<string>Waist</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxZDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxZDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxZDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxZDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelError">
|
||||
<property name="text">
|
||||
<string notr="true">_</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>groupBoxXDimension</tabstop>
|
||||
<tabstop>spinBoxXDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxXDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxXDimensionStep</tabstop>
|
||||
<tabstop>comboBoxXDimensionBase</tabstop>
|
||||
<tabstop>groupBoxYDimension</tabstop>
|
||||
<tabstop>spinBoxYDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxYDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxYDimensionStep</tabstop>
|
||||
<tabstop>comboBoxYDimensionBase</tabstop>
|
||||
<tabstop>groupBoxWDimension</tabstop>
|
||||
<tabstop>spinBoxWDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxWDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxWDimensionStep</tabstop>
|
||||
<tabstop>comboBoxWDimensionBase</tabstop>
|
||||
<tabstop>groupBoxZDimension</tabstop>
|
||||
<tabstop>spinBoxZDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxZDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxZDimensionStep</tabstop>
|
||||
<tabstop>comboBoxZDimensionBase</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../share/resources/tapeicon.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogSetupMultisize</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>746</x>
|
||||
<y>383</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogSetupMultisize</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>746</x>
|
||||
<y>383</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -216,7 +216,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
{
|
||||
if (topWinAllowsPop)
|
||||
{
|
||||
messageBox.setText(VAbstractApplication::ClearMessage(msg));
|
||||
messageBox.setText(msg);
|
||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
messageBox.setWindowModality(Qt::ApplicationModal);
|
||||
messageBox.setModal(true);
|
||||
|
@ -599,96 +599,46 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
|
|||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("filename", tr("The measurement file."));
|
||||
//-----
|
||||
QCommandLineOption heightOption(QStringList() << "e" << "height",
|
||||
tr("Open with the base height. Valid values: %1cm.")
|
||||
.arg(VMeasurement::WholeListHeights(Unit::Cm).join(", ")),
|
||||
tr("The base height"));
|
||||
parser.addOption(heightOption);
|
||||
//-----
|
||||
QCommandLineOption sizeOption(QStringList() << "s" << "size",
|
||||
tr("Open with the base size. Valid values: %1cm.").arg(VMeasurement::WholeListSizes(Unit::Cm).join(", ")),
|
||||
tr("The base size"));
|
||||
parser.addOption(sizeOption);
|
||||
//-----
|
||||
QCommandLineOption unitOption(QStringList() << "u" << "unit",
|
||||
tr("Set pattern file unit: cm, mm, inch."),
|
||||
tr("The pattern unit"));
|
||||
parser.addOption(unitOption);
|
||||
//-----
|
||||
QCommandLineOption testOption(QStringList() << "test",
|
||||
tr("Use for unit testing. Run the program and open a file without showing the main window."));
|
||||
parser.addOption(testOption);
|
||||
//-----
|
||||
QCommandLineOption scalingOption(QStringList() << LONG_OPTION_NO_HDPI_SCALING,
|
||||
tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
|
||||
"Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0"));
|
||||
parser.addOption(scalingOption);
|
||||
//-----
|
||||
|
||||
const QString LONG_OPTION_DIMENSION_A = QStringLiteral("dimensionA");
|
||||
const QString SINGLE_OPTION_DIMENSION_A = QChar('a');
|
||||
|
||||
const QString LONG_OPTION_DIMENSION_B = QStringLiteral("dimensionB");
|
||||
const QString SINGLE_OPTION_DIMENSION_B = QChar('b');
|
||||
|
||||
const QString LONG_OPTION_DIMENSION_C = QStringLiteral("dimensionC");
|
||||
const QString SINGLE_OPTION_DIMENSION_C = QChar('c');
|
||||
|
||||
const QString LONG_OPTION_UNITS = QStringLiteral("units");
|
||||
const QString SINGLE_OPTION_UNITS = QChar('u');
|
||||
|
||||
const QString LONG_OPTION_TEST = QStringLiteral("test");
|
||||
|
||||
parser.addOptions(
|
||||
{
|
||||
{{SINGLE_OPTION_DIMENSION_A, LONG_OPTION_DIMENSION_A}, tr("Set base for dimension A in the table units."),
|
||||
tr("The dimension A base")},
|
||||
|
||||
{{SINGLE_OPTION_DIMENSION_B, LONG_OPTION_DIMENSION_B}, tr("Set base for dimension B in the table units."),
|
||||
tr("The dimension B base")},
|
||||
|
||||
{{SINGLE_OPTION_DIMENSION_C, LONG_OPTION_DIMENSION_C}, tr("Set base for dimension C in the table units."),
|
||||
tr("The dimension C base")},
|
||||
|
||||
{{SINGLE_OPTION_UNITS, LONG_OPTION_UNITS}, tr("Set pattern file units: cm, mm, inch."),
|
||||
tr("The pattern units")},
|
||||
|
||||
{LONG_OPTION_TEST,
|
||||
tr("Use for unit testing. Run the program and open a file without showing the main window.")},
|
||||
|
||||
{LONG_OPTION_NO_HDPI_SCALING,
|
||||
tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
|
||||
"Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0")},
|
||||
});
|
||||
|
||||
parser.process(arguments);
|
||||
|
||||
bool flagHeight = false;
|
||||
bool flagSize = false;
|
||||
bool flagUnit = false;
|
||||
|
||||
int size = 0;
|
||||
int height = 0;
|
||||
Unit unit = Unit::Cm;
|
||||
|
||||
if (parser.isSet(heightOption))
|
||||
{
|
||||
const QString heightValue = parser.value(heightOption);
|
||||
if (VMeasurement::IsGradationHeightValid(heightValue))
|
||||
{
|
||||
flagHeight = true;
|
||||
height = heightValue.toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
qCCritical(mApp, "%s\n",
|
||||
qPrintable(tr("Invalid base height argument. Must be %1cm.")
|
||||
.arg(VMeasurement::WholeListHeights(Unit::Cm).join(", "))));
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.isSet(sizeOption))
|
||||
{
|
||||
const QString sizeValue = parser.value(sizeOption);
|
||||
if (VMeasurement::IsGradationSizeValid(sizeValue))
|
||||
{
|
||||
flagSize = true;
|
||||
size = sizeValue.toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
qCCritical(mApp, "%s\n",
|
||||
qPrintable(tr("Invalid base size argument. Must be %1cm.")
|
||||
.arg(VMeasurement::WholeListSizes(Unit::Cm).join(", "))));
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const QString unitValue = parser.value(unitOption);
|
||||
if (not unitValue.isEmpty())
|
||||
{
|
||||
|
||||
const QStringList units = QStringList() << unitMM << unitCM << unitINCH;
|
||||
if (units.contains(unitValue))
|
||||
{
|
||||
flagUnit = true;
|
||||
unit = StrToUnits(unitValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCCritical(mApp, "%s\n", qPrintable(tr("Invalid base size argument. Must be cm, mm or inch.")));
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testMode = parser.isSet(testOption);
|
||||
testMode = parser.isSet(LONG_OPTION_TEST);
|
||||
|
||||
if (not testMode && connection == SocketConnection::Client)
|
||||
{
|
||||
|
@ -737,6 +687,84 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
|
|||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
|
||||
bool flagDimensionA = false;
|
||||
bool flagDimensionB = false;
|
||||
bool flagDimensionC = false;
|
||||
bool flagUnits = false;
|
||||
|
||||
int dimensionAValue = 0;
|
||||
int dimensionBValue = 0;
|
||||
int dimensionCValue = 0;
|
||||
Unit unit = Unit::Cm;
|
||||
|
||||
if (parser.isSet(LONG_OPTION_DIMENSION_A))
|
||||
{
|
||||
const QString value = parser.value(LONG_OPTION_DIMENSION_A);
|
||||
|
||||
bool ok = false;
|
||||
dimensionAValue = value.toInt(&ok);
|
||||
if(ok && dimensionAValue > 0)
|
||||
{
|
||||
flagDimensionA = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qCCritical(mApp, "%s\n", qPrintable(tr("Invalid dimension A base value.")));
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.isSet(LONG_OPTION_DIMENSION_B))
|
||||
{
|
||||
const QString value = parser.value(LONG_OPTION_DIMENSION_B);
|
||||
|
||||
bool ok = false;
|
||||
dimensionBValue = value.toInt(&ok);
|
||||
if(ok && dimensionBValue > 0)
|
||||
{
|
||||
flagDimensionB = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qCCritical(mApp, "%s\n", qPrintable(tr("Invalid dimension B base value.")));
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.isSet(LONG_OPTION_DIMENSION_C))
|
||||
{
|
||||
const QString value = parser.value(LONG_OPTION_DIMENSION_C);
|
||||
|
||||
bool ok = false;
|
||||
dimensionCValue = value.toInt(&ok);
|
||||
if(ok && dimensionCValue > 0)
|
||||
{
|
||||
flagDimensionC = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qCCritical(mApp, "%s\n", qPrintable(tr("Invalid dimension C base value.")));
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const QString unitValue = parser.value(LONG_OPTION_UNITS);
|
||||
if (not unitValue.isEmpty())
|
||||
{
|
||||
if (QStringList{unitMM, unitCM, unitINCH}.contains(unitValue))
|
||||
{
|
||||
flagUnits = true;
|
||||
unit = StrToUnits(unitValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCCritical(mApp, "%s\n", qPrintable(tr("Invalid base size argument. Must be cm, mm or inch.")));
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &arg : args)
|
||||
{
|
||||
NewMainWindow();
|
||||
|
@ -750,17 +778,31 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
|
|||
continue;
|
||||
}
|
||||
|
||||
if (flagSize)
|
||||
if (flagDimensionA)
|
||||
{
|
||||
MainWindow()->SetBaseMSize(size);
|
||||
if (not MainWindow()->SetDimensionABase(dimensionAValue))
|
||||
{
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (flagHeight)
|
||||
if (flagDimensionB)
|
||||
{
|
||||
MainWindow()->SetBaseMHeight(height);
|
||||
if (not MainWindow()->SetDimensionBBase(dimensionBValue))
|
||||
{
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (flagUnit)
|
||||
if (flagDimensionC)
|
||||
{
|
||||
if (not MainWindow()->SetDimensionCBase(dimensionCValue))
|
||||
{
|
||||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if (flagUnits)
|
||||
{
|
||||
MainWindow()->SetPUnit(unit);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
# This need for corect working file translations.pro
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/dialogs/dialogdimensionlabels.cpp \
|
||||
$$PWD/dialogs/dialogmeasurementscsvcolumns.cpp \
|
||||
$$PWD/dialogs/dialogrestrictdimension.cpp \
|
||||
$$PWD/main.cpp \
|
||||
$$PWD/tmainwindow.cpp \
|
||||
$$PWD/mapplication.cpp \
|
||||
|
@ -11,11 +14,15 @@ SOURCES += \
|
|||
$$PWD/vlitepattern.cpp \
|
||||
$$PWD/dialogs/dialogtapepreferences.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp \
|
||||
$$PWD/dialogs/dialogsetupmultisize.cpp
|
||||
|
||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/dialogs/dialogdimensionlabels.h \
|
||||
$$PWD/dialogs/dialogmeasurementscsvcolumns.h \
|
||||
$$PWD/dialogs/dialogrestrictdimension.h \
|
||||
$$PWD/tmainwindow.h \
|
||||
$$PWD/stable.h \
|
||||
$$PWD/mapplication.h \
|
||||
|
@ -26,13 +33,18 @@ HEADERS += \
|
|||
$$PWD/vlitepattern.h \
|
||||
$$PWD/dialogs/dialogtapepreferences.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h \
|
||||
$$PWD/dialogs/dialogsetupmultisize.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/dialogs/dialogdimensionlabels.ui \
|
||||
$$PWD/dialogs/dialogmeasurementscsvcolumns.ui \
|
||||
$$PWD/dialogs/dialogrestrictdimension.ui \
|
||||
$$PWD/tmainwindow.ui \
|
||||
$$PWD/dialogs/dialogabouttape.ui \
|
||||
$$PWD/dialogs/dialognewmeasurements.ui \
|
||||
$$PWD/dialogs/dialogmdatabase.ui \
|
||||
$$PWD/dialogs/dialogtapepreferences.ui \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.ui \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.ui
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.ui \
|
||||
$$PWD/dialogs/dialogsetupmultisize.ui
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -44,6 +44,7 @@ namespace Ui
|
|||
|
||||
class QLabel;
|
||||
class QxtCsvModel;
|
||||
class VMeasurement;
|
||||
|
||||
class TMainWindow : public VAbstractMainWindow
|
||||
{
|
||||
|
@ -57,8 +58,9 @@ public:
|
|||
|
||||
void RetranslateTable();
|
||||
|
||||
void SetBaseMHeight(int height);
|
||||
void SetBaseMSize(int size);
|
||||
bool SetDimensionABase(int base);
|
||||
bool SetDimensionBBase(int base);
|
||||
bool SetDimensionCBase(int base);
|
||||
void SetPUnit(Unit unit);
|
||||
|
||||
bool LoadFile(const QString &path);
|
||||
|
@ -112,8 +114,11 @@ private slots:
|
|||
void AddKnown();
|
||||
void ImportFromPattern();
|
||||
|
||||
void ChangedSize(const QString &text);
|
||||
void ChangedHeight(const QString & text);
|
||||
void DimensionABaseChanged();
|
||||
void DimensionBBaseChanged();
|
||||
void DimensionCBaseChanged();
|
||||
|
||||
void GradationChanged();
|
||||
|
||||
void ShowMData();
|
||||
|
||||
|
@ -122,43 +127,67 @@ private slots:
|
|||
void SaveMName(const QString &text);
|
||||
void SaveMValue();
|
||||
void SaveMBaseValue(double value);
|
||||
void SaveMSizeIncrease(double value);
|
||||
void SaveMHeightIncrease(double value);
|
||||
void SaveMShiftA(double value);
|
||||
void SaveMShiftB(double value);
|
||||
void SaveMShiftC(double value);
|
||||
void SaveMCorrectionValue(double value);
|
||||
void SaveMDescription();
|
||||
void SaveMFullName();
|
||||
void SaveMUnits();
|
||||
void SaveMDimension();
|
||||
|
||||
void FullCircumferenceChanged(bool checked);
|
||||
|
||||
void ExportToIndividual();
|
||||
|
||||
void RestrictSecondDimesion();
|
||||
void RestrictThirdDimesion();
|
||||
|
||||
void EditDimensionLabels();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(TMainWindow)
|
||||
Ui::TMainWindow *ui;
|
||||
VMeasurements *m;
|
||||
VContainer *data;
|
||||
Unit mUnit;
|
||||
Unit pUnit;
|
||||
MeasurementsType mType;
|
||||
qreal currentSize;
|
||||
qreal currentHeight;
|
||||
QString curFile;
|
||||
QComboBox *gradationHeights;
|
||||
QComboBox *gradationSizes;
|
||||
QComboBox *comboBoxUnits;
|
||||
VMeasurements *m{nullptr};
|
||||
VContainer *data{nullptr};
|
||||
Unit mUnit{Unit::Cm};
|
||||
Unit pUnit{Unit::Cm};
|
||||
MeasurementsType mType{MeasurementsType::Individual};
|
||||
int currentDimensionA{0};
|
||||
int currentDimensionB{0};
|
||||
int currentDimensionC{0};
|
||||
QString curFile{};
|
||||
QComboBox *gradationDimensionA{nullptr};
|
||||
QComboBox *gradationDimensionB{nullptr};
|
||||
QComboBox *gradationDimensionC{nullptr};
|
||||
QComboBox *comboBoxUnits{nullptr};
|
||||
int formulaBaseHeight;
|
||||
QSharedPointer<VLockGuard<char>> lock;
|
||||
QSharedPointer<VTableSearch> search;
|
||||
QLabel *labelGradationHeights;
|
||||
QLabel *labelGradationSizes;
|
||||
QLabel *labelPatternUnit;
|
||||
bool isInitialized;
|
||||
bool mIsReadOnly;
|
||||
QSharedPointer<VLockGuard<char>> lock{nullptr};
|
||||
QSharedPointer<VTableSearch> search{};
|
||||
QLabel *labelGradationDimensionA{nullptr};
|
||||
QLabel *labelGradationDimensionB{nullptr};
|
||||
QLabel *labelGradationDimensionC{nullptr};
|
||||
QLabel *labelPatternUnit{nullptr};
|
||||
bool isInitialized{false};
|
||||
bool mIsReadOnly{false};
|
||||
QTimer *gradation;
|
||||
|
||||
QVector<QObject *> hackedWidgets;
|
||||
QVector<QObject *> hackedWidgets{};
|
||||
|
||||
void SetupMenu();
|
||||
void InitWindow();
|
||||
void InitMenu();
|
||||
void InitDimensionsBaseValue();
|
||||
void InitDimensionGradation(int index, const MeasurementDimension_p &dimension, QComboBox *control);
|
||||
void InitDimensionControls();
|
||||
void InitDimesionShifts();
|
||||
void InitTable();
|
||||
void SetDecimals();
|
||||
void InitUnits();
|
||||
void InitPatternUnits();
|
||||
void InitComboBoxUnits();
|
||||
void InitMeasurementUnits();
|
||||
void InitGender(QComboBox *gender);
|
||||
void InitMeasurementDimension();
|
||||
|
||||
void ShowNewMData(bool fresh);
|
||||
void ShowUnits();
|
||||
|
@ -172,18 +201,13 @@ private:
|
|||
|
||||
QTableWidgetItem *AddCell(const QString &text, int row, int column, int aligment, bool ok = true);
|
||||
|
||||
Q_REQUIRED_RESULT QComboBox *SetGradationList(QLabel *label, const QStringList &list);
|
||||
|
||||
void SetDefaultHeight(int value);
|
||||
void SetDefaultSize(int value);
|
||||
|
||||
void RefreshData(bool freshCall = false);
|
||||
void RefreshTable(bool freshCall = false);
|
||||
|
||||
QString GetCustomName() const;
|
||||
QString ClearCustomName(const QString &name) const;
|
||||
|
||||
bool EvalFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label);
|
||||
bool EvalFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label, bool specialUnits);
|
||||
void ShowMDiagram(const QString &name);
|
||||
|
||||
void Open(const QString &pathTo, const QString &filter);
|
||||
|
@ -208,15 +232,25 @@ private:
|
|||
|
||||
template <class T>
|
||||
void HackWidget(T **widget);
|
||||
void HackDimensionBaseValue();
|
||||
void HackDimensionShifts();
|
||||
|
||||
QString CheckMName(const QString &name, const QSet<QString> &importedNames) const;
|
||||
void ShowError(const QString &text);
|
||||
void RefreshDataAfterImport();
|
||||
|
||||
void ImportIndividualMeasurements(const QxtCsvModel &csv);
|
||||
void ImportMultisizeMeasurements(const QxtCsvModel &csv);
|
||||
void ImportIndividualMeasurements(const QxtCsvModel &csv, const QVector<int> &map);
|
||||
void ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVector<int> &map);
|
||||
|
||||
void SetCurrentPatternUnit();
|
||||
|
||||
void ShowDimensionControls();
|
||||
void SetDimensionBases();
|
||||
void SetCurrentDimensionValues();
|
||||
|
||||
QVector<int> DimensionRestrictedValues(int index, const MeasurementDimension_p &dimension);
|
||||
|
||||
QMap<int, QSharedPointer<VMeasurement> > OrderedMeasurments() const;
|
||||
};
|
||||
|
||||
#endif // TMAINWINDOW_H
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -150,7 +150,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
const bool isPatternMessage = qApp->IsPatternMessage(msg);
|
||||
if (isPatternMessage)
|
||||
{
|
||||
logMsg = logMsg.remove(VAbstractApplication::patternMessageSignature);
|
||||
logMsg = logMsg.remove(VAbstractValApplication::patternMessageSignature);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
break;
|
||||
}
|
||||
|
||||
messageBox.setText(VAbstractApplication::ClearMessage(logMsg));
|
||||
messageBox.setText(VAbstractValApplication::ClearMessage(logMsg));
|
||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
messageBox.setWindowModality(Qt::ApplicationModal);
|
||||
messageBox.setModal(true);
|
||||
|
@ -287,7 +287,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
* @param argv command line.
|
||||
*/
|
||||
VApplication::VApplication(int &argc, char **argv)
|
||||
: VAbstractApplication(argc, argv),
|
||||
: VAbstractValApplication(argc, argv),
|
||||
trVars(nullptr),
|
||||
autoSaveTimer(nullptr),
|
||||
lockLog(),
|
||||
|
|
|
@ -29,11 +29,12 @@
|
|||
#ifndef VAPPLICATION_H
|
||||
#define VAPPLICATION_H
|
||||
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "vsettings.h"
|
||||
#include "vcmdexport.h"
|
||||
#include "vlockguard.h"
|
||||
|
||||
class VApplication;// use in define
|
||||
|
||||
|
@ -45,7 +46,7 @@ class VApplication;// use in define
|
|||
/**
|
||||
* @brief The VApplication class reimplamentation QApplication class.
|
||||
*/
|
||||
class VApplication : public VAbstractApplication
|
||||
class VApplication : public VAbstractValApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -114,7 +115,5 @@ inline void VApplication::setAutoSaveTimer(QTimer *value)
|
|||
{
|
||||
autoSaveTimer = value;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif // VAPPLICATION_H
|
||||
|
|
|
@ -506,40 +506,68 @@ bool VCommandLine::IsGuiEnabled() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VCommandLine::IsSetGradationSize() const
|
||||
bool VCommandLine::IsSetDimensionA() const
|
||||
{
|
||||
return IsOptionSet(LONG_OPTION_GRADATIONSIZE);
|
||||
return IsOptionSet(LONG_OPTION_DIMENSION_A);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VCommandLine::IsSetGradationHeight() const
|
||||
bool VCommandLine::IsSetDimensionB() const
|
||||
{
|
||||
return IsOptionSet(LONG_OPTION_GRADATIONHEIGHT);
|
||||
return IsOptionSet(LONG_OPTION_DIMENSION_B);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VCommandLine::OptGradationSize() const
|
||||
bool VCommandLine::IsSetDimensionC() const
|
||||
{
|
||||
const QString size = OptionValue(LONG_OPTION_GRADATIONSIZE);
|
||||
if (VMeasurement::IsGradationSizeValid(size))
|
||||
return IsOptionSet(LONG_OPTION_DIMENSION_C);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommandLine::OptDimensionA() const
|
||||
{
|
||||
const QString value = OptionValue(LONG_OPTION_DIMENSION_A);
|
||||
|
||||
bool ok = false;
|
||||
int dimensionAValue = value.toInt(&ok);
|
||||
if(ok && dimensionAValue > 0)
|
||||
{
|
||||
return size;
|
||||
return dimensionAValue;
|
||||
}
|
||||
|
||||
qCritical() << translate("VCommandLine", "Invalid gradation size value.") << "\n";
|
||||
qCritical() << translate("VCommandLine", "Invalid dimension A value.") << "\n";
|
||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VCommandLine::OptGradationHeight() const
|
||||
int VCommandLine::OptDimensionB() const
|
||||
{
|
||||
const QString height = OptionValue(LONG_OPTION_GRADATIONHEIGHT);
|
||||
if (VMeasurement::IsGradationHeightValid(height))
|
||||
const QString value = OptionValue(LONG_OPTION_DIMENSION_B);
|
||||
|
||||
bool ok = false;
|
||||
int dimensionBValue = value.toInt(&ok);
|
||||
if(ok && dimensionBValue > 0)
|
||||
{
|
||||
return height;
|
||||
return dimensionBValue;
|
||||
}
|
||||
|
||||
qCritical() << translate("VCommandLine", "Invalid gradation height value.") << "\n";
|
||||
qCritical() << translate("VCommandLine", "Invalid dimension B value.") << "\n";
|
||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommandLine::OptDimensionC() const
|
||||
{
|
||||
const QString value = OptionValue(LONG_OPTION_DIMENSION_C);
|
||||
|
||||
bool ok = false;
|
||||
int dimensionCValue = value.toInt(&ok);
|
||||
if(ok && dimensionCValue > 0)
|
||||
{
|
||||
return dimensionCValue;
|
||||
}
|
||||
|
||||
qCritical() << translate("VCommandLine", "Invalid dimension C value.") << "\n";
|
||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
|
||||
|
@ -635,14 +663,19 @@ void VCommandLine::InitCommandLineOptions()
|
|||
{LONG_OPTION_EXPORTSUCHDETAILS,
|
||||
translate("VCommandLine", "Export only details that match a piece name regex."),
|
||||
translate("VCommandLine", "The name regex")},
|
||||
{{SINGLE_OPTION_GRADATIONSIZE, LONG_OPTION_GRADATIONSIZE},
|
||||
translate("VCommandLine", "Set size value for pattern file, that was opened with multisize measurements "
|
||||
"(export mode). Valid values: %1cm.").arg(VMeasurement::WholeListSizes(Unit::Cm) .join(QStringLiteral(", "))),
|
||||
translate("VCommandLine", "The size value")},
|
||||
{{SINGLE_OPTION_GRADATIONHEIGHT, LONG_OPTION_GRADATIONHEIGHT},
|
||||
translate("VCommandLine", "Set height value for pattern file, that was opened with multisize measurements "
|
||||
"(export mode). Valid values: %1cm.").arg(VMeasurement::WholeListHeights(Unit::Cm).join(QStringLiteral(", "))),
|
||||
translate("VCommandLine", "The height value")},
|
||||
|
||||
{LONG_OPTION_DIMENSION_A,
|
||||
translate("VCommandLine", "Set base for dimension A in the multisize measurements units (export mode)."),
|
||||
translate("VCommandLine", "The dimension A base")},
|
||||
|
||||
{LONG_OPTION_DIMENSION_B,
|
||||
translate("VCommandLine", "Set base for dimension B in the multisize measurements units (export mode)."),
|
||||
translate("VCommandLine", "The dimension B base")},
|
||||
|
||||
{LONG_OPTION_DIMENSION_C,
|
||||
translate("VCommandLine", "Set base for dimension C in the multisize measurements units (export mode)."),
|
||||
translate("VCommandLine", "The dimension C base")},
|
||||
|
||||
{LONG_OPTION_USER_MATERIAL,
|
||||
translate("VCommandLine", "Use this option to override user material defined in pattern. The value must be in "
|
||||
"form <number>@<user matrial name>. The number should be in range from 1 to %1. For example, 1@Fabric2. The "
|
||||
|
|
|
@ -115,11 +115,13 @@ public:
|
|||
|
||||
bool IsGuiEnabled()const;
|
||||
|
||||
bool IsSetGradationSize() const;
|
||||
bool IsSetGradationHeight() const;
|
||||
bool IsSetDimensionA() const;
|
||||
bool IsSetDimensionB() const;
|
||||
bool IsSetDimensionC() const;
|
||||
|
||||
QString OptGradationSize() const;
|
||||
QString OptGradationHeight() const;
|
||||
int OptDimensionA() const;
|
||||
int OptDimensionB() const;
|
||||
int OptDimensionC() const;
|
||||
|
||||
QMarginsF TiledPageMargins() const;
|
||||
VAbstractLayoutDialog::PaperSizeTemplate OptTiledPaperSize() const;
|
||||
|
|
|
@ -2318,7 +2318,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
|||
VFormula length1(spl.GetC1LengthFormula(), i->getData());
|
||||
length1.setCheckZero(false);
|
||||
length1.setToolId(i->getId());
|
||||
length1.setPostfix(UnitsToStr(qApp->patternUnit()));
|
||||
length1.setPostfix(UnitsToStr(qApp->patternUnits()));
|
||||
length1.Eval();
|
||||
AddPropertyFormula(tr("C1: length:"), length1, AttrLength1);
|
||||
|
||||
|
@ -2332,7 +2332,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
|||
VFormula length2(spl.GetC2LengthFormula(), i->getData());
|
||||
length2.setCheckZero(false);
|
||||
length2.setToolId(i->getId());
|
||||
length2.setPostfix(UnitsToStr(qApp->patternUnit()));
|
||||
length2.setPostfix(UnitsToStr(qApp->patternUnits()));
|
||||
length2.Eval();
|
||||
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
|
||||
|
||||
|
@ -3046,7 +3046,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
|||
VFormula length1F(spl.GetC1LengthFormula(), i->getData());
|
||||
length1F.setCheckZero(false);
|
||||
length1F.setToolId(i->getId());
|
||||
length1F.setPostfix(UnitsToStr(qApp->patternUnit()));
|
||||
length1F.setPostfix(UnitsToStr(qApp->patternUnits()));
|
||||
length1F.Eval();
|
||||
QVariant length1;
|
||||
length1.setValue(length1F);
|
||||
|
@ -3064,7 +3064,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
|||
VFormula length2F(spl.GetC2LengthFormula(), i->getData());
|
||||
length2F.setCheckZero(false);
|
||||
length2F.setToolId(i->getId());
|
||||
length2F.setPostfix(UnitsToStr(qApp->patternUnit()));
|
||||
length2F.setPostfix(UnitsToStr(qApp->patternUnits()));
|
||||
length2F.Eval();
|
||||
QVariant length2;
|
||||
length2.setValue(length2F);
|
||||
|
|
|
@ -373,7 +373,7 @@ void DialogFinalMeasurements::SaveFormula()
|
|||
{
|
||||
QTableWidgetItem *result = ui->tableWidget->item(row, 1);
|
||||
//Show unit in dialog lable (cm, mm or inch)
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit());
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits());
|
||||
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
|
||||
return;
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ void DialogFinalMeasurements::SaveFormula()
|
|||
if (text.isEmpty())
|
||||
{
|
||||
//Show unit in dialog lable (cm, mm or inch)
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit());
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits());
|
||||
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
||||
return;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ void DialogFinalMeasurements::Fx()
|
|||
dialog->setWindowTitle(tr("Edit measurement"));
|
||||
dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(),
|
||||
qApp->Settings()->GetOsSeparator()));
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits(), true);
|
||||
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
|
||||
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
|
@ -513,7 +513,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogFinalMeasurements::ShowUnits()
|
||||
{
|
||||
const QString unit = UnitsToStr(qApp->patternUnit());
|
||||
const QString unit = UnitsToStr(qApp->patternUnits());
|
||||
|
||||
{
|
||||
// calculated value
|
||||
|
@ -554,7 +554,7 @@ void DialogFinalMeasurements::AddCell(const QString &text, int row, int column,
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromUser)
|
||||
{
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch)
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch)
|
||||
if (formula.isEmpty())
|
||||
{
|
||||
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
||||
|
|
|
@ -268,7 +268,7 @@ void DialogIncrements::FillAnglesCurves()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogIncrements::ShowUnits()
|
||||
{
|
||||
const QString unit = UnitsToStr(qApp->patternUnit());
|
||||
const QString unit = UnitsToStr(qApp->patternUnits());
|
||||
|
||||
ShowHeaderUnits(ui->tableWidgetIncrement, 1, unit);// calculated value
|
||||
ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// formula
|
||||
|
@ -361,7 +361,7 @@ QString DialogIncrements::ClearIncrementName(const QString &name) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label)
|
||||
{
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch)
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch)
|
||||
if (formula.isEmpty())
|
||||
{
|
||||
label->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
||||
|
@ -1228,7 +1228,7 @@ void DialogIncrements::SaveIncrFormula()
|
|||
{
|
||||
QTableWidgetItem *result = table->item(row, 1);
|
||||
//Show unit in dialog lable (cm, mm or inch)
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit());
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits());
|
||||
labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
|
||||
return;
|
||||
}
|
||||
|
@ -1236,7 +1236,7 @@ void DialogIncrements::SaveIncrFormula()
|
|||
if (text.isEmpty())
|
||||
{
|
||||
//Show unit in dialog lable (cm, mm or inch)
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit());
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits());
|
||||
labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
||||
return;
|
||||
}
|
||||
|
@ -1374,7 +1374,7 @@ void DialogIncrements::Fx()
|
|||
|
||||
dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(plainTextEditFormula->toPlainText(),
|
||||
qApp->Settings()->GetOsSeparator()));
|
||||
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||
const QString postfix = UnitsToStr(qApp->patternUnits(), true);
|
||||
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
|
||||
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
|
|
|
@ -71,7 +71,7 @@ DialogLayoutScale::~DialogLayoutScale()
|
|||
void DialogLayoutScale::SetTiledMargins(QMarginsF margins)
|
||||
{
|
||||
// read Margins top, right, bottom, left
|
||||
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnit());
|
||||
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits());
|
||||
|
||||
ui->doubleSpinBoxLeftField->setValue(margins.left());
|
||||
ui->doubleSpinBoxTopField->setValue(margins.top());
|
||||
|
@ -89,7 +89,7 @@ QMarginsF DialogLayoutScale::GetTiledMargins() const
|
|||
ui->doubleSpinBoxBottomField->value()
|
||||
);
|
||||
|
||||
return UnitConvertor(margins, qApp->patternUnit(), Unit::Mm);
|
||||
return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -181,7 +181,7 @@ void DialogLayoutScale::VerticalScaleChanged(double d)
|
|||
void DialogLayoutScale::ReadSettings()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
const Unit unit = qApp->patternUnits();
|
||||
|
||||
// read Margins top, right, bottom, left
|
||||
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
|
||||
|
@ -201,7 +201,7 @@ void DialogLayoutScale::ReadSettings()
|
|||
void DialogLayoutScale::WriteSettings() const
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
const Unit unit = qApp->patternUnits();
|
||||
|
||||
// write Margins top, right, bottom, left
|
||||
QMarginsF margins = QMarginsF(
|
||||
|
|
|
@ -82,8 +82,7 @@ void DialogPatternMaterials::SetPatternMaterials(const QMap<int, QString> &list)
|
|||
|
||||
for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
|
||||
{
|
||||
const QString translated = qApp->TrVars()->PlaceholderToUser(pl_userMaterial + QString::number(i + 1));
|
||||
QTableWidgetItem *item = new QTableWidgetItem(per + translated + per);
|
||||
QTableWidgetItem *item = new QTableWidgetItem(per + pl_userMaterial + QString::number(i + 1) + per);
|
||||
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
|
||||
item->setTextAlignment(Qt::AlignLeft);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <QMenu>
|
||||
#include <QDate>
|
||||
#include <QMessageBox>
|
||||
#include <QRadioButton>
|
||||
|
||||
#include "../xml/vpattern.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
|
@ -42,21 +43,12 @@
|
|||
#include "dialogknownmaterials.h"
|
||||
#include "dialogpatternmaterials.h"
|
||||
|
||||
// calc how many combinations we have
|
||||
static const int heightsCount = (static_cast<int>(GHeights::H200) -
|
||||
(static_cast<int>(GHeights::H50) - heightStep))/heightStep;
|
||||
static const int sizesCount = (static_cast<int>(GSizes::S72) - (static_cast<int>(GSizes::S22) - sizeStep))/sizeStep;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DialogPatternProperties),
|
||||
doc(doc),
|
||||
pattern(pattern),
|
||||
heightsChecked(heightsCount),
|
||||
sizesChecked(sizesCount),
|
||||
heights (QMap<GHeights, bool>()),
|
||||
sizes(QMap<GSizes, bool>()),
|
||||
data(QMap<QCheckBox *, int>()),
|
||||
descriptionChanged(false),
|
||||
gradationChanged(false),
|
||||
|
@ -79,6 +71,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
setWindowFlags(Qt::Window);
|
||||
#endif
|
||||
|
||||
ui->lineEditCustomerEmail->setClearButtonEnabled(true);
|
||||
|
||||
SCASSERT(doc != nullptr)
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
|
@ -140,44 +134,11 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
connect(bCancel, &QPushButton::clicked, this, &DialogPatternProperties::close);
|
||||
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
if (qApp->patternType() != MeasurementsType::Multisize)
|
||||
if (qApp->GetMeasurementsType() != MeasurementsType::Multisize)
|
||||
{
|
||||
ui->tabWidget->setTabEnabled(1, false);
|
||||
}
|
||||
|
||||
InitHeights();
|
||||
InitSizes();
|
||||
|
||||
heights = doc->GetGradationHeights();
|
||||
sizes = doc->GetGradationSizes();
|
||||
|
||||
SetOptions(heights);
|
||||
SetOptions(sizes);
|
||||
|
||||
InitComboBox(ui->comboBoxHeight, heights);
|
||||
InitComboBox(ui->comboBoxSize, sizes);
|
||||
|
||||
const QString height = QString().setNum(doc->GetDefCustomHeight());
|
||||
SetDefaultHeight(height);
|
||||
|
||||
const QString size = QString().setNum(doc->GetDefCustomSize());
|
||||
SetDefaultSize(size);
|
||||
|
||||
connect(ui->radioButtonDefFromP, &QRadioButton::toggled, this, [this]()
|
||||
{
|
||||
ui->comboBoxHeight->setEnabled(ui->radioButtonDefFromP->isChecked());
|
||||
ui->comboBoxSize->setEnabled(ui->radioButtonDefFromP->isChecked());
|
||||
});
|
||||
|
||||
auto DefValueChanged = [this](){defaultChanged = true;};
|
||||
|
||||
connect(ui->radioButtonDefFromP, &QRadioButton::toggled, this, DefValueChanged);
|
||||
|
||||
ui->radioButtonDefFromP->setChecked(doc->IsDefCustom());
|
||||
|
||||
connect(ui->comboBoxHeight, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefValueChanged);
|
||||
connect(ui->comboBoxSize, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefValueChanged);
|
||||
|
||||
const bool readOnly = doc->IsReadOnly();
|
||||
ui->checkBoxPatternReadOnly->setChecked(readOnly);
|
||||
if (not readOnly)
|
||||
|
@ -198,21 +159,29 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
ui->lineEditPatternNumber->setText(doc->GetPatternNumber());
|
||||
ui->lineEditCompanyName->setText(doc->GetCompanyName());
|
||||
|
||||
if (qApp->patternType() == MeasurementsType::Individual)
|
||||
ui->lineEditCustomerName->setText(qApp->GetCustomerName());
|
||||
ui->lineEditCustomerEmail->setText(qApp->CustomerEmail());
|
||||
ui->dateEditCustomerBirthDate->setDate(qApp->GetCustomerBirthDate());
|
||||
|
||||
if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
|
||||
{
|
||||
ui->lineEditCustomerName->setText(qApp->GetCustomerName());
|
||||
ui->lineEditCustomerName->setReadOnly(true);
|
||||
ui->lineEditCustomerName->setToolTip(tr("The customer name from individual measurements"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lineEditCustomerName->setText(doc->GetCustomerName());
|
||||
|
||||
ui->lineEditCustomerEmail->setReadOnly(true);
|
||||
ui->lineEditCustomerEmail->setToolTip(tr("The customer email from individual measurements"));
|
||||
|
||||
ui->dateEditCustomerBirthDate->setReadOnly(true);
|
||||
ui->dateEditCustomerBirthDate->setToolTip(tr("The customer birth date from individual measurements"));
|
||||
}
|
||||
|
||||
connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||
connect(ui->lineEditCompanyName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||
connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||
connect(ui->lineEditCustomerEmail, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
|
||||
connect(ui->dateEditCustomerBirthDate, &QDateEdit::editingFinished, this,
|
||||
&DialogPatternProperties::LabelDataChanged);
|
||||
connect(ui->pushButtonEditPatternLabel, &QPushButton::clicked, this, &DialogPatternProperties::EditLabel);
|
||||
connect(ui->pushButtonPatternMaterials, &QPushButton::clicked, this,
|
||||
&DialogPatternProperties::ManagePatternMaterials);
|
||||
|
@ -245,13 +214,9 @@ void DialogPatternProperties::Apply()
|
|||
SaveDescription();
|
||||
break;
|
||||
case 1:
|
||||
SaveGradation();
|
||||
SaveDefValues();
|
||||
break;
|
||||
case 2:
|
||||
SaveReadOnlyState();
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
SaveLabelData();
|
||||
SaveTemplateData();
|
||||
SaveMaterialData();
|
||||
|
@ -266,8 +231,6 @@ void DialogPatternProperties::Apply()
|
|||
void DialogPatternProperties::Ok()
|
||||
{
|
||||
SaveDescription();
|
||||
SaveGradation();
|
||||
SaveDefValues();
|
||||
SaveReadOnlyState();
|
||||
SaveLabelData();
|
||||
SaveTemplateData();
|
||||
|
@ -278,143 +241,12 @@ void DialogPatternProperties::Ok()
|
|||
close();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SelectAll(int state)
|
||||
{
|
||||
QCheckBox* box = qobject_cast<QCheckBox*>(sender());
|
||||
if (box)
|
||||
{
|
||||
if (box == ui->checkBoxAllHeights)
|
||||
{
|
||||
if (state == Qt::Checked)
|
||||
{
|
||||
SetHeightsChecked(true);
|
||||
}
|
||||
else if (state == Qt::Unchecked)
|
||||
{
|
||||
SetHeightsChecked(false);
|
||||
}
|
||||
|
||||
if (data.contains(box))
|
||||
{
|
||||
heights.insert(static_cast<GHeights>(data.value(box)), box->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
if (box == ui->checkBoxAllSizes)
|
||||
{
|
||||
if (state == Qt::Checked)
|
||||
{
|
||||
SetSizesChecked(true);
|
||||
}
|
||||
else if (state == Qt::Unchecked)
|
||||
{
|
||||
SetSizesChecked(false);
|
||||
}
|
||||
|
||||
if (data.contains(box))
|
||||
{
|
||||
sizes.insert(static_cast<GSizes>(data.value(box)), box->isChecked());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::CheckStateHeight(int state)
|
||||
{
|
||||
QCheckBox* box = qobject_cast<QCheckBox*>(sender());
|
||||
if (box)
|
||||
{
|
||||
if (state == Qt::Checked)
|
||||
{
|
||||
++heightsChecked;
|
||||
if (heightsChecked == heightsCount)
|
||||
{
|
||||
ui->checkBoxAllHeights->blockSignals(true);//don't touch anothers checkboxes
|
||||
ui->checkBoxAllHeights->setCheckState(Qt::Checked);
|
||||
heights.insert(GHeights::ALL, true);
|
||||
ui->checkBoxAllHeights->blockSignals(false);
|
||||
}
|
||||
}
|
||||
else if (state == Qt::Unchecked)
|
||||
{
|
||||
if (heightsChecked == heightsCount)
|
||||
{
|
||||
ui->checkBoxAllHeights->blockSignals(true);//don't touch anothers checkboxes
|
||||
ui->checkBoxAllHeights->setCheckState(Qt::Unchecked);
|
||||
heights.insert(GHeights::ALL, false);
|
||||
ui->checkBoxAllHeights->blockSignals(false);
|
||||
}
|
||||
--heightsChecked;
|
||||
}
|
||||
|
||||
if (data.contains(box))
|
||||
{
|
||||
heights.insert(static_cast<GHeights>(data.value(box)), box->isChecked());
|
||||
}
|
||||
|
||||
UpdateDefHeight();
|
||||
|
||||
CheckApplyOk();
|
||||
gradationChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::CheckStateSize(int state)
|
||||
{
|
||||
QCheckBox* box = qobject_cast<QCheckBox*>(sender());
|
||||
if (box)
|
||||
{
|
||||
|
||||
if (state == Qt::Checked)
|
||||
{
|
||||
++sizesChecked;
|
||||
if (sizesChecked == sizesCount)
|
||||
{
|
||||
ui->checkBoxAllSizes->blockSignals(true);//don't touch anothers checkboxes
|
||||
ui->checkBoxAllSizes->setCheckState(Qt::Checked);
|
||||
sizes.insert(GSizes::ALL, true);
|
||||
ui->checkBoxAllSizes->blockSignals(false);
|
||||
}
|
||||
}
|
||||
else if (state == Qt::Unchecked)
|
||||
{
|
||||
if (sizesChecked == sizesCount)
|
||||
{
|
||||
ui->checkBoxAllSizes->blockSignals(true);//don't touch anothers checkboxes
|
||||
ui->checkBoxAllSizes->setCheckState(Qt::Unchecked);
|
||||
sizes.insert(GSizes::ALL, false);
|
||||
ui->checkBoxAllSizes->blockSignals(false);
|
||||
}
|
||||
--sizesChecked;
|
||||
}
|
||||
|
||||
if (data.contains(box))
|
||||
{
|
||||
sizes.insert(static_cast<GSizes>(data.value(box)), box->isChecked());
|
||||
}
|
||||
|
||||
UpdateDefSize();
|
||||
|
||||
CheckApplyOk();
|
||||
gradationChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::DescEdited()
|
||||
{
|
||||
descriptionChanged = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::DefValueChanged()
|
||||
{
|
||||
defaultChanged = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::LabelDataChanged()
|
||||
{
|
||||
|
@ -422,134 +254,6 @@ void DialogPatternProperties::LabelDataChanged()
|
|||
askSaveLabelData = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SetHeightsChecked(bool enabled)
|
||||
{
|
||||
ui->checkBoxH50->setChecked(enabled);
|
||||
ui->checkBoxH56->setChecked(enabled);
|
||||
ui->checkBoxH62->setChecked(enabled);
|
||||
ui->checkBoxH68->setChecked(enabled);
|
||||
ui->checkBoxH74->setChecked(enabled);
|
||||
ui->checkBoxH80->setChecked(enabled);
|
||||
ui->checkBoxH86->setChecked(enabled);
|
||||
ui->checkBoxH92->setChecked(enabled);
|
||||
ui->checkBoxH98->setChecked(enabled);
|
||||
ui->checkBoxH104->setChecked(enabled);
|
||||
ui->checkBoxH110->setChecked(enabled);
|
||||
ui->checkBoxH116->setChecked(enabled);
|
||||
ui->checkBoxH122->setChecked(enabled);
|
||||
ui->checkBoxH128->setChecked(enabled);
|
||||
ui->checkBoxH134->setChecked(enabled);
|
||||
ui->checkBoxH140->setChecked(enabled);
|
||||
ui->checkBoxH146->setChecked(enabled);
|
||||
ui->checkBoxH152->setChecked(enabled);
|
||||
ui->checkBoxH158->setChecked(enabled);
|
||||
ui->checkBoxH164->setChecked(enabled);
|
||||
ui->checkBoxH170->setChecked(enabled);
|
||||
ui->checkBoxH176->setChecked(enabled);
|
||||
ui->checkBoxH182->setChecked(enabled);
|
||||
ui->checkBoxH188->setChecked(enabled);
|
||||
ui->checkBoxH194->setChecked(enabled);
|
||||
ui->checkBoxH200->setChecked(enabled);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SetSizesChecked(bool enabled)
|
||||
{
|
||||
ui->checkBoxS22->setChecked(enabled);
|
||||
ui->checkBoxS24->setChecked(enabled);
|
||||
ui->checkBoxS26->setChecked(enabled);
|
||||
ui->checkBoxS28->setChecked(enabled);
|
||||
ui->checkBoxS30->setChecked(enabled);
|
||||
ui->checkBoxS32->setChecked(enabled);
|
||||
ui->checkBoxS34->setChecked(enabled);
|
||||
ui->checkBoxS36->setChecked(enabled);
|
||||
ui->checkBoxS38->setChecked(enabled);
|
||||
ui->checkBoxS40->setChecked(enabled);
|
||||
ui->checkBoxS42->setChecked(enabled);
|
||||
ui->checkBoxS44->setChecked(enabled);
|
||||
ui->checkBoxS46->setChecked(enabled);
|
||||
ui->checkBoxS48->setChecked(enabled);
|
||||
ui->checkBoxS50->setChecked(enabled);
|
||||
ui->checkBoxS52->setChecked(enabled);
|
||||
ui->checkBoxS54->setChecked(enabled);
|
||||
ui->checkBoxS56->setChecked(enabled);
|
||||
ui->checkBoxS58->setChecked(enabled);
|
||||
ui->checkBoxS60->setChecked(enabled);
|
||||
ui->checkBoxS62->setChecked(enabled);
|
||||
ui->checkBoxS64->setChecked(enabled);
|
||||
ui->checkBoxS66->setChecked(enabled);
|
||||
ui->checkBoxS68->setChecked(enabled);
|
||||
ui->checkBoxS70->setChecked(enabled);
|
||||
ui->checkBoxS72->setChecked(enabled);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::InitHeights()
|
||||
{
|
||||
Init(ui->checkBoxAllHeights, static_cast<int>(GHeights::ALL), &DialogPatternProperties::SelectAll);
|
||||
|
||||
Init(ui->checkBoxH50, static_cast<int>(GHeights::H50), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH56, static_cast<int>(GHeights::H56), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH62, static_cast<int>(GHeights::H62), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH68, static_cast<int>(GHeights::H68), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH74, static_cast<int>(GHeights::H74), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH80, static_cast<int>(GHeights::H80), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH86, static_cast<int>(GHeights::H86), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH92, static_cast<int>(GHeights::H92), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH98, static_cast<int>(GHeights::H98), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH104, static_cast<int>(GHeights::H104), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH110, static_cast<int>(GHeights::H110), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH116, static_cast<int>(GHeights::H116), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH122, static_cast<int>(GHeights::H122), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH128, static_cast<int>(GHeights::H128), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH134, static_cast<int>(GHeights::H134), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH140, static_cast<int>(GHeights::H140), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH146, static_cast<int>(GHeights::H146), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH152, static_cast<int>(GHeights::H152), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH158, static_cast<int>(GHeights::H158), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH164, static_cast<int>(GHeights::H164), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH170, static_cast<int>(GHeights::H170), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH176, static_cast<int>(GHeights::H176), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH182, static_cast<int>(GHeights::H182), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH188, static_cast<int>(GHeights::H188), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH194, static_cast<int>(GHeights::H194), &DialogPatternProperties::CheckStateHeight);
|
||||
Init(ui->checkBoxH200, static_cast<int>(GHeights::H200), &DialogPatternProperties::CheckStateHeight);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::InitSizes()
|
||||
{
|
||||
Init(ui->checkBoxAllSizes, static_cast<int>(GSizes::ALL), &DialogPatternProperties::SelectAll);
|
||||
|
||||
Init(ui->checkBoxS22, static_cast<int>(GSizes::S22), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS24, static_cast<int>(GSizes::S24), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS26, static_cast<int>(GSizes::S26), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS28, static_cast<int>(GSizes::S28), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS30, static_cast<int>(GSizes::S30), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS32, static_cast<int>(GSizes::S32), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS34, static_cast<int>(GSizes::S34), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS36, static_cast<int>(GSizes::S36), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS38, static_cast<int>(GSizes::S38), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS40, static_cast<int>(GSizes::S40), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS42, static_cast<int>(GSizes::S42), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS44, static_cast<int>(GSizes::S44), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS46, static_cast<int>(GSizes::S46), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS48, static_cast<int>(GSizes::S48), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS50, static_cast<int>(GSizes::S50), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS52, static_cast<int>(GSizes::S52), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS54, static_cast<int>(GSizes::S54), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS56, static_cast<int>(GSizes::S56), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS58, static_cast<int>(GSizes::S58), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS60, static_cast<int>(GSizes::S60), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS62, static_cast<int>(GSizes::S62), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS64, static_cast<int>(GSizes::S64), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS66, static_cast<int>(GSizes::S66), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS68, static_cast<int>(GSizes::S68), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS70, static_cast<int>(GSizes::S70), &DialogPatternProperties::CheckStateSize);
|
||||
Init(ui->checkBoxS72, static_cast<int>(GSizes::S72), &DialogPatternProperties::CheckStateSize);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::InitComboBoxFormats(QComboBox *box, const QStringList &items,
|
||||
const QString ¤tFormat)
|
||||
|
@ -568,14 +272,6 @@ void DialogPatternProperties::InitComboBoxFormats(QComboBox *box, const QStringL
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::CheckApplyOk()
|
||||
{
|
||||
bool enable = !(heightsChecked == 0 || sizesChecked == 0);
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SaveDescription()
|
||||
{
|
||||
|
@ -589,38 +285,6 @@ void DialogPatternProperties::SaveDescription()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SaveGradation()
|
||||
{
|
||||
if (gradationChanged)
|
||||
{
|
||||
doc->SetGradationHeights(heights);
|
||||
doc->SetGradationSizes(sizes);
|
||||
emit UpdateGradation();
|
||||
gradationChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SaveDefValues()
|
||||
{
|
||||
if (defaultChanged)
|
||||
{
|
||||
if (ui->radioButtonDefFromM->isChecked())
|
||||
{
|
||||
doc->SetDefCustom(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
doc->SetDefCustom(true);
|
||||
doc->SetDefCustomHeight(ui->comboBoxHeight->currentText().toInt());
|
||||
doc->SetDefCustomSize(ui->comboBoxSize->currentText().toInt());
|
||||
}
|
||||
defaultChanged = false;
|
||||
emit doc->patternChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SaveLabelData()
|
||||
{
|
||||
|
@ -629,9 +293,11 @@ void DialogPatternProperties::SaveLabelData()
|
|||
doc->SetPatternName(ui->lineEditPatternName->text());
|
||||
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
|
||||
doc->SetCompanyName(ui->lineEditCompanyName->text());
|
||||
if (qApp->patternType() != MeasurementsType::Individual)
|
||||
if (qApp->GetMeasurementsType() != MeasurementsType::Individual)
|
||||
{
|
||||
doc->SetCustomerName(ui->lineEditCustomerName->text());
|
||||
doc->SetCustomerBirthDate(ui->dateEditCustomerBirthDate->date());
|
||||
doc->SetCustomerEmail(ui->lineEditCustomerEmail->text());
|
||||
}
|
||||
doc->SetLabelDateFormat(ui->comboBoxDateFormat->currentText());
|
||||
doc->SetLabelTimeFormat(ui->comboBoxTimeFormat->currentText());
|
||||
|
@ -672,114 +338,6 @@ void DialogPatternProperties::SaveReadOnlyState()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SetDefaultHeight(const QString &def)
|
||||
{
|
||||
int index = ui->comboBoxHeight->findText(def);
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxHeight->setCurrentIndex(index);
|
||||
defaultChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const int height = static_cast<int>(pattern->height());
|
||||
index = ui->comboBoxHeight->findText(QString().setNum(height));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxHeight->setCurrentIndex(index);
|
||||
defaultChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SetDefaultSize(const QString &def)
|
||||
{
|
||||
int index = ui->comboBoxSize->findText(def);
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxSize->setCurrentIndex(index);
|
||||
defaultChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const int size = static_cast<int>(pattern->size());
|
||||
index = ui->comboBoxSize->findText(QString().setNum(size));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxSize->setCurrentIndex(index);
|
||||
defaultChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::UpdateDefHeight()
|
||||
{
|
||||
const QString def = ui->comboBoxHeight->currentText();
|
||||
InitComboBox(ui->comboBoxHeight, heights);
|
||||
SetDefaultHeight(def);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::UpdateDefSize()
|
||||
{
|
||||
const QString def = ui->comboBoxSize->currentText();
|
||||
InitComboBox(ui->comboBoxSize, sizes);
|
||||
SetDefaultSize(def);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<typename Func>
|
||||
void DialogPatternProperties::Init(QCheckBox *check, int val, Func slot)
|
||||
{
|
||||
connect(check, &QCheckBox::stateChanged, this, slot);
|
||||
data.insert(check, val);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<typename GVal>
|
||||
void DialogPatternProperties::SetOptions(const QMap<GVal, bool> &option)
|
||||
{
|
||||
if (option.value(GVal::ALL) == false)
|
||||
{
|
||||
QMapIterator<GVal, bool> i(option);
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (i.value() == false && i.key() != GVal::ALL)
|
||||
{
|
||||
QCheckBox *box = data.key(static_cast<int>(i.key()));
|
||||
if (box != nullptr)
|
||||
{
|
||||
box->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<typename GVal>
|
||||
void DialogPatternProperties::InitComboBox(QComboBox *box, const QMap<GVal, bool> &option)
|
||||
{
|
||||
SCASSERT(box != nullptr)
|
||||
|
||||
box->clear();
|
||||
|
||||
QMapIterator<GVal, bool> i(option);
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (i.value() && i.key() != GVal::ALL)
|
||||
{
|
||||
box->addItem(QString().setNum(static_cast<int>(UnitConvertor(static_cast<int>(i.key()), Unit::Cm,
|
||||
*pattern->GetPatternUnit()))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QImage DialogPatternProperties::GetImage()
|
||||
{
|
||||
|
@ -937,7 +495,7 @@ void DialogPatternProperties::EditLabel()
|
|||
}
|
||||
}
|
||||
|
||||
DialogEditLabel editor(doc);
|
||||
DialogEditLabel editor(doc, pattern);
|
||||
|
||||
templateDataChanged ? editor.SetTemplate(templateLines) : editor.SetTemplate(doc->GetPatternLabelTemplate());
|
||||
|
||||
|
|
|
@ -50,16 +50,10 @@ class DialogPatternProperties : public QDialog
|
|||
public:
|
||||
explicit DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent = nullptr);
|
||||
virtual ~DialogPatternProperties() override;
|
||||
signals:
|
||||
void UpdateGradation();
|
||||
private slots:
|
||||
void DefValueChanged();
|
||||
void LabelDataChanged();
|
||||
void Apply();
|
||||
void Ok();
|
||||
void SelectAll(int state);
|
||||
void CheckStateHeight(int state);
|
||||
void CheckStateSize(int state);
|
||||
void DescEdited();
|
||||
void ChangeImage();
|
||||
void SaveImage();
|
||||
|
@ -70,10 +64,6 @@ private:
|
|||
Ui::DialogPatternProperties *ui;
|
||||
VPattern *doc;
|
||||
VContainer *pattern;
|
||||
int heightsChecked;
|
||||
int sizesChecked;
|
||||
QMap<GHeights, bool> heights;
|
||||
QMap<GSizes, bool> sizes;
|
||||
QMap<QCheckBox *, int> data;
|
||||
bool descriptionChanged;
|
||||
bool gradationChanged;
|
||||
|
@ -91,31 +81,13 @@ private:
|
|||
QVector<VLabelTemplateLine> templateLines;
|
||||
QMap<int, QString> patternMaterials;
|
||||
|
||||
void SetHeightsChecked(bool enabled);
|
||||
void SetSizesChecked(bool enabled);
|
||||
void InitHeights();
|
||||
void InitSizes();
|
||||
template<typename Func>
|
||||
void Init(QCheckBox *check, int val, Func slot);
|
||||
template<typename GVal>
|
||||
void SetOptions(const QMap<GVal, bool> &option);
|
||||
template<typename GVal>
|
||||
void InitComboBox(QComboBox *box, const QMap<GVal, bool> &option);
|
||||
void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString ¤tFormat);
|
||||
void CheckApplyOk();
|
||||
void SaveDescription();
|
||||
void SaveGradation();
|
||||
void SaveDefValues();
|
||||
void SaveLabelData();
|
||||
void SaveTemplateData();
|
||||
void SaveMaterialData();
|
||||
void SaveReadOnlyState();
|
||||
|
||||
void SetDefaultHeight(const QString &def);
|
||||
void SetDefaultSize(const QString &def);
|
||||
|
||||
void UpdateDefHeight();
|
||||
void UpdateDefSize();
|
||||
void InitImage();
|
||||
QImage GetImage();
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -676,7 +676,7 @@ void DialogSaveLayout::SetTiledExportMode(bool tiledExportMode)
|
|||
void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
|
||||
{
|
||||
// read Margins top, right, bottom, left
|
||||
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnit());
|
||||
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits());
|
||||
|
||||
ui->doubleSpinBoxLeftField->setValue(margins.left());
|
||||
ui->doubleSpinBoxTopField->setValue(margins.top());
|
||||
|
@ -694,7 +694,7 @@ QMarginsF DialogSaveLayout::GetTiledMargins() const
|
|||
ui->doubleSpinBoxBottomField->value()
|
||||
);
|
||||
|
||||
return UnitConvertor(margins, qApp->patternUnit(), Unit::Mm);
|
||||
return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -892,7 +892,7 @@ void DialogSaveLayout::RemoveFormatFromList(LayoutExportFormats format)
|
|||
void DialogSaveLayout::ReadSettings()
|
||||
{
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
const Unit unit = qApp->patternUnits();
|
||||
|
||||
// read Margins top, right, bottom, left
|
||||
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
|
||||
|
@ -946,7 +946,7 @@ void DialogSaveLayout::WriteSettings() const
|
|||
}
|
||||
|
||||
VSettings *settings = qApp->ValentinaSettings();
|
||||
const Unit unit = qApp->patternUnit();
|
||||
const Unit unit = qApp->patternUnits();
|
||||
|
||||
// write Margins top, right, bottom, left
|
||||
QMarginsF margins = QMarginsF(
|
||||
|
|
|
@ -297,7 +297,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
|||
catch (const VExceptionBadId &)
|
||||
{
|
||||
const QString errorMsg = tr("Cannot find piece by id '%1'").arg(id);
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ void VWidgetGroups::CtxMenu(const QPoint &pos)
|
|||
}
|
||||
else if (selectedAction == actionPreferences)
|
||||
{
|
||||
QScopedPointer<VContainer> fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitP(),
|
||||
QScopedPointer<VContainer> fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitsP(),
|
||||
VContainer::UniqueNamespace()));
|
||||
QScopedPointer<DialogGroup> dialog(new DialogGroup(fackeContainer.data(), NULL_ID, this));
|
||||
dialog->SetName(doc->GetGroupName(id));
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,7 +32,9 @@
|
|||
#include "mainwindowsnogui.h"
|
||||
#include "core/vcmdexport.h"
|
||||
#include "../vmisc/vlockguard.h"
|
||||
#include "../vformat/vdimensions.h"
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QPointer>
|
||||
|
||||
namespace Ui
|
||||
|
@ -51,7 +53,6 @@ class DialogFinalMeasurements;
|
|||
class VWidgetGroups;
|
||||
class VWidgetDetails;
|
||||
class QToolButton;
|
||||
class QDoubleSpinBox;
|
||||
class QProgressBar;
|
||||
class WatermarkWindow;
|
||||
|
||||
|
@ -208,8 +209,11 @@ private slots:
|
|||
void OpenAt(QAction *where);
|
||||
#endif //defined(Q_OS_MAC)
|
||||
|
||||
void ChangedSize(const QString &text);
|
||||
void ChangedHeight(const QString &text);
|
||||
void DimensionABaseChanged();
|
||||
void DimensionBBaseChanged();
|
||||
void DimensionCBaseChanged();
|
||||
|
||||
void GradationChanged();
|
||||
|
||||
void ShowProgress();
|
||||
void ClearPatternMessages();
|
||||
|
@ -267,12 +271,14 @@ private:
|
|||
QLabel *rightGoToStage;
|
||||
QTimer *autoSaveTimer;
|
||||
bool guiEnabled;
|
||||
QPointer<QComboBox> gradationHeights;
|
||||
QPointer<QComboBox> gradationSizes;
|
||||
QPointer<QLabel> gradationHeightsLabel;
|
||||
QPointer<QLabel> gradationSizesLabel;
|
||||
QPointer<QLabel> zoomScale;
|
||||
QPointer<QDoubleSpinBox> doubleSpinBoxScale;
|
||||
QPointer<QComboBox> dimensionA{nullptr};
|
||||
QPointer<QComboBox> dimensionB{nullptr};
|
||||
QPointer<QComboBox> dimensionC{nullptr};
|
||||
QPointer<QLabel> dimensionALabel{nullptr};
|
||||
QPointer<QLabel> dimensionBLabel{nullptr};
|
||||
QPointer<QLabel> dimensionCLabel{nullptr};
|
||||
QPointer<QLabel> zoomScale{nullptr};
|
||||
QPointer<QDoubleSpinBox> doubleSpinBoxScale{nullptr};
|
||||
VToolOptionsPropertyBrowser *toolOptions;
|
||||
VWidgetGroups *groupsWidget;
|
||||
VWidgetDetails *detailsWidget;
|
||||
|
@ -285,8 +291,16 @@ private:
|
|||
|
||||
QList<QPointer<WatermarkWindow>> m_watermarkEditors{};
|
||||
|
||||
void SetDefaultHeight();
|
||||
void SetDefaultSize();
|
||||
int m_currentDimensionA{0};
|
||||
int m_currentDimensionB{0};
|
||||
int m_currentDimensionC{0};
|
||||
|
||||
QSharedPointer<VMeasurements> m{};
|
||||
|
||||
QTimer *m_gradation;
|
||||
|
||||
void InitDimensionControls();
|
||||
void InitDimensionGradation(int index, const MeasurementDimension_p &dimension, QPointer<QComboBox> control);
|
||||
|
||||
void ToolBarOption();
|
||||
void ToolBarStages();
|
||||
|
@ -338,15 +352,12 @@ private:
|
|||
void InitAutoSave();
|
||||
bool PatternPieceName(QString &name);
|
||||
QString CheckPathToMeasurements(const QString &patternPath, const QString &path);
|
||||
QComboBox *SetGradationList(QLabel *label, const QStringList &list);
|
||||
void ChangePP(int index, bool zoomBestFit = true);
|
||||
/**
|
||||
* @brief EndVisualization try show dialog after and working with tool visualization.
|
||||
*/
|
||||
void EndVisualization(bool click = false);
|
||||
void ZoomFirstShow();
|
||||
void UpdateHeightsList(const QStringList &list);
|
||||
void UpdateSizesList(const QStringList &list);
|
||||
|
||||
void AddDocks();
|
||||
void InitDocksContain();
|
||||
|
@ -360,14 +371,15 @@ private:
|
|||
void InitScenes();
|
||||
|
||||
bool LoadMeasurements(const QString &path);
|
||||
bool UpdateMeasurements(const QString &path, int size, int height);
|
||||
bool UpdateMeasurements(const QString &path, int baseA, int baseB, int baseC);
|
||||
|
||||
void ReopenFilesAfterCrash(QStringList &args);
|
||||
bool DoExport(const VCommandLinePtr& expParams);
|
||||
bool DoFMExport(const VCommandLinePtr& expParams);
|
||||
|
||||
bool SetSize(const QString &text);
|
||||
bool SetHeight(const QString & text);
|
||||
bool SetDimensionA(int value);
|
||||
bool SetDimensionB(int value);
|
||||
bool SetDimensionC(int value);
|
||||
|
||||
QString GetPatternFileName();
|
||||
QString GetMeasurementFileName();
|
||||
|
@ -393,6 +405,12 @@ private:
|
|||
|
||||
void OpenWatermark(const QString &path = QString());
|
||||
void CleanWaterkmarkEditors();
|
||||
|
||||
void StoreMultisizeMDimensions();
|
||||
void StoreIndividualMDimensions();
|
||||
|
||||
QVector<int> DimensionRestrictedValues(int index, const MeasurementDimension_p &dimension);
|
||||
void SetDimensionBases();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -136,7 +136,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
|||
listDetails(),
|
||||
currentScene(nullptr),
|
||||
tempSceneLayout(nullptr),
|
||||
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP(), valentinaNamespace)),
|
||||
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitsP(), valentinaNamespace)),
|
||||
doc(nullptr),
|
||||
papers(),
|
||||
shadows(),
|
||||
|
@ -155,7 +155,6 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
|||
margins(),
|
||||
paperSize(),
|
||||
m_dialogSaveLayout(),
|
||||
m_mouseCoordinate(),
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
m_taskbarButton(new QWinTaskbarButton(this)),
|
||||
m_taskbarProgress(nullptr),
|
||||
|
@ -930,7 +929,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
|
|||
{
|
||||
const QString errorMsg = tr("File error.\n\n%1\n\n%2").arg(e.ErrorMessage(), e.DetailedInformation());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2047,33 +2046,6 @@ QString MainWindowsNoGUI::FileName() const
|
|||
return QFileInfo(fileName).baseName();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindowsNoGUI::SetSizeHeightForIndividualM() const
|
||||
{
|
||||
const QHash<QString, QSharedPointer<VInternalVariable> > * vars = pattern->DataVariables();
|
||||
|
||||
if (vars->contains(size_M))
|
||||
{
|
||||
pattern->SetSize(*vars->value(size_M)->GetValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern->SetSize(0);
|
||||
}
|
||||
|
||||
if (vars->contains(height_M))
|
||||
{
|
||||
pattern->SetHeight(*vars->value(height_M)->GetValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern->SetHeight(0);
|
||||
}
|
||||
|
||||
doc->SetPatternWasChanged(true);
|
||||
emit doc->UpdatePatternLabel();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib,
|
||||
const QChar &separator) const
|
||||
|
@ -2191,21 +2163,6 @@ QSharedPointer<VMeasurements> MainWindowsNoGUI::OpenMeasurementFile(const QStrin
|
|||
}
|
||||
|
||||
CheckRequiredMeasurements(m.data());
|
||||
|
||||
if (m->Type() == MeasurementsType::Multisize)
|
||||
{
|
||||
if (m->MUnit() == Unit::Inch)
|
||||
{
|
||||
qCCritical(vMainNoGUIWindow, "%s\n\n%s", qUtf8Printable(tr("Wrong units.")),
|
||||
qUtf8Printable(tr("Application doesn't support multisize table with inches.")));
|
||||
m->clear();
|
||||
if (not VApplication::IsGUIMode())
|
||||
{
|
||||
qApp->exit(V_EX_DATAERR);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
|
|
|
@ -122,8 +122,8 @@ protected:
|
|||
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout;
|
||||
|
||||
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
|
||||
QPointer<QLabel> m_mouseCoordinate;
|
||||
QPointer<QLabel> m_unreadPatternMessage{};
|
||||
QPointer<QLabel> m_mouseCoordinate{nullptr};
|
||||
QPointer<QLabel> m_unreadPatternMessage{nullptr};
|
||||
|
||||
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
QWinTaskbarButton *m_taskbarButton;
|
||||
|
@ -142,7 +142,6 @@ protected:
|
|||
bool GenerateLayout(VLayoutGenerator& lGenerator);
|
||||
int ContinueIfLayoutStale();
|
||||
QString FileName() const;
|
||||
void SetSizeHeightForIndividualM() const;
|
||||
|
||||
bool ExportFMeasurementsToCSVData(const QString &fileName,
|
||||
bool withHeader, int mib, const QChar &separator) const;
|
||||
|
|
|
@ -127,7 +127,7 @@ void VPattern::CreateEmptyFile()
|
|||
|
||||
patternElement.appendChild(createComment(FileComment()));
|
||||
patternElement.appendChild(CreateElementWithText(TagVersion, VPatternConverter::PatternMaxVerStr));
|
||||
patternElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(qApp->patternUnit())));
|
||||
patternElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(qApp->patternUnits())));
|
||||
|
||||
patternElement.appendChild(createElement(TagDescription));
|
||||
patternElement.appendChild(createElement(TagNotes));
|
||||
|
@ -4196,164 +4196,6 @@ QString VPattern::GenerateSuffix() const
|
|||
return QString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPattern::IsDefCustom() const
|
||||
{
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const QDomNode domNode = tags.at(0);
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
return GetParametrBool(domElement, AttrCustom, falseStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPattern::SetDefCustom(bool value)
|
||||
{
|
||||
CheckTagExists(TagGradation);
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.isEmpty())
|
||||
{
|
||||
qDebug()<<"Can't save attribute "<<AttrCustom<<Q_FUNC_INFO;
|
||||
return;
|
||||
}
|
||||
|
||||
QDomNode domNode = tags.at(0);
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
if (value == false)
|
||||
{
|
||||
domElement.removeAttribute(AttrDefHeight);
|
||||
SetDefCustomHeight(0);
|
||||
SetDefCustomSize(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetAttribute(domElement, AttrCustom, value);
|
||||
}
|
||||
modified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't save attribute "<<AttrCustom<<Q_FUNC_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VPattern::GetDefCustomHeight() const
|
||||
{
|
||||
if (IsDefCustom())
|
||||
{
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.size() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QDomNode domNode = tags.at(0);
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
return static_cast<int>(GetParametrUInt(domElement, AttrDefHeight, QChar('0')));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPattern::SetDefCustomHeight(int value)
|
||||
{
|
||||
CheckTagExists(TagGradation);
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.isEmpty())
|
||||
{
|
||||
qDebug()<<"Can't save attribute "<<AttrDefHeight<<Q_FUNC_INFO;
|
||||
return;
|
||||
}
|
||||
|
||||
QDomNode domNode = tags.at(0);
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
SetAttributeOrRemoveIf(domElement, AttrDefHeight, value, value == 0);
|
||||
modified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't save attribute "<<AttrDefHeight<<Q_FUNC_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VPattern::GetDefCustomSize() const
|
||||
{
|
||||
if (IsDefCustom())
|
||||
{
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.size() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QDomNode domNode = tags.at(0);
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
return static_cast<int>(GetParametrUInt(domElement, AttrDefSize, QChar('0')));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPattern::SetDefCustomSize(int value)
|
||||
{
|
||||
CheckTagExists(TagGradation);
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.isEmpty())
|
||||
{
|
||||
qDebug()<<"Can't save attribute "<<AttrDefSize<<Q_FUNC_INFO;
|
||||
return;
|
||||
}
|
||||
|
||||
QDomNode domNode = tags.at(0);
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
SetAttributeOrRemoveIf(domElement, AttrDefSize, value, value == 0);
|
||||
modified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't save attribute "<<AttrDefSize<<Q_FUNC_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPattern::IsReadOnly() const
|
||||
{
|
||||
|
|
|
@ -97,15 +97,6 @@ public:
|
|||
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const override;
|
||||
virtual QString GenerateSuffix() const override;
|
||||
|
||||
bool IsDefCustom() const;
|
||||
void SetDefCustom(bool value);
|
||||
|
||||
int GetDefCustomHeight() const;
|
||||
void SetDefCustomHeight(int value);
|
||||
|
||||
int GetDefCustomSize() const;
|
||||
void SetDefCustomSize(int value);
|
||||
|
||||
bool IsReadOnly() const;
|
||||
void SetReadOnly(bool rOnly);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "../ifc/exception/vexception.h"
|
||||
#include "../ifc/xml/vabstractconverter.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "fvavailableupdate.h"
|
||||
#include "fvupdatewindow.h"
|
||||
|
|
|
@ -59,12 +59,14 @@
|
|||
<file>schema/pattern/v0.8.5.xsd</file>
|
||||
<file>schema/pattern/v0.8.6.xsd</file>
|
||||
<file>schema/pattern/v0.8.7.xsd</file>
|
||||
<file>schema/standard_measurements/v0.3.0.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.2.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.3.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.4.xsd</file>
|
||||
<file>schema/pattern/v0.8.8.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.3.0.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.4.0.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.4.1.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.4.2.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.4.3.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.4.4.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.5.0.xsd</file>
|
||||
<file>schema/individual_measurements/v0.2.0.xsd</file>
|
||||
<file>schema/individual_measurements/v0.3.0.xsd</file>
|
||||
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
||||
|
@ -72,6 +74,7 @@
|
|||
<file>schema/individual_measurements/v0.3.3.xsd</file>
|
||||
<file>schema/individual_measurements/v0.4.0.xsd</file>
|
||||
<file>schema/individual_measurements/v0.5.0.xsd</file>
|
||||
<file>schema/individual_measurements/v0.5.1.xsd</file>
|
||||
<file>schema/label_template/v1.0.0.xsd</file>
|
||||
<file>schema/watermark/v1.0.0.xsd</file>
|
||||
</qresource>
|
||||
|
|
83
src/libs/ifc/schema/individual_measurements/v0.5.1.xsd
Normal file
83
src/libs/ifc/schema/individual_measurements/v0.5.1.xsd
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xs:element name="vit">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="version" type="formatVersion"/>
|
||||
<xs:element name="read-only" type="xs:boolean"/>
|
||||
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="unit" type="units"/>
|
||||
<xs:element name="pm_system" type="psCode"/>
|
||||
<xs:element name="personal">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="customer" type="xs:string"/>
|
||||
<xs:element name="birth-date" type="xs:date"/>
|
||||
<xs:element name="gender" type="gender"/>
|
||||
<xs:element name="email" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="body-measurements">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="m" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="name" type="shortName" use="required"/>
|
||||
<xs:attribute name="value" type="xs:string" use="required"/>
|
||||
<xs:attribute name="full_name" type="xs:string"/>
|
||||
<xs:attribute name="description" type="xs:string"/>
|
||||
<xs:attribute name="specialUnits" type="xs:boolean"/>
|
||||
<xs:attribute name="dimension" type="dimensionType"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="template" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:unique name="measurementName">
|
||||
<xs:selector xpath="body-measurements/m"/>
|
||||
<xs:field xpath="@name"/>
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
<xs:simpleType name="shortName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="([^\p{Nd}\p{Zs}*/&|!<>^ \()\-−+.,٫, ٬.’=?:;'\"]){1,1}([^\p{Zs}*/&|!<>^ \()\-−+.,٫, ٬.’=?:;\"]){0,}"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="formatVersion">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="units">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="mm"/>
|
||||
<xs:enumeration value="cm"/>
|
||||
<xs:enumeration value="inch"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="gender">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="unknown"/>
|
||||
<xs:enumeration value="male"/>
|
||||
<xs:enumeration value="female"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="psCode">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="(([0-9]|[1-4][0-9]|5[0-4])|998)"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="dimensionType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="n"/>
|
||||
<xs:enumeration value="x"/>
|
||||
<xs:enumeration value="y"/>
|
||||
<xs:enumeration value="w"/>
|
||||
<xs:enumeration value="z"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
125
src/libs/ifc/schema/multisize_measurements/v0.5.0.xsd
Normal file
125
src/libs/ifc/schema/multisize_measurements/v0.5.0.xsd
Normal file
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xs:element name="vst">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="version" type="formatVersion"/>
|
||||
<xs:element name="read-only" type="xs:boolean"/>
|
||||
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="unit" type="units"/>
|
||||
<xs:element name="pm_system" type="psCode"/>
|
||||
<xs:element name="dimensions">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="dimension" minOccurs="0" maxOccurs="3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="labels" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="label" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="value" type="dimesionValue" use="required"/>
|
||||
<xs:attribute name="label" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="type" type="dimensionType" use="required"/>
|
||||
<xs:attribute name="base" type="dimesionValue" use="required"/>
|
||||
<xs:attribute name="min" type="dimesionValue" use="required"/>
|
||||
<xs:attribute name="max" type="dimesionValue" use="required"/>
|
||||
<xs:attribute name="step" type="dimensionStep" use="required"/>
|
||||
<xs:attribute name="circumference" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="fullCircumference" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="restrictions">
|
||||
</xs:element>
|
||||
<xs:element name="body-measurements">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="m" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="corrections" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="correction" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="coordinates" type="xs:string" use="required"/>
|
||||
<xs:attribute name="correction" type="xs:double" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" type="shortName" use="required"/>
|
||||
<xs:attribute name="base" type="xs:double" use="required"/>
|
||||
<xs:attribute name="shiftA" type="xs:double" use="required"/>
|
||||
<xs:attribute name="shiftB" type="xs:double"/>
|
||||
<xs:attribute name="shiftC" type="xs:double"/>
|
||||
<xs:attribute name="full_name" type="xs:string"/>
|
||||
<xs:attribute name="description" type="xs:string"/>
|
||||
<xs:attribute name="specialUnits" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:unique name="measurementName">
|
||||
<xs:selector xpath="body-measurements/m"/>
|
||||
<xs:field xpath="@name"/>
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
<xs:simpleType name="shortName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="([^\p{Nd}\p{Zs}*/&|!<>^ \()\-−+.,٫, ٬.’=?:;'\"]){1,1}([^\p{Zs}*/&|!<>^ \()\-−+.,٫, ٬.’=?:;\"]){0,}"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="units">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="mm"/>
|
||||
<xs:enumeration value="cm"/>
|
||||
<xs:enumeration value="inch"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="formatVersion">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="psCode">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="(([0-9]|[1-4][0-9]|5[0-4])|998)"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="dimensionType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="x"/>
|
||||
<xs:enumeration value="y"/>
|
||||
<xs:enumeration value="w"/>
|
||||
<xs:enumeration value="z"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="dimesionValue">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:minInclusive value="6"/>
|
||||
<xs:maxInclusive value="2720"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="dimensionStep">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:minInclusive value="0"/>
|
||||
<xs:maxInclusive value="80"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
1073
src/libs/ifc/schema/pattern/v0.8.8.xsd
Normal file
1073
src/libs/ifc/schema/pattern/v0.8.8.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -54,7 +54,7 @@
|
|||
#include "vpatternconverter.h"
|
||||
#include "vdomdocument.h"
|
||||
#include "vtoolrecord.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vlayout/vtextmanager.h"
|
||||
|
||||
|
@ -82,14 +82,13 @@ const QString VAbstractPattern::TagArc = QStringLiteral("arc");
|
|||
const QString VAbstractPattern::TagElArc = QStringLiteral("elArc");
|
||||
const QString VAbstractPattern::TagTools = QStringLiteral("tools");
|
||||
const QString VAbstractPattern::TagOperation = QStringLiteral("operation");
|
||||
const QString VAbstractPattern::TagGradation = QStringLiteral("gradation");
|
||||
const QString VAbstractPattern::TagHeights = QStringLiteral("heights");
|
||||
const QString VAbstractPattern::TagSizes = QStringLiteral("sizes");
|
||||
const QString VAbstractPattern::TagData = QStringLiteral("data");
|
||||
const QString VAbstractPattern::TagPatternInfo = QStringLiteral("patternInfo");
|
||||
const QString VAbstractPattern::TagPatternName = QStringLiteral("patternName");
|
||||
const QString VAbstractPattern::TagPatternNum = QStringLiteral("patternNumber");
|
||||
const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer");
|
||||
const QString VAbstractPattern::TagCustomerBirthDate = QStringLiteral("birthDate");
|
||||
const QString VAbstractPattern::TagCustomerEmail = QStringLiteral("email");
|
||||
const QString VAbstractPattern::TagCompanyName = QStringLiteral("company");
|
||||
const QString VAbstractPattern::TagPatternLabel = QStringLiteral("patternLabel");
|
||||
const QString VAbstractPattern::TagWatermark = QStringLiteral("watermark");
|
||||
|
@ -138,65 +137,6 @@ const QString VAbstractPattern::AttrPassmarkLength = QStringLiteral("passmark
|
|||
const QString VAbstractPattern::AttrOpacity = QStringLiteral("opacity");
|
||||
const QString VAbstractPattern::AttrTags = QStringLiteral("tags");
|
||||
|
||||
const QString VAbstractPattern::AttrAll = QStringLiteral("all");
|
||||
|
||||
const QString VAbstractPattern::AttrH50 = QStringLiteral("h50");
|
||||
const QString VAbstractPattern::AttrH56 = QStringLiteral("h56");
|
||||
const QString VAbstractPattern::AttrH62 = QStringLiteral("h62");
|
||||
const QString VAbstractPattern::AttrH68 = QStringLiteral("h68");
|
||||
const QString VAbstractPattern::AttrH74 = QStringLiteral("h74");
|
||||
const QString VAbstractPattern::AttrH80 = QStringLiteral("h80");
|
||||
const QString VAbstractPattern::AttrH86 = QStringLiteral("h86");
|
||||
const QString VAbstractPattern::AttrH92 = QStringLiteral("h92");
|
||||
const QString VAbstractPattern::AttrH98 = QStringLiteral("h98");
|
||||
const QString VAbstractPattern::AttrH104 = QStringLiteral("h104");
|
||||
const QString VAbstractPattern::AttrH110 = QStringLiteral("h110");
|
||||
const QString VAbstractPattern::AttrH116 = QStringLiteral("h116");
|
||||
const QString VAbstractPattern::AttrH122 = QStringLiteral("h122");
|
||||
const QString VAbstractPattern::AttrH128 = QStringLiteral("h128");
|
||||
const QString VAbstractPattern::AttrH134 = QStringLiteral("h134");
|
||||
const QString VAbstractPattern::AttrH140 = QStringLiteral("h140");
|
||||
const QString VAbstractPattern::AttrH146 = QStringLiteral("h146");
|
||||
const QString VAbstractPattern::AttrH152 = QStringLiteral("h152");
|
||||
const QString VAbstractPattern::AttrH158 = QStringLiteral("h158");
|
||||
const QString VAbstractPattern::AttrH164 = QStringLiteral("h164");
|
||||
const QString VAbstractPattern::AttrH170 = QStringLiteral("h170");
|
||||
const QString VAbstractPattern::AttrH176 = QStringLiteral("h176");
|
||||
const QString VAbstractPattern::AttrH182 = QStringLiteral("h182");
|
||||
const QString VAbstractPattern::AttrH188 = QStringLiteral("h188");
|
||||
const QString VAbstractPattern::AttrH194 = QStringLiteral("h194");
|
||||
const QString VAbstractPattern::AttrH200 = QStringLiteral("h200");
|
||||
|
||||
const QString VAbstractPattern::AttrS22 = QStringLiteral("s22");
|
||||
const QString VAbstractPattern::AttrS24 = QStringLiteral("s24");
|
||||
const QString VAbstractPattern::AttrS26 = QStringLiteral("s26");
|
||||
const QString VAbstractPattern::AttrS28 = QStringLiteral("s28");
|
||||
const QString VAbstractPattern::AttrS30 = QStringLiteral("s30");
|
||||
const QString VAbstractPattern::AttrS32 = QStringLiteral("s32");
|
||||
const QString VAbstractPattern::AttrS34 = QStringLiteral("s34");
|
||||
const QString VAbstractPattern::AttrS36 = QStringLiteral("s36");
|
||||
const QString VAbstractPattern::AttrS38 = QStringLiteral("s38");
|
||||
const QString VAbstractPattern::AttrS40 = QStringLiteral("s40");
|
||||
const QString VAbstractPattern::AttrS42 = QStringLiteral("s42");
|
||||
const QString VAbstractPattern::AttrS44 = QStringLiteral("s44");
|
||||
const QString VAbstractPattern::AttrS46 = QStringLiteral("s46");
|
||||
const QString VAbstractPattern::AttrS48 = QStringLiteral("s48");
|
||||
const QString VAbstractPattern::AttrS50 = QStringLiteral("s50");
|
||||
const QString VAbstractPattern::AttrS52 = QStringLiteral("s52");
|
||||
const QString VAbstractPattern::AttrS54 = QStringLiteral("s54");
|
||||
const QString VAbstractPattern::AttrS56 = QStringLiteral("s56");
|
||||
const QString VAbstractPattern::AttrS58 = QStringLiteral("s58");
|
||||
const QString VAbstractPattern::AttrS60 = QStringLiteral("s60");
|
||||
const QString VAbstractPattern::AttrS62 = QStringLiteral("s62");
|
||||
const QString VAbstractPattern::AttrS64 = QStringLiteral("s64");
|
||||
const QString VAbstractPattern::AttrS66 = QStringLiteral("s66");
|
||||
const QString VAbstractPattern::AttrS68 = QStringLiteral("s68");
|
||||
const QString VAbstractPattern::AttrS70 = QStringLiteral("s70");
|
||||
const QString VAbstractPattern::AttrS72 = QStringLiteral("s72");
|
||||
|
||||
const QString VAbstractPattern::AttrCustom = QStringLiteral("custom");
|
||||
const QString VAbstractPattern::AttrDefHeight = QStringLiteral("defHeight");
|
||||
const QString VAbstractPattern::AttrDefSize = QStringLiteral("defSize");
|
||||
const QString VAbstractPattern::AttrExtension = QStringLiteral("extension");
|
||||
|
||||
const QString VAbstractPattern::AttrFormula = QStringLiteral("formula");
|
||||
|
@ -953,395 +893,6 @@ QStringList VAbstractPattern::getPatternPieces() const
|
|||
return patternPieces;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMap<GHeights, bool> VAbstractPattern::GetGradationHeights() const
|
||||
{
|
||||
QMap<GHeights, bool> map;
|
||||
|
||||
map.insert(GHeights::ALL, true);
|
||||
map.insert(GHeights::H50, true);
|
||||
map.insert(GHeights::H56, true);
|
||||
map.insert(GHeights::H62, true);
|
||||
map.insert(GHeights::H68, true);
|
||||
map.insert(GHeights::H74, true);
|
||||
map.insert(GHeights::H80, true);
|
||||
map.insert(GHeights::H86, true);
|
||||
map.insert(GHeights::H92, true);
|
||||
map.insert(GHeights::H98, true);
|
||||
map.insert(GHeights::H104, true);
|
||||
map.insert(GHeights::H110, true);
|
||||
map.insert(GHeights::H116, true);
|
||||
map.insert(GHeights::H122, true);
|
||||
map.insert(GHeights::H128, true);
|
||||
map.insert(GHeights::H134, true);
|
||||
map.insert(GHeights::H140, true);
|
||||
map.insert(GHeights::H146, true);
|
||||
map.insert(GHeights::H152, true);
|
||||
map.insert(GHeights::H158, true);
|
||||
map.insert(GHeights::H164, true);
|
||||
map.insert(GHeights::H170, true);
|
||||
map.insert(GHeights::H176, true);
|
||||
map.insert(GHeights::H182, true);
|
||||
map.insert(GHeights::H188, true);
|
||||
map.insert(GHeights::H194, true);
|
||||
map.insert(GHeights::H200, true);
|
||||
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.size() == 0)
|
||||
{
|
||||
return map;
|
||||
}
|
||||
|
||||
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||
QDomNode domNode = tags.at(0).firstChild();
|
||||
while (domNode.isNull() == false)
|
||||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
const QString defValue = trueStr;
|
||||
switch (gTags.indexOf(domElement.tagName()))
|
||||
{
|
||||
case 0: // TagHeights
|
||||
if (GetParametrBool(domElement, AttrAll, defValue))
|
||||
{
|
||||
return map;
|
||||
}
|
||||
else
|
||||
{
|
||||
map.insert(GHeights::ALL, false);
|
||||
}
|
||||
|
||||
map.insert(GHeights::H50, GetParametrBool(domElement, AttrH50, defValue));
|
||||
map.insert(GHeights::H56, GetParametrBool(domElement, AttrH56, defValue));
|
||||
map.insert(GHeights::H62, GetParametrBool(domElement, AttrH62, defValue));
|
||||
map.insert(GHeights::H68, GetParametrBool(domElement, AttrH68, defValue));
|
||||
map.insert(GHeights::H74, GetParametrBool(domElement, AttrH74, defValue));
|
||||
map.insert(GHeights::H80, GetParametrBool(domElement, AttrH80, defValue));
|
||||
map.insert(GHeights::H86, GetParametrBool(domElement, AttrH86, defValue));
|
||||
map.insert(GHeights::H92, GetParametrBool(domElement, AttrH92, defValue));
|
||||
map.insert(GHeights::H98, GetParametrBool(domElement, AttrH98, defValue));
|
||||
map.insert(GHeights::H104, GetParametrBool(domElement, AttrH104, defValue));
|
||||
map.insert(GHeights::H110, GetParametrBool(domElement, AttrH110, defValue));
|
||||
map.insert(GHeights::H116, GetParametrBool(domElement, AttrH116, defValue));
|
||||
map.insert(GHeights::H122, GetParametrBool(domElement, AttrH122, defValue));
|
||||
map.insert(GHeights::H128, GetParametrBool(domElement, AttrH128, defValue));
|
||||
map.insert(GHeights::H134, GetParametrBool(domElement, AttrH134, defValue));
|
||||
map.insert(GHeights::H140, GetParametrBool(domElement, AttrH140, defValue));
|
||||
map.insert(GHeights::H146, GetParametrBool(domElement, AttrH146, defValue));
|
||||
map.insert(GHeights::H152, GetParametrBool(domElement, AttrH152, defValue));
|
||||
map.insert(GHeights::H158, GetParametrBool(domElement, AttrH158, defValue));
|
||||
map.insert(GHeights::H164, GetParametrBool(domElement, AttrH164, defValue));
|
||||
map.insert(GHeights::H170, GetParametrBool(domElement, AttrH170, defValue));
|
||||
map.insert(GHeights::H176, GetParametrBool(domElement, AttrH176, defValue));
|
||||
map.insert(GHeights::H182, GetParametrBool(domElement, AttrH182, defValue));
|
||||
map.insert(GHeights::H188, GetParametrBool(domElement, AttrH188, defValue));
|
||||
map.insert(GHeights::H194, GetParametrBool(domElement, AttrH194, defValue));
|
||||
map.insert(GHeights::H200, GetParametrBool(domElement, AttrH200, defValue));
|
||||
return map;
|
||||
case 1: // TagSizes
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetGradationHeights(const QMap<GHeights, bool> &options)
|
||||
{
|
||||
CheckTagExists(TagGradation);
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.isEmpty())
|
||||
{
|
||||
qDebug()<<"Can't save tag "<<TagGradation<<Q_FUNC_INFO;
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||
QDomNode domNode = tags.at(0).firstChild();
|
||||
while (domNode.isNull() == false)
|
||||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
switch (gTags.indexOf(domElement.tagName()))
|
||||
{
|
||||
case 0: // TagHeights
|
||||
SetAttribute(domElement, AttrAll, options.value(GHeights::ALL));
|
||||
if (options.value(GHeights::ALL))
|
||||
{
|
||||
domElement.removeAttribute(AttrH50);
|
||||
domElement.removeAttribute(AttrH56);
|
||||
domElement.removeAttribute(AttrH62);
|
||||
domElement.removeAttribute(AttrH68);
|
||||
domElement.removeAttribute(AttrH74);
|
||||
domElement.removeAttribute(AttrH80);
|
||||
domElement.removeAttribute(AttrH86);
|
||||
domElement.removeAttribute(AttrH92);
|
||||
domElement.removeAttribute(AttrH98);
|
||||
domElement.removeAttribute(AttrH104);
|
||||
domElement.removeAttribute(AttrH110);
|
||||
domElement.removeAttribute(AttrH116);
|
||||
domElement.removeAttribute(AttrH122);
|
||||
domElement.removeAttribute(AttrH128);
|
||||
domElement.removeAttribute(AttrH134);
|
||||
domElement.removeAttribute(AttrH140);
|
||||
domElement.removeAttribute(AttrH146);
|
||||
domElement.removeAttribute(AttrH152);
|
||||
domElement.removeAttribute(AttrH158);
|
||||
domElement.removeAttribute(AttrH164);
|
||||
domElement.removeAttribute(AttrH170);
|
||||
domElement.removeAttribute(AttrH176);
|
||||
domElement.removeAttribute(AttrH182);
|
||||
domElement.removeAttribute(AttrH188);
|
||||
domElement.removeAttribute(AttrH194);
|
||||
domElement.removeAttribute(AttrH200);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetAttribute(domElement, AttrH50, options.value(GHeights::H50));
|
||||
SetAttribute(domElement, AttrH56, options.value(GHeights::H56));
|
||||
SetAttribute(domElement, AttrH62, options.value(GHeights::H62));
|
||||
SetAttribute(domElement, AttrH68, options.value(GHeights::H68));
|
||||
SetAttribute(domElement, AttrH74, options.value(GHeights::H74));
|
||||
SetAttribute(domElement, AttrH80, options.value(GHeights::H80));
|
||||
SetAttribute(domElement, AttrH86, options.value(GHeights::H86));
|
||||
SetAttribute(domElement, AttrH92, options.value(GHeights::H92));
|
||||
SetAttribute(domElement, AttrH98, options.value(GHeights::H98));
|
||||
SetAttribute(domElement, AttrH104, options.value(GHeights::H104));
|
||||
SetAttribute(domElement, AttrH110, options.value(GHeights::H110));
|
||||
SetAttribute(domElement, AttrH116, options.value(GHeights::H116));
|
||||
SetAttribute(domElement, AttrH122, options.value(GHeights::H122));
|
||||
SetAttribute(domElement, AttrH128, options.value(GHeights::H128));
|
||||
SetAttribute(domElement, AttrH134, options.value(GHeights::H134));
|
||||
SetAttribute(domElement, AttrH140, options.value(GHeights::H140));
|
||||
SetAttribute(domElement, AttrH146, options.value(GHeights::H146));
|
||||
SetAttribute(domElement, AttrH152, options.value(GHeights::H152));
|
||||
SetAttribute(domElement, AttrH158, options.value(GHeights::H158));
|
||||
SetAttribute(domElement, AttrH164, options.value(GHeights::H164));
|
||||
SetAttribute(domElement, AttrH170, options.value(GHeights::H170));
|
||||
SetAttribute(domElement, AttrH176, options.value(GHeights::H176));
|
||||
SetAttribute(domElement, AttrH182, options.value(GHeights::H182));
|
||||
SetAttribute(domElement, AttrH188, options.value(GHeights::H188));
|
||||
SetAttribute(domElement, AttrH194, options.value(GHeights::H194));
|
||||
SetAttribute(domElement, AttrH200, options.value(GHeights::H200));
|
||||
}
|
||||
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
return;
|
||||
case 1: // TagSizes
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMap<GSizes, bool> VAbstractPattern::GetGradationSizes() const
|
||||
{
|
||||
QMap<GSizes, bool> map;
|
||||
map.insert(GSizes::ALL, true);
|
||||
map.insert(GSizes::S22, true);
|
||||
map.insert(GSizes::S24, true);
|
||||
map.insert(GSizes::S26, true);
|
||||
map.insert(GSizes::S28, true);
|
||||
map.insert(GSizes::S30, true);
|
||||
map.insert(GSizes::S32, true);
|
||||
map.insert(GSizes::S34, true);
|
||||
map.insert(GSizes::S36, true);
|
||||
map.insert(GSizes::S38, true);
|
||||
map.insert(GSizes::S40, true);
|
||||
map.insert(GSizes::S42, true);
|
||||
map.insert(GSizes::S44, true);
|
||||
map.insert(GSizes::S46, true);
|
||||
map.insert(GSizes::S48, true);
|
||||
map.insert(GSizes::S50, true);
|
||||
map.insert(GSizes::S52, true);
|
||||
map.insert(GSizes::S54, true);
|
||||
map.insert(GSizes::S56, true);
|
||||
map.insert(GSizes::S58, true);
|
||||
map.insert(GSizes::S60, true);
|
||||
map.insert(GSizes::S62, true);
|
||||
map.insert(GSizes::S64, true);
|
||||
map.insert(GSizes::S66, true);
|
||||
map.insert(GSizes::S68, true);
|
||||
map.insert(GSizes::S70, true);
|
||||
map.insert(GSizes::S72, true);
|
||||
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.size() == 0)
|
||||
{
|
||||
return map;
|
||||
}
|
||||
|
||||
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||
QDomNode domNode = tags.at(0).firstChild();
|
||||
while (domNode.isNull() == false)
|
||||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
const QString defValue = trueStr;
|
||||
switch (gTags.indexOf(domElement.tagName()))
|
||||
{
|
||||
case 1: // TagSizes
|
||||
if (GetParametrBool(domElement, AttrAll, defValue))
|
||||
{
|
||||
return map;
|
||||
}
|
||||
else
|
||||
{
|
||||
map.insert(GSizes::ALL, false);
|
||||
}
|
||||
|
||||
map.insert(GSizes::S22, GetParametrBool(domElement, AttrS22, defValue));
|
||||
map.insert(GSizes::S24, GetParametrBool(domElement, AttrS24, defValue));
|
||||
map.insert(GSizes::S26, GetParametrBool(domElement, AttrS26, defValue));
|
||||
map.insert(GSizes::S28, GetParametrBool(domElement, AttrS28, defValue));
|
||||
map.insert(GSizes::S30, GetParametrBool(domElement, AttrS30, defValue));
|
||||
map.insert(GSizes::S32, GetParametrBool(domElement, AttrS32, defValue));
|
||||
map.insert(GSizes::S34, GetParametrBool(domElement, AttrS34, defValue));
|
||||
map.insert(GSizes::S36, GetParametrBool(domElement, AttrS36, defValue));
|
||||
map.insert(GSizes::S38, GetParametrBool(domElement, AttrS38, defValue));
|
||||
map.insert(GSizes::S40, GetParametrBool(domElement, AttrS40, defValue));
|
||||
map.insert(GSizes::S42, GetParametrBool(domElement, AttrS42, defValue));
|
||||
map.insert(GSizes::S44, GetParametrBool(domElement, AttrS44, defValue));
|
||||
map.insert(GSizes::S46, GetParametrBool(domElement, AttrS46, defValue));
|
||||
map.insert(GSizes::S48, GetParametrBool(domElement, AttrS48, defValue));
|
||||
map.insert(GSizes::S50, GetParametrBool(domElement, AttrS50, defValue));
|
||||
map.insert(GSizes::S52, GetParametrBool(domElement, AttrS52, defValue));
|
||||
map.insert(GSizes::S54, GetParametrBool(domElement, AttrS54, defValue));
|
||||
map.insert(GSizes::S56, GetParametrBool(domElement, AttrS56, defValue));
|
||||
map.insert(GSizes::S58, GetParametrBool(domElement, AttrS58, defValue));
|
||||
map.insert(GSizes::S60, GetParametrBool(domElement, AttrS60, defValue));
|
||||
map.insert(GSizes::S62, GetParametrBool(domElement, AttrS62, defValue));
|
||||
map.insert(GSizes::S64, GetParametrBool(domElement, AttrS64, defValue));
|
||||
map.insert(GSizes::S66, GetParametrBool(domElement, AttrS66, defValue));
|
||||
map.insert(GSizes::S68, GetParametrBool(domElement, AttrS68, defValue));
|
||||
map.insert(GSizes::S70, GetParametrBool(domElement, AttrS70, defValue));
|
||||
map.insert(GSizes::S72, GetParametrBool(domElement, AttrS72, defValue));
|
||||
return map;
|
||||
case 0: // TagHeights
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetGradationSizes(const QMap<GSizes, bool> &options)
|
||||
{
|
||||
CheckTagExists(TagGradation);
|
||||
QDomNodeList tags = elementsByTagName(TagGradation);
|
||||
if (tags.isEmpty())
|
||||
{
|
||||
qDebug()<<"Can't save tag "<<TagGradation<<Q_FUNC_INFO;
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList gTags = QStringList() << TagHeights << TagSizes;
|
||||
QDomNode domNode = tags.at(0).firstChild();
|
||||
while (domNode.isNull() == false)
|
||||
{
|
||||
if (domNode.isElement())
|
||||
{
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
switch (gTags.indexOf(domElement.tagName()))
|
||||
{
|
||||
case 1: // TagSizes
|
||||
SetAttribute(domElement, AttrAll, options.value(GSizes::ALL));
|
||||
if (options.value(GSizes::ALL))
|
||||
{
|
||||
domElement.removeAttribute(AttrS22);
|
||||
domElement.removeAttribute(AttrS24);
|
||||
domElement.removeAttribute(AttrS26);
|
||||
domElement.removeAttribute(AttrS28);
|
||||
domElement.removeAttribute(AttrS30);
|
||||
domElement.removeAttribute(AttrS32);
|
||||
domElement.removeAttribute(AttrS34);
|
||||
domElement.removeAttribute(AttrS36);
|
||||
domElement.removeAttribute(AttrS38);
|
||||
domElement.removeAttribute(AttrS40);
|
||||
domElement.removeAttribute(AttrS42);
|
||||
domElement.removeAttribute(AttrS44);
|
||||
domElement.removeAttribute(AttrS46);
|
||||
domElement.removeAttribute(AttrS48);
|
||||
domElement.removeAttribute(AttrS50);
|
||||
domElement.removeAttribute(AttrS52);
|
||||
domElement.removeAttribute(AttrS54);
|
||||
domElement.removeAttribute(AttrS56);
|
||||
domElement.removeAttribute(AttrS58);
|
||||
domElement.removeAttribute(AttrS60);
|
||||
domElement.removeAttribute(AttrS62);
|
||||
domElement.removeAttribute(AttrS64);
|
||||
domElement.removeAttribute(AttrS66);
|
||||
domElement.removeAttribute(AttrS68);
|
||||
domElement.removeAttribute(AttrS70);
|
||||
domElement.removeAttribute(AttrS72);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetAttribute(domElement, AttrS22, options.value(GSizes::S22));
|
||||
SetAttribute(domElement, AttrS24, options.value(GSizes::S24));
|
||||
SetAttribute(domElement, AttrS26, options.value(GSizes::S26));
|
||||
SetAttribute(domElement, AttrS28, options.value(GSizes::S28));
|
||||
SetAttribute(domElement, AttrS30, options.value(GSizes::S30));
|
||||
SetAttribute(domElement, AttrS32, options.value(GSizes::S32));
|
||||
SetAttribute(domElement, AttrS34, options.value(GSizes::S34));
|
||||
SetAttribute(domElement, AttrS36, options.value(GSizes::S36));
|
||||
SetAttribute(domElement, AttrS38, options.value(GSizes::S38));
|
||||
SetAttribute(domElement, AttrS40, options.value(GSizes::S40));
|
||||
SetAttribute(domElement, AttrS42, options.value(GSizes::S42));
|
||||
SetAttribute(domElement, AttrS44, options.value(GSizes::S44));
|
||||
SetAttribute(domElement, AttrS46, options.value(GSizes::S46));
|
||||
SetAttribute(domElement, AttrS48, options.value(GSizes::S48));
|
||||
SetAttribute(domElement, AttrS50, options.value(GSizes::S50));
|
||||
SetAttribute(domElement, AttrS52, options.value(GSizes::S52));
|
||||
SetAttribute(domElement, AttrS54, options.value(GSizes::S54));
|
||||
SetAttribute(domElement, AttrS56, options.value(GSizes::S56));
|
||||
SetAttribute(domElement, AttrS58, options.value(GSizes::S58));
|
||||
SetAttribute(domElement, AttrS60, options.value(GSizes::S60));
|
||||
SetAttribute(domElement, AttrS62, options.value(GSizes::S62));
|
||||
SetAttribute(domElement, AttrS64, options.value(GSizes::S64));
|
||||
SetAttribute(domElement, AttrS66, options.value(GSizes::S66));
|
||||
SetAttribute(domElement, AttrS68, options.value(GSizes::S68));
|
||||
SetAttribute(domElement, AttrS70, options.value(GSizes::S70));
|
||||
SetAttribute(domElement, AttrS72, options.value(GSizes::S72));
|
||||
}
|
||||
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
return;
|
||||
case 0: // TagHeights
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
domNode = domNode.nextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetDescription() const
|
||||
{
|
||||
|
@ -1451,6 +1002,38 @@ void VAbstractPattern::SetCustomerName(const QString& qsName)
|
|||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDate VAbstractPattern::GetCustomerBirthDate() const
|
||||
{
|
||||
return QDate::fromString(UniqueTagText(TagCustomerBirthDate), "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetCustomerBirthDate(const QDate &date)
|
||||
{
|
||||
CheckTagExists(TagCustomerBirthDate);
|
||||
setTagText(TagCustomerBirthDate, date.toString("yyyy-MM-dd"));
|
||||
patternLabelWasChanged = true;
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetCustomerEmail() const
|
||||
{
|
||||
return UniqueTagText(TagCustomerEmail);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetCustomerEmail(const QString &email)
|
||||
{
|
||||
CheckTagExists(TagCustomerEmail);
|
||||
setTagText(TagCustomerEmail, email);
|
||||
patternLabelWasChanged = true;
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetLabelDateFormat() const
|
||||
{
|
||||
|
@ -1798,15 +1381,16 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
TagImage, // 1
|
||||
TagDescription, // 2
|
||||
TagNotes, // 3
|
||||
TagGradation, // 4
|
||||
TagPatternName, // 5
|
||||
TagPatternNum, // 6
|
||||
TagCompanyName, // 7
|
||||
TagCustomerName, // 8
|
||||
TagPatternLabel, // 9
|
||||
TagWatermark, // 10
|
||||
TagPatternMaterials, // 11
|
||||
TagFinalMeasurements // 12
|
||||
TagPatternName, // 4
|
||||
TagPatternNum, // 5
|
||||
TagCompanyName, // 6
|
||||
TagCustomerName, // 7
|
||||
TagCustomerBirthDate, // 8
|
||||
TagCustomerEmail, // 9
|
||||
TagPatternLabel, // 10
|
||||
TagWatermark, // 11
|
||||
TagPatternMaterials, // 12
|
||||
TagFinalMeasurements // 13
|
||||
};
|
||||
|
||||
switch (tags.indexOf(tag))
|
||||
|
@ -1820,41 +1404,34 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
case 3: //TagNotes
|
||||
element = createElement(TagNotes);
|
||||
break;
|
||||
case 4: //TagGradation
|
||||
{
|
||||
element = createElement(TagGradation);
|
||||
|
||||
QDomElement heights = createElement(TagHeights);
|
||||
heights.setAttribute(AttrAll, trueStr);
|
||||
element.appendChild(heights);
|
||||
|
||||
QDomElement sizes = createElement(TagSizes);
|
||||
sizes.setAttribute(AttrAll, trueStr);
|
||||
element.appendChild(sizes);
|
||||
break;
|
||||
}
|
||||
case 5: // TagPatternName
|
||||
case 4: // TagPatternName
|
||||
element = createElement(TagPatternName);
|
||||
break;
|
||||
case 6: // TagPatternNum
|
||||
case 5: // TagPatternNum
|
||||
element = createElement(TagPatternNum);
|
||||
break;
|
||||
case 7: // TagCompanyName
|
||||
case 6: // TagCompanyName
|
||||
element = createElement(TagCompanyName);
|
||||
break;
|
||||
case 8: // TagCustomerName
|
||||
case 7: // TagCustomerName
|
||||
element = createElement(TagCustomerName);
|
||||
break;
|
||||
case 9: // TagPatternLabel
|
||||
case 8: // TagCustomerBirthDate
|
||||
element = createElement(TagCustomerBirthDate);
|
||||
break;
|
||||
case 9: // TagCustomerEmail
|
||||
element = createElement(TagCustomerEmail);
|
||||
break;
|
||||
case 10: // TagPatternLabel
|
||||
element = createElement(TagPatternLabel);
|
||||
break;
|
||||
case 10: // TagWatermark
|
||||
case 11: // TagWatermark
|
||||
element = createElement(TagWatermark);
|
||||
break;
|
||||
case 11: // TagPatternMaterials
|
||||
case 12: // TagPatternMaterials
|
||||
element = createElement(TagPatternMaterials);
|
||||
break;
|
||||
case 12: // TagFinalMeasurements
|
||||
case 13: // TagFinalMeasurements
|
||||
element = createElement(TagFinalMeasurements);
|
||||
break;
|
||||
case 0: //TagUnit (Mandatory tag)
|
||||
|
|
|
@ -147,12 +147,6 @@ public:
|
|||
|
||||
QStringList getPatternPieces() const;
|
||||
|
||||
QMap<GHeights, bool> GetGradationHeights() const;
|
||||
void SetGradationHeights(const QMap<GHeights, bool> &options);
|
||||
|
||||
QMap<GSizes, bool> GetGradationSizes() const;
|
||||
void SetGradationSizes(const QMap<GSizes, bool> &options);
|
||||
|
||||
QString GetDescription() const;
|
||||
void SetDescription(const QString &text);
|
||||
|
||||
|
@ -171,6 +165,12 @@ public:
|
|||
QString GetCustomerName() const;
|
||||
void SetCustomerName(const QString& qsName);
|
||||
|
||||
QDate GetCustomerBirthDate() const;
|
||||
void SetCustomerBirthDate(const QDate& date);
|
||||
|
||||
QString GetCustomerEmail() const;
|
||||
void SetCustomerEmail(const QString& email);
|
||||
|
||||
QString GetLabelDateFormat() const;
|
||||
void SetLabelDateFormat(const QString &format);
|
||||
|
||||
|
@ -252,15 +252,14 @@ public:
|
|||
static const QString TagElArc;
|
||||
static const QString TagTools;
|
||||
static const QString TagOperation;
|
||||
static const QString TagGradation;
|
||||
static const QString TagHeights;
|
||||
static const QString TagSizes;
|
||||
static const QString TagData;
|
||||
static const QString TagPatternInfo;
|
||||
static const QString TagPatternName;
|
||||
static const QString TagPatternNum;
|
||||
static const QString TagCompanyName;
|
||||
static const QString TagCustomerName;
|
||||
static const QString TagCustomerBirthDate;
|
||||
static const QString TagCustomerEmail;
|
||||
static const QString TagPatternLabel;
|
||||
static const QString TagWatermark;
|
||||
static const QString TagPatternMaterials;
|
||||
|
@ -308,65 +307,6 @@ public:
|
|||
static const QString AttrOpacity;
|
||||
static const QString AttrTags;
|
||||
|
||||
static const QString AttrAll;
|
||||
|
||||
static const QString AttrH50;
|
||||
static const QString AttrH56;
|
||||
static const QString AttrH62;
|
||||
static const QString AttrH68;
|
||||
static const QString AttrH74;
|
||||
static const QString AttrH80;
|
||||
static const QString AttrH86;
|
||||
static const QString AttrH92;
|
||||
static const QString AttrH98;
|
||||
static const QString AttrH104;
|
||||
static const QString AttrH110;
|
||||
static const QString AttrH116;
|
||||
static const QString AttrH122;
|
||||
static const QString AttrH128;
|
||||
static const QString AttrH134;
|
||||
static const QString AttrH140;
|
||||
static const QString AttrH146;
|
||||
static const QString AttrH152;
|
||||
static const QString AttrH158;
|
||||
static const QString AttrH164;
|
||||
static const QString AttrH170;
|
||||
static const QString AttrH176;
|
||||
static const QString AttrH182;
|
||||
static const QString AttrH188;
|
||||
static const QString AttrH194;
|
||||
static const QString AttrH200;
|
||||
|
||||
static const QString AttrS22;
|
||||
static const QString AttrS24;
|
||||
static const QString AttrS26;
|
||||
static const QString AttrS28;
|
||||
static const QString AttrS30;
|
||||
static const QString AttrS32;
|
||||
static const QString AttrS34;
|
||||
static const QString AttrS36;
|
||||
static const QString AttrS38;
|
||||
static const QString AttrS40;
|
||||
static const QString AttrS42;
|
||||
static const QString AttrS44;
|
||||
static const QString AttrS46;
|
||||
static const QString AttrS48;
|
||||
static const QString AttrS50;
|
||||
static const QString AttrS52;
|
||||
static const QString AttrS54;
|
||||
static const QString AttrS56;
|
||||
static const QString AttrS58;
|
||||
static const QString AttrS60;
|
||||
static const QString AttrS62;
|
||||
static const QString AttrS64;
|
||||
static const QString AttrS66;
|
||||
static const QString AttrS68;
|
||||
static const QString AttrS70;
|
||||
static const QString AttrS72;
|
||||
|
||||
static const QString AttrCustom;
|
||||
static const QString AttrDefHeight;
|
||||
static const QString AttrDefSize;
|
||||
static const QString AttrExtension;
|
||||
|
||||
static const QString AttrFormula;
|
||||
|
|
|
@ -59,8 +59,8 @@ class QDomElement;
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.7");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.7.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.8");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.8.xsd");
|
||||
|
||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
|
@ -237,7 +237,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
std::make_pair(FORMAT_VERSION(0, 8, 4), QStringLiteral("://schema/pattern/v0.8.4.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 5), QStringLiteral("://schema/pattern/v0.8.5.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 6), QStringLiteral("://schema/pattern/v0.8.6.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 7), CurrentSchema)
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 7), QStringLiteral("://schema/pattern/v0.8.7.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 8), CurrentSchema)
|
||||
};
|
||||
|
||||
if (schemas.contains(ver))
|
||||
|
@ -486,6 +487,10 @@ void VPatternConverter::ApplyPatches()
|
|||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 7)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 7)):
|
||||
ToV0_8_8();
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 8)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 8)):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -503,7 +508,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
|||
bool VPatternConverter::IsReadOnly() const
|
||||
{
|
||||
// Check if attribute readOnly was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 7),
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 8),
|
||||
"Check attribute readOnly.");
|
||||
|
||||
// Possibly in future attribute readOnly will change position etc.
|
||||
|
@ -1143,6 +1148,17 @@ void VPatternConverter::ToV0_8_7()
|
|||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_8_8()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.8.8
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 8),
|
||||
"Time to refactor the code.");
|
||||
SetVersion(QStringLiteral("0.8.8"));
|
||||
RemoveGradationV0_8_8();
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
|
@ -2662,6 +2678,20 @@ void VPatternConverter::AddTagPreviewCalculationsV0_6_2()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::RemoveGradationV0_8_8()
|
||||
{
|
||||
QDomElement patternElement = documentElement();
|
||||
if (patternElement.isElement())
|
||||
{
|
||||
QDomElement gradationTag = patternElement.firstChildElement(*strGradation);
|
||||
if (gradationTag.isElement())
|
||||
{
|
||||
patternElement.removeChild(gradationTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnionDetailsToV0_4_0()
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
static const QString PatternMaxVerStr;
|
||||
static const QString CurrentSchema;
|
||||
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 7);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 8);
|
||||
|
||||
protected:
|
||||
virtual int MinVer() const override;
|
||||
|
@ -130,6 +130,7 @@ private:
|
|||
void ToV0_8_5();
|
||||
void ToV0_8_6();
|
||||
void ToV0_8_7();
|
||||
void ToV0_8_8();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
@ -182,6 +183,8 @@ private:
|
|||
void RemoveUniqueTagV0_6_0(const QString &tag);
|
||||
|
||||
void AddTagPreviewCalculationsV0_6_2();
|
||||
|
||||
void RemoveGradationV0_8_8();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
*/
|
||||
|
||||
const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0");
|
||||
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.5.0");
|
||||
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.5.0.xsd");
|
||||
const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.5.1");
|
||||
const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.5.1.xsd");
|
||||
|
||||
//VVITConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
//VVITConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
|
@ -89,7 +89,8 @@ QString VVITConverter::XSDSchema(int ver) const
|
|||
std::make_pair(FORMAT_VERSION(0, 3, 2), QStringLiteral("://schema/individual_measurements/v0.3.2.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 3, 3), QStringLiteral("://schema/individual_measurements/v0.3.3.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 4, 0), QStringLiteral("://schema/individual_measurements/v0.4.0.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 5, 0), CurrentSchema),
|
||||
std::make_pair(FORMAT_VERSION(0, 5, 0), QStringLiteral("://schema/individual_measurements/v0.5.0.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 5, 1), CurrentSchema),
|
||||
};
|
||||
|
||||
if (schemas.contains(ver))
|
||||
|
@ -132,6 +133,10 @@ void VVITConverter::ApplyPatches()
|
|||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 5, 0)):
|
||||
ToV0_5_1();
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 1)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 5, 1)):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -150,7 +155,7 @@ void VVITConverter::DowngradeToCurrentMaxVersion()
|
|||
bool VVITConverter::IsReadOnly() const
|
||||
{
|
||||
// Check if attribute read-only was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMaxVer == FORMAT_VERSION(0, 5, 0),
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMaxVer == FORMAT_VERSION(0, 5, 1),
|
||||
"Check attribute read-only.");
|
||||
|
||||
// Possibly in future attribute read-only will change position etc.
|
||||
|
@ -428,3 +433,14 @@ void VVITConverter::ToV0_5_0()
|
|||
SetVersion(QStringLiteral("0.5.0"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VVITConverter::ToV0_5_1()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.1
|
||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FORMAT_VERSION(0, 5, 1),
|
||||
"Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.5.1"));
|
||||
Save();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
static const QString MeasurementMaxVerStr;
|
||||
static const QString CurrentSchema;
|
||||
static Q_DECL_CONSTEXPR const int MeasurementMinVer = FORMAT_VERSION(0, 2, 0);
|
||||
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = FORMAT_VERSION(0, 5, 0);
|
||||
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = FORMAT_VERSION(0, 5, 1);
|
||||
|
||||
protected:
|
||||
virtual int MinVer() const override;
|
||||
|
@ -82,6 +82,7 @@ private:
|
|||
void ToV0_3_3();
|
||||
void ToV0_4_0();
|
||||
void ToV0_5_0();
|
||||
void ToV0_5_1();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
*/
|
||||
|
||||
const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
|
||||
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.4");
|
||||
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.4.xsd");
|
||||
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.5.0");
|
||||
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/multisize_measurements/v0.5.0.xsd");
|
||||
|
||||
//VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
//VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
|
@ -75,25 +75,25 @@ VVSTConverter::VVSTConverter(const QString &fileName)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VVSTConverter::XSDSchema(int ver) const
|
||||
{
|
||||
switch (ver)
|
||||
QHash <int, QString> schemas =
|
||||
{
|
||||
case (0x000300):
|
||||
return QStringLiteral("://schema/standard_measurements/v0.3.0.xsd");
|
||||
case (0x000400):
|
||||
return QStringLiteral("://schema/standard_measurements/v0.4.0.xsd");
|
||||
case (0x000401):
|
||||
return QStringLiteral("://schema/standard_measurements/v0.4.1.xsd");
|
||||
case (0x000402):
|
||||
return QStringLiteral("://schema/standard_measurements/v0.4.2.xsd");
|
||||
case (0x000403):
|
||||
return QStringLiteral("://schema/standard_measurements/v0.4.3.xsd");
|
||||
case (0x000404):
|
||||
return CurrentSchema;
|
||||
default:
|
||||
InvalidVersion(ver);
|
||||
break;
|
||||
std::make_pair(FORMAT_VERSION(0, 3, 0), QStringLiteral("://schema/multisize_measurements/v0.3.0.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 4, 0), QStringLiteral("://schema/multisize_measurements/v0.4.0.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 4, 1), QStringLiteral("://schema/multisize_measurements/v0.4.1.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 4, 2), QStringLiteral("://schema/multisize_measurements/v0.4.2.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 4, 3), QStringLiteral("://schema/multisize_measurements/v0.4.3.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 4, 4), QStringLiteral("://schema/multisize_measurements/v0.4.4.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 5, 0), CurrentSchema),
|
||||
};
|
||||
|
||||
if (schemas.contains(ver))
|
||||
{
|
||||
return schemas.value(ver);
|
||||
}
|
||||
else
|
||||
{
|
||||
InvalidVersion(ver);
|
||||
}
|
||||
return QString();//unreachable code
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -101,27 +101,31 @@ void VVSTConverter::ApplyPatches()
|
|||
{
|
||||
switch (m_ver)
|
||||
{
|
||||
case (0x000300):
|
||||
case (FORMAT_VERSION(0, 3, 0)):
|
||||
ToV0_4_0();
|
||||
ValidateXML(XSDSchema(0x000400));
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 0)));
|
||||
Q_FALLTHROUGH();
|
||||
case (0x000400):
|
||||
case (FORMAT_VERSION(0, 4, 0)):
|
||||
ToV0_4_1();
|
||||
ValidateXML(XSDSchema(0x000401));
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 1)));
|
||||
Q_FALLTHROUGH();
|
||||
case (0x000401):
|
||||
case (FORMAT_VERSION(0, 4, 1)):
|
||||
ToV0_4_2();
|
||||
ValidateXML(XSDSchema(0x000402));
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 2)));
|
||||
Q_FALLTHROUGH();
|
||||
case (0x000402):
|
||||
case (FORMAT_VERSION(0, 4, 2)):
|
||||
ToV0_4_3();
|
||||
ValidateXML(XSDSchema(0x000403));
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 3)));
|
||||
Q_FALLTHROUGH();
|
||||
case (0x000403):
|
||||
case (FORMAT_VERSION(0, 4, 3)):
|
||||
ToV0_4_4();
|
||||
ValidateXML(XSDSchema(0x000404));
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 4)));
|
||||
Q_FALLTHROUGH();
|
||||
case (0x000404):
|
||||
case (FORMAT_VERSION(0, 4, 4)):
|
||||
ToV0_5_0();
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 5, 0)):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -140,7 +144,7 @@ void VVSTConverter::DowngradeToCurrentMaxVersion()
|
|||
bool VVSTConverter::IsReadOnly() const
|
||||
{
|
||||
// Check if attribute read-only was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FORMAT_VERSION(0, 4, 4),
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == FORMAT_VERSION(0, 5, 0),
|
||||
"Check attribute read-only.");
|
||||
|
||||
// Possibly in future attribute read-only will change position etc.
|
||||
|
@ -308,6 +312,112 @@ void VVSTConverter::ConvertMeasurementsToV0_4_2()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VVSTConverter::AddNewTagsForV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FORMAT_VERSION(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
|
||||
QDomElement root = documentElement();
|
||||
const QDomElement pmSystemTag = root.firstChildElement(QStringLiteral("pm_system"));
|
||||
if (pmSystemTag.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QDomElement dimensionsTag = createElement(QStringLiteral("dimensions"));
|
||||
|
||||
auto Base = [this](const QString &base)
|
||||
{
|
||||
const QDomElement root = documentElement();
|
||||
const QDomElement baseTag = root.firstChildElement(base);
|
||||
if (baseTag.isNull())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return GetParametrInt(baseTag, QStringLiteral("base"), QChar('0'));
|
||||
};
|
||||
|
||||
const Unit units = MUnit();
|
||||
|
||||
{
|
||||
const int step = static_cast<int>(UnitConvertor(6, Unit::Cm, units));
|
||||
const int min = static_cast<int>(UnitConvertor(50, Unit::Cm, units));
|
||||
const int max = static_cast<int>(UnitConvertor(200, Unit::Cm, units));
|
||||
|
||||
QDomElement dimensionX = createElement(QStringLiteral("dimension"));
|
||||
SetAttribute(dimensionX, QStringLiteral("type"), QChar('x'));
|
||||
SetAttribute(dimensionX, QStringLiteral("step"), step);
|
||||
SetAttribute(dimensionX, QStringLiteral("min"), min);
|
||||
SetAttribute(dimensionX, QStringLiteral("max"), max);
|
||||
SetAttribute(dimensionX, QStringLiteral("base"), Base(QStringLiteral("height")));
|
||||
dimensionsTag.appendChild(dimensionX);
|
||||
}
|
||||
|
||||
{
|
||||
const int step = static_cast<int>(UnitConvertor(2, Unit::Cm, units));
|
||||
const int min = static_cast<int>(UnitConvertor(22, Unit::Cm, units));
|
||||
const int max = static_cast<int>(UnitConvertor(72, Unit::Cm, units));
|
||||
|
||||
QDomElement dimensionY = createElement(QStringLiteral("dimension"));
|
||||
SetAttribute(dimensionY, QStringLiteral("type"), QChar('y'));
|
||||
SetAttribute(dimensionY, QStringLiteral("step"), step);
|
||||
SetAttribute(dimensionY, QStringLiteral("min"), min);
|
||||
SetAttribute(dimensionY, QStringLiteral("max"), max);
|
||||
SetAttribute(dimensionY, QStringLiteral("base"), Base(QStringLiteral("size")));
|
||||
SetAttribute(dimensionY, QStringLiteral("circumference"), true);
|
||||
dimensionsTag.appendChild(dimensionY);
|
||||
}
|
||||
|
||||
root.insertAfter(dimensionsTag, pmSystemTag);
|
||||
|
||||
root.insertAfter(createElement(QStringLiteral("restrictions")), dimensionsTag);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VVSTConverter::RemoveTagsForV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FORMAT_VERSION(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
|
||||
QDomElement root = documentElement();
|
||||
|
||||
const QDomElement sizeTag = root.firstChildElement(QStringLiteral("size"));
|
||||
if (not sizeTag.isNull())
|
||||
{
|
||||
root.removeChild(sizeTag);
|
||||
}
|
||||
|
||||
const QDomElement heightTag = root.firstChildElement(QStringLiteral("height"));
|
||||
if (not heightTag.isNull())
|
||||
{
|
||||
root.removeChild(heightTag);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VVSTConverter::ConvertMeasurementsToV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FORMAT_VERSION(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
|
||||
const QDomNodeList measurements = elementsByTagName(QStringLiteral("m"));
|
||||
for (int i = 0; i < measurements.size(); ++i)
|
||||
{
|
||||
QDomElement m = measurements.at(i).toElement();
|
||||
|
||||
SetAttribute(m, QStringLiteral("shiftA"), GetParametrString(m, QStringLiteral("height_increase")));
|
||||
m.removeAttribute(QStringLiteral("height_increase"));
|
||||
|
||||
SetAttribute(m, QStringLiteral("shiftB"), GetParametrString(m, QStringLiteral("size_increase")));
|
||||
m.removeAttribute(QStringLiteral("size_increase"));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VVSTConverter::ToV0_4_0()
|
||||
{
|
||||
|
@ -368,3 +478,17 @@ void VVSTConverter::ToV0_4_4()
|
|||
SetVersion(QStringLiteral("0.4.4"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VVSTConverter::ToV0_5_0()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.5.0
|
||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FORMAT_VERSION(0, 5, 0),
|
||||
"Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.5.0"));
|
||||
AddNewTagsForV0_5_0();
|
||||
RemoveTagsForV0_5_0();
|
||||
ConvertMeasurementsToV0_5_0();
|
||||
Save();
|
||||
}
|
||||
|
|
|
@ -51,10 +51,10 @@ public:
|
|||
// GCC 4.6 doesn't allow constexpr and const together
|
||||
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
|
||||
static Q_DECL_CONSTEXPR int MeasurementMinVer = FORMAT_VERSION(0, 3, 0);
|
||||
static Q_DECL_CONSTEXPR int MeasurementMaxVer = FORMAT_VERSION(0, 4, 4);
|
||||
static Q_DECL_CONSTEXPR int MeasurementMaxVer = FORMAT_VERSION(0, 5, 0);
|
||||
#else
|
||||
static Q_DECL_CONSTEXPR const int MeasurementMinVer = FORMAT_VERSION(0, 3, 0);
|
||||
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = FORMAT_VERSION(0, 4, 4);
|
||||
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = FORMAT_VERSION(0, 5, 0);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -80,11 +80,16 @@ private:
|
|||
void PM_SystemV0_4_1();
|
||||
void ConvertMeasurementsToV0_4_2();
|
||||
|
||||
void AddNewTagsForV0_5_0();
|
||||
void RemoveTagsForV0_5_0();
|
||||
void ConvertMeasurementsToV0_5_0();
|
||||
|
||||
void ToV0_4_0();
|
||||
void ToV0_4_1();
|
||||
void ToV0_4_2();
|
||||
void ToV0_4_3();
|
||||
void ToV0_4_4();
|
||||
void ToV0_5_0();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
#include <algorithm>
|
||||
#include <QString>
|
||||
#include <QTextCodec>
|
||||
#include <QDebug>
|
||||
#include "../drw_base.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
|
||||
namespace
|
||||
|
@ -112,7 +113,7 @@ void DRW_TextCodec::setCodePage(const std::string *c, bool dxfFormat){
|
|||
const QString errorMsg = QCoreApplication::translate("DRW_TextCodec", "No available codec for code page '%1'.")
|
||||
.arg(cp.c_str());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
|
||||
if (version < DRW::AC1021 && cp == "UTF-8")
|
||||
{
|
||||
|
|
415
src/libs/vformat/vdimensions.cpp
Normal file
415
src/libs/vformat/vdimensions.cpp
Normal file
|
@ -0,0 +1,415 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vdimensions.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 9, 2020
|
||||
**
|
||||
** @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) 2020 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 "vdimensions.h"
|
||||
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstartMeasurementDimension::VAbstartMeasurementDimension(Unit units)
|
||||
: m_units(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstartMeasurementDimension::VAbstartMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: m_units(units),
|
||||
m_minValue(min),
|
||||
m_maxValue(max),
|
||||
m_step(step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsValid()
|
||||
{
|
||||
m_error.clear();
|
||||
return IsUnitsValid() && IsRangeValid() && IsStepValid() && IsBaseValid();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<int> VAbstartMeasurementDimension::ValidSteps() const
|
||||
{
|
||||
QVector<int> steps;
|
||||
|
||||
const int diff = m_maxValue - m_minValue;
|
||||
if (diff == 0)
|
||||
{
|
||||
steps.append(0); // only one possible value
|
||||
}
|
||||
else if (diff > 0)
|
||||
{
|
||||
for (int i=1; i < 9; ++i)
|
||||
{
|
||||
const int step = (m_units == Unit::Mm ? i * 10 : i);
|
||||
if (diff % step == 0)
|
||||
{
|
||||
steps.append(step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return steps;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<int> VAbstartMeasurementDimension::ValidBases() const
|
||||
{
|
||||
return VAbstartMeasurementDimension::ValidBases(m_minValue, m_maxValue, m_step);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList VAbstartMeasurementDimension::ValidBasesList() const
|
||||
{
|
||||
QVector<int> bases = ValidBases();
|
||||
QStringList list;
|
||||
for(auto &base : bases)
|
||||
{
|
||||
list.append(QString::number(base));
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<int> VAbstartMeasurementDimension::ValidBases(int min, int max, int step)
|
||||
{
|
||||
QVector<int> validBases;
|
||||
|
||||
if (step < 0)
|
||||
{
|
||||
return validBases;
|
||||
}
|
||||
else if (step == 0)
|
||||
{
|
||||
step = 1;
|
||||
}
|
||||
|
||||
for (int value = min; value <= max; value += step)
|
||||
{
|
||||
validBases.append(value);
|
||||
}
|
||||
|
||||
return validBases;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsRangeValid()
|
||||
{
|
||||
bool valid = m_minValue > 0 && m_maxValue > 0 && m_minValue >= RangeMin() && m_minValue <= RangeMax()
|
||||
&& m_minValue <= m_maxValue;
|
||||
|
||||
if (not valid)
|
||||
{
|
||||
m_error = tr("Invalid min/max range");
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsStepValid()
|
||||
{
|
||||
bool valid = ValidSteps().indexOf(m_step) != -1;
|
||||
if (not valid)
|
||||
{
|
||||
m_error = tr("Invalid step");
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsBaseValid()
|
||||
{
|
||||
bool valid = ValidBases().indexOf(m_baseValue) != -1;
|
||||
if (not valid)
|
||||
{
|
||||
m_error = tr("Base value invalid");
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsUnitsValid()
|
||||
{
|
||||
return m_units == Unit::Cm || m_units == Unit::Mm || m_units == Unit::Inch;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstartMeasurementDimension::DimensionName(MeasurementDimension type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case MeasurementDimension::X:
|
||||
return tr("Height");
|
||||
case MeasurementDimension::Y:
|
||||
return tr("Size");
|
||||
case MeasurementDimension::W:
|
||||
return tr("Hip");
|
||||
case MeasurementDimension::Z:
|
||||
return tr("Waist");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstartMeasurementDimension::DimensionToolTip(MeasurementDimension type, bool circumference, bool fc)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case MeasurementDimension::X:
|
||||
return tr("Height");
|
||||
case MeasurementDimension::Y:
|
||||
if (circumference)
|
||||
{
|
||||
return fc ? tr("Chest full circumference") : tr("Chest half circumference");
|
||||
}
|
||||
else
|
||||
{
|
||||
return tr("Size");
|
||||
}
|
||||
return circumference ? tr("Chest circumference") : tr("Size");
|
||||
case MeasurementDimension::W:
|
||||
return fc ? tr("Hip full circumference") : tr("Hip half circumference");
|
||||
case MeasurementDimension::Z:
|
||||
return fc ? tr("Waist full circumference") : tr("Waist half circumference");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
// VXMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VXMeasurementDimension::VXMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VXMeasurementDimension::VXMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VXMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::X;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VXMeasurementDimension::RangeMin() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 50;
|
||||
case Unit::Mm:
|
||||
return 500;
|
||||
case Unit::Inch:
|
||||
return 19;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VXMeasurementDimension::RangeMax() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 272;
|
||||
case Unit::Mm:
|
||||
return 2720;
|
||||
case Unit::Inch:
|
||||
return 107;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// VYMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VYMeasurementDimension::VYMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VYMeasurementDimension::VYMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VYMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::Y;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VYMeasurementDimension::RangeMin() const
|
||||
{
|
||||
if (m_circumference)
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 22;
|
||||
case Unit::Mm:
|
||||
return 220;
|
||||
case Unit::Inch:
|
||||
return 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VYMeasurementDimension::RangeMax() const
|
||||
{
|
||||
if (m_circumference)
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 72;
|
||||
case Unit::Mm:
|
||||
return 720;
|
||||
case Unit::Inch:
|
||||
return 29;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 58;
|
||||
}
|
||||
}
|
||||
|
||||
// VWMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VWMeasurementDimension::VWMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VWMeasurementDimension::VWMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VWMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::W;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VWMeasurementDimension::RangeMin() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 33;
|
||||
case Unit::Mm:
|
||||
return 330;
|
||||
case Unit::Inch:
|
||||
return 12;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VWMeasurementDimension::RangeMax() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 63;
|
||||
case Unit::Mm:
|
||||
return 630;
|
||||
case Unit::Inch:
|
||||
return 25;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// VZMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VZMeasurementDimension::VZMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VZMeasurementDimension::VZMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VZMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::Z;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VZMeasurementDimension::RangeMin() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 33;
|
||||
case Unit::Mm:
|
||||
return 330;
|
||||
case Unit::Inch:
|
||||
return 12;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VZMeasurementDimension::RangeMax() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 63;
|
||||
case Unit::Mm:
|
||||
return 630;
|
||||
case Unit::Inch:
|
||||
return 25;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
274
src/libs/vformat/vdimensions.h
Normal file
274
src/libs/vformat/vdimensions.h
Normal file
|
@ -0,0 +1,274 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vdimensions.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 9, 2020
|
||||
**
|
||||
** @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) 2020 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 VDIMENSIONS_H
|
||||
#define VDIMENSIONS_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QMap>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
enum class MeasurementDimension: qint8
|
||||
{
|
||||
X = 0, // height
|
||||
Y = 1, // size (chest half circumference)
|
||||
W = 2, // hip half circumference
|
||||
Z = 3 // waist half circumference
|
||||
};
|
||||
|
||||
class VAbstartMeasurementDimension;
|
||||
template <class T> class QSharedPointer;
|
||||
|
||||
using MeasurementDimension_p = QSharedPointer<VAbstartMeasurementDimension>;
|
||||
using DimesionLabels = QMap<int, QString>;
|
||||
|
||||
class VAbstartMeasurementDimension
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VAbstartMeasurementDimension)
|
||||
public:
|
||||
VAbstartMeasurementDimension() =default;
|
||||
explicit VAbstartMeasurementDimension(Unit units);
|
||||
VAbstartMeasurementDimension(Unit units, int min, int max, int step);
|
||||
virtual ~VAbstartMeasurementDimension() =default;
|
||||
|
||||
virtual MeasurementDimension Type() const =0;
|
||||
|
||||
virtual bool IsValid();
|
||||
|
||||
int MinValue() const;
|
||||
void SetMinValue(int minValue);
|
||||
|
||||
int MaxValue() const;
|
||||
void SetMaxValue(int maxValue);
|
||||
|
||||
int Step() const;
|
||||
void SetStep(int step);
|
||||
|
||||
int BaseValue() const;
|
||||
void SetBaseValue(int baseValue);
|
||||
|
||||
QString Error() const;
|
||||
|
||||
Unit Units() const;
|
||||
|
||||
virtual bool IsCircumference() const;
|
||||
|
||||
virtual int RangeMin() const =0;
|
||||
virtual int RangeMax() const =0;
|
||||
|
||||
QVector<int> ValidSteps() const;
|
||||
QVector<int> ValidBases() const;
|
||||
QStringList ValidBasesList() const;
|
||||
|
||||
static QVector<int> ValidBases(int min, int max, int step);
|
||||
static QString DimensionName(MeasurementDimension type);
|
||||
static QString DimensionToolTip(MeasurementDimension type, bool circumference, bool fc);
|
||||
|
||||
DimesionLabels Labels() const;
|
||||
void SetLabels(const DimesionLabels &labels);
|
||||
|
||||
protected:
|
||||
Unit m_units{Unit::Cm};
|
||||
int m_minValue{0};
|
||||
int m_maxValue{0};
|
||||
int m_step{-1};
|
||||
int m_baseValue{0};
|
||||
QString m_error{};
|
||||
DimesionLabels m_labels{};
|
||||
|
||||
bool IsRangeValid();
|
||||
bool IsStepValid();
|
||||
bool IsBaseValid();
|
||||
bool IsUnitsValid();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::MinValue() const
|
||||
{
|
||||
return m_minValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetMinValue(int minValue)
|
||||
{
|
||||
m_minValue = minValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::MaxValue() const
|
||||
{
|
||||
return m_maxValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetMaxValue(int maxValue)
|
||||
{
|
||||
m_maxValue = maxValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::Step() const
|
||||
{
|
||||
return m_step;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetStep(int step)
|
||||
{
|
||||
m_step = step;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::BaseValue() const
|
||||
{
|
||||
return m_baseValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetBaseValue(int baseValue)
|
||||
{
|
||||
m_baseValue = baseValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstartMeasurementDimension::Error() const
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline Unit VAbstartMeasurementDimension::Units() const
|
||||
{
|
||||
return m_units;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool VAbstartMeasurementDimension::IsCircumference() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline DimesionLabels VAbstartMeasurementDimension::Labels() const
|
||||
{
|
||||
return m_labels;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetLabels(const DimesionLabels &labels)
|
||||
{
|
||||
m_labels = labels;
|
||||
}
|
||||
|
||||
// VXMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VXMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VXMeasurementDimension() =default;
|
||||
explicit VXMeasurementDimension(Unit units);
|
||||
VXMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
|
||||
virtual bool IsCircumference() const override;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool VXMeasurementDimension::IsCircumference() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// VYMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VYMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VYMeasurementDimension() =default;
|
||||
explicit VYMeasurementDimension(Unit units);
|
||||
VYMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
|
||||
virtual bool IsCircumference() const override;
|
||||
void SetCircumference(bool circumference);
|
||||
|
||||
private:
|
||||
bool m_circumference{true};
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool VYMeasurementDimension::IsCircumference() const
|
||||
{
|
||||
return m_circumference;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VYMeasurementDimension::SetCircumference(bool circumference)
|
||||
{
|
||||
m_circumference = circumference;
|
||||
}
|
||||
|
||||
// VWMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VWMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VWMeasurementDimension() =default;
|
||||
explicit VWMeasurementDimension(Unit units);
|
||||
VWMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
};
|
||||
|
||||
// VZMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VZMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VZMeasurementDimension() =default;
|
||||
explicit VZMeasurementDimension(Unit units);
|
||||
VZMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
};
|
||||
|
||||
#endif // VDIMENSIONS_H
|
|
@ -2,6 +2,7 @@
|
|||
# This need for corect working file translations.pro
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vdimensions.cpp \
|
||||
$$PWD/vmeasurements.cpp \
|
||||
$$PWD/vlabeltemplate.cpp \
|
||||
$$PWD/vpatternrecipe.cpp \
|
||||
|
@ -10,6 +11,7 @@ SOURCES += \
|
|||
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/vdimensions.h \
|
||||
$$PWD/vmeasurements.h \
|
||||
$$PWD/stable.h \
|
||||
$$PWD/vlabeltemplate.h \
|
||||
|
|
|
@ -60,8 +60,6 @@ const QString VMeasurements::TagVST = QStringLiteral("vst");
|
|||
const QString VMeasurements::TagVIT = QStringLiteral("vit");
|
||||
const QString VMeasurements::TagBodyMeasurements = QStringLiteral("body-measurements");
|
||||
const QString VMeasurements::TagNotes = QStringLiteral("notes");
|
||||
const QString VMeasurements::TagSize = QStringLiteral("size");
|
||||
const QString VMeasurements::TagHeight = QStringLiteral("height");
|
||||
const QString VMeasurements::TagPersonal = QStringLiteral("personal");
|
||||
const QString VMeasurements::TagCustomer = QStringLiteral("customer");
|
||||
const QString VMeasurements::TagBirthDate = QStringLiteral("birth-date");
|
||||
|
@ -70,22 +68,50 @@ const QString VMeasurements::TagPMSystem = QStringLiteral("pm_system");
|
|||
const QString VMeasurements::TagEmail = QStringLiteral("email");
|
||||
const QString VMeasurements::TagReadOnly = QStringLiteral("read-only");
|
||||
const QString VMeasurements::TagMeasurement = QStringLiteral("m");
|
||||
const QString VMeasurements::TagDimensions = QStringLiteral("dimensions");
|
||||
const QString VMeasurements::TagDimension = QStringLiteral("dimension");
|
||||
const QString VMeasurements::TagRestrictions = QStringLiteral("restrictions");
|
||||
const QString VMeasurements::TagRestriction = QStringLiteral("restriction");
|
||||
const QString VMeasurements::TagCorrections = QStringLiteral("corrections");
|
||||
const QString VMeasurements::TagCorrection = QStringLiteral("correction");
|
||||
const QString VMeasurements::TagLabels = QStringLiteral("labels");
|
||||
const QString VMeasurements::TagLabel = QStringLiteral("label");
|
||||
|
||||
const QString VMeasurements::AttrBase = QStringLiteral("base");
|
||||
const QString VMeasurements::AttrValue = QStringLiteral("value");
|
||||
const QString VMeasurements::AttrSizeIncrease = QStringLiteral("size_increase");
|
||||
const QString VMeasurements::AttrHeightIncrease = QStringLiteral("height_increase");
|
||||
const QString VMeasurements::AttrDescription = QStringLiteral("description");
|
||||
const QString VMeasurements::AttrName = QStringLiteral("name");
|
||||
const QString VMeasurements::AttrFullName = QStringLiteral("full_name");
|
||||
const QString VMeasurements::AttrBase = QStringLiteral("base");
|
||||
const QString VMeasurements::AttrValue = QStringLiteral("value");
|
||||
const QString VMeasurements::AttrShiftA = QStringLiteral("shiftA");
|
||||
const QString VMeasurements::AttrShiftB = QStringLiteral("shiftB");
|
||||
const QString VMeasurements::AttrShiftC = QStringLiteral("shiftC");
|
||||
const QString VMeasurements::AttrCorrection = QStringLiteral("correction");
|
||||
const QString VMeasurements::AttrCoordinates = QStringLiteral("coordinates");
|
||||
const QString VMeasurements::AttrSpecialUnits = QStringLiteral("specialUnits");
|
||||
const QString VMeasurements::AttrDescription = QStringLiteral("description");
|
||||
const QString VMeasurements::AttrName = QStringLiteral("name");
|
||||
const QString VMeasurements::AttrFullName = QStringLiteral("full_name");
|
||||
const QString VMeasurements::AttrMin = QStringLiteral("min");
|
||||
const QString VMeasurements::AttrMax = QStringLiteral("max");
|
||||
const QString VMeasurements::AttrStep = QStringLiteral("step");
|
||||
const QString VMeasurements::AttrCircumference = QStringLiteral("circumference");
|
||||
const QString VMeasurements::AttrFullCircumference = QStringLiteral("fullCircumference");
|
||||
const QString VMeasurements::AttrLabel = QStringLiteral("label");
|
||||
const QString VMeasurements::AttrDimension = QStringLiteral("dimension");
|
||||
|
||||
const QString VMeasurements::GenderMale = QStringLiteral("male");
|
||||
const QString VMeasurements::GenderFemale = QStringLiteral("female");
|
||||
const QString VMeasurements::GenderUnknown = QStringLiteral("unknown");
|
||||
|
||||
const QString VMeasurements::DimensionN = QStringLiteral("n");
|
||||
const QString VMeasurements::DimensionX = QStringLiteral("x");
|
||||
const QString VMeasurements::DimensionY = QStringLiteral("y");
|
||||
const QString VMeasurements::DimensionW = QStringLiteral("w");
|
||||
const QString VMeasurements::DimensionZ = QStringLiteral("z");
|
||||
|
||||
namespace
|
||||
{
|
||||
using VDimensions = QMap<MeasurementDimension, MeasurementDimension_p>;
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01")))
|
||||
Q_GLOBAL_STATIC(VDimensions, dimensionsCached)
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString FileComment()
|
||||
|
@ -116,14 +142,15 @@ VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VMeasurements::VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer *data)
|
||||
VMeasurements::VMeasurements(Unit unit, const QVector<MeasurementDimension_p > &dimensions,
|
||||
VContainer *data)
|
||||
:VDomDocument(),
|
||||
data(data),
|
||||
type(MeasurementsType::Multisize)
|
||||
data(data),
|
||||
type(MeasurementsType::Multisize)
|
||||
{
|
||||
SCASSERT(data != nullptr)
|
||||
|
||||
CreateEmptyMultisizeFile(unit, baseSize, baseHeight);
|
||||
CreateEmptyMultisizeFile(unit, dimensions);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -256,14 +283,19 @@ void VMeasurements::StoreNames(bool store)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::ReadMeasurements(qreal height, qreal size) const
|
||||
void VMeasurements::ReadMeasurements(qreal baseA, qreal baseB, qreal baseC) const
|
||||
{
|
||||
// For conversion values we must first calculate all data in measurement file's unit.
|
||||
// That's why we need two containers: one for converted values, second for real data.
|
||||
|
||||
// Container for values in measurement file's unit
|
||||
QScopedPointer<VContainer> tempData(new VContainer(data->GetTrVars(), data->GetPatternUnit(),
|
||||
VContainer::UniqueNamespace()));
|
||||
QSharedPointer<VContainer> tempData;
|
||||
|
||||
if (type == MeasurementsType::Individual)
|
||||
{
|
||||
tempData = QSharedPointer<VContainer>::create(data->GetTrVars(), data->GetPatternUnit(),
|
||||
VContainer::UniqueNamespace());
|
||||
}
|
||||
|
||||
const QDomNodeList list = elementsByTagName(TagMeasurement);
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
|
@ -273,55 +305,104 @@ void VMeasurements::ReadMeasurements(qreal height, qreal size) const
|
|||
const QString name = GetParametrString(dom, AttrName).simplified();
|
||||
const QString description = GetParametrEmptyString(dom, AttrDescription);
|
||||
const QString fullName = GetParametrEmptyString(dom, AttrFullName);
|
||||
const bool specialUnits = GetParametrBool(dom, AttrSpecialUnits, falseStr);
|
||||
|
||||
QSharedPointer<VMeasurement> meash;
|
||||
QSharedPointer<VMeasurement> tempMeash;
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
qreal base = GetParametrDouble(dom, AttrBase, QChar('0'));
|
||||
qreal ksize = GetParametrDouble(dom, AttrSizeIncrease, QChar('0'));
|
||||
qreal kheight = GetParametrDouble(dom, AttrHeightIncrease, QChar('0'));
|
||||
qreal shiftA = GetParametrDouble(dom, AttrShiftA, QChar('0'));
|
||||
qreal shiftB = GetParametrDouble(dom, AttrShiftB, QChar('0'));
|
||||
qreal shiftC = GetParametrDouble(dom, AttrShiftC, QChar('0'));
|
||||
QMap<QString, qreal> corrections = ReadCorrections(dom);
|
||||
|
||||
tempMeash = QSharedPointer<VMeasurement>(new VMeasurement(static_cast<quint32>(i), name, BaseSize(),
|
||||
BaseHeight(), base, ksize, kheight));
|
||||
tempMeash->SetSize(size);
|
||||
tempMeash->SetHeight(height);
|
||||
tempMeash->SetUnit(data->GetPatternUnit());
|
||||
qreal convertedBaseA = DimensionABase();
|
||||
qreal convertedBaseB = DimensionBBase();
|
||||
qreal convertedBaseC = DimensionCBase();
|
||||
qreal convertedStepA = DimensionAStep();
|
||||
qreal convertedStepB = DimensionBStep();
|
||||
qreal convertedStepC = DimensionCStep();
|
||||
|
||||
base = UnitConvertor(base, MUnit(), *data->GetPatternUnit());
|
||||
ksize = UnitConvertor(ksize, MUnit(), *data->GetPatternUnit());
|
||||
kheight = UnitConvertor(kheight, MUnit(), *data->GetPatternUnit());
|
||||
if (not specialUnits)
|
||||
{
|
||||
base = UnitConvertor(base, MUnit(), *data->GetPatternUnit());
|
||||
shiftA = UnitConvertor(shiftA, MUnit(), *data->GetPatternUnit());
|
||||
shiftB = UnitConvertor(shiftB, MUnit(), *data->GetPatternUnit());
|
||||
shiftC = UnitConvertor(shiftC, MUnit(), *data->GetPatternUnit());
|
||||
|
||||
const qreal baseSize = UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit());
|
||||
const qreal baseHeight = UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit());
|
||||
QMutableMapIterator<QString, qreal> iterator(corrections);
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
iterator.next();
|
||||
iterator.setValue(UnitConvertor(iterator.value(), MUnit(), *data->GetPatternUnit()));
|
||||
}
|
||||
|
||||
meash = QSharedPointer<VMeasurement>(new VMeasurement(static_cast<quint32>(i), name, baseSize, baseHeight,
|
||||
base, ksize, kheight, fullName, description));
|
||||
meash->SetSize(size);
|
||||
meash->SetHeight(height);
|
||||
meash->SetUnit(data->GetPatternUnit());
|
||||
convertedBaseA = UnitConvertor(convertedBaseA, MUnit(), *data->GetPatternUnit());
|
||||
convertedBaseB = UnitConvertor(convertedBaseB, MUnit(), *data->GetPatternUnit());
|
||||
convertedBaseC = UnitConvertor(convertedBaseC, MUnit(), *data->GetPatternUnit());
|
||||
|
||||
convertedStepA = UnitConvertor(convertedStepA, MUnit(), *data->GetPatternUnit());
|
||||
convertedStepB = UnitConvertor(convertedStepB, MUnit(), *data->GetPatternUnit());
|
||||
convertedStepC = UnitConvertor(convertedStepC, MUnit(), *data->GetPatternUnit());
|
||||
}
|
||||
|
||||
meash = QSharedPointer<VMeasurement>::create(static_cast<quint32>(i), name,
|
||||
convertedBaseA, convertedBaseB, convertedBaseC, base);
|
||||
meash->SetBaseA(baseA);
|
||||
meash->SetBaseB(baseB);
|
||||
meash->SetBaseC(baseC);
|
||||
|
||||
meash->SetShiftA(shiftA);
|
||||
meash->SetShiftB(shiftB);
|
||||
meash->SetShiftC(shiftC);
|
||||
|
||||
meash->SetStepA(convertedStepA);
|
||||
meash->SetStepB(convertedStepB);
|
||||
meash->SetStepC(convertedStepC);
|
||||
|
||||
meash->SetSpecialUnits(specialUnits);
|
||||
meash->SetCorrections(corrections);
|
||||
meash->SetGuiText(fullName);
|
||||
meash->SetDescription(description);
|
||||
}
|
||||
else
|
||||
{
|
||||
const IMD dimension =
|
||||
VMeasurements::StrToIMD(GetParametrString(dom, AttrDimension, VMeasurements::IMDToStr(IMD::N)));
|
||||
const QString formula = GetParametrString(dom, AttrValue, QChar('0'));
|
||||
bool ok = false;
|
||||
qreal value = EvalFormula(tempData.data(), formula, &ok);
|
||||
|
||||
tempMeash = QSharedPointer<VMeasurement>(new VMeasurement(tempData.data(), static_cast<quint32>(i), name,
|
||||
value, formula, ok));
|
||||
tempMeash = QSharedPointer<VMeasurement>::create(tempData.data(), static_cast<quint32>(i), name, value,
|
||||
formula, ok);
|
||||
|
||||
value = UnitConvertor(value, MUnit(), *data->GetPatternUnit());
|
||||
meash = QSharedPointer<VMeasurement>(new VMeasurement(data, static_cast<quint32>(i), name, value, formula,
|
||||
ok, fullName, description));
|
||||
if (not specialUnits)
|
||||
{
|
||||
value = UnitConvertor(value, MUnit(), *data->GetPatternUnit());
|
||||
}
|
||||
|
||||
meash = QSharedPointer<VMeasurement>::create(data, static_cast<quint32>(i), name, value, formula, ok);
|
||||
meash->SetGuiText(fullName);
|
||||
meash->SetDescription(description);
|
||||
meash->SetSpecialUnits(specialUnits);
|
||||
meash->SetDimension(dimension);
|
||||
}
|
||||
|
||||
if (m_keepNames)
|
||||
{
|
||||
tempData->AddUniqueVariable(tempMeash);
|
||||
if (not tempData.isNull())
|
||||
{
|
||||
tempData->AddUniqueVariable(tempMeash);
|
||||
}
|
||||
data->AddUniqueVariable(meash);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempData->AddVariable(tempMeash);
|
||||
if (not tempData.isNull())
|
||||
{
|
||||
tempData->AddVariable(tempMeash);
|
||||
}
|
||||
data->AddVariable(meash);
|
||||
}
|
||||
}
|
||||
|
@ -352,29 +433,93 @@ MeasurementsType VMeasurements::Type() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VMeasurements::BaseSize() const
|
||||
int VMeasurements::DimensionABase() const
|
||||
{
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
return static_cast<int>(UniqueTagAttr(TagSize, AttrBase, 50));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
const auto dimensions = Dimensions();
|
||||
if (not dimensions.isEmpty())
|
||||
{
|
||||
return dimensions.first()->BaseValue();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VMeasurements::BaseHeight() const
|
||||
int VMeasurements::DimensionBBase() const
|
||||
{
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
return static_cast<int>(UniqueTagAttr(TagHeight, AttrBase, 176));
|
||||
const auto dimensions = Dimensions();
|
||||
if (not dimensions.isEmpty() && dimensions.size() >= 2)
|
||||
{
|
||||
return dimensions.values().at(1)->BaseValue();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VMeasurements::DimensionCBase() const
|
||||
{
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
return 0;
|
||||
const auto dimensions = Dimensions();
|
||||
if (not dimensions.isEmpty() && dimensions.size() == 3)
|
||||
{
|
||||
return dimensions.last()->BaseValue();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VMeasurements::DimensionAStep() const
|
||||
{
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
const auto dimensions = Dimensions();
|
||||
if (not dimensions.isEmpty())
|
||||
{
|
||||
return dimensions.first()->Step();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VMeasurements::DimensionBStep() const
|
||||
{
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
const auto dimensions = Dimensions();
|
||||
if (not dimensions.isEmpty() && dimensions.size() >= 2)
|
||||
{
|
||||
return dimensions.values().at(1)->Step();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VMeasurements::DimensionCStep() const
|
||||
{
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
const auto dimensions = Dimensions();
|
||||
if (not dimensions.isEmpty() && dimensions.size() == 3)
|
||||
{
|
||||
return dimensions.last()->Step();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -479,6 +624,36 @@ void VMeasurements::SetReadOnly(bool ro)
|
|||
setTagText(TagReadOnly, ro ? trueStr : falseStr);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VMeasurements::IsFullCircumference() const
|
||||
{
|
||||
QDomElement dimenstionsTag = documentElement().firstChildElement(TagDimensions);
|
||||
if (not dimenstionsTag.isNull())
|
||||
{
|
||||
return GetParametrBool(dimenstionsTag, AttrFullCircumference, falseStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't read full circumference "<<Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetFullCircumference(bool fc)
|
||||
{
|
||||
QDomElement dimenstionsTag = documentElement().firstChildElement(TagDimensions);
|
||||
if (not dimenstionsTag.isNull())
|
||||
{
|
||||
SetAttributeOrRemoveIf(dimenstionsTag, AttrFullCircumference, fc, not fc);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't save full circumference "<<Q_FUNC_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMName(const QString &name, const QString &text)
|
||||
{
|
||||
|
@ -522,12 +697,12 @@ void VMeasurements::SetMBaseValue(const QString &name, double value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMSizeIncrease(const QString &name, double value)
|
||||
void VMeasurements::SetMShiftA(const QString &name, double value)
|
||||
{
|
||||
QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
SetAttribute(node, AttrSizeIncrease, value);
|
||||
SetAttribute(node, AttrShiftA, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -536,12 +711,69 @@ void VMeasurements::SetMSizeIncrease(const QString &name, double value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMHeightIncrease(const QString &name, double value)
|
||||
void VMeasurements::SetMShiftB(const QString &name, double value)
|
||||
{
|
||||
QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
SetAttribute(node, AttrHeightIncrease, value);
|
||||
SetAttribute(node, AttrShiftB, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << tr("Can't find measurement '%1'").arg(name);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMShiftC(const QString &name, double value)
|
||||
{
|
||||
QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
SetAttribute(node, AttrShiftC, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << tr("Can't find measurement '%1'").arg(name);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMSpecialUnits(const QString &name, bool special)
|
||||
{
|
||||
QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
SetAttributeOrRemoveIf(node, AttrSpecialUnits, special, not special);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << tr("Can't find measurement '%1'").arg(name);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMCorrectionValue(const QString &name, qreal baseA, qreal baseB, qreal baseC, double value)
|
||||
{
|
||||
QDomElement mElement = FindM(name);
|
||||
if (not mElement.isNull())
|
||||
{
|
||||
QMap<QString, qreal> corrections = ReadCorrections(mElement);
|
||||
const QString hash = VMeasurement::CorrectionHash(baseA, baseB, baseC);
|
||||
|
||||
if (not qFuzzyIsNull(value))
|
||||
{
|
||||
corrections.insert(hash, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (corrections.contains(hash))
|
||||
{
|
||||
corrections.remove(hash);
|
||||
}
|
||||
}
|
||||
|
||||
WriteCorrections(mElement, corrections);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -577,6 +809,172 @@ void VMeasurements::SetMFullName(const QString &name, const QString &text)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMDimension(const QString &name, IMD type)
|
||||
{
|
||||
ClearDimension(type);
|
||||
QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
SetAttributeOrRemoveIf(node, AttrDimension, VMeasurements::IMDToStr(type), type == IMD::N);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << tr("Can't find measurement '%1'").arg(name);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VMeasurements::MeasurementForDimension(IMD type) const
|
||||
{
|
||||
const QString d = VMeasurements::IMDToStr(type);
|
||||
QDomNodeList list = elementsByTagName(TagMeasurement);
|
||||
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
const QDomElement domElement = list.at(i).toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
if (domElement.attribute(AttrDimension) == d)
|
||||
{
|
||||
return domElement.attribute(AttrName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMap<MeasurementDimension, MeasurementDimension_p > VMeasurements::Dimensions() const
|
||||
{
|
||||
if (type != MeasurementsType::Multisize)
|
||||
{
|
||||
return QMap<MeasurementDimension, MeasurementDimension_p>();
|
||||
}
|
||||
|
||||
if (dimensionsCached->isEmpty())
|
||||
{
|
||||
const Unit units = MUnit();
|
||||
const QDomNodeList list = elementsByTagName(TagDimension);
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
const QDomElement dom = list.at(i).toElement();
|
||||
const MeasurementDimension type = StrToDimensionType(GetParametrString(dom, AttrType));
|
||||
const int min = GetParametrInt(dom, AttrMin, QChar('0'));
|
||||
const int max = GetParametrInt(dom, AttrMax, QChar('0'));
|
||||
const int step = GetParametrInt(dom, AttrStep, QString("-1"));
|
||||
const int base = GetParametrInt(dom, AttrBase, QChar('0'));
|
||||
|
||||
const DimesionLabels labels = ReadDimensionLabels(dom);
|
||||
|
||||
if (type == MeasurementDimension::X)
|
||||
{
|
||||
auto dimension = QSharedPointer<VXMeasurementDimension>::create(units, min, max, step);
|
||||
dimension->SetBaseValue(base);
|
||||
dimension->SetLabels(labels);
|
||||
dimensionsCached->insert(type, dimension);
|
||||
}
|
||||
else if (type == MeasurementDimension::Y)
|
||||
{
|
||||
auto dimension = QSharedPointer<VYMeasurementDimension>::create(units, min, max, step);
|
||||
dimension->SetBaseValue(base);
|
||||
dimension->SetCircumference(GetParametrBool(dom, AttrCircumference, trueStr));
|
||||
dimension->SetLabels(labels);
|
||||
dimensionsCached->insert(type, dimension);
|
||||
}
|
||||
else if (type == MeasurementDimension::W)
|
||||
{
|
||||
auto dimension = QSharedPointer<VWMeasurementDimension>::create(units, min, max, step);
|
||||
dimension->SetBaseValue(base);
|
||||
dimension->SetLabels(labels);
|
||||
dimensionsCached->insert(type, dimension);
|
||||
}
|
||||
else if (type == MeasurementDimension::Z)
|
||||
{
|
||||
auto dimension = QSharedPointer<VZMeasurementDimension>::create(units, min, max, step);
|
||||
dimension->SetBaseValue(base);
|
||||
dimension->SetLabels(labels);
|
||||
dimensionsCached->insert(type, dimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *dimensionsCached;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMap<QString, QPair<int, int> > VMeasurements::GetRestrictions() const
|
||||
{
|
||||
QMap<QString, QPair<int, int> > restrictions;
|
||||
|
||||
const QDomNodeList list = elementsByTagName(TagRestriction);
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
const QDomElement res = list.at(i).toElement();
|
||||
|
||||
QString coordinates = GetParametrString(res, AttrCoordinates);
|
||||
const int min = GetParametrInt(res, AttrMin, QChar('0'));
|
||||
const int max = GetParametrInt(res, AttrMax, QChar('0'));
|
||||
|
||||
restrictions.insert(coordinates, qMakePair(min, max));
|
||||
}
|
||||
|
||||
return restrictions;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetRestrictions(const QMap<QString, QPair<int, int> > &restrictions)
|
||||
{
|
||||
QDomElement root = documentElement();
|
||||
QDomElement restrictionsTag = root.firstChildElement(TagRestrictions);
|
||||
|
||||
if (restrictionsTag.isNull())
|
||||
{
|
||||
qDebug() << "Can't find restrictions tag";
|
||||
}
|
||||
|
||||
RemoveAllChildren(restrictionsTag);
|
||||
|
||||
QMap<QString, QPair<int, int> >::const_iterator i = restrictions.constBegin();
|
||||
while (i != restrictions.constEnd())
|
||||
{
|
||||
QDomElement restrictionTag = createElement(TagRestriction);
|
||||
|
||||
SetAttribute(restrictionTag, AttrCoordinates, i.key());
|
||||
SetAttribute(restrictionTag, AttrMin, i.value().first);
|
||||
SetAttribute(restrictionTag, AttrMax, i.value().second);
|
||||
|
||||
restrictionsTag.appendChild(restrictionTag);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPair<int, int> VMeasurements::Restriction(int base, int base2) const
|
||||
{
|
||||
const QMap<QString, QPair<int, int> > restrictions = GetRestrictions();
|
||||
const QString hash = VMeasurement::CorrectionHash(base, base2, 0);
|
||||
return restrictions.value(hash, QPair<int, int>(0, 0));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetDimensionLabels(const QMap<MeasurementDimension, DimesionLabels> &labels)
|
||||
{
|
||||
const QDomNodeList list = elementsByTagName(TagDimension);
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
QDomElement dom = list.at(i).toElement();
|
||||
const MeasurementDimension type = StrToDimensionType(GetParametrString(dom, AttrType));
|
||||
|
||||
if (labels.contains(type))
|
||||
{
|
||||
SaveDimesionLabels(dom, labels.value(type));
|
||||
}
|
||||
}
|
||||
|
||||
dimensionsCached->clear(); // Invalidate cache
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VMeasurements::GenderToStr(const GenderType &sex)
|
||||
{
|
||||
|
@ -608,6 +1006,100 @@ GenderType VMeasurements::StrToGender(const QString &sex)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VMeasurements::DimensionTypeToStr(const MeasurementDimension &type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MeasurementDimension::Y:
|
||||
return DimensionY;
|
||||
case MeasurementDimension::W:
|
||||
return DimensionW;
|
||||
case MeasurementDimension::Z:
|
||||
return DimensionZ;
|
||||
case MeasurementDimension::X:
|
||||
default:
|
||||
return DimensionX;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VMeasurements::StrToDimensionType(const QString &type)
|
||||
{
|
||||
const QStringList dimensions = QStringList{DimensionX, DimensionY, DimensionW, DimensionZ};
|
||||
switch (dimensions.indexOf(type))
|
||||
{
|
||||
case 1: // DimensionY
|
||||
return MeasurementDimension::Y;
|
||||
case 2: // DimensionW
|
||||
return MeasurementDimension::W;
|
||||
case 3: // DimensionZ
|
||||
return MeasurementDimension::Z;
|
||||
case 0: // DimensionX
|
||||
default:
|
||||
return MeasurementDimension::X;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VMeasurements::IMDToStr(const IMD &type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case IMD::X:
|
||||
return DimensionX;
|
||||
case IMD::Y:
|
||||
return DimensionY;
|
||||
case IMD::W:
|
||||
return DimensionW;
|
||||
case IMD::Z:
|
||||
return DimensionZ;
|
||||
case IMD::N:
|
||||
default:
|
||||
return DimensionN;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
IMD VMeasurements::StrToIMD(const QString &type)
|
||||
{
|
||||
const QStringList dimensions = QStringList{DimensionN, DimensionX, DimensionY, DimensionW, DimensionZ};
|
||||
switch (dimensions.indexOf(type))
|
||||
{
|
||||
case 1: // DimensionX
|
||||
return IMD::X;
|
||||
case 2: // DimensionY
|
||||
return IMD::Y;
|
||||
case 3: // DimensionW
|
||||
return IMD::W;
|
||||
case 4: // DimensionZ
|
||||
return IMD::Z;
|
||||
case 0: // DimensionN
|
||||
default:
|
||||
return IMD::N;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VMeasurements::IMDName(IMD type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case IMD::N:
|
||||
return tr("None");
|
||||
case IMD::X:
|
||||
return tr("Height");
|
||||
case IMD::Y:
|
||||
return tr("Size");
|
||||
case IMD::W:
|
||||
return tr("Hip");
|
||||
case IMD::Z:
|
||||
return tr("Waist");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList VMeasurements::ListAll() const
|
||||
{
|
||||
|
@ -672,7 +1164,8 @@ VContainer *VMeasurements::GetData() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::CreateEmptyMultisizeFile(Unit unit, int baseSize, int baseHeight)
|
||||
void VMeasurements::CreateEmptyMultisizeFile(Unit unit,
|
||||
const QVector<MeasurementDimension_p > &dimensions)
|
||||
{
|
||||
this->clear();
|
||||
QDomElement mElement = this->createElement(TagVST);
|
||||
|
@ -683,15 +1176,8 @@ void VMeasurements::CreateEmptyMultisizeFile(Unit unit, int baseSize, int baseHe
|
|||
mElement.appendChild(createElement(TagNotes));
|
||||
mElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(unit)));
|
||||
mElement.appendChild(CreateElementWithText(TagPMSystem, ClearPMCode(p998_S)));
|
||||
|
||||
QDomElement size = createElement(TagSize);
|
||||
SetAttribute(size, AttrBase, QString().setNum(baseSize));
|
||||
mElement.appendChild(size);
|
||||
|
||||
QDomElement height = createElement(TagHeight);
|
||||
SetAttribute(height, AttrBase, QString().setNum(baseHeight));
|
||||
mElement.appendChild(height);
|
||||
|
||||
mElement.appendChild(CreateDimensions(dimensions));
|
||||
mElement.appendChild(createElement(TagRestrictions));
|
||||
mElement.appendChild(createElement(TagBodyMeasurements));
|
||||
|
||||
this->appendChild(mElement);
|
||||
|
@ -727,6 +1213,32 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
|||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), this->firstChild());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDomElement VMeasurements::CreateDimensions(const QVector<MeasurementDimension_p > &dimensions)
|
||||
{
|
||||
QDomElement dimensionsTag = createElement(TagDimensions);
|
||||
|
||||
for(auto &dimension : dimensions)
|
||||
{
|
||||
QDomElement dimensionTag = createElement(TagDimension);
|
||||
|
||||
SetAttribute(dimensionTag, AttrType, DimensionTypeToStr(dimension->Type()));
|
||||
SetAttribute(dimensionTag, AttrBase, dimension->BaseValue());
|
||||
SetAttribute(dimensionTag, AttrMin, dimension->MinValue());
|
||||
SetAttribute(dimensionTag, AttrMax, dimension->MaxValue());
|
||||
SetAttribute(dimensionTag, AttrStep, dimension->Step());
|
||||
|
||||
if (dimension->Type() == MeasurementDimension::Y)
|
||||
{
|
||||
SetAttribute(dimensionTag, AttrCircumference, dimension->IsCircumference());
|
||||
}
|
||||
|
||||
dimensionsTag.appendChild(dimensionTag);
|
||||
}
|
||||
|
||||
return dimensionsTag;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VMeasurements::UniqueTagAttr(const QString &tag, const QString &attr, qreal defValue) const
|
||||
{
|
||||
|
@ -762,8 +1274,7 @@ QDomElement VMeasurements::MakeEmpty(const QString &name, const QString &formula
|
|||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
SetAttribute(element, AttrBase, QChar('0'));
|
||||
SetAttribute(element, AttrSizeIncrease, QChar('0'));
|
||||
SetAttribute(element, AttrHeightIncrease, QChar('0'));
|
||||
SetAttribute(element, AttrShiftA, QChar('0'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -856,3 +1367,173 @@ QString VMeasurements::ClearPMCode(const QString &code) const
|
|||
}
|
||||
return clear;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMap<QString, qreal> VMeasurements::ReadCorrections(const QDomElement &mElement) const
|
||||
{
|
||||
if (mElement.isNull())
|
||||
{
|
||||
return QMap<QString, qreal>();
|
||||
}
|
||||
|
||||
QDomElement correctionsTag = mElement.firstChildElement(TagCorrections);
|
||||
if (correctionsTag.isNull())
|
||||
{
|
||||
return QMap<QString, qreal>();
|
||||
}
|
||||
|
||||
QMap<QString, qreal> corrections;
|
||||
|
||||
QDomNode correctionTag = correctionsTag.firstChild();
|
||||
while (not correctionTag.isNull())
|
||||
{
|
||||
if (correctionTag.isElement())
|
||||
{
|
||||
const QDomElement c = correctionTag.toElement();
|
||||
const QString hash = GetParametrString(c, AttrCoordinates);
|
||||
const qreal correction = GetParametrDouble(c, AttrCorrection, QChar('0'));
|
||||
|
||||
corrections.insert(hash, correction);
|
||||
}
|
||||
correctionTag = correctionTag.nextSibling();
|
||||
}
|
||||
|
||||
return corrections;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::WriteCorrections(QDomElement &mElement, const QMap<QString, qreal> &corrections)
|
||||
{
|
||||
QDomElement correctionsTag = mElement.firstChildElement(TagCorrections);
|
||||
if (not corrections.isEmpty())
|
||||
{
|
||||
if (not correctionsTag.isNull())
|
||||
{
|
||||
RemoveAllChildren(correctionsTag);
|
||||
}
|
||||
else
|
||||
{
|
||||
correctionsTag = createElement(TagCorrections);
|
||||
mElement.appendChild(correctionsTag);
|
||||
}
|
||||
|
||||
QMap<QString, qreal>::const_iterator i = corrections.constBegin();
|
||||
while (i != corrections.constEnd())
|
||||
{
|
||||
QDomElement correctionTag = createElement(TagCorrection);
|
||||
|
||||
SetAttribute(correctionTag, AttrCorrection, i.value());
|
||||
SetAttribute(correctionTag, AttrCoordinates, i.key());
|
||||
|
||||
correctionsTag.appendChild(correctionTag);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not correctionsTag.isNull())
|
||||
{
|
||||
mElement.removeChild(correctionsTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SaveDimesionLabels(QDomElement &dElement, const DimesionLabels &labels)
|
||||
{
|
||||
if (dElement.isNull())
|
||||
{
|
||||
qDebug() << "Invalid dimension tag";
|
||||
}
|
||||
|
||||
QDomElement labelsTag = dElement.firstChildElement(TagLabels);
|
||||
if (not labels.isEmpty())
|
||||
{
|
||||
if (not labelsTag.isNull())
|
||||
{
|
||||
RemoveAllChildren(labelsTag);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelsTag = createElement(TagLabels);
|
||||
dElement.appendChild(labelsTag);
|
||||
}
|
||||
|
||||
DimesionLabels::const_iterator i = labels.constBegin();
|
||||
while (i != labels.constEnd())
|
||||
{
|
||||
if (not i.value().isEmpty())
|
||||
{
|
||||
QDomElement labelTag = createElement(TagLabel);
|
||||
|
||||
SetAttribute(labelTag, AttrValue, i.key());
|
||||
SetAttribute(labelTag, AttrLabel, i.value());
|
||||
|
||||
labelsTag.appendChild(labelTag);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not labelsTag.isNull())
|
||||
{
|
||||
dElement.removeChild(labelsTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DimesionLabels VMeasurements::ReadDimensionLabels(const QDomElement &dElement) const
|
||||
{
|
||||
if (dElement.isNull())
|
||||
{
|
||||
return DimesionLabels();
|
||||
}
|
||||
|
||||
QDomElement labelsTag = dElement.firstChildElement(TagLabels);
|
||||
if (labelsTag.isNull())
|
||||
{
|
||||
return DimesionLabels();
|
||||
}
|
||||
|
||||
DimesionLabels labels;
|
||||
|
||||
QDomNode labelTag = labelsTag.firstChild();
|
||||
while (not labelTag.isNull())
|
||||
{
|
||||
if (labelTag.isElement())
|
||||
{
|
||||
const QDomElement l = labelTag.toElement();
|
||||
const int value = GetParametrInt(l, AttrValue, QChar('0'));
|
||||
const QString label = GetParametrEmptyString(l, AttrLabel);
|
||||
|
||||
if (value > 0 && not label.isEmpty())
|
||||
{
|
||||
labels.insert(value, label);
|
||||
}
|
||||
}
|
||||
labelTag = labelTag.nextSibling();
|
||||
}
|
||||
|
||||
return labels;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::ClearDimension(IMD type)
|
||||
{
|
||||
const QString d = VMeasurements::IMDToStr(type);
|
||||
QDomNodeList list = elementsByTagName(TagMeasurement);
|
||||
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
QDomElement domElement = list.at(i).toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
if (domElement.attribute(AttrDimension) == d)
|
||||
{
|
||||
domElement.removeAttribute(AttrDimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "../ifc/xml/vdomdocument.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "vdimensions.h"
|
||||
|
||||
class VContainer;
|
||||
|
||||
|
@ -49,7 +50,8 @@ class VMeasurements : public VDomDocument
|
|||
public:
|
||||
explicit VMeasurements(VContainer *data);
|
||||
VMeasurements(Unit unit, VContainer *data);
|
||||
VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer *data);
|
||||
VMeasurements(Unit unit, const QVector<MeasurementDimension_p > &dimensions,
|
||||
VContainer *data);
|
||||
virtual ~VMeasurements() Q_DECL_EQ_DEFAULT;
|
||||
|
||||
virtual void setXMLContent(const QString &fileName) override;
|
||||
|
@ -65,12 +67,17 @@ public:
|
|||
|
||||
void StoreNames(bool store);
|
||||
|
||||
void ReadMeasurements(qreal height, qreal size) const;
|
||||
void ReadMeasurements(qreal baseA, qreal baseB=0, qreal baseC=0) const;
|
||||
void ClearForExport();
|
||||
|
||||
MeasurementsType Type() const;
|
||||
int BaseSize() const;
|
||||
int BaseHeight() const;
|
||||
int DimensionABase() const;
|
||||
int DimensionBBase() const;
|
||||
int DimensionCBase() const;
|
||||
|
||||
int DimensionAStep() const;
|
||||
int DimensionBStep() const;
|
||||
int DimensionCStep() const;
|
||||
|
||||
QString Notes() const;
|
||||
void SetNotes(const QString &text);
|
||||
|
@ -82,7 +89,7 @@ public:
|
|||
void SetBirthDate(const QDate &date);
|
||||
|
||||
GenderType Gender() const;
|
||||
void SetGender(const GenderType &gender);
|
||||
void SetGender(const GenderType &gender);
|
||||
|
||||
QString PMSystem() const;
|
||||
void SetPMSystem(const QString &system);
|
||||
|
@ -93,20 +100,36 @@ public:
|
|||
bool IsReadOnly() const;
|
||||
void SetReadOnly(bool ro);
|
||||
|
||||
bool IsFullCircumference() const;
|
||||
void SetFullCircumference(bool fc);
|
||||
|
||||
void SetMName(const QString &name, const QString &text);
|
||||
void SetMValue(const QString &name, const QString &text);
|
||||
void SetMBaseValue(const QString &name, double value);
|
||||
void SetMSizeIncrease(const QString &name, double value);
|
||||
void SetMHeightIncrease(const QString &name, double value);
|
||||
void SetMShiftA(const QString &name, double value);
|
||||
void SetMShiftB(const QString &name, double value);
|
||||
void SetMShiftC(const QString &name, double value);
|
||||
void SetMSpecialUnits(const QString &name, bool special);
|
||||
void SetMCorrectionValue(const QString &name, qreal baseA, qreal baseB, qreal baseC, double value);
|
||||
void SetMDescription(const QString &name, const QString &text);
|
||||
void SetMFullName(const QString &name, const QString &text);
|
||||
void SetMDimension(const QString &name, IMD type);
|
||||
|
||||
QString MeasurementForDimension(IMD type) const;
|
||||
|
||||
QMap<MeasurementDimension, MeasurementDimension_p > Dimensions() const;
|
||||
|
||||
QMap<QString, QPair<int, int> > GetRestrictions() const;
|
||||
void SetRestrictions(const QMap<QString, QPair<int, int> > &restrictions);
|
||||
|
||||
QPair<int, int> Restriction(int base, int base2=0) const;
|
||||
|
||||
void SetDimensionLabels(const QMap<MeasurementDimension, DimesionLabels> &labels);
|
||||
|
||||
static const QString TagVST;
|
||||
static const QString TagVIT;
|
||||
static const QString TagBodyMeasurements;
|
||||
static const QString TagNotes;
|
||||
static const QString TagSize;
|
||||
static const QString TagHeight;
|
||||
static const QString TagPersonal;
|
||||
static const QString TagCustomer;
|
||||
static const QString TagBirthDate;
|
||||
|
@ -115,22 +138,55 @@ public:
|
|||
static const QString TagEmail;
|
||||
static const QString TagReadOnly;
|
||||
static const QString TagMeasurement;
|
||||
static const QString TagDimensions;
|
||||
static const QString TagDimension;
|
||||
static const QString TagRestrictions;
|
||||
static const QString TagRestriction;
|
||||
static const QString TagCorrections;
|
||||
static const QString TagCorrection;
|
||||
static const QString TagLabels;
|
||||
static const QString TagLabel;
|
||||
|
||||
static const QString AttrBase;
|
||||
static const QString AttrValue;
|
||||
static const QString AttrSizeIncrease;
|
||||
static const QString AttrHeightIncrease;
|
||||
static const QString AttrShiftA;
|
||||
static const QString AttrShiftB;
|
||||
static const QString AttrShiftC;
|
||||
static const QString AttrCorrection;
|
||||
static const QString AttrCoordinates;
|
||||
static const QString AttrSpecialUnits;
|
||||
static const QString AttrDescription;
|
||||
static const QString AttrName;
|
||||
static const QString AttrFullName;
|
||||
static const QString AttrMin;
|
||||
static const QString AttrMax;
|
||||
static const QString AttrStep;
|
||||
static const QString AttrCircumference;
|
||||
static const QString AttrFullCircumference;
|
||||
static const QString AttrLabel;
|
||||
static const QString AttrDimension;
|
||||
|
||||
static const QString GenderMale;
|
||||
static const QString GenderFemale;
|
||||
static const QString GenderUnknown;
|
||||
|
||||
static const QString DimensionN;
|
||||
static const QString DimensionX;
|
||||
static const QString DimensionY;
|
||||
static const QString DimensionW;
|
||||
static const QString DimensionZ;
|
||||
|
||||
static QString GenderToStr(const GenderType &sex);
|
||||
static GenderType StrToGender(const QString &sex);
|
||||
|
||||
static QString DimensionTypeToStr(const MeasurementDimension &type);
|
||||
static MeasurementDimension StrToDimensionType(const QString &type);
|
||||
|
||||
static QString IMDToStr(const IMD &type);
|
||||
static IMD StrToIMD(const QString &type);
|
||||
|
||||
static QString IMDName(IMD type);
|
||||
|
||||
QStringList ListAll() const;
|
||||
QStringList ListKnown() const;
|
||||
|
||||
|
@ -148,9 +204,11 @@ private:
|
|||
/** @brief m_keepNames store names in container to check uniqueness. */
|
||||
bool m_keepNames{true};
|
||||
|
||||
void CreateEmptyMultisizeFile(Unit unit, int baseSize, int baseHeight);
|
||||
void CreateEmptyMultisizeFile(Unit unit, const QVector<MeasurementDimension_p > &dimensions);
|
||||
void CreateEmptyIndividualFile(Unit unit);
|
||||
|
||||
QDomElement CreateDimensions(const QVector<MeasurementDimension_p > &dimensions);
|
||||
|
||||
qreal UniqueTagAttr(const QString &tag, const QString &attr, qreal defValue) const;
|
||||
|
||||
QDomElement MakeEmpty(const QString &name, const QString &formula);
|
||||
|
@ -160,6 +218,14 @@ private:
|
|||
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
|
||||
|
||||
QString ClearPMCode(const QString &code) const;
|
||||
|
||||
QMap<QString, qreal> ReadCorrections(const QDomElement &mElement) const;
|
||||
void WriteCorrections(QDomElement &mElement, const QMap<QString, qreal> &corrections);
|
||||
|
||||
void SaveDimesionLabels(QDomElement &dElement, const DimesionLabels &labels);
|
||||
DimesionLabels ReadDimensionLabels(const QDomElement &dElement) const;
|
||||
|
||||
void ClearDimension(IMD type);
|
||||
};
|
||||
|
||||
#endif // VMEASUREMENTS_H
|
||||
|
|
|
@ -118,7 +118,7 @@ QDomElement VPatternRecipe::Prerequisite()
|
|||
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
|
||||
|
||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), APP_VERSION_STR));
|
||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"), UnitsToStr(qApp->patternUnit())));
|
||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"), UnitsToStr(qApp->patternUnits())));
|
||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName()));
|
||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName()));
|
||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("description"), m_pattern->GetDescription()));
|
||||
|
@ -437,7 +437,7 @@ QDomElement VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm)
|
|||
tr("Value for final measurtement '%1' is infinite or NaN. "
|
||||
"Please, check your calculations.").arg(fm.name));
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
|
||||
SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "vabstractcurve_p.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||
|
||||
|
@ -146,7 +146,7 @@ QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QP
|
|||
.arg(piece, name(), error);
|
||||
}
|
||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
|
||||
return segment;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <QSharedData>
|
||||
#include "vgeometrydef.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/diagnostic.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define VELLIPTICALARC_P
|
||||
|
||||
#include <QSharedData>
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "vpointf.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <QLineF>
|
||||
|
||||
#include "vpointf.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "vabstractpiece.h"
|
||||
#include "vabstractpiece_p.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
|
@ -1072,7 +1072,7 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
|
|||
{
|
||||
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
return QVector<QPointF>();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <QLoggingCategory>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "vlayoutdef.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
|
@ -335,7 +335,7 @@ bool VBank::PrepareUnsorted()
|
|||
const qint64 square = details.at(i).Square();
|
||||
if (square <= 0)
|
||||
{
|
||||
qCCritical(lBank) << VAbstractApplication::patternMessageSignature +
|
||||
qCCritical(lBank) << VAbstractValApplication::patternMessageSignature +
|
||||
tr("Preparing data for layout error: Detail '%1' square <= 0")
|
||||
.arg(details.at(i).GetName());
|
||||
prepare = false;
|
||||
|
@ -360,7 +360,7 @@ bool VBank::PrepareDetails()
|
|||
{
|
||||
if (layoutWidth <= 0)
|
||||
{
|
||||
qCCritical(lBank) << VAbstractApplication::patternMessageSignature +
|
||||
qCCritical(lBank) << VAbstractValApplication::patternMessageSignature +
|
||||
tr("Preparing data for layout error: Layout paper sheet <= 0");
|
||||
prepare = false;
|
||||
return prepare;
|
||||
|
@ -368,7 +368,7 @@ bool VBank::PrepareDetails()
|
|||
|
||||
if (details.isEmpty())
|
||||
{
|
||||
qCCritical(lBank) << VAbstractApplication::patternMessageSignature +
|
||||
qCCritical(lBank) << VAbstractValApplication::patternMessageSignature +
|
||||
tr("Preparing data for layout error: List of details is empty");
|
||||
prepare = false;
|
||||
return prepare;
|
||||
|
@ -391,7 +391,7 @@ bool VBank::PrepareDetails()
|
|||
const QString errorMsg = QObject::tr("Piece '%1' has invalid layout allowance. Please, check seam allowance"
|
||||
" to check how seam allowance behave.").arg(details.at(i).GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
|
||||
const qreal d = details.at(i).Diagonal();
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
|
@ -269,7 +269,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
|
||||
.arg(pData.nodeName, piece.GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
"empty.")
|
||||
.arg(pData.nodeName, piece.GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
return;
|
||||
}
|
||||
layoutPassmark.baseLine = ConstFirst (baseLines);
|
||||
|
@ -300,7 +300,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||
.arg(pData.nodeName, piece.GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -326,7 +326,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.")
|
||||
.arg(pData.nodeName, piece.GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.")
|
||||
.arg(pData.nodeName, piece.GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||
.arg(pData.nodeName, piece.GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -508,7 +508,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
|||
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
||||
.arg(piece.GetName());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
|
||||
det.SetCountourPoints(futureMainPath.result(),
|
||||
|
@ -697,7 +697,7 @@ void VLayoutPiece::SetPieceText(const QString& qsName, const VPieceLabelData& da
|
|||
// generate text
|
||||
d->m_tmDetail.SetFont(font);
|
||||
d->m_tmDetail.SetFontSize(data.GetFontSize());
|
||||
d->m_tmDetail.Update(qsName, data);
|
||||
d->m_tmDetail.Update(qsName, data, pattern);
|
||||
// this will generate the lines of text
|
||||
d->m_tmDetail.SetFontSize(data.GetFontSize());
|
||||
d->m_tmDetail.FitFontSize(labelWidth, labelHeight);
|
||||
|
@ -754,7 +754,7 @@ void VLayoutPiece::SetPatternInfo(VAbstractPattern* pDoc, const VPatternLabelDat
|
|||
d->m_tmPattern.SetFont(font);
|
||||
d->m_tmPattern.SetFontSize(geom.GetFontSize());
|
||||
|
||||
d->m_tmPattern.Update(pDoc);
|
||||
d->m_tmPattern.Update(pDoc, pattern);
|
||||
|
||||
// generate lines of text
|
||||
d->m_tmPattern.SetFontSize(geom.GetFontSize());
|
||||
|
|
|
@ -43,10 +43,11 @@
|
|||
#include <QImageReader>
|
||||
#include <QPixmapCache>
|
||||
#include <QPainter>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "../vmisc/vmath.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
|
||||
namespace
|
||||
|
@ -309,7 +310,7 @@ QVector<QGraphicsItem *> VPoster::ImageWatermark(QGraphicsItem *parent, const Po
|
|||
{
|
||||
const QString errorMsg = tr("Cannot open the watermark image.") + QChar(' ') + error;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -319,7 +320,7 @@ QVector<QGraphicsItem *> VPoster::ImageWatermark(QGraphicsItem *parent, const Po
|
|||
{
|
||||
const QString errorMsg = tr("Not supported file suffix '%1'").arg(f.suffix());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
qWarning() << VAbstractValApplication::patternMessageSignature + errorMsg;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -455,7 +456,7 @@ void VPoster::Ruler(QVector<QGraphicsItem *> &data, QGraphicsItem *parent, QRect
|
|||
|
||||
const qreal notchHeight = ToPixel(3); // mm
|
||||
const qreal shortNotchHeight = ToPixel(1.1); // mm
|
||||
Unit patternUnits = qApp->patternUnit();
|
||||
Unit patternUnits = qApp->patternUnits();
|
||||
const qreal step = UnitConvertor(1, patternUnits, Unit::Px);
|
||||
double marksCount = rec.width() / step;
|
||||
int i = 0;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
# include "../vmisc/vdatastreamenum.h"
|
||||
|
@ -166,9 +166,10 @@ namespace
|
|||
{
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc)
|
||||
QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc, const VContainer *data)
|
||||
{
|
||||
SCASSERT(doc != nullptr)
|
||||
SCASSERT(data != nullptr)
|
||||
|
||||
QMap<QString, QString> placeholders;
|
||||
|
||||
|
@ -185,38 +186,39 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc)
|
|||
placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
|
||||
placeholders.insert(pl_author, doc->GetCompanyName());
|
||||
|
||||
if (qApp->patternType() == MeasurementsType::Individual)
|
||||
placeholders.insert(pl_mUnits, UnitsToStr(qApp->MeasurementsUnits(), true));
|
||||
placeholders.insert(pl_pUnits, UnitsToStr(qApp->patternUnits(), true));
|
||||
placeholders.insert(pl_mSizeUnits, UnitsToStr(qApp->DimensionSizeUnits(), true));
|
||||
|
||||
if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
|
||||
{
|
||||
placeholders.insert(pl_customer, qApp->GetCustomerName());
|
||||
|
||||
const QString birthDate = locale.toString(qApp->GetCustomerBirthDate(), doc->GetLabelDateFormat());
|
||||
placeholders.insert(pl_birthDate, birthDate);
|
||||
|
||||
placeholders.insert(pl_email, qApp->CustomerEmail());
|
||||
}
|
||||
else
|
||||
{
|
||||
placeholders.insert(pl_customer, doc->GetCustomerName());
|
||||
|
||||
const QString birthDate = locale.toString(doc->GetCustomerBirthDate(), doc->GetLabelDateFormat());
|
||||
placeholders.insert(pl_birthDate, birthDate);
|
||||
|
||||
placeholders.insert(pl_email, doc->GetCustomerEmail());
|
||||
}
|
||||
|
||||
placeholders.insert(pl_pExt, QStringLiteral("val"));
|
||||
placeholders.insert(pl_pFileName, QFileInfo(qApp->GetPatternPath()).baseName());
|
||||
placeholders.insert(pl_mFileName, QFileInfo(doc->MPath()).baseName());
|
||||
|
||||
QString curSize;
|
||||
QString curHeight;
|
||||
QString mExt;
|
||||
if (qApp->patternType() == MeasurementsType::Multisize)
|
||||
{
|
||||
curSize = QString::number(VContainer::size(valentinaNamespace));
|
||||
curHeight = QString::number(VContainer::height(valentinaNamespace));
|
||||
mExt = QStringLiteral("vst");
|
||||
}
|
||||
else if (qApp->patternType() == MeasurementsType::Individual)
|
||||
{
|
||||
curSize = QString::number(VContainer::size(valentinaNamespace));
|
||||
curHeight = QString::number(VContainer::height(valentinaNamespace));
|
||||
mExt = QStringLiteral("vit");
|
||||
}
|
||||
|
||||
placeholders.insert(pl_size, curSize);
|
||||
placeholders.insert(pl_height, curHeight);
|
||||
placeholders.insert(pl_mExt, mExt);
|
||||
placeholders.insert(pl_height, QString::number(qApp->GetDimensionHeight()));
|
||||
placeholders.insert(pl_size, QString::number(qApp->GetDimensionSize()));
|
||||
placeholders.insert(pl_hip, QString::number(qApp->GetDimensionHip()));
|
||||
placeholders.insert(pl_waist, QString::number(qApp->GetDimensionWaist()));
|
||||
placeholders.insert(pl_mExt, qApp->GetMeasurementsType() == MeasurementsType::Multisize ? QString("vst")
|
||||
: QString("vit"));
|
||||
|
||||
const QMap<int, QString> materials = doc->GetPatternMaterials();
|
||||
for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
|
||||
|
@ -232,6 +234,15 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc)
|
|||
placeholders.insert(pl_userMaterial + number, value);
|
||||
}
|
||||
|
||||
const QMap<QString, QSharedPointer<VMeasurement> > measurements = data->DataMeasurements();
|
||||
auto i = measurements.constBegin();
|
||||
while (i != measurements.constEnd())
|
||||
{
|
||||
QString description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText();
|
||||
placeholders.insert(pl_measurement + i.key(), QString::number(*i.value()->GetValue()));
|
||||
++i;
|
||||
}
|
||||
|
||||
// Piece tags
|
||||
placeholders.insert(pl_pLetter, QString());
|
||||
placeholders.insert(pl_pAnnotation, QString());
|
||||
|
@ -473,11 +484,11 @@ void VTextManager::FitFontSize(qreal fW, qreal fH)
|
|||
* @param qsName detail name
|
||||
* @param data reference to the detail data
|
||||
*/
|
||||
void VTextManager::Update(const QString& qsName, const VPieceLabelData& data)
|
||||
void VTextManager::Update(const QString& qsName, const VPieceLabelData& data, const VContainer *pattern)
|
||||
{
|
||||
m_liLines.clear();
|
||||
|
||||
QMap<QString, QString> placeholders = PreparePlaceholders(qApp->getCurrentDocument());
|
||||
QMap<QString, QString> placeholders = PreparePlaceholders(qApp->getCurrentDocument(), pattern);
|
||||
InitPiecePlaceholders(placeholders, qsName, data);
|
||||
|
||||
QVector<VLabelTemplateLine> lines = data.GetLabelTemplate();
|
||||
|
@ -495,7 +506,7 @@ void VTextManager::Update(const QString& qsName, const VPieceLabelData& data)
|
|||
* @brief VTextManager::Update updates the text lines with pattern info
|
||||
* @param pDoc pointer to the abstract pattern object
|
||||
*/
|
||||
void VTextManager::Update(VAbstractPattern *pDoc)
|
||||
void VTextManager::Update(VAbstractPattern *pDoc, const VContainer *pattern)
|
||||
{
|
||||
m_liLines.clear();
|
||||
|
||||
|
@ -507,7 +518,7 @@ void VTextManager::Update(VAbstractPattern *pDoc)
|
|||
return; // Nothing to parse
|
||||
}
|
||||
|
||||
const QMap<QString, QString> placeholders = PreparePlaceholders(pDoc);
|
||||
const QMap<QString, QString> placeholders = PreparePlaceholders(pDoc, pattern);
|
||||
|
||||
for (int i=0; i<lines.size(); ++i)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
class VPieceLabelData;
|
||||
class VAbstractPattern;
|
||||
class VContainer;
|
||||
|
||||
#define MIN_FONT_SIZE 5
|
||||
#define MAX_FONT_SIZE 128
|
||||
|
@ -88,8 +89,8 @@ public:
|
|||
int GetSourceLinesCount() const;
|
||||
const TextLine& GetSourceLine(int i) const;
|
||||
|
||||
void Update(const QString& qsName, const VPieceLabelData& data);
|
||||
void Update(VAbstractPattern* pDoc);
|
||||
void Update(const QString& qsName, const VPieceLabelData& data, const VContainer *pattern);
|
||||
void Update(VAbstractPattern* pDoc, const VContainer *pattern);
|
||||
|
||||
friend QDataStream& operator<<(QDataStream& dataStream, const VTextManager& data);
|
||||
friend QDataStream& operator>>(QDataStream& dataStream, VTextManager& data);
|
||||
|
|
|
@ -90,11 +90,9 @@ const QString SINGLE_OPTION_TEST = QStringLiteral("t");
|
|||
|
||||
const QString LONG_OPTION_PENDANTIC = QStringLiteral("pedantic");
|
||||
|
||||
const QString LONG_OPTION_GRADATIONSIZE = QStringLiteral("gsize");
|
||||
const QString SINGLE_OPTION_GRADATIONSIZE = QStringLiteral("x");
|
||||
|
||||
const QString LONG_OPTION_GRADATIONHEIGHT = QStringLiteral("gheight");
|
||||
const QString SINGLE_OPTION_GRADATIONHEIGHT = QStringLiteral("e");
|
||||
const QString LONG_OPTION_DIMENSION_A = QStringLiteral("dimensionA");
|
||||
const QString LONG_OPTION_DIMENSION_B = QStringLiteral("dimensionB");
|
||||
const QString LONG_OPTION_DIMENSION_C = QStringLiteral("dimensionC");
|
||||
|
||||
const QString LONG_OPTION_USER_MATERIAL = QStringLiteral("userMaterial");
|
||||
|
||||
|
@ -170,8 +168,9 @@ QStringList AllKeys()
|
|||
LONG_OPTION_GROUPPING, SINGLE_OPTION_GROUPPING,
|
||||
LONG_OPTION_TEST, SINGLE_OPTION_TEST,
|
||||
LONG_OPTION_PENDANTIC,
|
||||
LONG_OPTION_GRADATIONSIZE, SINGLE_OPTION_GRADATIONSIZE,
|
||||
LONG_OPTION_GRADATIONHEIGHT, SINGLE_OPTION_GRADATIONHEIGHT,
|
||||
LONG_OPTION_DIMENSION_A,
|
||||
LONG_OPTION_DIMENSION_B,
|
||||
LONG_OPTION_DIMENSION_C,
|
||||
LONG_OPTION_USER_MATERIAL,
|
||||
LONG_OPTION_IGNORE_MARGINS, SINGLE_OPTION_IGNORE_MARGINS,
|
||||
LONG_OPTION_LEFT_MARGIN, SINGLE_OPTION_LEFT_MARGIN,
|
||||
|
|
|
@ -87,11 +87,9 @@ extern const QString SINGLE_OPTION_TEST;
|
|||
|
||||
extern const QString LONG_OPTION_PENDANTIC;
|
||||
|
||||
extern const QString LONG_OPTION_GRADATIONSIZE;
|
||||
extern const QString SINGLE_OPTION_GRADATIONSIZE;
|
||||
|
||||
extern const QString LONG_OPTION_GRADATIONHEIGHT;
|
||||
extern const QString SINGLE_OPTION_GRADATIONHEIGHT;
|
||||
extern const QString LONG_OPTION_DIMENSION_A;
|
||||
extern const QString LONG_OPTION_DIMENSION_B;
|
||||
extern const QString LONG_OPTION_DIMENSION_C;
|
||||
|
||||
extern const QString LONG_OPTION_USER_MATERIAL;
|
||||
|
||||
|
|
|
@ -149,17 +149,24 @@ const QStringList builInFunctions = QStringList() << degTorad_F
|
|||
|
||||
const QString pl_size = QStringLiteral("size");
|
||||
const QString pl_height = QStringLiteral("height");
|
||||
const QString pl_hip = QStringLiteral("hip");
|
||||
const QString pl_waist = QStringLiteral("waist");
|
||||
const QString pl_date = QStringLiteral("date");
|
||||
const QString pl_time = QStringLiteral("time");
|
||||
const QString pl_birthDate = QStringLiteral("birthDate");
|
||||
const QString pl_patternName = QStringLiteral("patternName");
|
||||
const QString pl_patternNumber = QStringLiteral("patternNumber");
|
||||
const QString pl_author = QStringLiteral("author");
|
||||
const QString pl_customer = QStringLiteral("customer");
|
||||
const QString pl_email = QStringLiteral("email");
|
||||
const QString pl_userMaterial = QStringLiteral("userMaterial");
|
||||
const QString pl_pExt = QStringLiteral("pExt");
|
||||
const QString pl_pUnits = QStringLiteral("pUnits");
|
||||
const QString pl_pFileName = QStringLiteral("pFileName");
|
||||
const QString pl_mFileName = QStringLiteral("mFileName");
|
||||
const QString pl_mExt = QStringLiteral("mExt");
|
||||
const QString pl_mUnits = QStringLiteral("mUnits");
|
||||
const QString pl_mSizeUnits = QStringLiteral("mSizeUnits");
|
||||
const QString pl_pLetter = QStringLiteral("pLetter");
|
||||
const QString pl_pAnnotation = QStringLiteral("pAnnotation");
|
||||
const QString pl_pOrientation = QStringLiteral("pOrientation");
|
||||
|
@ -174,34 +181,7 @@ const QString pl_mInterfacing = QStringLiteral("mInterfacing");
|
|||
const QString pl_mInterlining = QStringLiteral("mInterlining");
|
||||
const QString pl_wCut = QStringLiteral("wCut");
|
||||
const QString pl_wOnFold = QStringLiteral("wOnFold");
|
||||
|
||||
const QStringList labelTemplatePlaceholders = QStringList() << pl_size
|
||||
<< pl_height
|
||||
<< pl_date
|
||||
<< pl_time
|
||||
<< pl_patternName
|
||||
<< pl_patternNumber
|
||||
<< pl_author
|
||||
<< pl_customer
|
||||
<< pl_userMaterial
|
||||
<< pl_pExt
|
||||
<< pl_pFileName
|
||||
<< pl_mFileName
|
||||
<< pl_mExt
|
||||
<< pl_pLetter
|
||||
<< pl_pAnnotation
|
||||
<< pl_pOrientation
|
||||
<< pl_pRotation
|
||||
<< pl_pTilt
|
||||
<< pl_pFoldPosition
|
||||
<< pl_pName
|
||||
<< pl_pQuantity
|
||||
<< pl_mFabric
|
||||
<< pl_mLining
|
||||
<< pl_mInterfacing
|
||||
<< pl_mInterlining
|
||||
<< pl_wCut
|
||||
<< pl_wOnFold;
|
||||
const QString pl_measurement = QStringLiteral("measurement_");
|
||||
|
||||
const QString cursorArrowOpenHand = QStringLiteral("://cursor/cursor-arrow-openhand.png");
|
||||
const QString cursorArrowCloseHand = QStringLiteral("://cursor/cursor-arrow-closehand.png");
|
||||
|
@ -639,6 +619,8 @@ QString UnitsToStr(const Unit &unit, const bool translate)
|
|||
case Unit::Px:
|
||||
translate ? result = QObject::tr("px") : result = unitPX;
|
||||
break;
|
||||
case Unit::LAST_UNIT_DO_NOT_USE:
|
||||
break;
|
||||
case Unit::Cm:
|
||||
default:
|
||||
translate ? result = QObject::tr("cm") : result = unitCM;
|
||||
|
|
|
@ -82,7 +82,7 @@ extern const int maxLabelFontSize;
|
|||
|
||||
enum class NodeDetail : qint8 { Contour, Modeling };
|
||||
enum class SceneObject : qint8 { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };
|
||||
enum class MeasurementsType : qint8 { Multisize, Individual , Unknown};
|
||||
enum class MeasurementsType : qint8 { Multisize, Individual, Unknown};
|
||||
enum class Unit : qint8 { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE};
|
||||
enum class Source : qint8 { FromGui, FromFile, FromTool };
|
||||
enum class NodeUsage : bool {NotInUse = false, InUse = true};
|
||||
|
@ -275,18 +275,14 @@ enum class IncrementType : qint8 { Increment, Separator };
|
|||
QString IncrementTypeToString(IncrementType type);
|
||||
IncrementType StringToIncrementType(const QString &value);
|
||||
|
||||
static const int heightStep = 6;
|
||||
enum class GHeights : quint8 { ALL,
|
||||
H50=50, H56=56, H62=62, H68=68, H74=74, H80=80, H86=86, H92=92,
|
||||
H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134, H140=140,
|
||||
H146=146, H152=152, H158=158, H164=164, H170=170, H176=176, H182=182, H188=188,
|
||||
H194=194, H200=200};
|
||||
|
||||
static const int sizeStep = 2;
|
||||
enum class GSizes : quint8 { ALL,
|
||||
S22=22, S24=24, S26=26, S28=28, S30=30, S32=32, S34=34, S36=36, S38=38, S40=40,
|
||||
S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56, S58=58, S60=60,
|
||||
S62=62, S64=64, S66=66, S68=68, S70=70, S72=72 };
|
||||
enum class IMD: qint8 // Individual measurement dimension
|
||||
{
|
||||
N, // None
|
||||
X, // height
|
||||
Y, // size (chest half circumference)
|
||||
W, // hip half circumference
|
||||
Z // waist half circumference
|
||||
};
|
||||
|
||||
/* QImage supports a maximum of 32768x32768 px images (signed short).
|
||||
* This follows from the condition: width * height * colordepth < INT_MAX (4 billion) -> 32768 * 32768 * 4 = 4 billion.
|
||||
|
@ -407,17 +403,24 @@ extern const QStringList builInFunctions;
|
|||
// Placeholders
|
||||
extern const QString pl_size;
|
||||
extern const QString pl_height;
|
||||
extern const QString pl_hip;
|
||||
extern const QString pl_waist;
|
||||
extern const QString pl_date;
|
||||
extern const QString pl_time;
|
||||
extern const QString pl_birthDate;
|
||||
extern const QString pl_patternName;
|
||||
extern const QString pl_patternNumber;
|
||||
extern const QString pl_author;
|
||||
extern const QString pl_customer;
|
||||
extern const QString pl_email;
|
||||
extern const QString pl_userMaterial;
|
||||
extern const QString pl_pExt;
|
||||
extern const QString pl_pUnits;
|
||||
extern const QString pl_pFileName;
|
||||
extern const QString pl_mFileName;
|
||||
extern const QString pl_mExt;
|
||||
extern const QString pl_mUnits;
|
||||
extern const QString pl_mSizeUnits;
|
||||
extern const QString pl_pLetter;
|
||||
extern const QString pl_pAnnotation;
|
||||
extern const QString pl_pOrientation;
|
||||
|
@ -432,12 +435,11 @@ extern const QString pl_mInterfacing;
|
|||
extern const QString pl_mInterlining;
|
||||
extern const QString pl_wCut;
|
||||
extern const QString pl_wOnFold;
|
||||
extern const QString pl_measurement;
|
||||
|
||||
// Don't forget to syncronize with XSD schema.
|
||||
const int userMaterialPlaceholdersQuantity = 20;
|
||||
|
||||
extern const QStringList labelTemplatePlaceholders;
|
||||
|
||||
extern const QString cursorArrowOpenHand;
|
||||
extern const QString cursorArrowCloseHand;
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QShowEvent>
|
||||
#include <QTextCodec>
|
||||
#include <QDebug>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogExportToCSV::DialogExportToCSV(QWidget *parent)
|
||||
|
|
|
@ -89,5 +89,9 @@
|
|||
<file>icon/32x32/broken_link@2x.png</file>
|
||||
<file>icon/32x32/link.png</file>
|
||||
<file>icon/32x32/link@2x.png</file>
|
||||
<file>icon/24x24/star.png</file>
|
||||
<file>icon/24x24/star@2x.png</file>
|
||||
<file>icon/24x24/close.png</file>
|
||||
<file>icon/24x24/close@2x.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
src/libs/vmisc/share/resources/icon/24x24/close.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/24x24/close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 548 B |
BIN
src/libs/vmisc/share/resources/icon/24x24/close@2x.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/24x24/close@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 753 B |
BIN
src/libs/vmisc/share/resources/icon/24x24/star.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/24x24/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 659 B |
BIN
src/libs/vmisc/share/resources/icon/24x24/star@2x.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/24x24/star@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 827 B |
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "vabstractapplication.h"
|
||||
#include "projectversion.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
|
||||
#if defined(qApp)
|
||||
#undef qApp
|
||||
|
|
|
@ -42,9 +42,6 @@
|
|||
#include <QWidget>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/customevents.h"
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
@ -53,29 +50,10 @@
|
|||
# include "appimage.h"
|
||||
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
|
||||
|
||||
const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
||||
:QApplication(argc, argv),
|
||||
undoStack(new QUndoStack(this)),
|
||||
mainWindow(nullptr),
|
||||
settings(nullptr),
|
||||
qtTranslator(nullptr),
|
||||
qtxmlTranslator(nullptr),
|
||||
qtBaseTranslator(nullptr),
|
||||
appTranslator(nullptr),
|
||||
pmsTranslator(nullptr),
|
||||
_patternUnit(Unit::Cm),
|
||||
_patternType(MeasurementsType::Unknown),
|
||||
patternFilePath(),
|
||||
currentScene(nullptr),
|
||||
sceneView(nullptr),
|
||||
doc(nullptr),
|
||||
m_customerName(),
|
||||
m_userMaterials(),
|
||||
openingPattern(false),
|
||||
mode(Draw::Calculation)
|
||||
undoStack(new QUndoStack(this))
|
||||
{
|
||||
QString rules;
|
||||
|
||||
|
@ -121,10 +99,6 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
|||
connect(this, &QApplication::aboutToQuit, this, &VAbstractApplication::AboutToQuit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractApplication::~VAbstractApplication()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief translationsPath return path to the root directory that contain QM files.
|
||||
|
@ -189,56 +163,6 @@ QString VAbstractApplication::translationsPath(const QString &locale) const
|
|||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementsType VAbstractApplication::patternType() const
|
||||
{
|
||||
return _patternType;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::setPatternType(const MeasurementsType &patternType)
|
||||
{
|
||||
_patternType = patternType;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::setCurrentDocument(VAbstractPattern *doc)
|
||||
{
|
||||
this->doc = doc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractPattern *VAbstractApplication::getCurrentDocument() const
|
||||
{
|
||||
SCASSERT(doc != nullptr)
|
||||
return doc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractApplication::getOpeningPattern() const
|
||||
{
|
||||
return openingPattern;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::setOpeningPattern()
|
||||
{
|
||||
openingPattern = !openingPattern;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QWidget *VAbstractApplication::getMainWindow() const
|
||||
{
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::setMainWindow(QWidget *value)
|
||||
{
|
||||
SCASSERT(value != nullptr)
|
||||
mainWindow = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QUndoStack *VAbstractApplication::getUndoStack() const
|
||||
{
|
||||
|
@ -251,47 +175,6 @@ bool VAbstractApplication::IsPedantic() const
|
|||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ClearMessage helps to clear a message string from standard Qt function.
|
||||
* @param msg the message that contains '"' at the start and at the end
|
||||
* @return cleared string
|
||||
*/
|
||||
QString VAbstractApplication::ClearMessage(QString msg)
|
||||
{
|
||||
if (msg.startsWith('"') && msg.endsWith('"'))
|
||||
{
|
||||
msg.remove(0, 1);
|
||||
msg.chop(1);
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const Draw &VAbstractApplication::GetDrawMode() const
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::SetDrawMode(const Draw &value)
|
||||
{
|
||||
mode = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::PostPatternMessage(const QString &message, QtMsgType severity) const
|
||||
{
|
||||
QApplication::postEvent(mainWindow, new PatternMessageEvent(VAbstractApplication::ClearMessage(message), severity));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractApplication::IsPatternMessage(const QString &message) const
|
||||
{
|
||||
return VAbstractApplication::ClearMessage(message).startsWith(patternMessageSignature);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
#if defined(Q_OS_WIN)
|
||||
void VAbstractApplication::WinAttachConsole()
|
||||
|
@ -312,24 +195,6 @@ void VAbstractApplication::WinAttachConsole()
|
|||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit VAbstractApplication::patternUnit() const
|
||||
{
|
||||
return _patternUnit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const Unit *VAbstractApplication::patternUnitP() const
|
||||
{
|
||||
return &_patternUnit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::setPatternUnit(const Unit &patternUnit)
|
||||
{
|
||||
_patternUnit = patternUnit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSettings hide settings constructor.
|
||||
|
@ -341,43 +206,6 @@ VCommonSettings *VAbstractApplication::Settings()
|
|||
return settings;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGraphicsScene *VAbstractApplication::getCurrentScene() const
|
||||
{
|
||||
SCASSERT(*currentScene != nullptr)
|
||||
return *currentScene;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::setCurrentScene(QGraphicsScene **value)
|
||||
{
|
||||
currentScene = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VMainGraphicsView *VAbstractApplication::getSceneView() const
|
||||
{
|
||||
return sceneView;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::setSceneView(VMainGraphicsView *value)
|
||||
{
|
||||
sceneView = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
double VAbstractApplication::toPixel(double val) const
|
||||
{
|
||||
return ToPixel(val, _patternUnit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
double VAbstractApplication::fromPixel(double pix) const
|
||||
{
|
||||
return FromPixel(pix, _patternUnit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractApplication::LoadTranslation(const QString &locale)
|
||||
{
|
||||
|
|
|
@ -32,25 +32,21 @@
|
|||
#include <qcompilerdetection.h>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QGraphicsScene>
|
||||
#include <QLocale>
|
||||
#include <QMetaObject>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "def.h"
|
||||
#include "vcommonsettings.h"
|
||||
#include "vlockguard.h"
|
||||
#include "vsettings.h"
|
||||
|
||||
class QUndoStack;
|
||||
class VAbstractApplication;// use in define
|
||||
class VAbstractPattern;
|
||||
class VMainGraphicsView;
|
||||
class VCommonSettings;
|
||||
|
||||
#if defined(qApp)
|
||||
#undef qApp
|
||||
|
@ -62,92 +58,42 @@ class VAbstractApplication : public QApplication
|
|||
Q_OBJECT
|
||||
public:
|
||||
VAbstractApplication(int &argc, char ** argv);
|
||||
virtual ~VAbstractApplication() override;
|
||||
virtual ~VAbstractApplication() =default;
|
||||
|
||||
virtual const VTranslateVars *TrVars()=0;
|
||||
|
||||
QString translationsPath(const QString &locale = QString()) const;
|
||||
QString translationsPath(const QString &locale = QString()) const;
|
||||
|
||||
void LoadTranslation(const QString &locale);
|
||||
|
||||
Unit patternUnit() const;
|
||||
const Unit *patternUnitP() const;
|
||||
void setPatternUnit(const Unit &patternUnit);
|
||||
|
||||
MeasurementsType patternType() const;
|
||||
void setPatternType(const MeasurementsType &patternType);
|
||||
|
||||
QString GetCustomerName() const;
|
||||
void SetCustomerName(const QString &name);
|
||||
void LoadTranslation(const QString &locale);
|
||||
|
||||
virtual void OpenSettings()=0;
|
||||
VCommonSettings *Settings();
|
||||
|
||||
template <typename T>
|
||||
QString LocaleToString(const T &value);
|
||||
QString LocaleToString(const T &value);
|
||||
|
||||
QGraphicsScene *getCurrentScene() const;
|
||||
void setCurrentScene(QGraphicsScene **value);
|
||||
QUndoStack *getUndoStack() const;
|
||||
|
||||
VMainGraphicsView *getSceneView() const;
|
||||
void setSceneView(VMainGraphicsView *value);
|
||||
|
||||
double toPixel(double val) const;
|
||||
double fromPixel(double pix) const;
|
||||
|
||||
void setCurrentDocument(VAbstractPattern *doc);
|
||||
VAbstractPattern *getCurrentDocument()const;
|
||||
|
||||
bool getOpeningPattern() const;
|
||||
void setOpeningPattern();
|
||||
|
||||
QWidget *getMainWindow() const;
|
||||
void setMainWindow(QWidget *value);
|
||||
|
||||
QUndoStack *getUndoStack() const;
|
||||
|
||||
virtual bool IsAppInGUIMode()const =0;
|
||||
virtual bool IsPedantic() const;
|
||||
|
||||
QString GetPatternPath() const;
|
||||
void SetPatternPath(const QString &value);
|
||||
virtual bool IsAppInGUIMode()const =0;
|
||||
virtual bool IsPedantic() const;
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
static void WinAttachConsole();
|
||||
#endif
|
||||
|
||||
static QString ClearMessage(QString msg);
|
||||
|
||||
QMap<int, QString> GetUserMaterials() const;
|
||||
void SetUserMaterials(const QMap<int, QString> &userMaterials);
|
||||
|
||||
const Draw &GetDrawMode() const;
|
||||
void SetDrawMode(const Draw &value);
|
||||
|
||||
void PostPatternMessage(const QString &message, QtMsgType severity) const;
|
||||
|
||||
static const QString patternMessageSignature;
|
||||
bool IsPatternMessage(const QString &message) const;
|
||||
|
||||
protected:
|
||||
QUndoStack *undoStack;
|
||||
|
||||
/**
|
||||
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
|
||||
* modality doesn't work.
|
||||
*/
|
||||
QWidget *mainWindow;
|
||||
QUndoStack *undoStack;
|
||||
|
||||
/**
|
||||
* @brief settings pointer to settings. Help hide constructor creation settings. Make make code more readable.
|
||||
*/
|
||||
VCommonSettings *settings;
|
||||
VCommonSettings *settings{nullptr};
|
||||
|
||||
QPointer<QTranslator> qtTranslator;
|
||||
QPointer<QTranslator> qtxmlTranslator;
|
||||
QPointer<QTranslator> qtBaseTranslator;
|
||||
QPointer<QTranslator> appTranslator;
|
||||
QPointer<QTranslator> pmsTranslator;
|
||||
QPointer<QTranslator> qtTranslator{nullptr};
|
||||
QPointer<QTranslator> qtxmlTranslator{nullptr};
|
||||
QPointer<QTranslator> qtBaseTranslator{nullptr};
|
||||
QPointer<QTranslator> appTranslator{nullptr};
|
||||
QPointer<QTranslator> pmsTranslator{nullptr};
|
||||
|
||||
virtual void InitTrVars()=0;
|
||||
|
||||
|
@ -156,66 +102,10 @@ protected slots:
|
|||
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractApplication)
|
||||
Unit _patternUnit;
|
||||
MeasurementsType _patternType;
|
||||
QString patternFilePath;
|
||||
|
||||
QGraphicsScene **currentScene;
|
||||
VMainGraphicsView *sceneView;
|
||||
|
||||
VAbstractPattern *doc;
|
||||
QString m_customerName;
|
||||
|
||||
QMap<int, QString> m_userMaterials;
|
||||
|
||||
/**
|
||||
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
|
||||
* we can allow user use Undo option.
|
||||
*/
|
||||
bool openingPattern;
|
||||
|
||||
/** @brief mode keep current draw mode. */
|
||||
Draw mode;
|
||||
|
||||
void ClearTranslation();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractApplication::GetCustomerName() const
|
||||
{
|
||||
return m_customerName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractApplication::SetCustomerName(const QString &name)
|
||||
{
|
||||
m_customerName = name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractApplication::GetPatternPath() const
|
||||
{
|
||||
return patternFilePath;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractApplication::SetPatternPath(const QString &value)
|
||||
{
|
||||
patternFilePath = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QMap<int, QString> VAbstractApplication::GetUserMaterials() const
|
||||
{
|
||||
return m_userMaterials;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractApplication::SetUserMaterials(const QMap<int, QString> &userMaterials)
|
||||
{
|
||||
m_userMaterials = userMaterials;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
inline QString VAbstractApplication::LocaleToString(const T &value)
|
||||
|
|
80
src/libs/vmisc/vabstractvalapplication.cpp
Normal file
80
src/libs/vmisc/vabstractvalapplication.cpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vabstractvalapplication.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 15 10, 2020
|
||||
**
|
||||
** @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) 2020 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 "vabstractvalapplication.h"
|
||||
#include "../vmisc/customevents.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
const QString VAbstractValApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractValApplication::VAbstractValApplication(int &argc, char **argv)
|
||||
: VAbstractApplication(argc, argv)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
double VAbstractValApplication::toPixel(double val) const
|
||||
{
|
||||
return ToPixel(val, m_patternUnits);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
double VAbstractValApplication::fromPixel(double pix) const
|
||||
{
|
||||
return FromPixel(pix, m_patternUnits);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractValApplication::PostPatternMessage(const QString &message, QtMsgType severity) const
|
||||
{
|
||||
QApplication::postEvent(mainWindow,
|
||||
new PatternMessageEvent(VAbstractValApplication::ClearMessage(message), severity));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ClearMessage helps to clear a message string from standard Qt function.
|
||||
* @param msg the message that contains '"' at the start and at the end
|
||||
* @return cleared string
|
||||
*/
|
||||
QString VAbstractValApplication::ClearMessage(QString msg)
|
||||
{
|
||||
if (msg.startsWith('"') && msg.endsWith('"'))
|
||||
{
|
||||
msg.remove(0, 1);
|
||||
msg.chop(1);
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractValApplication::IsPatternMessage(const QString &message) const
|
||||
{
|
||||
return VAbstractValApplication::ClearMessage(message).startsWith(patternMessageSignature);
|
||||
}
|
394
src/libs/vmisc/vabstractvalapplication.h
Normal file
394
src/libs/vmisc/vabstractvalapplication.h
Normal file
|
@ -0,0 +1,394 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vabstractvalapplication.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 15 10, 2020
|
||||
**
|
||||
** @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) 2020 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 VABSTRACTVALAPPLICATION_H
|
||||
#define VABSTRACTVALAPPLICATION_H
|
||||
|
||||
#include "vabstractapplication.h"
|
||||
|
||||
#include <QDate>
|
||||
|
||||
class VAbstractValApplication;// use in define
|
||||
class VAbstractPattern;
|
||||
class VMainGraphicsView;
|
||||
class QGraphicsScene;
|
||||
|
||||
#if defined(qApp)
|
||||
#undef qApp
|
||||
#endif
|
||||
#define qApp (static_cast<VAbstractValApplication*>(QCoreApplication::instance()))
|
||||
|
||||
class VAbstractValApplication : public VAbstractApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VAbstractValApplication(int &argc, char **argv);
|
||||
virtual ~VAbstractValApplication() =default;
|
||||
|
||||
QString GetCustomerName() const;
|
||||
void SetCustomerName(const QString &name);
|
||||
|
||||
QDate GetCustomerBirthDate() const;
|
||||
void SetCustomerBirthDate(const QDate &date);
|
||||
|
||||
QString CustomerEmail() const;
|
||||
void SetCustomerEmail(const QString &email);
|
||||
|
||||
Unit patternUnits() const;
|
||||
const Unit *patternUnitsP() const;
|
||||
void SetPatternUnits(const Unit &patternUnit);
|
||||
|
||||
MeasurementsType GetMeasurementsType() const;
|
||||
void SetMeasurementsType(const MeasurementsType &patternType);
|
||||
|
||||
Unit MeasurementsUnits() const;
|
||||
void SetMeasurementsUnits(const Unit &measurementsUnits);
|
||||
|
||||
Unit DimensionSizeUnits() const;
|
||||
void SetDimensionSizeUnits(const Unit &sizeUnits);
|
||||
|
||||
double toPixel(double val) const;
|
||||
double fromPixel(double pix) const;
|
||||
|
||||
void setCurrentDocument(VAbstractPattern *doc);
|
||||
VAbstractPattern *getCurrentDocument() const;
|
||||
|
||||
VMainGraphicsView *getSceneView() const;
|
||||
void setSceneView(VMainGraphicsView *value);
|
||||
|
||||
QGraphicsScene *getCurrentScene() const;
|
||||
void setCurrentScene(QGraphicsScene **value);
|
||||
|
||||
QWidget *getMainWindow() const;
|
||||
void setMainWindow(QWidget *value);
|
||||
|
||||
QString GetPatternPath() const;
|
||||
void SetPatternPath(const QString &value);
|
||||
|
||||
QMap<int, QString> GetUserMaterials() const;
|
||||
void SetUserMaterials(const QMap<int, QString> &userMaterials);
|
||||
|
||||
const Draw &GetDrawMode() const;
|
||||
void SetDrawMode(const Draw &value);
|
||||
|
||||
bool getOpeningPattern() const;
|
||||
void setOpeningPattern();
|
||||
|
||||
void PostPatternMessage(const QString &message, QtMsgType severity) const;
|
||||
|
||||
static QString ClearMessage(QString msg);
|
||||
|
||||
static const QString patternMessageSignature;
|
||||
bool IsPatternMessage(const QString &message) const;
|
||||
|
||||
qreal GetDimensionHeight() const;
|
||||
void SetDimensionHeight(qreal dimensionHeight);
|
||||
|
||||
qreal GetDimensionSize() const;
|
||||
void SetDimensionSize(qreal dimensionSize);
|
||||
|
||||
qreal GetDimensionHip() const;
|
||||
void SetDimensionHip(qreal dimensionHip);
|
||||
|
||||
qreal GetDimensionWaist() const;
|
||||
void SetDimensionWaist(qreal dimensionWaist);
|
||||
|
||||
protected:
|
||||
QString m_customerName{};
|
||||
QDate m_customerBirthDate{};
|
||||
QString m_customerEmail{};
|
||||
|
||||
Unit m_patternUnits{Unit::Cm};
|
||||
MeasurementsType m_measurementsType{MeasurementsType::Unknown};
|
||||
Unit m_measurementsUnits{Unit::Cm};
|
||||
VAbstractPattern *m_doc{nullptr};
|
||||
VMainGraphicsView *m_sceneView{nullptr};
|
||||
QGraphicsScene **m_currentScene{nullptr};
|
||||
QString m_patternFilePath{};
|
||||
QMap<int, QString> m_userMaterials{};
|
||||
|
||||
qreal m_dimensionHeight{0};
|
||||
qreal m_dimensionSize{0};
|
||||
qreal m_dimensionHip{0};
|
||||
qreal m_dimensionWaist{0};
|
||||
|
||||
Unit m_dimensionSizeUnits{Unit::Cm};
|
||||
|
||||
/**
|
||||
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
|
||||
* modality doesn't work.
|
||||
*/
|
||||
QWidget *mainWindow{nullptr};
|
||||
|
||||
/** @brief mode keep current draw mode. */
|
||||
Draw m_mode{Draw::Calculation};
|
||||
|
||||
/**
|
||||
* @brief openingPattern true when we opening pattern. If something will be wrong in formula this help understand if
|
||||
* we can allow user use Undo option.
|
||||
*/
|
||||
bool openingPattern{false};
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractValApplication)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractValApplication::GetCustomerName() const
|
||||
{
|
||||
return m_customerName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetCustomerName(const QString &name)
|
||||
{
|
||||
m_customerName = name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline Unit VAbstractValApplication::patternUnits() const
|
||||
{
|
||||
return m_patternUnits;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline const Unit *VAbstractValApplication::patternUnitsP() const
|
||||
{
|
||||
return &m_patternUnits;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetPatternUnits(const Unit &patternUnit)
|
||||
{
|
||||
m_patternUnits = patternUnit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline MeasurementsType VAbstractValApplication::GetMeasurementsType() const
|
||||
{
|
||||
return m_measurementsType;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetMeasurementsType(const MeasurementsType &patternType)
|
||||
{
|
||||
m_measurementsType = patternType;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline Unit VAbstractValApplication::MeasurementsUnits() const
|
||||
{
|
||||
return m_measurementsUnits;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetMeasurementsUnits(const Unit &measurementsUnits)
|
||||
{
|
||||
m_measurementsUnits = measurementsUnits;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline Unit VAbstractValApplication::DimensionSizeUnits() const
|
||||
{
|
||||
return m_dimensionSizeUnits;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionSizeUnits(const Unit &sizeUnits)
|
||||
{
|
||||
m_dimensionSizeUnits = sizeUnits;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::setCurrentDocument(VAbstractPattern *doc)
|
||||
{
|
||||
m_doc = doc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline VAbstractPattern *VAbstractValApplication::getCurrentDocument() const
|
||||
{
|
||||
return m_doc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline VMainGraphicsView *VAbstractValApplication::getSceneView() const
|
||||
{
|
||||
return m_sceneView;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::setSceneView(VMainGraphicsView *value)
|
||||
{
|
||||
m_sceneView = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QGraphicsScene *VAbstractValApplication::getCurrentScene() const
|
||||
{
|
||||
return *m_currentScene;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::setCurrentScene(QGraphicsScene **value)
|
||||
{
|
||||
m_currentScene = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QWidget *VAbstractValApplication::getMainWindow() const
|
||||
{
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::setMainWindow(QWidget *value)
|
||||
{
|
||||
mainWindow = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractValApplication::GetPatternPath() const
|
||||
{
|
||||
return m_patternFilePath;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetPatternPath(const QString &value)
|
||||
{
|
||||
m_patternFilePath = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QMap<int, QString> VAbstractValApplication::GetUserMaterials() const
|
||||
{
|
||||
return m_userMaterials;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetUserMaterials(const QMap<int, QString> &userMaterials)
|
||||
{
|
||||
m_userMaterials = userMaterials;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline const Draw &VAbstractValApplication::GetDrawMode() const
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDrawMode(const Draw &value)
|
||||
{
|
||||
m_mode = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool VAbstractValApplication::getOpeningPattern() const
|
||||
{
|
||||
return openingPattern;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::setOpeningPattern()
|
||||
{
|
||||
openingPattern = !openingPattern;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline qreal VAbstractValApplication::GetDimensionHeight() const
|
||||
{
|
||||
return m_dimensionHeight;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionHeight(qreal dimensionHeight)
|
||||
{
|
||||
m_dimensionHeight = dimensionHeight;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline qreal VAbstractValApplication::GetDimensionSize() const
|
||||
{
|
||||
return m_dimensionSize;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionSize(qreal dimensionSize)
|
||||
{
|
||||
m_dimensionSize = dimensionSize;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline qreal VAbstractValApplication::GetDimensionHip() const
|
||||
{
|
||||
return m_dimensionHip;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionHip(qreal dimensionHip)
|
||||
{
|
||||
m_dimensionHip = dimensionHip;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline qreal VAbstractValApplication::GetDimensionWaist() const
|
||||
{
|
||||
return m_dimensionWaist;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetDimensionWaist(qreal dimensionWaist)
|
||||
{
|
||||
m_dimensionWaist = dimensionWaist;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QDate VAbstractValApplication::GetCustomerBirthDate() const
|
||||
{
|
||||
return m_customerBirthDate;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetCustomerBirthDate(const QDate &date)
|
||||
{
|
||||
m_customerBirthDate = date;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstractValApplication::CustomerEmail() const
|
||||
{
|
||||
return m_customerEmail;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstractValApplication::SetCustomerEmail(const QString &email)
|
||||
{
|
||||
m_customerEmail = email;
|
||||
}
|
||||
|
||||
#endif // VABSTRACTVALAPPLICATION_H
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
SOURCES += \
|
||||
$$PWD/def.cpp \
|
||||
$$PWD/vabstractvalapplication.cpp \
|
||||
$$PWD/vsettings.cpp \
|
||||
$$PWD/vabstractapplication.cpp \
|
||||
$$PWD/projectversion.cpp \
|
||||
|
@ -27,6 +28,7 @@ HEADERS += \
|
|||
$$PWD/compatibility.h \
|
||||
$$PWD/stable.h \
|
||||
$$PWD/def.h \
|
||||
$$PWD/vabstractvalapplication.h \
|
||||
$$PWD/vmath.h \
|
||||
$$PWD/vsettings.h \
|
||||
$$PWD/vabstractapplication.h \
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, (QLatin1String("database/geometry")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefHeight, (QLatin1String("gradation/defHeight")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefSize, (QLatin1String("gradation/defSize")))
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -60,27 +57,3 @@ void VTapeSettings::SetDataBaseGeometry(const QByteArray &value)
|
|||
{
|
||||
setValue(*settingDataBaseGeometry, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTapeSettings::SetDefHeight(int value)
|
||||
{
|
||||
setValue(*settingDefHeight, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VTapeSettings::GetDefHeight() const
|
||||
{
|
||||
return value(*settingDefHeight, 176).toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTapeSettings::SetDefSize(int value)
|
||||
{
|
||||
setValue(*settingDefSize, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VTapeSettings::GetDefSize() const
|
||||
{
|
||||
return value(*settingDefSize, 50).toInt();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user