Move "Name of detail" field to Main path tab.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-01-03 20:07:55 +02:00
parent f52b690827
commit 8b2b9d3ee3
3 changed files with 102 additions and 99 deletions

View File

@ -153,7 +153,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
InitPlaceLabelsTab(); InitPlaceLabelsTab();
flagName = true;//We have default name of piece. flagName = true;//We have default name of piece.
ChangeColor(uiTabLabels->labelEditName, okColor); ChangeColor(uiTabPaths->labelEditName, okColor);
flagMainPathIsValid = MainPathIsValid(); flagMainPathIsValid = MainPathIsValid();
CheckState(); CheckState();
@ -303,7 +303,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
uiTabPaths->checkBoxForceFlipping->setChecked(piece.IsForceFlipping()); uiTabPaths->checkBoxForceFlipping->setChecked(piece.IsForceFlipping());
uiTabPaths->checkBoxSeams->setChecked(piece.IsSeamAllowance()); uiTabPaths->checkBoxSeams->setChecked(piece.IsSeamAllowance());
uiTabPaths->checkBoxBuiltIn->setChecked(piece.IsSeamAllowanceBuiltIn()); uiTabPaths->checkBoxBuiltIn->setChecked(piece.IsSeamAllowanceBuiltIn());
uiTabLabels->lineEditName->setText(piece.GetName()); uiTabPaths->lineEditName->setText(piece.GetName());
const QString width = qApp->TrVars()->FormulaToUser(piece.GetFormulaSAWidth(), qApp->Settings()->GetOsSeparator()); const QString width = qApp->TrVars()->FormulaToUser(piece.GetFormulaSAWidth(), qApp->Settings()->GetOsSeparator());
uiTabPaths->plainTextEditFormulaWidth->setPlainText(width); uiTabPaths->plainTextEditFormulaWidth->setPlainText(width);
@ -480,7 +480,7 @@ void DialogSeamAllowance::CheckState()
if (flagFormula && flagFormulaBefore && flagFormulaAfter) if (flagFormula && flagFormulaBefore && flagFormulaAfter)
{ {
if (flagMainPathIsValid) if (flagMainPathIsValid && flagName)
{ {
m_ftb->SetTabText(TabOrder::Paths, tr("Paths")); m_ftb->SetTabText(TabOrder::Paths, tr("Paths"));
} }
@ -495,7 +495,7 @@ void DialogSeamAllowance::CheckState()
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon); uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon);
} }
if (flagMainPathIsValid) if (flagMainPathIsValid && flagName)
{ {
if (flagFormula && flagFormulaBefore && flagFormulaAfter) if (flagFormula && flagFormulaBefore && flagFormulaAfter)
{ {
@ -578,19 +578,12 @@ void DialogSeamAllowance::NameDetailChanged()
if (edit->text().isEmpty()) if (edit->text().isEmpty())
{ {
flagName = false; flagName = false;
ChangeColor(uiTabLabels->labelEditName, Qt::red); ChangeColor(uiTabPaths->labelEditName, Qt::red);
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
const QIcon icon = QIcon::fromTheme("dialog-warning",
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabPieceLabelData), icon);
} }
else else
{ {
flagName = true; flagName = true;
ChangeColor(uiTabLabels->labelEditName, okColor); ChangeColor(uiTabPaths->labelEditName, okColor);
m_ftb->SetTabText(TabOrder::Labels, tr("Labels"));
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabPieceLabelData),
QIcon());
} }
} }
CheckState(); CheckState();
@ -2288,7 +2281,7 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked()); piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked()); piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked());
piece.SetHideMainPath(uiTabPaths->checkBoxHideMainPath->isChecked()); piece.SetHideMainPath(uiTabPaths->checkBoxHideMainPath->isChecked());
piece.SetName(uiTabLabels->lineEditName->text()); piece.SetName(uiTabPaths->lineEditName->text());
piece.SetMx(m_mx); piece.SetMx(m_mx);
piece.SetMy(m_my); piece.SetMy(m_my);
piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth); piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth);
@ -2615,6 +2608,11 @@ void DialogSeamAllowance::InitFancyTabBar()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitMainPathTab() void DialogSeamAllowance::InitMainPathTab()
{ {
connect(uiTabPaths->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged);
uiTabPaths->lineEditName->setClearButtonEnabled(true);
uiTabPaths->lineEditName->setText(GetDefaultPieceName());
connect(uiTabPaths->checkBoxForbidFlipping, &QCheckBox::stateChanged, this, [this](int state) connect(uiTabPaths->checkBoxForbidFlipping, &QCheckBox::stateChanged, this, [this](int state)
{ {
if (state == Qt::Checked) if (state == Qt::Checked)
@ -2784,7 +2782,6 @@ void DialogSeamAllowance::InitInternalPathsTab()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitPatternPieceDataTab() void DialogSeamAllowance::InitPatternPieceDataTab()
{ {
uiTabLabels->lineEditName->setClearButtonEnabled(true);
uiTabLabels->lineEditLetter->setClearButtonEnabled(true); uiTabLabels->lineEditLetter->setClearButtonEnabled(true);
uiTabLabels->lineEditAnnotation->setClearButtonEnabled(true); uiTabLabels->lineEditAnnotation->setClearButtonEnabled(true);
uiTabLabels->lineEditOrientation->setClearButtonEnabled(true); uiTabLabels->lineEditOrientation->setClearButtonEnabled(true);
@ -2792,7 +2789,6 @@ void DialogSeamAllowance::InitPatternPieceDataTab()
uiTabLabels->lineEditTilt->setClearButtonEnabled(true); uiTabLabels->lineEditTilt->setClearButtonEnabled(true);
uiTabLabels->lineEditFoldPosition->setClearButtonEnabled(true); uiTabLabels->lineEditFoldPosition->setClearButtonEnabled(true);
connect(uiTabLabels->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged);
connect(uiTabLabels->pushButtonEditPieceLabel, &QPushButton::clicked, this, &DialogSeamAllowance::EditLabel); connect(uiTabLabels->pushButtonEditPieceLabel, &QPushButton::clicked, this, &DialogSeamAllowance::EditLabel);
} }
@ -2863,8 +2859,6 @@ void DialogSeamAllowance::InitLabelsTab()
connect(uiTabLabels->pushButtonShowPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLHeight); connect(uiTabLabels->pushButtonShowPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLHeight);
connect(uiTabLabels->pushButtonShowPLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLAngle); connect(uiTabLabels->pushButtonShowPLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLAngle);
uiTabLabels->lineEditName->setText(GetDefaultPieceName());
EnabledPatternLabel(); EnabledPatternLabel();
} }

View File

@ -104,33 +104,13 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="labelEditName">
<property name="text">
<string>Name of detail:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="VLineEdit" name="lineEditName">
<property name="text">
<string>Detail</string>
</property>
<property name="maxLength">
<number>30</number>
</property>
<property name="placeholderText">
<string>Name can't be empty</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelQuantity"> <widget class="QLabel" name="labelQuantity">
<property name="text"> <property name="text">
<string>Quantity:</string> <string>Quantity:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBoxQuantity"> <widget class="QSpinBox" name="spinBoxQuantity">
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
@ -143,90 +123,90 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Placement:</string> <string>Placement:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="checkBoxFold"> <widget class="QCheckBox" name="checkBoxFold">
<property name="text"> <property name="text">
<string>on fold</string> <string>on fold</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Annotation:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="VLineEdit" name="lineEditAnnotation">
<property name="placeholderText">
<string>A text field to add comments in</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Orientation:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="VLineEdit" name="lineEditOrientation">
<property name="placeholderText">
<string notr="true">&quot;Left&quot;/&quot;Right&quot;/&quot;Undefined&quot;</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Rotation:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="VLineEdit" name="lineEditRotation">
<property name="placeholderText">
<string notr="true">&quot;1-Way&quot;/&quot;2-Way&quot;/&quot;4-Way&quot;/&quot;Any&quot;</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Tilt:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="VLineEdit" name="lineEditTilt">
<property name="placeholderText">
<string notr="true">&quot;CW X&quot;/&quot;CCW X&quot;</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Fold position:</string> <string>Fold position:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="3" column="1">
<widget class="VLineEdit" name="lineEditFoldPosition"> <widget class="VLineEdit" name="lineEditFoldPosition">
<property name="placeholderText"> <property name="placeholderText">
<string notr="true">&quot;Up/Down&quot;/&quot;Left/Right&quot;</string> <string notr="true">&quot;Up/Down&quot;/&quot;Left/Right&quot;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Annotation:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="VLineEdit" name="lineEditAnnotation">
<property name="placeholderText">
<string>A text field to add comments in</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Orientation:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="VLineEdit" name="lineEditOrientation">
<property name="placeholderText">
<string notr="true">&quot;Left&quot;/&quot;Right&quot;/&quot;Undefined&quot;</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Rotation:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="VLineEdit" name="lineEditRotation">
<property name="placeholderText">
<string notr="true">&quot;1-Way&quot;/&quot;2-Way&quot;/&quot;4-Way&quot;/&quot;Any&quot;</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Tilt:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="VLineEdit" name="lineEditTilt">
<property name="placeholderText">
<string notr="true">&quot;CW X&quot;/&quot;CCW X&quot;</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -73,6 +73,30 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelEditName">
<property name="text">
<string>Name of detail:</string>
</property>
</widget>
</item>
<item>
<widget class="VLineEdit" name="lineEditName">
<property name="text">
<string>Detail</string>
</property>
<property name="maxLength">
<number>30</number>
</property>
<property name="placeholderText">
<string>Name can't be empty</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QCheckBox" name="checkBoxForbidFlipping"> <widget class="QCheckBox" name="checkBoxForbidFlipping">
<property name="toolTip"> <property name="toolTip">
@ -945,6 +969,11 @@
<extends>QPlainTextEdit</extends> <extends>QPlainTextEdit</extends>
<header location="global">vplaintextedit.h</header> <header location="global">vplaintextedit.h</header>
</customwidget> </customwidget>
<customwidget>
<class>VLineEdit</class>
<extends>QLineEdit</extends>
<header>vlineedit.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../../../../../vmisc/share/resources/icon.qrc"/> <include location="../../../../../vmisc/share/resources/icon.qrc"/>