diff --git a/src/libs/vmisc/share/resources/icon.qrc b/src/libs/vmisc/share/resources/icon.qrc index 012520e8b..0eb3b135e 100644 --- a/src/libs/vmisc/share/resources/icon.qrc +++ b/src/libs/vmisc/share/resources/icon.qrc @@ -66,5 +66,13 @@ icon/16x16/forbid_detail@2x.png icon/16x16/toolsectionelarc.png icon/16x16/toolsectionelarc@2x.png + icon/32x32/grainline.png + icon/32x32/grainline@2x.png + icon/32x32/labels.png + icon/32x32/labels@2x.png + icon/32x32/paths.png + icon/32x32/paths@2x.png + icon/32x32/pins.png + icon/32x32/pins@2x.png diff --git a/src/libs/vmisc/share/resources/icon/32x32/grainline.png b/src/libs/vmisc/share/resources/icon/32x32/grainline.png new file mode 100644 index 000000000..025484b09 Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/grainline.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/grainline@2x.png b/src/libs/vmisc/share/resources/icon/32x32/grainline@2x.png new file mode 100644 index 000000000..2c555bbef Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/grainline@2x.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/labels.png b/src/libs/vmisc/share/resources/icon/32x32/labels.png new file mode 100644 index 000000000..499a75680 Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/labels.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/labels@2x.png b/src/libs/vmisc/share/resources/icon/32x32/labels@2x.png new file mode 100644 index 000000000..680e725b1 Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/labels@2x.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/paths.png b/src/libs/vmisc/share/resources/icon/32x32/paths.png new file mode 100644 index 000000000..5a2143783 Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/paths.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/paths@2x.png b/src/libs/vmisc/share/resources/icon/32x32/paths@2x.png new file mode 100644 index 000000000..8cb564ea1 Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/paths@2x.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/pins.png b/src/libs/vmisc/share/resources/icon/32x32/pins.png new file mode 100644 index 000000000..f9cbd2266 Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/pins.png differ diff --git a/src/libs/vmisc/share/resources/icon/32x32/pins@2x.png b/src/libs/vmisc/share/resources/icon/32x32/pins@2x.png new file mode 100644 index 000000000..947a8a7fb Binary files /dev/null and b/src/libs/vmisc/share/resources/icon/32x32/pins@2x.png differ diff --git a/src/libs/vmisc/share/resources/icon/svg/labels.svg b/src/libs/vmisc/share/resources/icon/svg/labels.svg new file mode 100644 index 000000000..75b45b093 --- /dev/null +++ b/src/libs/vmisc/share/resources/icon/svg/labels.svg @@ -0,0 +1,70 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/src/libs/vmisc/share/resources/icon/svg/paths.svg b/src/libs/vmisc/share/resources/icon/svg/paths.svg new file mode 100644 index 000000000..d8168e7ad --- /dev/null +++ b/src/libs/vmisc/share/resources/icon/svg/paths.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index 135de7182..4e4f2d5c4 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -42,7 +42,7 @@ HEADERS += \ $$PWD/tools/dialogflippingbyaxis.h \ $$PWD/tools/dialogmove.h \ $$PWD/tools/dialogellipticalarc.h \ - $$PWD/tools/dialogseamallowance.h \ + $$PWD/tools/piece/dialogseamallowance.h \ $$PWD/tools/dialogpiecepath.h \ $$PWD/tools/dialogpin.h @@ -86,7 +86,7 @@ SOURCES += \ $$PWD/tools/dialogflippingbyaxis.cpp \ $$PWD/tools/dialogmove.cpp \ $$PWD/tools/dialogellipticalarc.cpp \ - $$PWD/tools/dialogseamallowance.cpp \ + $$PWD/tools/piece/dialogseamallowance.cpp \ $$PWD/tools/dialogpiecepath.cpp \ $$PWD/tools/dialogpin.cpp @@ -129,6 +129,10 @@ FORMS += \ $$PWD/tools/dialogflippingbyaxis.ui \ $$PWD/tools/dialogmove.ui \ $$PWD/tools/dialogellipticalarc.ui \ - $$PWD/tools/dialogseamallowance.ui \ + $$PWD/tools/piece/dialogseamallowance.ui \ $$PWD/tools/dialogpiecepath.ui \ - $$PWD/tools/dialogpin.ui + $$PWD/tools/dialogpin.ui \ + $$PWD/tools/piece/tabs/tabpaths.ui \ + $$PWD/tools/piece/tabs/tablabels.ui \ + $$PWD/tools/piece/tabs/tabgrainline.ui \ + $$PWD/tools/piece/tabs/tabpins.ui diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index a98fe7402..8bd6558ac 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -33,7 +33,7 @@ #include "tools/dialogarc.h" #include "tools/dialogarcwithlength.h" #include "tools/dialogbisector.h" -#include "tools/dialogseamallowance.h" +#include "tools/piece/dialogseamallowance.h" #include "tools/dialogendline.h" #include "tools/dialogline.h" #include "tools/dialoglineintersect.h" diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp similarity index 62% rename from src/libs/vtools/dialogs/tools/dialogseamallowance.cpp rename to src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 5d1b63e6f..b5af43c71 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -28,19 +28,26 @@ #include "dialogseamallowance.h" #include "ui_dialogseamallowance.h" +#include "ui_tabpaths.h" +#include "ui_tablabels.h" +#include "ui_tabgrainline.h" +#include "ui_tabpins.h" +#include "../vwidgets/fancytabbar/fancytabbar.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/calculator.h" #include "visualization/path/vistoolpiece.h" #include "visualization/path/vispiecepins.h" -#include "dialogpiecepath.h" -#include "../../undocommands/savepiecepathoptions.h" -#include "../support/dialogeditwrongformula.h" +#include "../dialogpiecepath.h" +#include "../../../undocommands/savepiecepathoptions.h" +#include "../../support/dialogeditwrongformula.h" #include #include #include +enum TabOrder {Paths=0, Labels=1, Grainline=2, Pins=3, Count}; + namespace { //--------------------------------------------------------------------------------------------------------------------- @@ -69,6 +76,16 @@ QString GetFormulaFromUser(QPlainTextEdit *textEdit) DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent) : DialogTool(data, toolId, parent), ui(new Ui::DialogSeamAllowance), + uiTabPaths(new Ui::TabPaths), + uiTabLabels(new Ui::TabLabels), + uiTabGrainline(new Ui::TabGrainline), + uiTabPins(new Ui::TabPins), + m_tabPaths(new QWidget), + m_tabLabels(new QWidget), + m_tabGrainline(new QWidget), + m_tabPins(new QWidget), + m_ftb(new FancyTabBar(FancyTabBar::Left, this)), + dialogIsInitialized(false), applyAllowed(false),// By default disabled flagGPin(true), flagDPin(true), @@ -108,6 +125,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & ui->setupUi(this); InitOkCancelApply(ui); + InitFancyTabBar(); EnableApply(applyAllowed); InitMainPathTab(); @@ -118,10 +136,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & InitGrainlineTab(); InitPinsTab(); - connect(ui->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged); - flagName = true;//We have default name of piece. - ChangeColor(ui->labelEditName, okColor); + ChangeColor(uiTabLabels->labelEditName, okColor); flagError = MainPathIsValid(); CheckState(); @@ -130,13 +146,21 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & vis = new VisToolPiece(data); } - ui->tabWidget->setCurrentIndex(0);// Show always first tab active on start. + m_ftb->SetCurrentIndex(TabOrder::Paths);// Show always first tab active on start. } //--------------------------------------------------------------------------------------------------------------------- DialogSeamAllowance::~DialogSeamAllowance() { delete m_visPins; + delete m_tabPins; + delete m_tabGrainline; + delete m_tabLabels; + delete m_tabPaths; + delete uiTabPins; + delete uiTabGrainline; + delete uiTabLabels; + delete uiTabPaths; delete ui; } @@ -146,12 +170,12 @@ void DialogSeamAllowance::EnableApply(bool enable) SCASSERT(bApply != nullptr); bApply->setEnabled(enable); applyAllowed = enable; - ui->tabSeamAllowance->setEnabled(applyAllowed); - ui->tabInternalPaths->setEnabled(applyAllowed); - ui->tabPieceLabelData->setEnabled(applyAllowed); - ui->tabLabels->setEnabled(applyAllowed); - ui->tabGrainline->setEnabled(applyAllowed); - ui->tabPins->setEnabled(applyAllowed); + + uiTabPaths->tabSeamAllowance->setEnabled(applyAllowed); + uiTabPaths->tabInternalPaths->setEnabled(applyAllowed); + m_ftb->SetTabEnabled(TabOrder::Labels, applyAllowed); + m_ftb->SetTabEnabled(TabOrder::Grainline, applyAllowed); + m_ftb->SetTabEnabled(TabOrder::Pins, applyAllowed); } //--------------------------------------------------------------------------------------------------------------------- @@ -163,27 +187,27 @@ VPiece DialogSeamAllowance::GetPiece() const //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::SetPiece(const VPiece &piece) { - ui->listWidgetMainPath->clear(); + uiTabPaths->listWidgetMainPath->clear(); for (int i = 0; i < piece.GetPath().CountNodes(); ++i) { NewMainPathItem(piece.GetPath().at(i)); } - ui->listWidgetCustomSA->blockSignals(true); - ui->listWidgetCustomSA->clear(); + uiTabPaths->listWidgetCustomSA->blockSignals(true); + uiTabPaths->listWidgetCustomSA->clear(); for (int i = 0; i < piece.GetCustomSARecords().size(); ++i) { NewCustomSA(piece.GetCustomSARecords().at(i)); } - ui->listWidgetCustomSA->blockSignals(false); + uiTabPaths->listWidgetCustomSA->blockSignals(false); - ui->listWidgetInternalPaths->clear(); + uiTabPaths->listWidgetInternalPaths->clear(); for (int i = 0; i < piece.GetInternalPaths().size(); ++i) { NewInternalPath(piece.GetInternalPaths().at(i)); } - ui->listWidgetPins->clear(); + uiTabPins->listWidgetPins->clear(); for (int i = 0; i < piece.GetPins().size(); ++i) { NewPin(piece.GetPins().at(i)); @@ -191,28 +215,28 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) InitAllPinComboboxes(); - ui->comboBoxStartPoint->blockSignals(true); - ui->comboBoxStartPoint->clear(); - ui->comboBoxStartPoint->blockSignals(false); + uiTabPaths->comboBoxStartPoint->blockSignals(true); + uiTabPaths->comboBoxStartPoint->clear(); + uiTabPaths->comboBoxStartPoint->blockSignals(false); - ui->comboBoxEndPoint->blockSignals(true); - ui->comboBoxEndPoint->clear(); - ui->comboBoxEndPoint->blockSignals(false); + uiTabPaths->comboBoxEndPoint->blockSignals(true); + uiTabPaths->comboBoxEndPoint->clear(); + uiTabPaths->comboBoxEndPoint->blockSignals(false); CustomSAChanged(0); - ui->checkBoxForbidFlipping->setChecked(piece.IsForbidFlipping()); - ui->checkBoxSeams->setChecked(piece.IsSeamAllowance()); - ui->lineEditName->setText(piece.GetName()); + uiTabPaths->checkBoxForbidFlipping->setChecked(piece.IsForbidFlipping()); + uiTabPaths->checkBoxSeams->setChecked(piece.IsSeamAllowance()); + uiTabLabels->lineEditName->setText(piece.GetName()); const QString width = qApp->TrVars()->FormulaToUser(piece.GetFormulaSAWidth(), qApp->Settings()->GetOsSeparator()); - ui->plainTextEditFormulaWidth->setPlainText(width); + uiTabPaths->plainTextEditFormulaWidth->setPlainText(width); m_saWidth = piece.GetSAWidth(); m_mx = piece.GetMx(); m_my = piece.GetMy(); - ui->lineEditLetter->setText(piece.GetPatternPieceData().GetLetter()); + uiTabLabels->lineEditLetter->setText(piece.GetPatternPieceData().GetLetter()); m_conMCP.clear(); for (int i = 0; i < piece.GetPatternPieceData().GetMCPCount(); ++i) @@ -222,31 +246,31 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) UpdateList(); - ui->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); + uiTabGrainline->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); m_oldData = piece.GetPatternPieceData(); - ui->groupBoxDetailLabel->setChecked(m_oldData.IsVisible()); - ChangeCurrentData(ui->comboBoxDLCenterPin, m_oldData.CenterPin()); - ChangeCurrentData(ui->comboBoxDLTopLeftPin, m_oldData.TopLeftPin()); - ChangeCurrentData(ui->comboBoxDLBottomRightPin, m_oldData.BottomRightPin()); + uiTabLabels->groupBoxDetailLabel->setChecked(m_oldData.IsVisible()); + ChangeCurrentData(uiTabLabels->comboBoxDLCenterPin, m_oldData.CenterPin()); + ChangeCurrentData(uiTabLabels->comboBoxDLTopLeftPin, m_oldData.TopLeftPin()); + ChangeCurrentData(uiTabLabels->comboBoxDLBottomRightPin, m_oldData.BottomRightPin()); SetDLWidth(m_oldData.GetLabelWidth()); SetDLHeight(m_oldData.GetLabelHeight()); SetDLAngle(m_oldData.GetRotation()); m_oldGeom = piece.GetPatternInfo(); - ui->groupBoxPatternLabel->setChecked(m_oldGeom.IsVisible()); - ChangeCurrentData(ui->comboBoxPLCenterPin, m_oldGeom.CenterPin()); - ChangeCurrentData(ui->comboBoxPLTopLeftPin, m_oldGeom.TopLeftPin()); - ChangeCurrentData(ui->comboBoxPLBottomRightPin, m_oldGeom.BottomRightPin()); + uiTabLabels->groupBoxPatternLabel->setChecked(m_oldGeom.IsVisible()); + ChangeCurrentData(uiTabLabels->comboBoxPLCenterPin, m_oldGeom.CenterPin()); + ChangeCurrentData(uiTabLabels->comboBoxPLTopLeftPin, m_oldGeom.TopLeftPin()); + ChangeCurrentData(uiTabLabels->comboBoxPLBottomRightPin, m_oldGeom.BottomRightPin()); SetPLWidth(m_oldGeom.GetLabelWidth()); SetPLHeight(m_oldGeom.GetLabelHeight()); SetPLAngle(m_oldGeom.GetRotation()); m_oldGrainline = piece.GetGrainlineGeometry(); - ui->groupBoxGrainline->setChecked(m_oldGrainline.IsVisible()); - ChangeCurrentData(ui->comboBoxGrainlineCenterPin, m_oldGrainline.CenterPin()); - ChangeCurrentData(ui->comboBoxGrainlineTopPin, m_oldGrainline.TopPin()); - ChangeCurrentData(ui->comboBoxGrainlineBottomPin, m_oldGrainline.BottomPin()); + uiTabGrainline->groupBoxGrainline->setChecked(m_oldGrainline.IsVisible()); + ChangeCurrentData(uiTabGrainline->comboBoxGrainlineCenterPin, m_oldGrainline.CenterPin()); + ChangeCurrentData(uiTabGrainline->comboBoxGrainlineTopPin, m_oldGrainline.TopPin()); + ChangeCurrentData(uiTabGrainline->comboBoxGrainlineBottomPin, m_oldGrainline.BottomPin()); SetGrainlineAngle(m_oldGrainline.GetRotation()); SetGrainlineLength(m_oldGrainline.GetLength()); @@ -302,7 +326,7 @@ void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type) } else { - if (ui->listWidgetMainPath->count() > 1) + if (uiTabPaths->listWidgetMainPath->count() > 1) { delete GetItemById(id); } @@ -381,18 +405,38 @@ void DialogSeamAllowance::CheckState() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::closeEvent(QCloseEvent *event) { - ui->plainTextEditFormulaWidth->blockSignals(true); - ui->plainTextEditFormulaWidthBefore->blockSignals(true); - ui->plainTextEditFormulaWidthAfter->blockSignals(true); - ui->lineEditRotFormula->blockSignals(true); - ui->lineEditLenFormula->blockSignals(true); + uiTabPaths->plainTextEditFormulaWidth->blockSignals(true); + uiTabPaths->plainTextEditFormulaWidthBefore->blockSignals(true); + uiTabPaths->plainTextEditFormulaWidthAfter->blockSignals(true); + uiTabGrainline->lineEditRotFormula->blockSignals(true); + uiTabGrainline->lineEditLenFormula->blockSignals(true); DialogTool::closeEvent(event); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::showEvent(QShowEvent *event) +{ + DialogTool::showEvent( event ); + if ( event->spontaneous() ) + { + return; + } + if (dialogIsInitialized) + { + return; + } + // do your init stuff here + + m_ftb->setMaximumSize(m_ftb->size()); + m_ftb->setMinimumSize(m_ftb->size()); + + dialogIsInitialized = true;//first show windows are held +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateList() { - ui->listWidgetMCP->clear(); + uiTabLabels->listWidgetMCP->clear(); for (int i = 0; i < m_conMCP.count(); ++i) { MaterialCutPlacement mcp = m_conMCP.at(i); @@ -414,7 +458,7 @@ void DialogSeamAllowance::UpdateList() qsText = qsText.arg(""); } - ui->listWidgetMCP->addItem(qsText); + uiTabLabels->listWidgetMCP->addItem(qsText); } } @@ -424,8 +468,8 @@ void DialogSeamAllowance::AddUpdate() MaterialCutPlacement mcp; QStringList qslUserMaterials = qApp->Settings()->GetUserDefinedMaterials(); - const int i = CURRENT_DATA(ui->comboBoxMaterial).toInt(); - QString qsMat = ui->comboBoxMaterial->currentText(); + const int i = CURRENT_DATA(uiTabLabels->comboBoxMaterial).toInt(); + QString qsMat = uiTabLabels->comboBoxMaterial->currentText(); if (i < m_qslMaterials.count() && qsMat == m_qslMaterials[i]) { mcp.m_eMaterial = MaterialType(i); @@ -448,12 +492,12 @@ void DialogSeamAllowance::AddUpdate() { qApp->Settings()->AddUserDefinedMaterial(mcp.m_qsMaterialUserDef); qApp->Settings()->sync(); - ui->comboBoxMaterial->addItem(mcp.m_qsMaterialUserDef, int(MaterialType::mtUserDefined)); + uiTabLabels->comboBoxMaterial->addItem(mcp.m_qsMaterialUserDef, int(MaterialType::mtUserDefined)); } } - mcp.m_iCutNumber = ui->spinBoxCutNumber->value(); - mcp.m_ePlacement = PlacementType(ui->comboBoxPlacement->currentIndex()); + mcp.m_iCutNumber = uiTabLabels->spinBoxCutNumber->value(); + mcp.m_ePlacement = PlacementType(uiTabLabels->comboBoxPlacement->currentIndex()); if (m_bAddMode == true) { @@ -461,7 +505,7 @@ void DialogSeamAllowance::AddUpdate() } else { - int iR = ui->listWidgetMCP->currentRow(); + int iR = uiTabLabels->listWidgetMCP->currentRow(); SCASSERT(iR >= 0) m_conMCP[iR] = mcp; SetAddMode(); @@ -480,7 +524,7 @@ void DialogSeamAllowance::Cancel() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::Remove() { - int iR = ui->listWidgetMCP->currentRow(); + int iR = uiTabLabels->listWidgetMCP->currentRow(); SCASSERT(iR >= 0) m_conMCP.removeAt(iR); UpdateList(); @@ -497,15 +541,18 @@ void DialogSeamAllowance::NameDetailChanged() if (edit->text().isEmpty()) { flagName = false; - ChangeColor(ui->labelEditName, Qt::red); + ChangeColor(uiTabLabels->labelEditName, Qt::red); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabSeamAllowance), icon); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabPieceLabelData), icon); } else { flagName = true; - ChangeColor(ui->labelEditName, okColor); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabSeamAllowance), QIcon()); + ChangeColor(uiTabLabels->labelEditName, okColor); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels")); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabPieceLabelData), + QIcon()); } } CheckState(); @@ -514,21 +561,21 @@ void DialogSeamAllowance::NameDetailChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::MaterialChanged() { - ui->pushButtonAdd->setEnabled(ui->comboBoxMaterial->currentText().isEmpty() == false); + uiTabLabels->pushButtonAdd->setEnabled(uiTabLabels->comboBoxMaterial->currentText().isEmpty() == false); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) { - const int row = ui->listWidgetMainPath->currentRow(); - if (ui->listWidgetMainPath->count() == 0 || row == -1 || row >= ui->listWidgetMainPath->count()) + const int row = uiTabPaths->listWidgetMainPath->currentRow(); + if (uiTabPaths->listWidgetMainPath->count() == 0 || row == -1 || row >= uiTabPaths->listWidgetMainPath->count()) { return; } QScopedPointer menu(new QMenu()); - QListWidgetItem *rowItem = ui->listWidgetMainPath->item(row); + QListWidgetItem *rowItem = uiTabPaths->listWidgetMainPath->item(row); SCASSERT(rowItem != nullptr); VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -542,10 +589,10 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); - QAction *selectedAction = menu->exec(ui->listWidgetMainPath->viewport()->mapToGlobal(pos)); + QAction *selectedAction = menu->exec(uiTabPaths->listWidgetMainPath->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) { - delete ui->listWidgetMainPath->item(row); + delete uiTabPaths->listWidgetMainPath->item(row); ValidObjects(MainPathIsValid()); } else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse) @@ -562,8 +609,8 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos) { - const int row = ui->listWidgetCustomSA->currentRow(); - if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) + const int row = uiTabPaths->listWidgetCustomSA->currentRow(); + if (uiTabPaths->listWidgetCustomSA->count() == 0 || row == -1 || row >= uiTabPaths->listWidgetCustomSA->count()) { return; } @@ -571,7 +618,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos) QScopedPointer menu(new QMenu()); QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options")); - QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row); + QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); CustomSARecord record = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -581,10 +628,10 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos) QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); - QAction *selectedAction = menu->exec(ui->listWidgetCustomSA->viewport()->mapToGlobal(pos)); + QAction *selectedAction = menu->exec(uiTabPaths->listWidgetCustomSA->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) { - delete ui->listWidgetCustomSA->item(row); + delete uiTabPaths->listWidgetCustomSA->item(row); } else if (selectedAction == actionReverse) { @@ -612,8 +659,9 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos) { - const int row = ui->listWidgetInternalPaths->currentRow(); - if (ui->listWidgetInternalPaths->count() == 0 || row == -1 || row >= ui->listWidgetInternalPaths->count()) + const int row = uiTabPaths->listWidgetInternalPaths->currentRow(); + if (uiTabPaths->listWidgetInternalPaths->count() == 0 || row == -1 + || row >= uiTabPaths->listWidgetInternalPaths->count()) { return; } @@ -622,14 +670,14 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos) QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options")); QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); - QAction *selectedAction = menu->exec(ui->listWidgetInternalPaths->viewport()->mapToGlobal(pos)); + QAction *selectedAction = menu->exec(uiTabPaths->listWidgetInternalPaths->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) { - delete ui->listWidgetInternalPaths->item(row); + delete uiTabPaths->listWidgetInternalPaths->item(row); } else if (selectedAction == actionOption) { - QListWidgetItem *rowItem = ui->listWidgetInternalPaths->item(row); + QListWidgetItem *rowItem = uiTabPaths->listWidgetInternalPaths->item(row); SCASSERT(rowItem != nullptr); const quint32 pathId = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -647,8 +695,8 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos) { - const int row = ui->listWidgetPins->currentRow(); - if (ui->listWidgetPins->count() == 0 || row == -1 || row >= ui->listWidgetPins->count()) + const int row = uiTabPins->listWidgetPins->currentRow(); + if (uiTabPins->listWidgetPins->count() == 0 || row == -1 || row >= uiTabPins->listWidgetPins->count()) { return; } @@ -656,11 +704,11 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos) QScopedPointer menu(new QMenu()); QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); - QAction *selectedAction = menu->exec(ui->listWidgetPins->viewport()->mapToGlobal(pos)); + QAction *selectedAction = menu->exec(uiTabPins->listWidgetPins->viewport()->mapToGlobal(pos)); if (selectedAction == actionDelete) { - delete ui->listWidgetPins->item(row); - TabChanged(ui->tabWidget->currentIndex()); + delete uiTabPins->listWidgetPins->item(row); + FancyTabChanged(m_ftb->CurrentIndex()); InitAllPinComboboxes(); } } @@ -676,14 +724,14 @@ void DialogSeamAllowance::ListChanged() visPath->RefreshGeometry(); } InitNodesList(); - CustomSAChanged(ui->listWidgetCustomSA->currentRow()); + CustomSAChanged(uiTabPaths->listWidgetCustomSA->currentRow()); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EnableSeamAllowance(bool enable) { - ui->groupBoxAutomatic->setEnabled(enable); - ui->groupBoxCustom->setEnabled(enable); + uiTabPaths->groupBoxAutomatic->setEnabled(enable); + uiTabPaths->groupBoxCustom->setEnabled(enable); if (enable) { @@ -694,70 +742,70 @@ void DialogSeamAllowance::EnableSeamAllowance(bool enable) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::NodeChanged(int index) { - ui->plainTextEditFormulaWidthBefore->setDisabled(true); - ui->toolButtonExprBefore->setDisabled(true); - ui->pushButtonDefBefore->setDisabled(true); + uiTabPaths->plainTextEditFormulaWidthBefore->setDisabled(true); + uiTabPaths->toolButtonExprBefore->setDisabled(true); + uiTabPaths->pushButtonDefBefore->setDisabled(true); - ui->plainTextEditFormulaWidthAfter->setDisabled(true); - ui->toolButtonExprAfter->setDisabled(true); - ui->pushButtonDefAfter->setDisabled(true); + uiTabPaths->plainTextEditFormulaWidthAfter->setDisabled(true); + uiTabPaths->toolButtonExprAfter->setDisabled(true); + uiTabPaths->pushButtonDefAfter->setDisabled(true); - ui->comboBoxAngle->setDisabled(true); + uiTabPaths->comboBoxAngle->setDisabled(true); - ui->comboBoxAngle->blockSignals(true); + uiTabPaths->comboBoxAngle->blockSignals(true); if (index != -1) { const VPiece piece = CreatePiece(); - const int nodeIndex = piece.GetPath().indexOfNode(CURRENT_DATA(ui->comboBoxNodes).toUInt()); + const int nodeIndex = piece.GetPath().indexOfNode(CURRENT_DATA(uiTabPaths->comboBoxNodes).toUInt()); if (nodeIndex != -1) { const VPieceNode &node = piece.GetPath().at(nodeIndex); // Seam alowance before - ui->plainTextEditFormulaWidthBefore->setEnabled(true); - ui->toolButtonExprBefore->setEnabled(true); + uiTabPaths->plainTextEditFormulaWidthBefore->setEnabled(true); + uiTabPaths->toolButtonExprBefore->setEnabled(true); QString w1Formula = node.GetFormulaSABefore(); - EnableDefButton(ui->pushButtonDefBefore, w1Formula); + EnableDefButton(uiTabPaths->pushButtonDefBefore, w1Formula); w1Formula = qApp->TrVars()->FormulaToUser(w1Formula, qApp->Settings()->GetOsSeparator()); if (w1Formula.length() > 80)// increase height if needed. { this->DeployWidthBeforeFormulaTextEdit(); } - ui->plainTextEditFormulaWidthBefore->setPlainText(w1Formula); - MoveCursorToEnd(ui->plainTextEditFormulaWidthBefore); + uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(w1Formula); + MoveCursorToEnd(uiTabPaths->plainTextEditFormulaWidthBefore); // Seam alowance after - ui->plainTextEditFormulaWidthAfter->setEnabled(true); - ui->toolButtonExprAfter->setEnabled(true); + uiTabPaths->plainTextEditFormulaWidthAfter->setEnabled(true); + uiTabPaths->toolButtonExprAfter->setEnabled(true); QString w2Formula = node.GetFormulaSAAfter(); - EnableDefButton(ui->pushButtonDefAfter, w2Formula); + EnableDefButton(uiTabPaths->pushButtonDefAfter, w2Formula); w2Formula = qApp->TrVars()->FormulaToUser(w2Formula, qApp->Settings()->GetOsSeparator()); if (w2Formula.length() > 80)// increase height if needed. { this->DeployWidthAfterFormulaTextEdit(); } - ui->plainTextEditFormulaWidthAfter->setPlainText(w2Formula); - MoveCursorToEnd(ui->plainTextEditFormulaWidthAfter); + uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(w2Formula); + MoveCursorToEnd(uiTabPaths->plainTextEditFormulaWidthAfter); // Angle type - ui->comboBoxAngle->setEnabled(true); - const int index = ui->comboBoxAngle->findData(static_cast(node.GetAngleType())); + uiTabPaths->comboBoxAngle->setEnabled(true); + const int index = uiTabPaths->comboBoxAngle->findData(static_cast(node.GetAngleType())); if (index != -1) { - ui->comboBoxAngle->setCurrentIndex(index); + uiTabPaths->comboBoxAngle->setCurrentIndex(index); } } } else { - ui->plainTextEditFormulaWidthBefore->setPlainText(""); - ui->plainTextEditFormulaWidthAfter->setPlainText(""); - ui->comboBoxAngle->setCurrentIndex(-1); + uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(""); + uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(""); + uiTabPaths->comboBoxAngle->setCurrentIndex(-1); } - ui->comboBoxAngle->blockSignals(false); + uiTabPaths->comboBoxAngle->blockSignals(false); } //--------------------------------------------------------------------------------------------------------------------- @@ -765,16 +813,16 @@ void DialogSeamAllowance::CSAStartPointChanged(int index) { Q_UNUSED(index); - const int row = ui->listWidgetCustomSA->currentRow(); - if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) + const int row = uiTabPaths->listWidgetCustomSA->currentRow(); + if (uiTabPaths->listWidgetCustomSA->count() == 0 || row == -1 || row >= uiTabPaths->listWidgetCustomSA->count()) { return; } - QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row); + QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); CustomSARecord record = qvariant_cast(rowItem->data(Qt::UserRole)); - record.startPoint = CURRENT_DATA(ui->comboBoxStartPoint).toUInt(); + record.startPoint = CURRENT_DATA(uiTabPaths->comboBoxStartPoint).toUInt(); rowItem->setData(Qt::UserRole, QVariant::fromValue(record)); } @@ -783,16 +831,16 @@ void DialogSeamAllowance::CSAEndPointChanged(int index) { Q_UNUSED(index); - const int row = ui->listWidgetCustomSA->currentRow(); - if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) + const int row = uiTabPaths->listWidgetCustomSA->currentRow(); + if (uiTabPaths->listWidgetCustomSA->count() == 0 || row == -1 || row >= uiTabPaths->listWidgetCustomSA->count()) { return; } - QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row); + QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); CustomSARecord record = qvariant_cast(rowItem->data(Qt::UserRole)); - record.endPoint = CURRENT_DATA(ui->comboBoxEndPoint).toUInt(); + record.endPoint = CURRENT_DATA(uiTabPaths->comboBoxEndPoint).toUInt(); rowItem->setData(Qt::UserRole, QVariant::fromValue(record)); } @@ -801,30 +849,30 @@ void DialogSeamAllowance::CSAIncludeTypeChanged(int index) { Q_UNUSED(index); - const int row = ui->listWidgetCustomSA->currentRow(); - if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) + const int row = uiTabPaths->listWidgetCustomSA->currentRow(); + if (uiTabPaths->listWidgetCustomSA->count() == 0 || row == -1 || row >= uiTabPaths->listWidgetCustomSA->count()) { return; } - QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row); + QListWidgetItem *rowItem = uiTabPaths->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); CustomSARecord record = qvariant_cast(rowItem->data(Qt::UserRole)); - record.includeType = static_cast(CURRENT_DATA(ui->comboBoxIncludeType).toUInt()); + record.includeType = static_cast(CURRENT_DATA(uiTabPaths->comboBoxIncludeType).toUInt()); rowItem->setData(Qt::UserRole, QVariant::fromValue(record)); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::NodeAngleChanged(int index) { - const int i = ui->comboBoxNodes->currentIndex(); + const int i = uiTabPaths->comboBoxNodes->currentIndex(); if (i != -1 && index != -1) { - QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPaths->comboBoxNodes).toUInt()); if (rowItem) { VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); - rowNode.SetAngleType(static_cast(CURRENT_DATA(ui->comboBoxAngle).toUInt())); + rowNode.SetAngleType(static_cast(CURRENT_DATA(uiTabPaths->comboBoxAngle).toUInt())); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); ListChanged(); @@ -835,7 +883,7 @@ void DialogSeamAllowance::NodeAngleChanged(int index) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ReturnDefBefore() { - ui->plainTextEditFormulaWidthBefore->setPlainText(currentSeamAllowance); + uiTabPaths->plainTextEditFormulaWidthBefore->setPlainText(currentSeamAllowance); if (QPushButton* button = qobject_cast(sender())) { button->setEnabled(false); @@ -845,7 +893,7 @@ void DialogSeamAllowance::ReturnDefBefore() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ReturnDefAfter() { - ui->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance); + uiTabPaths->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance); if (QPushButton* button = qobject_cast(sender())) { button->setEnabled(false); @@ -855,58 +903,58 @@ void DialogSeamAllowance::ReturnDefAfter() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::CustomSAChanged(int row) { - if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) + if (uiTabPaths->listWidgetCustomSA->count() == 0 || row == -1 || row >= uiTabPaths->listWidgetCustomSA->count()) { - ui->comboBoxStartPoint->blockSignals(true); - ui->comboBoxStartPoint->clear(); - ui->comboBoxStartPoint->blockSignals(false); + uiTabPaths->comboBoxStartPoint->blockSignals(true); + uiTabPaths->comboBoxStartPoint->clear(); + uiTabPaths->comboBoxStartPoint->blockSignals(false); - ui->comboBoxEndPoint->blockSignals(true); - ui->comboBoxEndPoint->clear(); - ui->comboBoxEndPoint->blockSignals(false); + uiTabPaths->comboBoxEndPoint->blockSignals(true); + uiTabPaths->comboBoxEndPoint->clear(); + uiTabPaths->comboBoxEndPoint->blockSignals(false); - ui->comboBoxIncludeType->blockSignals(true); - ui->comboBoxIncludeType->clear(); - ui->comboBoxIncludeType->blockSignals(false); + uiTabPaths->comboBoxIncludeType->blockSignals(true); + uiTabPaths->comboBoxIncludeType->clear(); + uiTabPaths->comboBoxIncludeType->blockSignals(false); return; } - const QListWidgetItem *item = ui->listWidgetCustomSA->item( row ); + const QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item( row ); SCASSERT(item != nullptr); const CustomSARecord record = qvariant_cast(item->data(Qt::UserRole)); - ui->comboBoxStartPoint->blockSignals(true); - InitCSAPoint(ui->comboBoxStartPoint); + uiTabPaths->comboBoxStartPoint->blockSignals(true); + InitCSAPoint(uiTabPaths->comboBoxStartPoint); { - const int index = ui->comboBoxStartPoint->findData(record.startPoint); + const int index = uiTabPaths->comboBoxStartPoint->findData(record.startPoint); if (index != -1) { - ui->comboBoxStartPoint->setCurrentIndex(index); + uiTabPaths->comboBoxStartPoint->setCurrentIndex(index); } } - ui->comboBoxStartPoint->blockSignals(false); + uiTabPaths->comboBoxStartPoint->blockSignals(false); - ui->comboBoxEndPoint->blockSignals(true); - InitCSAPoint(ui->comboBoxEndPoint); + uiTabPaths->comboBoxEndPoint->blockSignals(true); + InitCSAPoint(uiTabPaths->comboBoxEndPoint); { - const int index = ui->comboBoxEndPoint->findData(record.endPoint); + const int index = uiTabPaths->comboBoxEndPoint->findData(record.endPoint); if (index != -1) { - ui->comboBoxEndPoint->setCurrentIndex(index); + uiTabPaths->comboBoxEndPoint->setCurrentIndex(index); } } - ui->comboBoxEndPoint->blockSignals(false); + uiTabPaths->comboBoxEndPoint->blockSignals(false); - ui->comboBoxIncludeType->blockSignals(true); + uiTabPaths->comboBoxIncludeType->blockSignals(true); InitSAIncludeType(); { - const int index = ui->comboBoxIncludeType->findData(static_cast(record.includeType)); + const int index = uiTabPaths->comboBoxIncludeType->findData(static_cast(record.includeType)); if (index != -1) { - ui->comboBoxIncludeType->setCurrentIndex(index); + uiTabPaths->comboBoxIncludeType->setCurrentIndex(index); } } - ui->comboBoxIncludeType->blockSignals(false); + uiTabPaths->comboBoxIncludeType->blockSignals(false); } //--------------------------------------------------------------------------------------------------------------------- @@ -938,28 +986,59 @@ void DialogSeamAllowance::PathDialogClosed(int result) delete m_dialog; } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::FancyTabChanged(int index) +{ + if (index < 0 || index >= TabOrder::Count) + { + return; + } + + m_tabPaths->hide(); + m_tabLabels->hide(); + m_tabGrainline->hide(); + m_tabPins->hide(); + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wswitch-default") + switch(index) + { + case TabOrder::Paths: + m_tabPaths->show(); + break; + case TabOrder::Labels: + m_tabLabels->show(); + break; + case TabOrder::Grainline: + m_tabGrainline->show(); + break; + case TabOrder::Pins: + m_tabPins->show(); + break; + } +QT_WARNING_POP + + if (index == TabOrder::Pins || index == TabOrder::Grainline + || (index == TabOrder::Labels && + uiTabLabels->tabWidget->currentIndex() == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels))) + { + ShowPins(); + } + else + { + if (not m_visPins.isNull()) + { + delete m_visPins; + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::TabChanged(int index) { - if (index == ui->tabWidget->indexOf(ui->tabPins) - || index == ui->tabWidget->indexOf(ui->tabGrainline) - || index == ui->tabWidget->indexOf(ui->tabLabels)) + if (index == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels)) { - if (m_visPins.isNull()) - { - m_visPins = new VisPiecePins(data); - } - - m_visPins->SetPins(GetPieceInternals(ui->listWidgetPins)); - - if (not qApp->getCurrentScene()->items().contains(m_visPins)) - { - m_visPins->VisualMode(NULL_ID); - } - else - { - m_visPins->RefreshGeometry(); - } + ShowPins(); } else { @@ -973,7 +1052,7 @@ void DialogSeamAllowance::TabChanged(int index) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateGrainlineValues() { - QPlainTextEdit* apleSender[2] = {ui->lineEditRotFormula, ui->lineEditLenFormula}; + QPlainTextEdit* apleSender[2] = {uiTabGrainline->lineEditRotFormula, uiTabGrainline->lineEditLenFormula}; bool bFormulasOK[2] = {true, true}; for (int i = 0; i < 2; ++i) @@ -983,14 +1062,14 @@ void DialogSeamAllowance::UpdateGrainlineValues() QString qsUnit; if (i == 0) { - plbVal = ui->labelRot; - plbText = ui->labelEditRot; + plbVal = uiTabGrainline->labelRot; + plbText = uiTabGrainline->labelEditRot; qsUnit = degreeSymbol; } else { - plbVal = ui->labelLen; - plbText = ui->labelEditLen; + plbVal = uiTabGrainline->labelLen; + plbText = uiTabGrainline->labelEditLen; qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); } @@ -1036,8 +1115,7 @@ void DialogSeamAllowance::UpdateGrainlineValues() flagGFormulas = bFormulasOK[0] && bFormulasOK[1]; if (not flagGFormulas && not flagGPin) { - QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); + m_ftb->SetTabText(TabOrder::Grainline, tr("Grainline") + QLatin1String("*")); } else { @@ -1049,8 +1127,8 @@ void DialogSeamAllowance::UpdateGrainlineValues() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateDetailLabelValues() { - QPlainTextEdit* apleSender[3] = {ui->lineEditDLWidthFormula, ui->lineEditDLHeightFormula, - ui->lineEditDLAngleFormula}; + QPlainTextEdit* apleSender[3] = {uiTabLabels->lineEditDLWidthFormula, uiTabLabels->lineEditDLHeightFormula, + uiTabLabels->lineEditDLAngleFormula}; bool bFormulasOK[3] = {true, true, true}; for (int i = 0; i < 3; ++i) @@ -1060,20 +1138,20 @@ void DialogSeamAllowance::UpdateDetailLabelValues() QString qsUnit; if (i == 0) { - plbVal = ui->labelDLWidth; - plbText = ui->labelEditDLWidth; + plbVal = uiTabLabels->labelDLWidth; + plbText = uiTabLabels->labelEditDLWidth; qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); } else if (i == 1) { - plbVal = ui->labelDLHeight; - plbText = ui->labelEditDLHeight; + plbVal = uiTabLabels->labelDLHeight; + plbText = uiTabLabels->labelEditDLHeight; qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); } else { - plbVal = ui->labelDLAngle; - plbText = ui->labelEditDLAngle; + plbVal = uiTabLabels->labelDLAngle; + plbText = uiTabLabels->labelEditDLAngle; qsUnit = degreeSymbol; } @@ -1120,8 +1198,9 @@ void DialogSeamAllowance::UpdateDetailLabelValues() flagDLFormulas = bFormulasOK[0] && bFormulasOK[1]; if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin)) { + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); } else { @@ -1133,8 +1212,8 @@ void DialogSeamAllowance::UpdateDetailLabelValues() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdatePatternLabelValues() { - QPlainTextEdit* apleSender[3] = {ui->lineEditPLWidthFormula, ui->lineEditPLHeightFormula, - ui->lineEditPLAngleFormula}; + QPlainTextEdit* apleSender[3] = {uiTabLabels->lineEditPLWidthFormula, uiTabLabels->lineEditPLHeightFormula, + uiTabLabels->lineEditPLAngleFormula}; bool bFormulasOK[3] = {true, true, true}; for (int i = 0; i < 3; ++i) @@ -1144,20 +1223,20 @@ void DialogSeamAllowance::UpdatePatternLabelValues() QString qsUnit; if (i == 0) { - plbVal = ui->labelPLWidth; - plbText = ui->labelEditPLWidth; + plbVal = uiTabLabels->labelPLWidth; + plbText = uiTabLabels->labelEditPLWidth; qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); } else if (i == 1) { - plbVal = ui->labelPLHeight; - plbText = ui->labelEditPLHeight; + plbVal = uiTabLabels->labelPLHeight; + plbText = uiTabLabels->labelEditPLHeight; qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); } else { - plbVal = ui->labelPLAngle; - plbText = ui->labelEditPLAngle; + plbVal = uiTabLabels->labelPLAngle; + plbText = uiTabLabels->labelEditPLAngle; qsUnit = degreeSymbol; } @@ -1204,8 +1283,9 @@ void DialogSeamAllowance::UpdatePatternLabelValues() flagPLFormulas = bFormulasOK[0] && bFormulasOK[1]; if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin)) { + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); } else { @@ -1217,26 +1297,26 @@ void DialogSeamAllowance::UpdatePatternLabelValues() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::SetAddMode() { - ui->pushButtonAdd->setText(tr("Add")); - ui->pushButtonCancel->hide(); - ui->pushButtonRemove->hide(); - ui->listWidgetMCP->setCurrentRow(-1); + uiTabLabels->pushButtonAdd->setText(tr("Add")); + uiTabLabels->pushButtonCancel->hide(); + uiTabLabels->pushButtonRemove->hide(); + uiTabLabels->listWidgetMCP->setCurrentRow(-1); m_bAddMode = true; } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::SetEditMode() { - int iR = ui->listWidgetMCP->currentRow(); + int iR = uiTabLabels->listWidgetMCP->currentRow(); // this method can be called by clicking on item or by update. In the latter case there is nothing else to do! if (iR < 0 || iR >= m_conMCP.count()) { return; } - ui->pushButtonAdd->setText(tr("Update")); - ui->pushButtonCancel->show(); - ui->pushButtonRemove->show(); + uiTabLabels->pushButtonAdd->setText(tr("Update")); + uiTabLabels->pushButtonCancel->show(); + uiTabLabels->pushButtonRemove->show(); MaterialCutPlacement mcp = m_conMCP.at(iR); if (mcp.m_eMaterial == MaterialType::mtUserDefined) @@ -1244,19 +1324,19 @@ void DialogSeamAllowance::SetEditMode() int iRow = qApp->Settings()->GetUserDefinedMaterials().indexOf(mcp.m_qsMaterialUserDef); if (iRow >= 0) { - ui->comboBoxMaterial->setCurrentIndex(iRow + m_qslMaterials.count()); + uiTabLabels->comboBoxMaterial->setCurrentIndex(iRow + m_qslMaterials.count()); } else { - ui->comboBoxMaterial->setCurrentText(mcp.m_qsMaterialUserDef); + uiTabLabels->comboBoxMaterial->setCurrentText(mcp.m_qsMaterialUserDef); } } else { - ui->comboBoxMaterial->setCurrentIndex(int(mcp.m_eMaterial)); + uiTabLabels->comboBoxMaterial->setCurrentIndex(int(mcp.m_eMaterial)); } - ui->spinBoxCutNumber->setValue(mcp.m_iCutNumber); - ui->comboBoxPlacement->setCurrentIndex(int(mcp.m_ePlacement)); + uiTabLabels->spinBoxCutNumber->setValue(mcp.m_iCutNumber); + uiTabLabels->comboBoxPlacement->setCurrentIndex(int(mcp.m_ePlacement)); m_bAddMode = false; } @@ -1264,7 +1344,7 @@ void DialogSeamAllowance::SetEditMode() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EnabledGrainline() { - if (ui->groupBoxGrainline->isChecked() == true) + if (uiTabGrainline->groupBoxGrainline->isChecked() == true) { UpdateGrainlineValues(); GrainlinePinPointChanged(); @@ -1280,7 +1360,7 @@ void DialogSeamAllowance::EnabledGrainline() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EnabledDetailLabel() { - if (ui->groupBoxDetailLabel->isChecked() == true) + if (uiTabLabels->groupBoxDetailLabel->isChecked() == true) { UpdateDetailLabelValues(); DetailPinPointChanged(); @@ -1297,7 +1377,7 @@ void DialogSeamAllowance::EnabledDetailLabel() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EnabledPatternLabel() { - if (ui->groupBoxPatternLabel->isChecked() == true) + if (uiTabLabels->groupBoxPatternLabel->isChecked() == true) { UpdatePatternLabelValues(); PatternPinPointChanged(); @@ -1318,15 +1398,15 @@ void DialogSeamAllowance::EditGrainlineFormula() bool bCheckZero; QString title; - if (sender() == ui->pushButtonLen) + if (sender() == uiTabGrainline->pushButtonLen) { - pleFormula = ui->lineEditLenFormula; + pleFormula = uiTabGrainline->lineEditLenFormula; bCheckZero = true; title = tr("Edit length"); } - else if (sender() == ui->pushButtonRot) + else if (sender() == uiTabGrainline->pushButtonRot) { - pleFormula = ui->lineEditRotFormula; + pleFormula = uiTabGrainline->lineEditRotFormula; bCheckZero = false; title = tr("Edit angle"); } @@ -1345,11 +1425,11 @@ void DialogSeamAllowance::EditGrainlineFormula() QString qsFormula = dlg.GetFormula(); qsFormula.replace("\n", " "); - if (sender() == ui->pushButtonLen) + if (sender() == uiTabGrainline->pushButtonLen) { SetGrainlineLength(qsFormula); } - else if (sender() == ui->pushButtonRot) + else if (sender() == uiTabGrainline->pushButtonRot) { SetGrainlineAngle(qsFormula); } @@ -1369,21 +1449,21 @@ void DialogSeamAllowance::EditDLFormula() bool bCheckZero; QString title; - if (sender() == ui->pushButtonDLHeight) + if (sender() == uiTabLabels->pushButtonDLHeight) { - pleFormula = ui->lineEditDLHeightFormula; + pleFormula = uiTabLabels->lineEditDLHeightFormula; bCheckZero = true; title = tr("Edit height"); } - else if (sender() == ui->pushButtonDLWidth) + else if (sender() == uiTabLabels->pushButtonDLWidth) { - pleFormula = ui->lineEditDLWidthFormula; + pleFormula = uiTabLabels->lineEditDLWidthFormula; bCheckZero = true; title = tr("Edit width"); } - else if (sender() == ui->pushButtonDLAngle) + else if (sender() == uiTabLabels->pushButtonDLAngle) { - pleFormula = ui->lineEditDLAngleFormula; + pleFormula = uiTabLabels->lineEditDLAngleFormula; bCheckZero = false; title = tr("Edit angle"); } @@ -1401,15 +1481,15 @@ void DialogSeamAllowance::EditDLFormula() { QString qsFormula = dlg.GetFormula(); qsFormula.replace("\n", " "); - if (sender() == ui->pushButtonDLHeight) + if (sender() == uiTabLabels->pushButtonDLHeight) { SetDLHeight(qsFormula); } - else if (sender() == ui->pushButtonDLWidth) + else if (sender() == uiTabLabels->pushButtonDLWidth) { SetDLWidth(qsFormula); } - else if (sender() == ui->pushButtonDLAngle) + else if (sender() == uiTabLabels->pushButtonDLAngle) { SetDLAngle(qsFormula); } @@ -1429,21 +1509,21 @@ void DialogSeamAllowance::EditPLFormula() bool bCheckZero; QString title; - if (sender() == ui->pushButtonPLHeight) + if (sender() == uiTabLabels->pushButtonPLHeight) { - pleFormula = ui->lineEditPLHeightFormula; + pleFormula = uiTabLabels->lineEditPLHeightFormula; bCheckZero = true; title = tr("Edit height"); } - else if (sender() == ui->pushButtonPLWidth) + else if (sender() == uiTabLabels->pushButtonPLWidth) { - pleFormula = ui->lineEditPLWidthFormula; + pleFormula = uiTabLabels->lineEditPLWidthFormula; bCheckZero = true; title = tr("Edit width"); } - else if (sender() == ui->pushButtonPLAngle) + else if (sender() == uiTabLabels->pushButtonPLAngle) { - pleFormula = ui->lineEditPLAngleFormula; + pleFormula = uiTabLabels->lineEditPLAngleFormula; bCheckZero = false; title = tr("Edit angle"); } @@ -1461,15 +1541,15 @@ void DialogSeamAllowance::EditPLFormula() { QString qsFormula = dlg.GetFormula(); qsFormula.replace("\n", " "); - if (sender() == ui->pushButtonPLHeight) + if (sender() == uiTabLabels->pushButtonPLHeight) { SetPLHeight(qsFormula); } - else if (sender() == ui->pushButtonPLWidth) + else if (sender() == uiTabLabels->pushButtonPLWidth) { SetPLWidth(qsFormula); } - else if (sender() == ui->pushButtonPLAngle) + else if (sender() == uiTabLabels->pushButtonPLAngle) { SetPLAngle(qsFormula); } @@ -1485,49 +1565,49 @@ void DialogSeamAllowance::EditPLFormula() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployGrainlineRotation() { - DeployFormula(ui->lineEditRotFormula, ui->pushButtonShowRot, m_iRotBaseHeight); + DeployFormula(uiTabGrainline->lineEditRotFormula, uiTabGrainline->pushButtonShowRot, m_iRotBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployGrainlineLength() { - DeployFormula(ui->lineEditLenFormula, ui->pushButtonShowLen, m_iLenBaseHeight); + DeployFormula(uiTabGrainline->lineEditLenFormula, uiTabGrainline->pushButtonShowLen, m_iLenBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployDLWidth() { - DeployFormula(ui->lineEditDLWidthFormula, ui->pushButtonShowDLWidth, m_DLWidthBaseHeight); + DeployFormula(uiTabLabels->lineEditDLWidthFormula, uiTabLabels->pushButtonShowDLWidth, m_DLWidthBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployDLHeight() { - DeployFormula(ui->lineEditDLHeightFormula, ui->pushButtonShowDLHeight, m_DLHeightBaseHeight); + DeployFormula(uiTabLabels->lineEditDLHeightFormula, uiTabLabels->pushButtonShowDLHeight, m_DLHeightBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployDLAngle() { - DeployFormula(ui->lineEditDLAngleFormula, ui->pushButtonShowDLAngle, m_DLAngleBaseHeight); + DeployFormula(uiTabLabels->lineEditDLAngleFormula, uiTabLabels->pushButtonShowDLAngle, m_DLAngleBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployPLWidth() { - DeployFormula(ui->lineEditPLWidthFormula, ui->pushButtonShowPLWidth, m_PLWidthBaseHeight); + DeployFormula(uiTabLabels->lineEditPLWidthFormula, uiTabLabels->pushButtonShowPLWidth, m_PLWidthBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployPLHeight() { - DeployFormula(ui->lineEditPLHeightFormula, ui->pushButtonShowPLHeight, m_PLHeightBaseHeight); + DeployFormula(uiTabLabels->lineEditPLHeightFormula, uiTabLabels->pushButtonShowPLHeight, m_PLHeightBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployPLAngle() { - DeployFormula(ui->lineEditPLAngleFormula, ui->pushButtonShowPLAngle, m_PLAngleBaseHeight); + DeployFormula(uiTabLabels->lineEditPLAngleFormula, uiTabLabels->pushButtonShowPLAngle, m_PLAngleBaseHeight); } //--------------------------------------------------------------------------------------------------------------------- @@ -1535,7 +1615,7 @@ void DialogSeamAllowance::ResetGrainlineWarning() { if (flagGFormulas || flagGPin) { - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), QIcon()); + m_ftb->SetTabText(TabOrder::Grainline, tr("Grainline")); } } @@ -1544,17 +1624,18 @@ void DialogSeamAllowance::ResetLabelsWarning() { if (flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle && (flagPLFormulas || flagPPin)) { - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), QIcon()); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels")); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), QIcon()); } } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EvalWidth() { - labelEditFormula = ui->labelEditWidth; + labelEditFormula = uiTabPaths->labelEditWidth; const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); - const QString formula = ui->plainTextEditFormulaWidth->toPlainText(); - m_saWidth = Eval(formula, flagFormula, ui->labelResultWidth, postfix, false, true); + const QString formula = uiTabPaths->plainTextEditFormulaWidth->toPlainText(); + m_saWidth = Eval(formula, flagFormula, uiTabPaths->labelResultWidth, postfix, false, true); if (m_saWidth >= 0) { @@ -1571,29 +1652,29 @@ void DialogSeamAllowance::EvalWidth() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EvalWidthBefore() { - labelEditFormula = ui->labelEditBefore; + labelEditFormula = uiTabPaths->labelEditBefore; const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); - const QString formula = ui->plainTextEditFormulaWidthBefore->toPlainText(); + const QString formula = uiTabPaths->plainTextEditFormulaWidthBefore->toPlainText(); bool flagFormula = false; // fake flag - Eval(formula, flagFormula, ui->labelResultBefore, postfix, false, true); + Eval(formula, flagFormula, uiTabPaths->labelResultBefore, postfix, false, true); - const QString formulaSABefore = GetFormulaFromUser(ui->plainTextEditFormulaWidthBefore); + const QString formulaSABefore = GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore); UpdateNodeSABefore(formulaSABefore); - EnableDefButton(ui->pushButtonDefBefore, formulaSABefore); + EnableDefButton(uiTabPaths->pushButtonDefBefore, formulaSABefore); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EvalWidthAfter() { - labelEditFormula = ui->labelEditAfter; + labelEditFormula = uiTabPaths->labelEditAfter; const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); - const QString formula = ui->plainTextEditFormulaWidthAfter->toPlainText(); + const QString formula = uiTabPaths->plainTextEditFormulaWidthAfter->toPlainText(); bool flagFormula = false; // fake flag - Eval(formula, flagFormula, ui->labelResultAfter, postfix, false, true); + Eval(formula, flagFormula, uiTabPaths->labelResultAfter, postfix, false, true); - const QString formulaSAAfter = GetFormulaFromUser(ui->plainTextEditFormulaWidthAfter); + const QString formulaSAAfter = GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter); UpdateNodeSAAfter(formulaSAAfter); - EnableDefButton(ui->pushButtonDefAfter, formulaSAAfter); + EnableDefButton(uiTabPaths->pushButtonDefAfter, formulaSAAfter); } //--------------------------------------------------------------------------------------------------------------------- @@ -1616,7 +1697,7 @@ void DialogSeamAllowance::FXWidthBefore() { DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit seam allowance width before")); - dialog->SetFormula(GetFormulaFromUser(ui->plainTextEditFormulaWidthBefore)); + dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore)); dialog->setCheckLessThanZero(true); dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) @@ -1631,7 +1712,7 @@ void DialogSeamAllowance::FXWidthAfter() { DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit seam allowance width after")); - dialog->SetFormula(GetFormulaFromUser(ui->plainTextEditFormulaWidthAfter)); + dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter)); dialog->setCheckLessThanZero(true); dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) @@ -1644,56 +1725,58 @@ void DialogSeamAllowance::FXWidthAfter() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::WidthChanged() { - labelEditFormula = ui->labelEditWidth; - labelResultCalculation = ui->labelResultWidth; + labelEditFormula = uiTabPaths->labelEditWidth; + labelResultCalculation = uiTabPaths->labelResultWidth; const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); - ValFormulaChanged(flagFormula, ui->plainTextEditFormulaWidth, m_timerWidth, postfix); + ValFormulaChanged(flagFormula, uiTabPaths->plainTextEditFormulaWidth, m_timerWidth, postfix); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::WidthBeforeChanged() { - labelEditFormula = ui->labelEditBefore; - labelResultCalculation = ui->labelResultBefore; + labelEditFormula = uiTabPaths->labelEditBefore; + labelResultCalculation = uiTabPaths->labelResultBefore; const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); bool flagFormula = false; - ValFormulaChanged(flagFormula, ui->plainTextEditFormulaWidthBefore, m_timerWidthBefore, postfix); + ValFormulaChanged(flagFormula, uiTabPaths->plainTextEditFormulaWidthBefore, m_timerWidthBefore, postfix); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::WidthAfterChanged() { - labelEditFormula = ui->labelEditAfter; - labelResultCalculation = ui->labelResultAfter; + labelEditFormula = uiTabPaths->labelEditAfter; + labelResultCalculation = uiTabPaths->labelResultAfter; const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); bool flagFormula = false; - ValFormulaChanged(flagFormula, ui->plainTextEditFormulaWidthAfter, m_timerWidthAfter, postfix); + ValFormulaChanged(flagFormula, uiTabPaths->plainTextEditFormulaWidthAfter, m_timerWidthAfter, postfix); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployWidthFormulaTextEdit() { - DeployFormula(ui->plainTextEditFormulaWidth, ui->pushButtonGrowWidth, m_formulaBaseWidth); + DeployFormula(uiTabPaths->plainTextEditFormulaWidth, uiTabPaths->pushButtonGrowWidth, m_formulaBaseWidth); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployWidthBeforeFormulaTextEdit() { - DeployFormula(ui->plainTextEditFormulaWidthBefore, ui->pushButtonGrowWidthBefore, m_formulaBaseWidthBefore); + DeployFormula(uiTabPaths->plainTextEditFormulaWidthBefore, uiTabPaths->pushButtonGrowWidthBefore, + m_formulaBaseWidthBefore); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::DeployWidthAfterFormulaTextEdit() { - DeployFormula(ui->plainTextEditFormulaWidthAfter, ui->pushButtonGrowWidthAfter, m_formulaBaseWidthAfter); + DeployFormula(uiTabPaths->plainTextEditFormulaWidthAfter, uiTabPaths->pushButtonGrowWidthAfter, + m_formulaBaseWidthAfter); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::GrainlinePinPointChanged() { QColor color = okColor; - const quint32 topPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin); - const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineBottomPin); + const quint32 topPinId = getCurrentObjectId(uiTabGrainline->comboBoxGrainlineTopPin); + const quint32 bottomPinId = getCurrentObjectId(uiTabGrainline->comboBoxGrainlineBottomPin); if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId) { flagGPin = true; @@ -1708,13 +1791,12 @@ void DialogSeamAllowance::GrainlinePinPointChanged() if (not flagGFormulas && not flagGPin) { - QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); + m_ftb->SetTabText(TabOrder::Grainline, tr("Grainline")); } } UpdateGrainlineValues(); - ChangeColor(ui->labelGrainlineTopPin, color); - ChangeColor(ui->labelGrainlineBottomPin, color); + ChangeColor(uiTabGrainline->labelGrainlineTopPin, color); + ChangeColor(uiTabGrainline->labelGrainlineBottomPin, color); CheckState(); } @@ -1722,8 +1804,8 @@ void DialogSeamAllowance::GrainlinePinPointChanged() void DialogSeamAllowance::DetailPinPointChanged() { QColor color = okColor; - const quint32 topPinId = getCurrentObjectId(ui->comboBoxDLTopLeftPin); - const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxDLBottomRightPin); + const quint32 topPinId = getCurrentObjectId(uiTabLabels->comboBoxDLTopLeftPin); + const quint32 bottomPinId = getCurrentObjectId(uiTabLabels->comboBoxDLBottomRightPin); if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId) { flagDPin = true; @@ -1731,7 +1813,8 @@ void DialogSeamAllowance::DetailPinPointChanged() if (flagPPin) { - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), QIcon()); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels")); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), QIcon()); } } else @@ -1739,12 +1822,13 @@ void DialogSeamAllowance::DetailPinPointChanged() flagDPin = false; topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor; + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); } UpdateDetailLabelValues(); - ChangeColor(ui->labelDLTopLeftPin, color); - ChangeColor(ui->labelDLBottomRightPin, color); + ChangeColor(uiTabLabels->labelDLTopLeftPin, color); + ChangeColor(uiTabLabels->labelDLBottomRightPin, color); CheckState(); } @@ -1752,8 +1836,8 @@ void DialogSeamAllowance::DetailPinPointChanged() void DialogSeamAllowance::PatternPinPointChanged() { QColor color = okColor; - const quint32 topPinId = getCurrentObjectId(ui->comboBoxPLTopLeftPin); - const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxPLBottomRightPin); + const quint32 topPinId = getCurrentObjectId(uiTabLabels->comboBoxPLTopLeftPin); + const quint32 bottomPinId = getCurrentObjectId(uiTabLabels->comboBoxPLBottomRightPin); if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId) { flagPPin = true; @@ -1761,7 +1845,8 @@ void DialogSeamAllowance::PatternPinPointChanged() if (flagDPin) { - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), QIcon()); + m_ftb->SetTabText(TabOrder::Labels, tr("Labels")); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), QIcon()); } } else @@ -1769,12 +1854,13 @@ void DialogSeamAllowance::PatternPinPointChanged() flagPPin = false; topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor; + m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*")); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabLabels), icon); + uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon); } UpdatePatternLabelValues(); - ChangeColor(ui->labelPLTopLeftPin, color); - ChangeColor(ui->labelPLBottomRightPin, color); + ChangeColor(uiTabLabels->labelPLTopLeftPin, color); + ChangeColor(uiTabLabels->labelPLBottomRightPin, color); CheckState(); } @@ -1782,17 +1868,17 @@ void DialogSeamAllowance::PatternPinPointChanged() VPiece DialogSeamAllowance::CreatePiece() const { VPiece piece; - piece.GetPath().SetNodes(GetPieceInternals(ui->listWidgetMainPath)); - piece.SetCustomSARecords(GetPieceInternals(ui->listWidgetCustomSA)); - piece.SetInternalPaths(GetPieceInternals(ui->listWidgetInternalPaths)); - piece.SetPins(GetPieceInternals(ui->listWidgetPins)); - piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked()); - piece.SetSeamAllowance(ui->checkBoxSeams->isChecked()); - piece.SetName(ui->lineEditName->text()); + piece.GetPath().SetNodes(GetPieceInternals(uiTabPaths->listWidgetMainPath)); + piece.SetCustomSARecords(GetPieceInternals(uiTabPaths->listWidgetCustomSA)); + piece.SetInternalPaths(GetPieceInternals(uiTabPaths->listWidgetInternalPaths)); + piece.SetPins(GetPieceInternals(uiTabPins->listWidgetPins)); + piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked()); + piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked()); + piece.SetName(uiTabLabels->lineEditName->text()); piece.SetMx(m_mx); piece.SetMy(m_my); - piece.SetFormulaSAWidth(GetFormulaFromUser(ui->plainTextEditFormulaWidth), m_saWidth); - piece.GetPatternPieceData().SetLetter(ui->lineEditLetter->text()); + piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth); + piece.GetPatternPieceData().SetLetter(uiTabLabels->lineEditLetter->text()); for (int i = 0; i < m_conMCP.count(); ++i) { @@ -1800,32 +1886,32 @@ VPiece DialogSeamAllowance::CreatePiece() const } piece.GetPatternPieceData().SetPos(m_oldData.GetPos()); - piece.GetPatternPieceData().SetLabelWidth(GetFormulaFromUser(ui->lineEditDLWidthFormula)); - piece.GetPatternPieceData().SetLabelHeight(GetFormulaFromUser(ui->lineEditDLHeightFormula)); + piece.GetPatternPieceData().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditDLWidthFormula)); + piece.GetPatternPieceData().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditDLHeightFormula)); piece.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize()); - piece.GetPatternPieceData().SetRotation(GetFormulaFromUser(ui->lineEditDLAngleFormula)); - piece.GetPatternPieceData().SetVisible(ui->groupBoxDetailLabel->isChecked()); - piece.GetPatternPieceData().SetCenterPin(getCurrentObjectId(ui->comboBoxDLCenterPin)); - piece.GetPatternPieceData().SetTopLeftPin(getCurrentObjectId(ui->comboBoxDLTopLeftPin)); - piece.GetPatternPieceData().SetBottomRightPin(getCurrentObjectId(ui->comboBoxDLBottomRightPin)); + piece.GetPatternPieceData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditDLAngleFormula)); + piece.GetPatternPieceData().SetVisible(uiTabLabels->groupBoxDetailLabel->isChecked()); + piece.GetPatternPieceData().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxDLCenterPin)); + piece.GetPatternPieceData().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxDLTopLeftPin)); + piece.GetPatternPieceData().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxDLBottomRightPin)); piece.GetPatternInfo() = m_oldGeom; - piece.GetPatternInfo().SetVisible(ui->groupBoxPatternLabel->isChecked()); - piece.GetPatternInfo().SetCenterPin(getCurrentObjectId(ui->comboBoxPLCenterPin)); - piece.GetPatternInfo().SetTopLeftPin(getCurrentObjectId(ui->comboBoxPLTopLeftPin)); - piece.GetPatternInfo().SetBottomRightPin(getCurrentObjectId(ui->comboBoxPLBottomRightPin)); - piece.GetPatternInfo().SetLabelWidth(GetFormulaFromUser(ui->lineEditPLWidthFormula)); - piece.GetPatternInfo().SetLabelHeight(GetFormulaFromUser(ui->lineEditPLHeightFormula)); - piece.GetPatternInfo().SetRotation(GetFormulaFromUser(ui->lineEditPLAngleFormula)); + piece.GetPatternInfo().SetVisible(uiTabLabels->groupBoxPatternLabel->isChecked()); + piece.GetPatternInfo().SetCenterPin(getCurrentObjectId(uiTabLabels->comboBoxPLCenterPin)); + piece.GetPatternInfo().SetTopLeftPin(getCurrentObjectId(uiTabLabels->comboBoxPLTopLeftPin)); + piece.GetPatternInfo().SetBottomRightPin(getCurrentObjectId(uiTabLabels->comboBoxPLBottomRightPin)); + piece.GetPatternInfo().SetLabelWidth(GetFormulaFromUser(uiTabLabels->lineEditPLWidthFormula)); + piece.GetPatternInfo().SetLabelHeight(GetFormulaFromUser(uiTabLabels->lineEditPLHeightFormula)); + piece.GetPatternInfo().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditPLAngleFormula)); piece.GetGrainlineGeometry() = m_oldGrainline; - piece.GetGrainlineGeometry().SetVisible(ui->groupBoxGrainline->isChecked()); - piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula)); - piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula)); - piece.GetGrainlineGeometry().SetArrowType(static_cast(ui->comboBoxArrow->currentIndex())); - piece.GetGrainlineGeometry().SetCenterPin(getCurrentObjectId(ui->comboBoxGrainlineCenterPin)); - piece.GetGrainlineGeometry().SetTopPin(getCurrentObjectId(ui->comboBoxGrainlineTopPin)); - piece.GetGrainlineGeometry().SetBottomPin(getCurrentObjectId(ui->comboBoxGrainlineBottomPin)); + piece.GetGrainlineGeometry().SetVisible(uiTabGrainline->groupBoxGrainline->isChecked()); + piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(uiTabGrainline->lineEditRotFormula)); + piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(uiTabGrainline->lineEditLenFormula)); + piece.GetGrainlineGeometry().SetArrowType(static_cast(uiTabGrainline->comboBoxArrow->currentIndex())); + piece.GetGrainlineGeometry().SetCenterPin(getCurrentObjectId(uiTabGrainline->comboBoxGrainlineCenterPin)); + piece.GetGrainlineGeometry().SetTopPin(getCurrentObjectId(uiTabGrainline->comboBoxGrainlineTopPin)); + piece.GetGrainlineGeometry().SetBottomPin(getCurrentObjectId(uiTabGrainline->comboBoxGrainlineBottomPin)); return piece; } @@ -1833,7 +1919,7 @@ VPiece DialogSeamAllowance::CreatePiece() const //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::NewMainPathItem(const VPieceNode &node) { - NewNodeItem(ui->listWidgetMainPath, node); + NewNodeItem(uiTabPaths->listWidgetMainPath, node); } //--------------------------------------------------------------------------------------------------------------------- @@ -1846,8 +1932,8 @@ void DialogSeamAllowance::NewCustomSA(const CustomSARecord &record) QListWidgetItem *item = new QListWidgetItem(name); item->setFont(QFont("Times", 12, QFont::Bold)); item->setData(Qt::UserRole, QVariant::fromValue(record)); - ui->listWidgetCustomSA->addItem(item); - ui->listWidgetCustomSA->setCurrentRow(ui->listWidgetCustomSA->count()-1); + uiTabPaths->listWidgetCustomSA->addItem(item); + uiTabPaths->listWidgetCustomSA->setCurrentRow(uiTabPaths->listWidgetCustomSA->count()-1); } } @@ -1861,8 +1947,8 @@ void DialogSeamAllowance::NewInternalPath(quint32 path) QListWidgetItem *item = new QListWidgetItem(name); item->setFont(QFont("Times", 12, QFont::Bold)); item->setData(Qt::UserRole, QVariant::fromValue(path)); - ui->listWidgetInternalPaths->addItem(item); - ui->listWidgetInternalPaths->setCurrentRow(ui->listWidgetInternalPaths->count()-1); + uiTabPaths->listWidgetInternalPaths->addItem(item); + uiTabPaths->listWidgetInternalPaths->setCurrentRow(uiTabPaths->listWidgetInternalPaths->count()-1); } } @@ -1876,8 +1962,8 @@ void DialogSeamAllowance::NewPin(quint32 pinPoint) QListWidgetItem *item = new QListWidgetItem(pin->name()); item->setFont(QFont("Times", 12, QFont::Bold)); item->setData(Qt::UserRole, QVariant::fromValue(pinPoint)); - ui->listWidgetPins->addItem(item); - ui->listWidgetPins->setCurrentRow(ui->listWidgetPins->count()-1); + uiTabPins->listWidgetPins->addItem(item); + uiTabPins->listWidgetPins->setCurrentRow(uiTabPins->listWidgetPins->count()-1); } } @@ -1907,7 +1993,7 @@ bool DialogSeamAllowance::MainPathIsValid() const if(CreatePiece().MainPathPoints(data).count() < 3) { url += tr("You need more points!"); - ui->helpLabel->setText(url); + uiTabPaths->helpLabel->setText(url); return false; } else @@ -1915,23 +2001,23 @@ bool DialogSeamAllowance::MainPathIsValid() const if(not MainPathIsClockwise()) { url += tr("You have to choose points in a clockwise direction!"); - ui->helpLabel->setText(url); + uiTabPaths->helpLabel->setText(url); return false; } - if (FirstPointEqualLast(ui->listWidgetMainPath)) + if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath)) { url += tr("First point cannot be equal to the last point!"); - ui->helpLabel->setText(url); + uiTabPaths->helpLabel->setText(url); return false; } - else if (DoublePoints(ui->listWidgetMainPath)) + else if (DoublePoints(uiTabPaths->listWidgetMainPath)) { url += tr("You have double points!"); - ui->helpLabel->setText(url); + uiTabPaths->helpLabel->setText(url); return false; } } - ui->helpLabel->setText(tr("Ready!")); + uiTabPaths->helpLabel->setText(tr("Ready!")); return true; } @@ -1963,12 +2049,12 @@ bool DialogSeamAllowance::MainPathIsClockwise() const //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitNodesList() { - const quint32 id = CURRENT_DATA(ui->comboBoxNodes).toUInt(); + const quint32 id = CURRENT_DATA(uiTabPaths->comboBoxNodes).toUInt(); - ui->comboBoxNodes->blockSignals(true); - ui->comboBoxNodes->clear(); + uiTabPaths->comboBoxNodes->blockSignals(true); + uiTabPaths->comboBoxNodes->clear(); - const QVector nodes = GetPieceInternals(ui->listWidgetMainPath); + const QVector nodes = GetPieceInternals(uiTabPaths->listWidgetMainPath); for (int i = 0; i < nodes.size(); ++i) { @@ -1977,29 +2063,29 @@ void DialogSeamAllowance::InitNodesList() { const QString name = GetNodeName(node); - ui->comboBoxNodes->addItem(name, node.GetId()); + uiTabPaths->comboBoxNodes->addItem(name, node.GetId()); } } - ui->comboBoxNodes->blockSignals(false); + uiTabPaths->comboBoxNodes->blockSignals(false); - const int index = ui->comboBoxNodes->findData(id); + const int index = uiTabPaths->comboBoxNodes->findData(id); if (index != -1) { - ui->comboBoxNodes->setCurrentIndex(index); + uiTabPaths->comboBoxNodes->setCurrentIndex(index); NodeChanged(index);// Need in case combox index was not changed } else { - ui->comboBoxNodes->count() > 0 ? NodeChanged(0) : NodeChanged(-1); + uiTabPaths->comboBoxNodes->count() > 0 ? NodeChanged(0) : NodeChanged(-1); } } //--------------------------------------------------------------------------------------------------------------------- QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id) { - for (qint32 i = 0; i < ui->listWidgetMainPath->count(); ++i) + for (qint32 i = 0; i < uiTabPaths->listWidgetMainPath->count(); ++i) { - QListWidgetItem *item = ui->listWidgetMainPath->item(i); + QListWidgetItem *item = uiTabPaths->listWidgetMainPath->item(i); const VPieceNode node = qvariant_cast(item->data(Qt::UserRole)); if (node.GetId() == id) @@ -2013,10 +2099,10 @@ QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id) //--------------------------------------------------------------------------------------------------------------------- quint32 DialogSeamAllowance::GetLastId() const { - const int count = ui->listWidgetMainPath->count(); + const int count = uiTabPaths->listWidgetMainPath->count(); if (count > 0) { - QListWidgetItem *item = ui->listWidgetMainPath->item(count-1); + QListWidgetItem *item = uiTabPaths->listWidgetMainPath->item(count-1); const VPieceNode node = qvariant_cast(item->data(Qt::UserRole)); return node.GetId(); } @@ -2043,10 +2129,10 @@ void DialogSeamAllowance::SetCurrentSAAfter(const QString &formula) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateNodeSABefore(const QString &formula) { - const int index = ui->comboBoxNodes->currentIndex(); + const int index = uiTabPaths->comboBoxNodes->currentIndex(); if (index != -1) { - QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPaths->comboBoxNodes).toUInt()); if (rowItem) { VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -2059,10 +2145,10 @@ void DialogSeamAllowance::UpdateNodeSABefore(const QString &formula) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateNodeSAAfter(const QString &formula) { - const int index = ui->comboBoxNodes->currentIndex(); + const int index = uiTabPaths->comboBoxNodes->currentIndex(); if (index != -1) { - QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPaths->comboBoxNodes).toUInt()); if (rowItem) { VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -2072,28 +2158,61 @@ void DialogSeamAllowance::UpdateNodeSAAfter(const QString &formula) } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::InitFancyTabBar() +{ + m_ftb->InsertTab(TabOrder::Paths, QIcon("://icon/32x32/paths.png"), tr("Paths")); + m_ftb->InsertTab(TabOrder::Labels, QIcon("://icon/32x32/labels.png"), tr("Labels")); + m_ftb->InsertTab(TabOrder::Grainline, QIcon("://icon/32x32/grainline.png"), tr("Grainline")); + m_ftb->InsertTab(TabOrder::Pins, QIcon("://icon/32x32/pins.png"), tr("Pins")); + + ui->horizontalLayout->addWidget(m_ftb, 0, Qt::AlignLeft); + + m_ftb->SetTabEnabled(TabOrder::Paths, true); + + m_tabPaths->hide(); + uiTabPaths->setupUi(m_tabPaths); + ui->horizontalLayout->addWidget(m_tabPaths, 1); + + m_tabLabels->hide(); + uiTabLabels->setupUi(m_tabLabels); + ui->horizontalLayout->addWidget(m_tabLabels, 1); + + m_tabGrainline->hide(); + uiTabGrainline->setupUi(m_tabGrainline); + ui->horizontalLayout->addWidget(m_tabGrainline, 1); + + m_tabPins->hide(); + uiTabPins->setupUi(m_tabPins); + ui->horizontalLayout->addWidget(m_tabPins, 1); + + connect(m_ftb, &FancyTabBar::CurrentChanged, this, &DialogSeamAllowance::FancyTabChanged); + connect(uiTabLabels->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitMainPathTab() { - ui->checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping()); + uiTabPaths->checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping()); - ui->listWidgetMainPath->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->listWidgetMainPath, &QListWidget::customContextMenuRequested, this, + uiTabPaths->listWidgetMainPath->setContextMenuPolicy(Qt::CustomContextMenu); + connect(uiTabPaths->listWidgetMainPath, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowMainPathContextMenu); - connect(ui->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this, &DialogSeamAllowance::ListChanged); + connect(uiTabPaths->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this, + &DialogSeamAllowance::ListChanged); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitSeamAllowanceTab() { - plainTextEditFormula = ui->plainTextEditFormulaWidth; - this->m_formulaBaseWidth = ui->plainTextEditFormulaWidth->height(); - this->m_formulaBaseWidthBefore = ui->plainTextEditFormulaWidthBefore->height(); - this->m_formulaBaseWidthAfter = ui->plainTextEditFormulaWidthAfter->height(); + plainTextEditFormula = uiTabPaths->plainTextEditFormulaWidth; + this->m_formulaBaseWidth = uiTabPaths->plainTextEditFormulaWidth->height(); + this->m_formulaBaseWidthBefore = uiTabPaths->plainTextEditFormulaWidthBefore->height(); + this->m_formulaBaseWidthAfter = uiTabPaths->plainTextEditFormulaWidthAfter->height(); - ui->plainTextEditFormulaWidth->installEventFilter(this); - ui->plainTextEditFormulaWidthBefore->installEventFilter(this); - ui->plainTextEditFormulaWidthAfter->installEventFilter(this); + uiTabPaths->plainTextEditFormulaWidth->installEventFilter(this); + uiTabPaths->plainTextEditFormulaWidthBefore->installEventFilter(this); + uiTabPaths->plainTextEditFormulaWidthAfter->installEventFilter(this); m_timerWidth = new QTimer(this); connect(m_timerWidth, &QTimer::timeout, this, &DialogSeamAllowance::EvalWidth); @@ -2104,48 +2223,51 @@ void DialogSeamAllowance::InitSeamAllowanceTab() m_timerWidthAfter = new QTimer(this); connect(m_timerWidthAfter, &QTimer::timeout, this, &DialogSeamAllowance::EvalWidthAfter); - connect(ui->checkBoxSeams, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableSeamAllowance); + connect(uiTabPaths->checkBoxSeams, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableSeamAllowance); // Default value for seam allowence is 1 cm. But pattern have different units, so just set 1 in dialog not enough. m_saWidth = UnitConvertor(1, Unit::Cm, qApp->patternUnit()); - ui->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth)); + uiTabPaths->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth)); InitNodesList(); - connect(ui->comboBoxNodes, static_cast(&QComboBox::currentIndexChanged), this, + connect(uiTabPaths->comboBoxNodes, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::NodeChanged); - connect(ui->pushButtonDefBefore, &QPushButton::clicked, this, &DialogSeamAllowance::ReturnDefBefore); - connect(ui->pushButtonDefAfter, &QPushButton::clicked, this, &DialogSeamAllowance::ReturnDefAfter); + connect(uiTabPaths->pushButtonDefBefore, &QPushButton::clicked, this, &DialogSeamAllowance::ReturnDefBefore); + connect(uiTabPaths->pushButtonDefAfter, &QPushButton::clicked, this, &DialogSeamAllowance::ReturnDefAfter); - InitNodeAngles(ui->comboBoxAngle); - connect(ui->comboBoxAngle, static_cast(&QComboBox::currentIndexChanged), this, + InitNodeAngles(uiTabPaths->comboBoxAngle); + connect(uiTabPaths->comboBoxAngle, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::NodeAngleChanged); - ui->listWidgetCustomSA->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->listWidgetCustomSA, &QListWidget::customContextMenuRequested, this, + uiTabPaths->listWidgetCustomSA->setContextMenuPolicy(Qt::CustomContextMenu); + connect(uiTabPaths->listWidgetCustomSA, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowCustomSAContextMenu); - connect(ui->listWidgetCustomSA, &QListWidget::currentRowChanged, this, &DialogSeamAllowance::CustomSAChanged); - connect(ui->comboBoxStartPoint, static_cast(&QComboBox::currentIndexChanged), this, - &DialogSeamAllowance::CSAStartPointChanged); - connect(ui->comboBoxEndPoint, static_cast(&QComboBox::currentIndexChanged), this, + connect(uiTabPaths->listWidgetCustomSA, &QListWidget::currentRowChanged, this, + &DialogSeamAllowance::CustomSAChanged); + connect(uiTabPaths->comboBoxStartPoint, static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::CSAStartPointChanged); + connect(uiTabPaths->comboBoxEndPoint, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::CSAEndPointChanged); - connect(ui->comboBoxIncludeType, static_cast(&QComboBox::currentIndexChanged), this, - &DialogSeamAllowance::CSAIncludeTypeChanged); + connect(uiTabPaths->comboBoxIncludeType, static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::CSAIncludeTypeChanged); - connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidth); - connect(ui->toolButtonExprBefore, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthBefore); - connect(ui->toolButtonExprAfter, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthAfter); + connect(uiTabPaths->toolButtonExprWidth, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidth); + connect(uiTabPaths->toolButtonExprBefore, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthBefore); + connect(uiTabPaths->toolButtonExprAfter, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidthAfter); - connect(ui->plainTextEditFormulaWidth, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::WidthChanged); - connect(ui->plainTextEditFormulaWidthBefore, &QPlainTextEdit::textChanged, this, + connect(uiTabPaths->plainTextEditFormulaWidth, &QPlainTextEdit::textChanged, this, + &DialogSeamAllowance::WidthChanged); + connect(uiTabPaths->plainTextEditFormulaWidthBefore, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::WidthBeforeChanged); - connect(ui->plainTextEditFormulaWidthAfter, &QPlainTextEdit::textChanged, this, + connect(uiTabPaths->plainTextEditFormulaWidthAfter, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::WidthAfterChanged); - connect(ui->pushButtonGrowWidth, &QPushButton::clicked, this, &DialogSeamAllowance::DeployWidthFormulaTextEdit); - connect(ui->pushButtonGrowWidthBefore, &QPushButton::clicked, + connect(uiTabPaths->pushButtonGrowWidth, &QPushButton::clicked, this, + &DialogSeamAllowance::DeployWidthFormulaTextEdit); + connect(uiTabPaths->pushButtonGrowWidthBefore, &QPushButton::clicked, this, &DialogSeamAllowance::DeployWidthBeforeFormulaTextEdit); - connect(ui->pushButtonGrowWidthAfter, &QPushButton::clicked, this, + connect(uiTabPaths->pushButtonGrowWidthAfter, &QPushButton::clicked, this, &DialogSeamAllowance::DeployWidthAfterFormulaTextEdit); } @@ -2156,7 +2278,7 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box) box->clear(); box->addItem(tr("Empty"), NULL_ID); - const QVector nodes = GetPieceInternals(ui->listWidgetMainPath); + const QVector nodes = GetPieceInternals(uiTabPaths->listWidgetMainPath); for (int i = 0; i < nodes.size(); ++i) { @@ -2183,7 +2305,7 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box) box->clear(); box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID); - const QVector pins = GetPieceInternals(ui->listWidgetPins); + const QVector pins = GetPieceInternals(uiTabPins->listWidgetPins); for (int i = 0; i < pins.size(); ++i) { @@ -2191,7 +2313,7 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box) box->addItem(pin->name(), pins.at(i)); } - const int index = ui->comboBoxNodes->findData(currentId); + const int index = uiTabPaths->comboBoxNodes->findData(currentId); if (index != -1) { box->setCurrentIndex(index); @@ -2201,18 +2323,19 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitSAIncludeType() { - ui->comboBoxIncludeType->clear(); + uiTabPaths->comboBoxIncludeType->clear(); - ui->comboBoxIncludeType->addItem(tr("main path"), static_cast(PiecePathIncludeType::AsMainPath)); - ui->comboBoxIncludeType->addItem(tr("custom seam allowance"), - static_cast(PiecePathIncludeType::AsCustomSA)); + uiTabPaths->comboBoxIncludeType->addItem(tr("main path"), + static_cast(PiecePathIncludeType::AsMainPath)); + uiTabPaths->comboBoxIncludeType->addItem(tr("custom seam allowance"), + static_cast(PiecePathIncludeType::AsCustomSA)); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitInternalPathsTab() { - ui->listWidgetInternalPaths->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->listWidgetInternalPaths, &QListWidget::customContextMenuRequested, this, + uiTabPaths->listWidgetInternalPaths->setContextMenuPolicy(Qt::CustomContextMenu); + connect(uiTabPaths->listWidgetInternalPaths, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowInternalPathsContextMenu); } @@ -2220,11 +2343,11 @@ void DialogSeamAllowance::InitInternalPathsTab() void DialogSeamAllowance::InitPatternPieceDataTab() { #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) - ui->lineEditName->setClearButtonEnabled(true); - ui->lineEditLetter->setClearButtonEnabled(true); + uiTabLabels->lineEditName->setClearButtonEnabled(true); + uiTabLabels->lineEditLetter->setClearButtonEnabled(true); #endif - connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged); + connect(uiTabLabels->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged); m_qslMaterials << QApplication::translate("Detail", "Fabric", 0) << QApplication::translate("Detail", "Lining", 0) @@ -2233,23 +2356,23 @@ void DialogSeamAllowance::InitPatternPieceDataTab() for (int i = 0; i < m_qslMaterials.count(); ++i) { - ui->comboBoxMaterial->addItem(m_qslMaterials[i], i); + uiTabLabels->comboBoxMaterial->addItem(m_qslMaterials[i], i); } const QStringList qsl = qApp->Settings()->GetUserDefinedMaterials(); for (int i = 0; i < qsl.count(); ++i) { - ui->comboBoxMaterial->addItem(qsl.at(i), int(MaterialType::mtUserDefined)); + uiTabLabels->comboBoxMaterial->addItem(qsl.at(i), int(MaterialType::mtUserDefined)); } m_qslPlacements << tr("None") << tr("Cut on fold"); - ui->comboBoxPlacement->addItems(m_qslPlacements); + uiTabLabels->comboBoxPlacement->addItems(m_qslPlacements); - connect(ui->pushButtonAdd, &QPushButton::clicked, this, &DialogSeamAllowance::AddUpdate); - connect(ui->pushButtonCancel, &QPushButton::clicked, this, &DialogSeamAllowance::Cancel); - connect(ui->pushButtonRemove, &QPushButton::clicked, this, &DialogSeamAllowance::Remove); - connect(ui->listWidgetMCP, &QListWidget::itemClicked, this, &DialogSeamAllowance::SetEditMode); - connect(ui->comboBoxMaterial, &QComboBox::currentTextChanged, this, &DialogSeamAllowance::MaterialChanged); + connect(uiTabLabels->pushButtonAdd, &QPushButton::clicked, this, &DialogSeamAllowance::AddUpdate); + connect(uiTabLabels->pushButtonCancel, &QPushButton::clicked, this, &DialogSeamAllowance::Cancel); + connect(uiTabLabels->pushButtonRemove, &QPushButton::clicked, this, &DialogSeamAllowance::Remove); + connect(uiTabLabels->listWidgetMCP, &QListWidget::itemClicked, this, &DialogSeamAllowance::SetEditMode); + connect(uiTabLabels->comboBoxMaterial, &QComboBox::currentTextChanged, this, &DialogSeamAllowance::MaterialChanged); SetAddMode(); } @@ -2257,69 +2380,69 @@ void DialogSeamAllowance::InitPatternPieceDataTab() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitLabelsTab() { - m_DLWidthBaseHeight = ui->lineEditDLWidthFormula->height(); - m_DLHeightBaseHeight = ui->lineEditDLHeightFormula->height(); - m_DLAngleBaseHeight = ui->lineEditDLAngleFormula->height(); + m_DLWidthBaseHeight = uiTabLabels->lineEditDLWidthFormula->height(); + m_DLHeightBaseHeight = uiTabLabels->lineEditDLHeightFormula->height(); + m_DLAngleBaseHeight = uiTabLabels->lineEditDLAngleFormula->height(); - connect(ui->groupBoxDetailLabel, &QGroupBox::toggled, this, &DialogSeamAllowance::EnabledDetailLabel); - InitPinPoint(ui->comboBoxDLCenterPin); - InitPinPoint(ui->comboBoxDLTopLeftPin); - InitPinPoint(ui->comboBoxDLBottomRightPin); + connect(uiTabLabels->groupBoxDetailLabel, &QGroupBox::toggled, this, &DialogSeamAllowance::EnabledDetailLabel); + InitPinPoint(uiTabLabels->comboBoxDLCenterPin); + InitPinPoint(uiTabLabels->comboBoxDLTopLeftPin); + InitPinPoint(uiTabLabels->comboBoxDLBottomRightPin); - connect(ui->comboBoxDLTopLeftPin, + connect(uiTabLabels->comboBoxDLTopLeftPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::DetailPinPointChanged); - connect(ui->comboBoxDLBottomRightPin, + connect(uiTabLabels->comboBoxDLBottomRightPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::DetailPinPointChanged); - connect(ui->pushButtonDLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula); - connect(ui->pushButtonDLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula); - connect(ui->pushButtonDLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula); + connect(uiTabLabels->pushButtonDLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula); + connect(uiTabLabels->pushButtonDLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula); + connect(uiTabLabels->pushButtonDLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula); - connect(ui->lineEditDLWidthFormula, &QPlainTextEdit::textChanged, this, + connect(uiTabLabels->lineEditDLWidthFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdateDetailLabelValues); - connect(ui->lineEditDLHeightFormula, &QPlainTextEdit::textChanged, this, + connect(uiTabLabels->lineEditDLHeightFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdateDetailLabelValues); - connect(ui->lineEditDLAngleFormula, &QPlainTextEdit::textChanged, this, + connect(uiTabLabels->lineEditDLAngleFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdateDetailLabelValues); - connect(ui->pushButtonShowDLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::DeployDLWidth); - connect(ui->pushButtonShowDLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::DeployDLHeight); - connect(ui->pushButtonShowDLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::DeployDLAngle); + connect(uiTabLabels->pushButtonShowDLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::DeployDLWidth); + connect(uiTabLabels->pushButtonShowDLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::DeployDLHeight); + connect(uiTabLabels->pushButtonShowDLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::DeployDLAngle); EnabledDetailLabel(); - m_PLWidthBaseHeight = ui->lineEditPLWidthFormula->height(); - m_PLHeightBaseHeight = ui->lineEditPLHeightFormula->height(); - m_PLAngleBaseHeight = ui->lineEditPLAngleFormula->height(); + m_PLWidthBaseHeight = uiTabLabels->lineEditPLWidthFormula->height(); + m_PLHeightBaseHeight = uiTabLabels->lineEditPLHeightFormula->height(); + m_PLAngleBaseHeight = uiTabLabels->lineEditPLAngleFormula->height(); - connect(ui->groupBoxPatternLabel, &QGroupBox::toggled, this, &DialogSeamAllowance::EnabledPatternLabel); - InitPinPoint(ui->comboBoxPLCenterPin); - InitPinPoint(ui->comboBoxPLTopLeftPin); - InitPinPoint(ui->comboBoxPLBottomRightPin); + connect(uiTabLabels->groupBoxPatternLabel, &QGroupBox::toggled, this, &DialogSeamAllowance::EnabledPatternLabel); + InitPinPoint(uiTabLabels->comboBoxPLCenterPin); + InitPinPoint(uiTabLabels->comboBoxPLTopLeftPin); + InitPinPoint(uiTabLabels->comboBoxPLBottomRightPin); - connect(ui->comboBoxPLTopLeftPin, + connect(uiTabLabels->comboBoxPLTopLeftPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::PatternPinPointChanged); - connect(ui->comboBoxPLBottomRightPin, + connect(uiTabLabels->comboBoxPLBottomRightPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::PatternPinPointChanged); - connect(ui->pushButtonPLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula); - connect(ui->pushButtonPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula); - connect(ui->pushButtonPLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula); + connect(uiTabLabels->pushButtonPLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula); + connect(uiTabLabels->pushButtonPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula); + connect(uiTabLabels->pushButtonPLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula); - connect(ui->lineEditPLWidthFormula, &QPlainTextEdit::textChanged, this, + connect(uiTabLabels->lineEditPLWidthFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdatePatternLabelValues); - connect(ui->lineEditPLHeightFormula, &QPlainTextEdit::textChanged, this, + connect(uiTabLabels->lineEditPLHeightFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdatePatternLabelValues); - connect(ui->lineEditPLAngleFormula, &QPlainTextEdit::textChanged, this, + connect(uiTabLabels->lineEditPLAngleFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdatePatternLabelValues); - connect(ui->pushButtonShowPLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLWidth); - connect(ui->pushButtonShowPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLHeight); - connect(ui->pushButtonShowPLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLAngle); + connect(uiTabLabels->pushButtonShowPLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLWidth); + connect(uiTabLabels->pushButtonShowPLHeight, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLHeight); + connect(uiTabLabels->pushButtonShowPLAngle, &QPushButton::clicked, this, &DialogSeamAllowance::DeployPLAngle); EnabledPatternLabel(); } @@ -2327,32 +2450,36 @@ void DialogSeamAllowance::InitLabelsTab() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitGrainlineTab() { - connect(ui->groupBoxGrainline, &QGroupBox::toggled, this, &DialogSeamAllowance::EnabledGrainline); - connect(ui->pushButtonRot, &QPushButton::clicked, this, &DialogSeamAllowance::EditGrainlineFormula); - connect(ui->pushButtonLen, &QPushButton::clicked, this, &DialogSeamAllowance::EditGrainlineFormula); - connect(ui->lineEditLenFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdateGrainlineValues); - connect(ui->lineEditRotFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdateGrainlineValues); + connect(uiTabGrainline->groupBoxGrainline, &QGroupBox::toggled, this, &DialogSeamAllowance::EnabledGrainline); + connect(uiTabGrainline->pushButtonRot, &QPushButton::clicked, this, &DialogSeamAllowance::EditGrainlineFormula); + connect(uiTabGrainline->pushButtonLen, &QPushButton::clicked, this, &DialogSeamAllowance::EditGrainlineFormula); + connect(uiTabGrainline->lineEditLenFormula, &QPlainTextEdit::textChanged, this, + &DialogSeamAllowance::UpdateGrainlineValues); + connect(uiTabGrainline->lineEditRotFormula, &QPlainTextEdit::textChanged, this, + &DialogSeamAllowance::UpdateGrainlineValues); - connect(ui->pushButtonShowRot, &QPushButton::clicked, this, &DialogSeamAllowance::DeployGrainlineRotation); - connect(ui->pushButtonShowLen, &QPushButton::clicked, this, &DialogSeamAllowance::DeployGrainlineLength); + connect(uiTabGrainline->pushButtonShowRot, &QPushButton::clicked, this, + &DialogSeamAllowance::DeployGrainlineRotation); + connect(uiTabGrainline->pushButtonShowLen, &QPushButton::clicked, this, + &DialogSeamAllowance::DeployGrainlineLength); EnabledGrainline(); - ui->comboBoxArrow->addItem(tr("Both")); - ui->comboBoxArrow->addItem(tr("Just front")); - ui->comboBoxArrow->addItem(tr("Just rear")); + uiTabGrainline->comboBoxArrow->addItem(tr("Both")); + uiTabGrainline->comboBoxArrow->addItem(tr("Just front")); + uiTabGrainline->comboBoxArrow->addItem(tr("Just rear")); - m_iRotBaseHeight = ui->lineEditRotFormula->height(); - m_iLenBaseHeight = ui->lineEditLenFormula->height(); + m_iRotBaseHeight = uiTabGrainline->lineEditRotFormula->height(); + m_iLenBaseHeight = uiTabGrainline->lineEditLenFormula->height(); - InitPinPoint(ui->comboBoxGrainlineCenterPin); - InitPinPoint(ui->comboBoxGrainlineTopPin); - InitPinPoint(ui->comboBoxGrainlineBottomPin); + InitPinPoint(uiTabGrainline->comboBoxGrainlineCenterPin); + InitPinPoint(uiTabGrainline->comboBoxGrainlineTopPin); + InitPinPoint(uiTabGrainline->comboBoxGrainlineBottomPin); - connect(ui->comboBoxGrainlineTopPin, + connect(uiTabGrainline->comboBoxGrainlineTopPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::GrainlinePinPointChanged); - connect(ui->comboBoxGrainlineBottomPin, + connect(uiTabGrainline->comboBoxGrainlineBottomPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::GrainlinePinPointChanged); } @@ -2360,31 +2487,31 @@ void DialogSeamAllowance::InitGrainlineTab() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitPinsTab() { - ui->listWidgetPins->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->listWidgetPins, &QListWidget::customContextMenuRequested, this, + uiTabPins->listWidgetPins->setContextMenuPolicy(Qt::CustomContextMenu); + connect(uiTabPins->listWidgetPins, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowPinsContextMenu); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitAllPinComboboxes() { - InitPinPoint(ui->comboBoxGrainlineCenterPin); - InitPinPoint(ui->comboBoxGrainlineTopPin); - InitPinPoint(ui->comboBoxGrainlineBottomPin); + InitPinPoint(uiTabGrainline->comboBoxGrainlineCenterPin); + InitPinPoint(uiTabGrainline->comboBoxGrainlineTopPin); + InitPinPoint(uiTabGrainline->comboBoxGrainlineBottomPin); - InitPinPoint(ui->comboBoxDLCenterPin); - InitPinPoint(ui->comboBoxDLTopLeftPin); - InitPinPoint(ui->comboBoxDLBottomRightPin); + InitPinPoint(uiTabLabels->comboBoxDLCenterPin); + InitPinPoint(uiTabLabels->comboBoxDLTopLeftPin); + InitPinPoint(uiTabLabels->comboBoxDLBottomRightPin); - InitPinPoint(ui->comboBoxPLCenterPin); - InitPinPoint(ui->comboBoxPLTopLeftPin); - InitPinPoint(ui->comboBoxPLBottomRightPin); + InitPinPoint(uiTabLabels->comboBoxPLCenterPin); + InitPinPoint(uiTabLabels->comboBoxPLTopLeftPin); + InitPinPoint(uiTabLabels->comboBoxPLBottomRightPin); } //--------------------------------------------------------------------------------------------------------------------- QString DialogSeamAllowance::GetFormulaSAWidth() const { - QString width = ui->plainTextEditFormulaWidth->toPlainText(); + QString width = uiTabPaths->plainTextEditFormulaWidth->toPlainText(); width.replace("\n", " "); return qApp->TrVars()->TryFormulaFromUser(width, qApp->Settings()->GetOsSeparator()); } @@ -2398,26 +2525,26 @@ void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula) { this->DeployWidthFormulaTextEdit(); } - ui->plainTextEditFormulaWidth->setPlainText(width); + uiTabPaths->plainTextEditFormulaWidth->setPlainText(width); VisToolPiece *path = qobject_cast(vis); SCASSERT(path != nullptr) const VPiece p = CreatePiece(); path->SetPiece(p); - MoveCursorToEnd(ui->plainTextEditFormulaWidth); + MoveCursorToEnd(uiTabPaths->plainTextEditFormulaWidth); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateCurrentCustomSARecord() { - const int row = ui->listWidgetCustomSA->currentRow(); - if (ui->listWidgetCustomSA->count() == 0 || row == -1) + const int row = uiTabPaths->listWidgetCustomSA->currentRow(); + if (uiTabPaths->listWidgetCustomSA->count() == 0 || row == -1) { return; } - QListWidgetItem *item = ui->listWidgetCustomSA->item(row); + QListWidgetItem *item = uiTabPaths->listWidgetCustomSA->item(row); SCASSERT(item != nullptr); const CustomSARecord record = qvariant_cast(item->data(Qt::UserRole)); item->setText(GetPathName(record.path, record.reverse)); @@ -2426,13 +2553,13 @@ void DialogSeamAllowance::UpdateCurrentCustomSARecord() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateCurrentInternalPathRecord() { - const int row = ui->listWidgetInternalPaths->currentRow(); - if (ui->listWidgetInternalPaths->count() == 0 || row == -1) + const int row = uiTabPaths->listWidgetInternalPaths->currentRow(); + if (uiTabPaths->listWidgetInternalPaths->count() == 0 || row == -1) { return; } - QListWidgetItem *item = ui->listWidgetInternalPaths->item(row); + QListWidgetItem *item = uiTabPaths->listWidgetInternalPaths->item(row); SCASSERT(item != nullptr); const quint32 path = qvariant_cast(item->data(Qt::UserRole)); item->setText(GetPathName(path)); @@ -2441,9 +2568,9 @@ void DialogSeamAllowance::UpdateCurrentInternalPathRecord() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ClearFields() { - ui->comboBoxMaterial->setCurrentIndex(0); - ui->spinBoxCutNumber->setValue(0); - ui->comboBoxPlacement->setCurrentIndex(0); + uiTabLabels->comboBoxMaterial->setCurrentIndex(0); + uiTabLabels->spinBoxCutNumber->setValue(0); + uiTabLabels->comboBoxPlacement->setCurrentIndex(0); } //--------------------------------------------------------------------------------------------------------------------- @@ -2474,9 +2601,9 @@ void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula) { this->DeployGrainlineRotation(); } - ui->lineEditRotFormula->setPlainText(formula); + uiTabGrainline->lineEditRotFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditRotFormula); + MoveCursorToEnd(uiTabGrainline->lineEditRotFormula); } //--------------------------------------------------------------------------------------------------------------------- @@ -2494,9 +2621,9 @@ void DialogSeamAllowance::SetGrainlineLength(QString lengthFormula) this->DeployGrainlineLength(); } - ui->lineEditLenFormula->setPlainText(formula); + uiTabGrainline->lineEditLenFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditLenFormula); + MoveCursorToEnd(uiTabGrainline->lineEditLenFormula); } //--------------------------------------------------------------------------------------------------------------------- @@ -2514,9 +2641,9 @@ void DialogSeamAllowance::SetDLWidth(QString widthFormula) this->DeployDLWidth(); } - ui->lineEditDLWidthFormula->setPlainText(formula); + uiTabLabels->lineEditDLWidthFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditDLWidthFormula); + MoveCursorToEnd(uiTabLabels->lineEditDLWidthFormula); } //--------------------------------------------------------------------------------------------------------------------- @@ -2534,9 +2661,9 @@ void DialogSeamAllowance::SetDLHeight(QString heightFormula) this->DeployDLHeight(); } - ui->lineEditDLHeightFormula->setPlainText(formula); + uiTabLabels->lineEditDLHeightFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditDLHeightFormula); + MoveCursorToEnd(uiTabLabels->lineEditDLHeightFormula); } //--------------------------------------------------------------------------------------------------------------------- @@ -2554,9 +2681,9 @@ void DialogSeamAllowance::SetDLAngle(QString angleFormula) this->DeployDLAngle(); } - ui->lineEditDLAngleFormula->setPlainText(formula); + uiTabLabels->lineEditDLAngleFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditDLAngleFormula); + MoveCursorToEnd(uiTabLabels->lineEditDLAngleFormula); } //--------------------------------------------------------------------------------------------------------------------- @@ -2574,9 +2701,9 @@ void DialogSeamAllowance::SetPLWidth(QString widthFormula) this->DeployPLWidth(); } - ui->lineEditPLWidthFormula->setPlainText(formula); + uiTabLabels->lineEditPLWidthFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditPLWidthFormula); + MoveCursorToEnd(uiTabLabels->lineEditPLWidthFormula); } //--------------------------------------------------------------------------------------------------------------------- @@ -2594,9 +2721,9 @@ void DialogSeamAllowance::SetPLHeight(QString heightFormula) this->DeployPLHeight(); } - ui->lineEditPLHeightFormula->setPlainText(formula); + uiTabLabels->lineEditPLHeightFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditPLHeightFormula); + MoveCursorToEnd(uiTabLabels->lineEditPLHeightFormula); } //--------------------------------------------------------------------------------------------------------------------- @@ -2614,7 +2741,27 @@ void DialogSeamAllowance::SetPLAngle(QString angleFormula) this->DeployPLAngle(); } - ui->lineEditPLAngleFormula->setPlainText(formula); + uiTabLabels->lineEditPLAngleFormula->setPlainText(formula); - MoveCursorToEnd(ui->lineEditPLAngleFormula); + MoveCursorToEnd(uiTabLabels->lineEditPLAngleFormula); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::ShowPins() +{ + if (m_visPins.isNull()) + { + m_visPins = new VisPiecePins(data); + } + + m_visPins->SetPins(GetPieceInternals(uiTabPins->listWidgetPins)); + + if (not qApp->getCurrentScene()->items().contains(m_visPins)) + { + m_visPins->VisualMode(NULL_ID); + } + else + { + m_visPins->RefreshGeometry(); + } } diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h similarity index 92% rename from src/libs/vtools/dialogs/tools/dialogseamallowance.h rename to src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h index c3c2237d7..f0967b597 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h @@ -29,7 +29,7 @@ #ifndef DIALOGSEAMALLOWANCE_H #define DIALOGSEAMALLOWANCE_H -#include "dialogtool.h" +#include "../dialogtool.h" #include "../vpatterndb/vpiece.h" #include "../vpatterndb/floatItemData/vpatternlabeldata.h" #include "../vpatterndb/floatItemData/vpiecelabeldata.h" @@ -38,9 +38,14 @@ namespace Ui { class DialogSeamAllowance; + class TabPaths; + class TabLabels; + class TabGrainline; + class TabPins; } class VisPiecePins; +class FancyTabBar; class DialogSeamAllowance : public DialogTool { @@ -66,6 +71,7 @@ protected: virtual void SaveData() Q_DECL_OVERRIDE; virtual void CheckState() Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; + virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE; protected slots: void UpdateList(); @@ -92,6 +98,7 @@ private slots: void ReturnDefAfter(); void CustomSAChanged(int row); void PathDialogClosed(int result); + void FancyTabChanged(int index); void TabChanged(int index); void UpdateGrainlineValues(); @@ -147,6 +154,19 @@ private: Q_DISABLE_COPY(DialogSeamAllowance) Ui::DialogSeamAllowance *ui; + Ui::TabPaths *uiTabPaths; + Ui::TabLabels *uiTabLabels; + Ui::TabGrainline *uiTabGrainline; + Ui::TabPins *uiTabPins; + + QWidget *m_tabPaths; + QWidget *m_tabLabels; + QWidget *m_tabGrainline; + QWidget *m_tabPins; + + FancyTabBar* m_ftb; + + bool dialogIsInitialized; bool applyAllowed; bool flagGPin; bool flagDPin; @@ -212,6 +232,7 @@ private: void UpdateNodeSABefore(const QString &formula); void UpdateNodeSAAfter(const QString &formula); + void InitFancyTabBar(); void InitMainPathTab(); void InitSeamAllowanceTab(); void InitNodesList(); @@ -240,6 +261,8 @@ private: void SetPLWidth(QString widthFormula); void SetPLHeight(QString heightFormula); void SetPLAngle(QString angleFormula); + + void ShowPins(); }; #endif // DIALOGSEAMALLOWANCE_H diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.ui b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.ui new file mode 100644 index 000000000..43e4a1df8 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.ui @@ -0,0 +1,73 @@ + + + DialogSeamAllowance + + + + 0 + 0 + 659 + 574 + + + + Seam allowance tool + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + DialogSeamAllowance + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogSeamAllowance + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabgrainline.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabgrainline.ui new file mode 100644 index 000000000..b3175187f --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabgrainline.ui @@ -0,0 +1,514 @@ + + + TabGrainline + + + + 0 + 0 + 275 + 362 + + + + Form + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + Grainline visible + + + true + + + false + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Rotation: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + + 0 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + 1 + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + ../../ + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Length: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + + 0 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + 90 + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + ../../ + + + + 16 + 16 + + + + true + + + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + Center pin: + + + + + + + + + + + + Qt::Horizontal + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + Top pin: + + + + + + + + + + Bottom pin: + + + + + + + + + + + + Qt::Horizontal + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 0 + 0 + + + + Arrows: + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tablabels.ui similarity index 51% rename from src/libs/vtools/dialogs/tools/dialogseamallowance.ui rename to src/libs/vtools/dialogs/tools/piece/tabs/tablabels.ui index b59cf9ca6..28f8dcf4b 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tablabels.ui @@ -1,908 +1,35 @@ - DialogSeamAllowance - + TabLabels + 0 0 532 - 611 + 479 - Seam allowance tool + Form - + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png - 5 + 0 - - - Main path - - - - - - - - - 0 - 0 - - - - - - - :/icon/32x32/clockwise.png - - - - - - - All objects in path should follow in clockwise direction. - - - true - - - - - - - - - Forbid piece be mirrored in a layout. - - - Forbid flipping - - - - - - - QAbstractItemView::InternalMove - - - - - - - Ready! - - - Qt::RichText - - - false - - - - - - - - Seam allowance - - - - - - Seam allowance - - - false - - - - - - - false - - - Automatic - - - false - - - false - - - - 0 - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Width: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - Nodes - - - - 0 - - - - - - - - 0 - 0 - - - - Node: - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Before: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Return to default width - - - Default - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - After: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Return to default width - - - Default - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - - - Angle: - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - false - - - Custom - - - false - - - - 6 - - - 9 - - - 0 - - - - - Qt::Horizontal - - - true - - - - - QFormLayout::ExpandingFieldsGrow - - - 6 - - - - - Start point: - - - - - - - - - - End point: - - - - - - - - - - Include as: - - - - - - - - 0 - 0 - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Internal paths - - - - - - QAbstractItemView::InternalMove - - - - - Piece label data - + - + Qt::Horizontal @@ -1060,9 +187,9 @@ Labels - + - + Qt::Horizontal @@ -1157,7 +284,7 @@ ... - + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -1174,7 +301,7 @@ - :/icon/24x24/equal.png + :/icon/24x24/equal.png @@ -1257,7 +384,7 @@ - .. + ../../ @@ -1359,7 +486,7 @@ ... - + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -1376,7 +503,7 @@ - :/icon/24x24/equal.png + :/icon/24x24/equal.png @@ -1459,7 +586,7 @@ - .. + ../../ @@ -1645,7 +772,7 @@ ... - + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -1662,7 +789,7 @@ - :/icon/24x24/equal.png + :/icon/24x24/equal.png @@ -1745,7 +872,7 @@ - .. + ../../ @@ -1863,7 +990,7 @@ ... - + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -1880,7 +1007,7 @@ - :/icon/24x24/equal.png + :/icon/24x24/equal.png @@ -1963,7 +1090,7 @@ - .. + ../../ @@ -2065,7 +1192,7 @@ ... - + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -2082,7 +1209,7 @@ - :/icon/24x24/equal.png + :/icon/24x24/equal.png @@ -2165,7 +1292,7 @@ - .. + ../../ @@ -2351,7 +1478,7 @@ ... - + :/icon/24x24/fx.png:/icon/24x24/fx.png @@ -2368,7 +1495,7 @@ - :/icon/24x24/equal.png + :/icon/24x24/equal.png @@ -2451,7 +1578,7 @@ - .. + ../../ @@ -2485,563 +1612,12 @@ - - - Grainline - - - - - - Grainline visible - - - true - - - false - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Rotation: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - - 0 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - 1 - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Length: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - - 0 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - 90 - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - Center pin: - - - - - - - - - - - - Qt::Horizontal - - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - Top pin: - - - - - - - - - - Bottom pin: - - - - - - - - - - - - Qt::Horizontal - - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - - 0 - 0 - - - - Arrows: - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Pins - - - - - - QAbstractItemView::InternalMove - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + - - - buttonBox - accepted() - DialogSeamAllowance - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogSeamAllowance - reject() - - - 316 - 260 - - - 286 - 274 - - - - + diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui new file mode 100644 index 000000000..d35b64c97 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui @@ -0,0 +1,894 @@ + + + TabPaths + + + + 0 + 0 + 401 + 572 + + + + Form + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + 0 + + + + Main path + + + + + + + + + 0 + 0 + + + + + + + :/icon/32x32/clockwise.png + + + + + + + All objects in path should follow in clockwise direction. + + + true + + + + + + + + + Forbid piece be mirrored in a layout. + + + Forbid flipping + + + + + + + QAbstractItemView::InternalMove + + + + + + + Ready! + + + Qt::RichText + + + false + + + + + + + + Seam allowance + + + + + + Seam allowance + + + false + + + + + + + false + + + Automatic + + + false + + + false + + + + 0 + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Width: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + ../../ + + + + 16 + 16 + + + + true + + + + + + + + + Nodes + + + + 0 + + + + + + + + 0 + 0 + + + + Node: + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Before: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Return to default width + + + Default + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + ../../ + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + After: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Return to default width + + + Default + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + ../../ + + + + 16 + 16 + + + + true + + + + + + + + + + + Angle: + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + false + + + Custom + + + false + + + + 6 + + + 9 + + + 0 + + + + + Qt::Horizontal + + + true + + + + + QFormLayout::ExpandingFieldsGrow + + + 6 + + + + + Start point: + + + + + + + + + + End point: + + + + + + + + + + Include as: + + + + + + + + 0 + 0 + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + + + + Internal paths + + + + + + QAbstractItemView::InternalMove + + + + + + + + + + + + + + diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabpins.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabpins.ui new file mode 100644 index 000000000..1b6af4eb4 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpins.ui @@ -0,0 +1,34 @@ + + + TabPins + + + + 0 + 0 + 296 + 255 + + + + Form + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + QAbstractItemView::InternalMove + + + + + + + + + + diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 4bce8e9e2..dece7bca2 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtoolseamallowance.h" -#include "../dialogs/tools/dialogseamallowance.h" +#include "../dialogs/tools/piece/dialogseamallowance.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/calculator.h" diff --git a/src/libs/vwidgets/fancytabbar/fancytab.cpp b/src/libs/vwidgets/fancytabbar/fancytab.cpp new file mode 100644 index 000000000..a01749bf0 --- /dev/null +++ b/src/libs/vwidgets/fancytabbar/fancytab.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "fancytab.h" + +#include + +//--------------------------------------------------------------------------------------------------------------------- +FancyTab::FancyTab(QWidget *tabbar) + : m_icon(), + m_text(), + m_toolTip(), + m_enabled(false), + m_Animator(), + m_TabBar(tabbar), + m_Fader(0) +{ + m_Animator.setPropertyName("fader"); + m_Animator.setTargetObject(this); +} + +//--------------------------------------------------------------------------------------------------------------------- +float FancyTab::fader() +{ + return m_Fader; +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTab::fadeIn() +{ + m_Animator.stop(); + m_Animator.setDuration(80); + m_Animator.setEndValue(40); + m_Animator.start(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTab::fadeOut() +{ + m_Animator.stop(); + m_Animator.setDuration(160); + m_Animator.setEndValue(0); + m_Animator.start(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTab::setFader(float value) +{ + m_Fader = value; + m_TabBar->update(); +} diff --git a/src/libs/vwidgets/fancytabbar/fancytab.h b/src/libs/vwidgets/fancytabbar/fancytab.h new file mode 100644 index 000000000..8b3ee4adc --- /dev/null +++ b/src/libs/vwidgets/fancytabbar/fancytab.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef FANCYTAB_H +#define FANCYTAB_H + +#include +#include + +class FancyTab : public QObject +{ + friend class FancyTabBar; + Q_OBJECT + + Q_PROPERTY(float fader READ fader WRITE setFader) +public: + explicit FancyTab(QWidget *tabbar); + + float fader(); + void setFader(float value); + + void fadeIn(); + void fadeOut(); + +private: + Q_DISABLE_COPY(FancyTab) + QIcon m_icon; + QString m_text; + QString m_toolTip; + bool m_enabled; + QPropertyAnimation m_Animator; + QWidget *m_TabBar; + float m_Fader; +}; + +#endif // FANCYTAB_H diff --git a/src/libs/vwidgets/fancytabbar/fancytabbar.cpp b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp new file mode 100644 index 000000000..69fb20796 --- /dev/null +++ b/src/libs/vwidgets/fancytabbar/fancytabbar.cpp @@ -0,0 +1,658 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "fancytabbar.h" +#include "stylehelper.h" + +#include +#include +#include +#include +#include + +const int FancyTabBar::m_rounding = 22; +const int FancyTabBar::m_textPadding = 4; + +//--------------------------------------------------------------------------------------------------------------------- +FancyTabBar::FancyTabBar(const TabBarPosition position, QWidget *parent) + : QWidget(parent), + m_position(position), + m_hoverRect(), + m_hoverIndex(-1), + m_currentIndex(-1), + m_attachedTabs(), + m_timerTriggerChangedSignal() +{ + if (m_position == FancyTabBar::Above || m_position == FancyTabBar::Below) + { + setMinimumHeight(qMax(2 * m_rounding, 40)); + setMaximumHeight(TabSizeHint(false).height()); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + } + else + { + setMinimumWidth(qMax(2 * m_rounding, 40)); + setMaximumWidth(TabSizeHint(false).width()); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + } + + setAttribute(Qt::WA_Hover, true); + setFocusPolicy(Qt::NoFocus); + setMouseTracking(true); // Needed for hover events + m_timerTriggerChangedSignal.setSingleShot(true); + + // We use a zerotimer to keep the sidebar responsive + connect(&m_timerTriggerChangedSignal, &QTimer::timeout, this, &FancyTabBar::EmitCurrentIndex); +} + +//--------------------------------------------------------------------------------------------------------------------- +FancyTabBar::~FancyTabBar() +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +QSize FancyTabBar::TabSizeHint(bool minimum) const +{ + QFont boldFont(font()); + boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + QFontMetrics fm(boldFont); + int spacing = 8; + int width = 60 + spacing + 2; + int maxLabelwidth = 0; + for (int tab=0 ; tab maxLabelwidth) + { + maxLabelwidth = width; + } + } + int iconHeight = minimum ? 0 : 32; + + return QSize(qMax(width, maxLabelwidth + 4), iconHeight + spacing + fm.height()); +} + +//--------------------------------------------------------------------------------------------------------------------- +QPoint FancyTabBar::GetCorner(const QRect& rect, const Corner corner) const +{ + switch(m_position) + { + case Above: + switch(corner) + { + case OutsideBeginning: + return rect.topLeft(); + case OutsideEnd: + return rect.topRight(); + case InsideBeginning: + return rect.bottomLeft(); + case InsideEnd: + return rect.bottomRight(); + default: + break; + } + case Below: + switch(corner) + { + case OutsideBeginning: + return rect.bottomLeft(); + case OutsideEnd: + return rect.bottomRight(); + case InsideBeginning: + return rect.topLeft(); + case InsideEnd: + return rect.topRight(); + default: + break; + } + case Left: + switch(corner) + { + case OutsideBeginning: + return rect.topLeft(); + case OutsideEnd: + return rect.bottomLeft(); + case InsideBeginning: + return rect.topRight(); + case InsideEnd: + return rect.bottomRight(); + default: + break; + } + case Right: + switch(corner) + { + case OutsideBeginning: + return rect.topRight(); + case OutsideEnd: + return rect.bottomRight(); + case InsideBeginning: + return rect.topLeft(); + case InsideEnd: + return rect.bottomLeft(); + default: + break; + } + default: + break; + } + + Q_ASSERT("that's impossible!"); + + return QPoint(); +} + +//--------------------------------------------------------------------------------------------------------------------- +// You can pass this method a QRect and tell it to move its edges to the outside (+) +// or inside (-) of the rect. For example, with a TabBar at the Above, +// +// adjustRect(QRect(0,0,10,10), 1, 2, 3, -4) // thats a 10 by 10 QRect, starting at 0/0 +// +// gives +// +// QRect(-3, -1, 9, 13) // 9 by 13 rect, starting at -3/-1. +QRect FancyTabBar::AdjustRect(const QRect& rect, const qint8 offsetOutside, const qint8 offsetInside, + const qint8 offsetBeginning, const qint8 offsetEnd) const +{ + switch(m_position) + { + case Above: + return rect.adjusted(-offsetBeginning, -offsetOutside, offsetEnd, offsetInside); + case Below: + return rect.adjusted(-offsetBeginning, -offsetInside, -offsetBeginning, offsetOutside); + case Left: + return rect.adjusted(-offsetOutside, -offsetBeginning, offsetInside, offsetEnd); + case Right: + return rect.adjusted(-offsetInside, -offsetBeginning, offsetOutside, offsetEnd); + default: + break; + } + + Q_ASSERT("that's impossible!"); + return QRect(); +} + +//--------------------------------------------------------------------------------------------------------------------- +// Same with a point: + means towards Outside/End, - means towards Inside/Beginning +QPoint FancyTabBar::AdjustPoint(const QPoint& point, const qint8 offsetInsideOutside, + const qint8 offsetBeginningEnd) const +{ + switch(m_position) + { + case Above: + return point + QPoint(offsetBeginningEnd, -offsetInsideOutside); + case Below: + return point + QPoint(offsetBeginningEnd, offsetInsideOutside); + case Left: + return point + QPoint(-offsetInsideOutside, offsetBeginningEnd); + case Right: + return point + QPoint(offsetInsideOutside, offsetBeginningEnd); + default: + break; + } + + Q_ASSERT("that's impossible!"); + return QPoint(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event) + QPainter painter(this); + + // paint background + QRect rectangle = AdjustRect(rect(), 0, -1, 0, 0); + QLinearGradient lg; + + lg.setStart(GetCorner(rectangle, OutsideBeginning)); + lg.setFinalStop(GetCorner(rectangle, InsideBeginning)); + lg.setColorAt(0.0, QColor(64, 64, 64, 255)); + lg.setColorAt(1.0, QColor(130, 130, 130, 255)); + painter.fillRect(rectangle, lg); + + // draw dark widget bordert on inner inside (e.g. bottom if the widget position is top) + painter.setPen(StyleHelper::borderColor()); + painter.drawLine(AdjustPoint(GetCorner(rectangle, InsideBeginning), -1, 0), + AdjustPoint(GetCorner(rectangle, InsideEnd), -1, 0)); + + // draw bright widget border on outer inside (e.g. bottom if the widget position is top) + painter.setPen(StyleHelper::sidebarHighlight()); + painter.drawLine(GetCorner(rectangle, InsideBeginning), GetCorner(rectangle, InsideEnd)); + + // paint inactive tabs + for (int i = 0; i < Count(); ++i) + { + if (i != CurrentIndex()) + { + PaintTab(&painter, i); + } + } + + // paint active tab last, since it overlaps the neighbors + if (CurrentIndex() != -1) + { + PaintTab(&painter, CurrentIndex()); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +// Handle hover events for mouse fade ins +void FancyTabBar::mouseMoveEvent(QMouseEvent *e) +{ + int newHover = -1; + for (int i = 0; i < Count(); ++i) + { + QRect area = TabRect(i); + if (area.contains(e->pos())) + { + newHover = i; + break; + } + } + if (newHover == m_hoverIndex) + { + return; + } + + if (ValidIndex(m_hoverIndex)) + { + m_attachedTabs[m_hoverIndex]->fadeOut(); + } + + m_hoverIndex = newHover; + + if (ValidIndex(m_hoverIndex)) + { + m_attachedTabs[m_hoverIndex]->fadeIn(); + m_hoverRect = TabRect(m_hoverIndex); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +bool FancyTabBar::event(QEvent *event) +{ + if (event->type() == QEvent::ToolTip) + { + if (ValidIndex(m_hoverIndex)) + { + QString tt = TabToolTip(m_hoverIndex); + if (!tt.isEmpty()) + { + QToolTip::showText(static_cast(event)->globalPos(), tt, this); + return true; + } + } + } + return QWidget::event(event); +} + +//--------------------------------------------------------------------------------------------------------------------- +// Resets hover animation on mouse enter +void FancyTabBar::enterEvent(QEvent *e) +{ + Q_UNUSED(e) + m_hoverRect = QRect(); + m_hoverIndex = -1; +} + +//--------------------------------------------------------------------------------------------------------------------- +// Resets hover animation on mouse leave +void FancyTabBar::leaveEvent(QEvent *e) +{ + Q_UNUSED(e) + m_hoverIndex = -1; + m_hoverRect = QRect(); + for (int i = 0 ; i < m_attachedTabs.count() ; ++i) + { + m_attachedTabs[i]->fadeOut(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +bool FancyTabBar::ValidIndex(int index) const +{ + return index >= 0 && index < m_attachedTabs.count(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::SetOrientation(const FancyTabBar::TabBarPosition p) +{ + m_position = p; +} + +//--------------------------------------------------------------------------------------------------------------------- +QSize FancyTabBar::sizeHint() const +{ + QSize sh = TabSizeHint(); + // return QSize(sh.width(), sh.height() * mAttachedTabs.count()); + + if (m_position == Above || m_position == Below) + { + return QSize(sh.width() * m_attachedTabs.count(), sh.height()); + } + else + { + return QSize(sh.width(), sh.height() * m_attachedTabs.count()); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +QSize FancyTabBar::minimumSizeHint() const +{ + const QSize sh = TabSizeHint(true); +// return QSize(sh.width(), sh.height() * mAttachedTabs.count()); + + if(m_position == Above || m_position == Below) + { + return QSize(sh.width() * m_attachedTabs.count(), sh.height()); + } + else + { + return QSize(sh.width(), sh.height() * m_attachedTabs.count()); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +QRect FancyTabBar::TabRect(int index) const +{ + QSize sh = TabSizeHint(); + + if(m_position == Above || m_position == Below) + { + if (sh.width() * m_attachedTabs.count() > width()) + { + sh.setWidth(width() / m_attachedTabs.count()); + } + + return QRect(index * sh.width(), 0, sh.width(), sh.height()); + } + else + { + if (sh.height() * m_attachedTabs.count() > height()) + { + sh.setHeight(height() / m_attachedTabs.count()); + } + + return QRect(0, index * sh.height(), sh.width(), sh.height()); + } + +} + +//--------------------------------------------------------------------------------------------------------------------- +// This keeps the sidebar responsive since +// we get a repaint before loading the +// mode itself +void FancyTabBar::EmitCurrentIndex() +{ + emit CurrentChanged(m_currentIndex); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::mousePressEvent(QMouseEvent *e) +{ + e->accept(); + for (int index = 0; index < m_attachedTabs.count(); ++index) + { + if (TabRect(index).contains(e->pos())) + { + if (IsTabEnabled(index)) + { + m_currentIndex = index; + update(); + m_timerTriggerChangedSignal.start(0); + } + break; + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::PaintTab(QPainter *painter, int tabIndex) const +{ + if (!ValidIndex(tabIndex)) + { + qWarning("invalid index"); + return; + } + painter->save(); + + QRect rect = TabRect(tabIndex); + bool selected = (tabIndex == m_currentIndex); + bool enabled = IsTabEnabled(tabIndex); + + if(selected) + { + // background + painter->save(); + QLinearGradient grad(GetCorner(rect, OutsideBeginning), GetCorner(rect, InsideBeginning)); + grad.setColorAt(0, QColor(255, 255, 255, 140)); + grad.setColorAt(1, QColor(255, 255, 255, 210)); + painter->fillRect(AdjustRect(rect, 0, 0, 0, -1), grad); + painter->restore(); + + // shadows (the black lines immediately before/after (active && selected)-backgrounds) + painter->setPen(QColor(0, 0, 0, 110)); + painter->drawLine(AdjustPoint(GetCorner(rect, OutsideBeginning), 0, -1), + AdjustPoint(GetCorner(rect, InsideBeginning), 0, -1)); + painter->drawLine(GetCorner(rect, OutsideEnd), GetCorner(rect, InsideEnd)); + + // thin shadow on the outside of active tab + painter->setPen(QColor(0, 0, 0, 40)); + painter->drawLine(GetCorner(rect, OutsideBeginning), GetCorner(rect, OutsideEnd)); + + // highlights + painter->setPen(QColor(255, 255, 255, 50)); + painter->drawLine(AdjustPoint(GetCorner(rect, OutsideBeginning), 0, -2), + AdjustPoint(GetCorner(rect, InsideBeginning), 0, -2)); + painter->drawLine(AdjustPoint(GetCorner(rect, OutsideEnd), 0, 1), + AdjustPoint(GetCorner(rect, InsideEnd), 0, 1)); + + painter->setPen(QColor(255, 255, 255, 40)); + // thin white line towards beginning + painter->drawLine(AdjustPoint(GetCorner(rect, OutsideBeginning), 0, 0), + AdjustPoint(GetCorner(rect, InsideBeginning), 0, 0)); + // thin white line on inside border + painter->drawLine(AdjustPoint(GetCorner(rect, InsideBeginning), 0, 1), + AdjustPoint(GetCorner(rect, InsideEnd), 0, -1)); + // thin white line towards end + painter->drawLine(AdjustPoint(GetCorner(rect, OutsideEnd), 0, -1), + AdjustPoint(GetCorner(rect, InsideEnd), 0, -1)); + } + + QString tabText(this->TabText(tabIndex)); + QRect tabTextRect(rect); + const bool drawIcon = rect.height() > 36; + QRect tabIconRect(tabTextRect); + tabTextRect.translate(0, drawIcon ? -2 : 1); + QFont boldFont(painter->font()); + boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + painter->setFont(boldFont); + painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110)); + const int textFlags = Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) | Qt::TextWordWrap; + if (enabled) + { + painter->drawText(tabTextRect, textFlags, tabText); + painter->setPen(selected ? QColor(60, 60, 60) : StyleHelper::panelTextColor()); + } + else + { + painter->setPen(selected ? StyleHelper::panelTextColor() : QColor(255, 255, 255, 120)); + } + +#if defined(Q_OS_MAC) + bool isMac=true; +#else + bool isMac = false; +#endif + + // hover + if(!isMac && !selected && enabled) + { + painter->save(); + int fader = int(m_attachedTabs[tabIndex]->fader()); + QLinearGradient grad(GetCorner(rect, OutsideBeginning), GetCorner(rect, InsideBeginning)); + + grad.setColorAt(0, Qt::transparent); + grad.setColorAt(0.5, QColor(255, 255, 255, fader)); + grad.setColorAt(1, Qt::transparent); + painter->fillRect(rect, grad); + painter->setPen(QPen(grad, 1.0)); + + if(m_position == Above || m_position == Below) + { + painter->drawLine(rect.topLeft(), rect.bottomLeft()); + painter->drawLine(rect.topRight(), rect.bottomRight()); + } + else + { + painter->drawLine(rect.topLeft(), rect.topRight()); + painter->drawLine(rect.bottomLeft(), rect.bottomRight()); + } + + painter->restore(); + } + + if (!enabled) + { + painter->setOpacity(0.7); + } + + if (drawIcon) + { + int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, + tabText).height(); + tabIconRect.adjust(0, 4, 0, -textHeight); + StyleHelper::drawIconWithShadow(TabIcon(tabIndex), tabIconRect, painter, + enabled ? QIcon::Normal : QIcon::Disabled); + } + + painter->translate(0, -1); + painter->drawText(tabTextRect, textFlags, tabText); + painter->restore(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::SetCurrentIndex(int index) +{ + if (IsTabEnabled(index)) + { + m_currentIndex = index; + update(); + emit CurrentChanged(m_currentIndex); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +int FancyTabBar::CurrentIndex() const +{ + return m_currentIndex; +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::SetTabToolTip(int index, QString toolTip) +{ + m_attachedTabs[index]->m_toolTip = toolTip; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString FancyTabBar::TabToolTip(int index) const +{ + return m_attachedTabs.at(index)->m_toolTip; +} + +//--------------------------------------------------------------------------------------------------------------------- +QIcon FancyTabBar::TabIcon(int index) const +{ + return m_attachedTabs.at(index)->m_icon; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString FancyTabBar::TabText(int index) const +{ + return m_attachedTabs.at(index)->m_text; +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::SetTabText(int index, QString text) +{ + m_attachedTabs.at(index)->m_text=text; + update(); +} + +//--------------------------------------------------------------------------------------------------------------------- +int FancyTabBar::Count() const +{ + return m_attachedTabs.count(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::SetTabEnabled(int index, bool enable) +{ + Q_ASSERT(index < m_attachedTabs.size()); + Q_ASSERT(index >= 0); + + if (index < m_attachedTabs.size() && index >= 0) + { + m_attachedTabs[index]->m_enabled = enable; + update(TabRect(index)); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +bool FancyTabBar::IsTabEnabled(int index) const +{ + Q_ASSERT(index < m_attachedTabs.size()); + Q_ASSERT(index >= 0); + + if (index < m_attachedTabs.size() && index >= 0) + { + return m_attachedTabs[index]->m_enabled; + } + + return false; +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::InsertTab(int index, const QIcon &icon, const QString &label) +{ + FancyTab *tab = new FancyTab(this); + tab->m_icon = icon; + tab->m_text = label; + m_attachedTabs.insert(index, tab); +} + +//--------------------------------------------------------------------------------------------------------------------- +void FancyTabBar::RemoveTab(int index) +{ + FancyTab *tab = m_attachedTabs.takeAt(index); + delete tab; +} diff --git a/src/libs/vwidgets/fancytabbar/fancytabbar.h b/src/libs/vwidgets/fancytabbar/fancytabbar.h new file mode 100644 index 000000000..015e22b30 --- /dev/null +++ b/src/libs/vwidgets/fancytabbar/fancytabbar.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef FANCYTABWIDGET_H +#define FANCYTABWIDGET_H + +#include +#include +#include +#include + +class QPainter; + +#include "fancytab.h" + +class FancyTabBar : public QWidget +{ + Q_OBJECT + +public: + enum TabBarPosition + { + Above, + Below, + Left, + Right + }; + + FancyTabBar(const TabBarPosition position, QWidget *parent = nullptr); + virtual ~FancyTabBar(); + + virtual QSize sizeHint() const Q_DECL_OVERRIDE; + virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; + + void SetOrientation(const TabBarPosition p); + + void SetTabEnabled(int index, bool enable); + bool IsTabEnabled(int index) const; + + void InsertTab(int index, const QIcon &icon, const QString &label); + void RemoveTab(int index); + + void SetCurrentIndex(int index); + int CurrentIndex() const; + + void SetTabToolTip(int index, QString toolTip); + QString TabToolTip(int index) const; + + QIcon TabIcon(int index) const; + + QString TabText(int index) const; + void SetTabText(int index, QString text); + + int Count() const; + QRect TabRect(int index) const; + +signals: + void CurrentChanged(int); + +protected: + virtual bool event(QEvent *event) Q_DECL_OVERRIDE; + virtual void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + virtual void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; + virtual void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; + virtual void enterEvent(QEvent *) Q_DECL_OVERRIDE; + virtual void leaveEvent(QEvent *) Q_DECL_OVERRIDE; + +private slots: + void EmitCurrentIndex(); + +private: + Q_DISABLE_COPY(FancyTabBar) + + enum Corner { OutsideBeginning, OutsideEnd, InsideBeginning, InsideEnd }; + + static const int m_rounding; + static const int m_textPadding; + + TabBarPosition m_position; + QRect m_hoverRect; + int m_hoverIndex; + int m_currentIndex; + QList m_attachedTabs; + QTimer m_timerTriggerChangedSignal; + + QPoint GetCorner(const QRect& rect, const Corner corner) const; + + QRect AdjustRect(const QRect& rect, const qint8 offsetOutside, const qint8 offsetInside, const qint8 offsetStart, + const qint8 offsetEnd) const; + + // Same with a point. + means towards Outside/End, - means towards Inside/Beginning + QPoint AdjustPoint(const QPoint& point, const qint8 offsetInsideOutside, const qint8 offsetBeginningEnd) const; + + QSize TabSizeHint(bool minimum = false) const; + void PaintTab(QPainter *painter, int tabIndex) const; + bool ValidIndex(int index) const; +}; + +#endif // FANCYTABWIDGET_H diff --git a/src/libs/vwidgets/fancytabbar/stylehelper.cpp b/src/libs/vwidgets/fancytabbar/stylehelper.cpp new file mode 100644 index 000000000..f6620320a --- /dev/null +++ b/src/libs/vwidgets/fancytabbar/stylehelper.cpp @@ -0,0 +1,194 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "stylehelper.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------------------------------------- +qreal StyleHelper::sidebarFontSize() +{ +#if defined(Q_OS_MAC) + return 10; +#else + return 7.5; +#endif +} + +//--------------------------------------------------------------------------------------------------------------------- +QColor StyleHelper::panelTextColor(bool lightColored) +{ + //qApp->palette().highlightedText().color(); + if (!lightColored) + { + return Qt::white; + } + else + { + return Qt::black; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +// Invalid by default, setBaseColor needs to be called at least once +QColor StyleHelper::m_baseColor; +QColor StyleHelper::m_requestedBaseColor; + +//--------------------------------------------------------------------------------------------------------------------- +QColor StyleHelper::baseColor(bool lightColored) +{ + if (!lightColored) + { + return m_baseColor; + } + else + { + return m_baseColor.lighter(230); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +QColor StyleHelper::borderColor(bool lightColored) +{ + QColor result = baseColor(lightColored); + result.setHsv(result.hue(), + result.saturation(), + result.value() / 2); + return result; +} + +//--------------------------------------------------------------------------------------------------------------------- +QColor StyleHelper::sidebarHighlight() +{ + return QColor(255, 255, 255, 40); +} + +//--------------------------------------------------------------------------------------------------------------------- +// We try to ensure that the actual color used are within +// reasonalbe bounds while generating the actual baseColor +// from the users request. +void StyleHelper::setBaseColor(const QColor &newcolor) +{ + m_requestedBaseColor = newcolor; + + QColor color; + color.setHsv(newcolor.hue(), + static_cast(newcolor.saturation() * 0.7), + 64 + newcolor.value() / 3); + + if (color.isValid() && color != m_baseColor) + { + m_baseColor = color; + foreach (QWidget *w, QApplication::topLevelWidgets()) + { + w->update(); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +// Draws a cached pixmap with shadow +void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode, + int radius, const QColor &color, const QPoint &offset) +{ + QPixmap cache; + QString pixmapName = QString::fromLatin1("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height()); + + if (!QPixmapCache::find(pixmapName, cache)) + { + QPixmap px = icon.pixmap(rect.size()); + cache = QPixmap(px.size() + QSize(radius * 2, radius * 2)); + cache.fill(Qt::transparent); + + QPainter cachePainter(&cache); + if (iconMode == QIcon::Disabled) + { + QImage im = px.toImage().convertToFormat(QImage::Format_ARGB32); + for (int y=0; y(im.scanLine(y)); + for (int x=0; x(qGray(pixel)); + *scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel)); + ++scanLine; + } + } + px = QPixmap::fromImage(im); + } + + // Draw shadow + QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied); + tmp.fill(Qt::transparent); + + QPainter tmpPainter(&tmp); + tmpPainter.setCompositionMode(QPainter::CompositionMode_Source); + tmpPainter.drawPixmap(QPoint(radius, radius), px); + tmpPainter.end(); + + // blur the alpha channel + QImage blurred(tmp.size(), QImage::Format_ARGB32_Premultiplied); + blurred.fill(Qt::transparent); + QPainter blurPainter(&blurred); + qt_blurImage(&blurPainter, tmp, radius, false, true); + blurPainter.end(); + + tmp = blurred; + + // blacken the image... + tmpPainter.begin(&tmp); + tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); + tmpPainter.fillRect(tmp.rect(), color); + tmpPainter.end(); + + tmpPainter.begin(&tmp); + tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); + tmpPainter.fillRect(tmp.rect(), color); + tmpPainter.end(); + + // draw the blurred drop shadow... + cachePainter.drawImage(QRect(0, 0, cache.rect().width(), cache.rect().height()), tmp); + + // Draw the actual pixmap... + cachePainter.drawPixmap(QPoint(radius, radius) + offset, px); + QPixmapCache::insert(pixmapName, cache); + } + + QRect targetRect = cache.rect(); + targetRect.moveCenter(rect.center()); + p->drawPixmap(targetRect.topLeft() - offset, cache); +} diff --git a/src/libs/vwidgets/fancytabbar/stylehelper.h b/src/libs/vwidgets/fancytabbar/stylehelper.h new file mode 100644 index 000000000..12198eb47 --- /dev/null +++ b/src/libs/vwidgets/fancytabbar/stylehelper.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef STYLEHELPER_H +#define STYLEHELPER_H + +#include +#include + +class QPalette; +class QPainter; +class QRect; + +// Note, this is exported but in a private header as qtopengl depends on it. +// We should consider adding this as a public helper function. +void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0); + +// Helper class holding all custom color values +class StyleHelper +{ +public: + static const unsigned int DEFAULT_BASE_COLOR = 0x666666; + + static qreal sidebarFontSize(); + // This is our color table, all colors derive from baseColor + static QColor baseColor(bool lightColored = false); + static QColor panelTextColor(bool lightColored = false); + static QColor borderColor(bool lightColored = false); + static QColor sidebarHighlight(); + + // Sets the base color and makes sure all top level widgets are updated + static void setBaseColor(const QColor &color); + static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode, + int radius = 3, const QColor &color = QColor(0, 0, 0, 130), + const QPoint &offset = QPoint(1, -2)); + +private: + static QColor m_baseColor; + static QColor m_requestedBaseColor; +}; + +#endif // STYLEHELPER_H diff --git a/src/libs/vwidgets/vwidgets.pri b/src/libs/vwidgets/vwidgets.pri index 1f3219b8f..5b16032b7 100644 --- a/src/libs/vwidgets/vwidgets.pri +++ b/src/libs/vwidgets/vwidgets.pri @@ -1,35 +1,41 @@ -# ADD TO EACH PATH $$PWD VARIABLE!!!!!! -# This need for corect working file translations.pro - -SOURCES += \ - $$PWD/vmaingraphicsscene.cpp \ - $$PWD/vmaingraphicsview.cpp \ - $$PWD/vwidgetpopup.cpp \ - $$PWD/vcontrolpointspline.cpp \ - $$PWD/vgraphicssimpletextitem.cpp \ - $$PWD/vsimplepoint.cpp \ - $$PWD/vabstractsimple.cpp \ - $$PWD/vnobrushscalepathitem.cpp \ - $$PWD/vsimplecurve.cpp \ - $$PWD/vabstractmainwindow.cpp \ - $$PWD/vtextgraphicsitem.cpp \ - $$PWD/vgrainlineitem.cpp \ - $$PWD/vpieceitem.cpp - -win32-msvc*:SOURCES += $$PWD/stable.cpp - -HEADERS += \ - $$PWD/stable.h \ - $$PWD/vmaingraphicsscene.h \ - $$PWD/vmaingraphicsview.h \ - $$PWD/vwidgetpopup.h \ - $$PWD/vcontrolpointspline.h \ - $$PWD/vgraphicssimpletextitem.h \ - $$PWD/vsimplepoint.h \ - $$PWD/vabstractsimple.h \ - $$PWD/vnobrushscalepathitem.h \ - $$PWD/vsimplecurve.h \ - $$PWD/vabstractmainwindow.h \ - $$PWD/vtextgraphicsitem.h \ - $$PWD/vgrainlineitem.h \ - $$PWD/vpieceitem.h +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +SOURCES += \ + $$PWD/vmaingraphicsscene.cpp \ + $$PWD/vmaingraphicsview.cpp \ + $$PWD/vwidgetpopup.cpp \ + $$PWD/vcontrolpointspline.cpp \ + $$PWD/vgraphicssimpletextitem.cpp \ + $$PWD/vsimplepoint.cpp \ + $$PWD/vabstractsimple.cpp \ + $$PWD/vnobrushscalepathitem.cpp \ + $$PWD/vsimplecurve.cpp \ + $$PWD/vabstractmainwindow.cpp \ + $$PWD/vtextgraphicsitem.cpp \ + $$PWD/vgrainlineitem.cpp \ + $$PWD/vpieceitem.cpp \ + $$PWD/fancytabbar/fancytab.cpp \ + $$PWD/fancytabbar/fancytabbar.cpp \ + $$PWD/fancytabbar/stylehelper.cpp + +win32-msvc*:SOURCES += $$PWD/stable.cpp + +HEADERS += \ + $$PWD/stable.h \ + $$PWD/vmaingraphicsscene.h \ + $$PWD/vmaingraphicsview.h \ + $$PWD/vwidgetpopup.h \ + $$PWD/vcontrolpointspline.h \ + $$PWD/vgraphicssimpletextitem.h \ + $$PWD/vsimplepoint.h \ + $$PWD/vabstractsimple.h \ + $$PWD/vnobrushscalepathitem.h \ + $$PWD/vsimplecurve.h \ + $$PWD/vabstractmainwindow.h \ + $$PWD/vtextgraphicsitem.h \ + $$PWD/vgrainlineitem.h \ + $$PWD/vpieceitem.h \ + $$PWD/fancytabbar/fancytab.h \ + $$PWD/fancytabbar/fancytabbar.h \ + $$PWD/fancytabbar/stylehelper.h