diff --git a/src/Mod/TechDraw/Gui/SymbolChooser.ui b/src/Mod/TechDraw/Gui/SymbolChooser.ui index 634b025821..355a9ef2e2 100644 --- a/src/Mod/TechDraw/Gui/SymbolChooser.ui +++ b/src/Mod/TechDraw/Gui/SymbolChooser.ui @@ -9,8 +9,8 @@ 0 0 - 400 - 394 + 360 + 280 @@ -19,98 +19,79 @@ true - - - - 19 - 19 - 361 - 341 - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - 2 - - - - - 9 - 19 - 341 - 191 - - - - - - - - - - - - 10 - 220 - 341 - 41 - - - - + + + + + Select a symbol that should be used + + + + + + + + + 0 + 0 + + Cancel - + + + + 0 + 0 + + OK + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - - - 10 - 280 - 341 - 35 - - - - + + + + Symbol Dir - + + + Directory to welding symbols. + Gui::FileChooser::Directory - - + + diff --git a/src/Mod/TechDraw/Gui/TaskRestoreLines.ui b/src/Mod/TechDraw/Gui/TaskRestoreLines.ui index db6338b64c..f8199ce9d3 100644 --- a/src/Mod/TechDraw/Gui/TaskRestoreLines.ui +++ b/src/Mod/TechDraw/Gui/TaskRestoreLines.ui @@ -7,7 +7,7 @@ 0 0 227 - 180 + 130 diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp index 2f53579f5b..5b2ed4f49f 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp @@ -83,44 +83,27 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) : m_leadFeat(leader), m_weldFeat(nullptr), m_createMode(true), - m_arrowDirty(false), m_otherDirty(false) { //TODO: why does DWS need DLL as parent? // Base::Console().Message("TWS::TWS() - create mode\n"); if (m_leadFeat == nullptr) { //should be caught in CMD caller - Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n"); + Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n"); return; } ui->setupUi(this); - connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)), - this, SLOT(onArrowSymbolClicked(bool))); - connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)), - this, SLOT(onOtherSymbolClicked(bool))); - connect(ui->pbOtherErase, SIGNAL(clicked(bool)), - this, SLOT(onOtherEraseClicked(bool))); - - connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)), - this, SLOT(onDirectorySelected(const QString&))); - - connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)), - this, SLOT(onArrowTextChanged(const QString&))); - connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)), - this, SLOT(onArrowTextChanged(const QString&))); - connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)), - this, SLOT(onArrowTextChanged(const QString&))); - - connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)), - this, SLOT(onOtherTextChanged(const QString&))); - connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)), - this, SLOT(onOtherTextChanged(const QString&))); - connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)), - this, SLOT(onOtherTextChanged(const QString&))); - - setUiPrimary(); + + connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)), + this, SLOT(onArrowSymbolCreateClicked())); + connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)), + this, SLOT(onOtherSymbolCreateClicked())); + connect(ui->pbOtherErase, SIGNAL(clicked(bool)), + this, SLOT(onOtherEraseCreateClicked())); + connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(QString)), + this, SLOT(onDirectorySelected(const QString))); } //ctor for edit @@ -129,7 +112,6 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) : m_leadFeat(nullptr), m_weldFeat(weld), m_createMode(false), - m_arrowDirty(false), m_otherDirty(false) { // Base::Console().Message("TWS::TWS() - edit mode\n"); @@ -150,33 +132,41 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) : ui->setupUi(this); + setUiEdit(); + connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)), - this, SLOT(onArrowSymbolClicked(bool))); + this, SLOT(onArrowSymbolClicked())); connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)), - this, SLOT(onOtherSymbolClicked(bool))); + this, SLOT(onOtherSymbolClicked())); connect(ui->pbOtherErase, SIGNAL(clicked(bool)), - this, SLOT(onOtherEraseClicked(bool))); + this, SLOT(onOtherEraseClicked())); - connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)), - this, SLOT(onDirectorySelected(const QString&))); + connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(QString)), + this, SLOT(onDirectorySelected(const QString))); - connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)), - this, SLOT(onArrowTextChanged(const QString&))); - connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)), - this, SLOT(onArrowTextChanged(const QString&))); - connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)), - this, SLOT(onArrowTextChanged(const QString&))); + connect(ui->leArrowTextL, SIGNAL(textEdited(QString)), + this, SLOT(onArrowTextChanged())); + connect(ui->leArrowTextR, SIGNAL(textEdited(QString)), + this, SLOT(onArrowTextChanged())); + connect(ui->leArrowTextC, SIGNAL(textEdited(QString)), + this, SLOT(onArrowTextChanged())); - connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)), - this, SLOT(onOtherTextChanged(const QString&))); - connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)), - this, SLOT(onOtherTextChanged(const QString&))); - connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)), - this, SLOT(onOtherTextChanged(const QString&))); + connect(ui->leOtherTextL, SIGNAL(textEdited(QString)), + this, SLOT(onOtherTextChanged())); + connect(ui->leOtherTextR, SIGNAL(textEdited(QString)), + this, SLOT(onOtherTextChanged())); + connect(ui->leOtherTextC, SIGNAL(textEdited(QString)), + this, SLOT(onOtherTextChanged())); - saveState(); - setUiEdit(); + connect(ui->leTailText, SIGNAL(textEdited(QString)), + this, SLOT(onWeldingChanged())); + connect(ui->cbFieldWeld, SIGNAL(toggled(bool)), + this, SLOT(onWeldingChanged())); + connect(ui->cbAllAround, SIGNAL(toggled(bool)), + this, SLOT(onWeldingChanged())); + connect(ui->cbAltWeld, SIGNAL(toggled(bool)), + this, SLOT(onWeldingChanged())); } TaskWeldingSymbol::~TaskWeldingSymbol() @@ -246,7 +236,7 @@ void TaskWeldingSymbol::setUiEdit() ui->pbArrowSymbol->setIconSize(iconSize); ui->pbArrowSymbol->setText(QString()); } else { - ui->pbArrowSymbol->setText(QString::fromUtf8("Symbol")); + ui->pbArrowSymbol->setText(tr("Symbol")); } } @@ -263,78 +253,106 @@ void TaskWeldingSymbol::setUiEdit() if (fi.isReadable()) { qTemp = QString::fromUtf8(m_otherFeat->SymbolFile.getValue()); QIcon targetIcon(qTemp); - QSize iconSize(32,32); + QSize iconSize(32, 32); ui->pbOtherSymbol->setIcon(targetIcon); ui->pbOtherSymbol->setIconSize(iconSize); ui->pbOtherSymbol->setText(QString()); } else { - ui->pbOtherSymbol->setText(QString::fromUtf8("Symbol")); + ui->pbOtherSymbol->setText(tr("Symbol")); } } ui->pbArrowSymbol->setFocus(); } -void TaskWeldingSymbol::onArrowSymbolClicked(bool b) +void TaskWeldingSymbol::onArrowSymbolCreateClicked() { -// Base::Console().Message("TWS::OnArrowSymbolClicked()\n"); - Q_UNUSED(b); + QString source = tr("arrow"); + SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source); + connect(dlg, SIGNAL(symbolSelected(QString, QString)), + this, SLOT(onSymbolSelected(QString, QString))); + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->exec(); +} - QString source = QString::fromUtf8("arrow"); +void TaskWeldingSymbol::onArrowSymbolClicked() +{ + QString source = tr("arrow"); SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source); connect(dlg, SIGNAL(symbolSelected(QString, QString)), this, SLOT(onSymbolSelected(QString, QString))); dlg->setAttribute(Qt::WA_DeleteOnClose); - //int rc = + dlg->exec(); + updateTiles(); + m_weldFeat->requestPaint(); +} + +void TaskWeldingSymbol::onOtherSymbolCreateClicked() +{ + QString source = tr("other"); + SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source); + connect(dlg, SIGNAL(symbolSelected(QString, QString)), + this, SLOT(onSymbolSelected(QString, QString))); + dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->exec(); } -void TaskWeldingSymbol::onOtherSymbolClicked(bool b) +void TaskWeldingSymbol::onOtherSymbolClicked() { -// Base::Console().Message("TWS::OnOtherSymbolClicked()\n"); - Q_UNUSED(b); - - QString source = QString::fromUtf8("other"); + QString source = tr("other"); SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source); connect(dlg, SIGNAL(symbolSelected(QString, QString)), this, SLOT(onSymbolSelected(QString, QString))); dlg->setAttribute(Qt::WA_DeleteOnClose); - -// int rc = dlg->exec(); + updateTiles(); + m_weldFeat->requestPaint(); } -void TaskWeldingSymbol::onOtherEraseClicked(bool b) +void TaskWeldingSymbol::onOtherEraseCreateClicked() { -// Base::Console().Message("TWS::onOtherEraseClicked()\n"); - Q_UNUSED(b); - m_otherDirty = true; - m_otherOut.init(); - ui->leOtherTextL->setText(QString()); ui->leOtherTextC->setText(QString()); ui->leOtherTextR->setText(QString()); ui->pbOtherSymbol->setIcon(QIcon()); - ui->pbOtherSymbol->setText(QString::fromUtf8("Symbol")); + ui->pbOtherSymbol->setText(tr("Symbol")); m_otherOut.init(); m_otherPath = QString(); } -void TaskWeldingSymbol::onArrowTextChanged(const QString& qs) +void TaskWeldingSymbol::onOtherEraseClicked() { -// Base::Console().Message("TWS::onArrowTextChanged(%s)\n", qPrintable(qs)); - Q_UNUSED(qs); - m_arrowDirty = true; -} - -void TaskWeldingSymbol::onOtherTextChanged(const QString& qs) -{ -// Base::Console().Message("TWS::onOtherTextChanged(%s)\n", qPrintable(qs)); - Q_UNUSED(qs); m_otherDirty = true; + ui->leOtherTextL->setText(QString()); + ui->leOtherTextC->setText(QString()); + ui->leOtherTextR->setText(QString()); + ui->pbOtherSymbol->setIcon(QIcon()); + ui->pbOtherSymbol->setText(tr("Symbol")); + m_otherOut.init(); + m_otherPath = QString(); + updateTiles(); + m_weldFeat->requestPaint(); } +void TaskWeldingSymbol::onArrowTextChanged() +{ + updateTiles(); + m_weldFeat->requestPaint(); +} + +void TaskWeldingSymbol::onOtherTextChanged() +{ + m_otherDirty = true; + updateTiles(); + m_weldFeat->requestPaint(); +} + +void TaskWeldingSymbol::onWeldingChanged() +{ + updateWeldingSymbol(); + m_weldFeat->requestPaint(); +} void TaskWeldingSymbol::onDirectorySelected(const QString& newDir) { @@ -349,10 +367,9 @@ void TaskWeldingSymbol::onSymbolSelected(QString symbolPath, // qPrintable(symbolPath), qPrintable(source)); QIcon targetIcon(symbolPath); QSize iconSize(32,32); - QString arrow = QString::fromUtf8("arrow"); - QString other = QString::fromUtf8("other"); + QString arrow = tr("arrow"); + QString other = tr("other"); if (source == arrow) { - m_arrowDirty = true; ui->pbArrowSymbol->setIcon(targetIcon); ui->pbArrowSymbol->setIconSize(iconSize); ui->pbArrowSymbol->setText(QString()); @@ -366,16 +383,6 @@ void TaskWeldingSymbol::onSymbolSelected(QString symbolPath, } } -void TaskWeldingSymbol::blockButtons(bool b) -{ - Q_UNUSED(b); -} - -//obsolete. tiles are only updated on accept. -void TaskWeldingSymbol::saveState(void) -{ -} - void TaskWeldingSymbol::collectArrowData(void) { // Base::Console().Message("TWS::collectArrowData()\n"); @@ -383,10 +390,10 @@ void TaskWeldingSymbol::collectArrowData(void) m_arrowOut.arrowSide = false; m_arrowOut.row = 0; m_arrowOut.col = 0; - m_arrowOut.leftText = Base::Tools::toStdString(ui->leArrowTextL->text()); - m_arrowOut.centerText = Base::Tools::toStdString(ui->leArrowTextC->text()); - m_arrowOut.rightText = Base::Tools::toStdString(ui->leArrowTextR->text()); - m_arrowOut.symbolPath= Base::Tools::toStdString(m_arrowPath); + m_arrowOut.leftText = ui->leArrowTextL->text().toStdString(); + m_arrowOut.centerText = ui->leArrowTextC->text().toStdString(); + m_arrowOut.rightText = ui->leArrowTextR->text().toStdString(); + m_arrowOut.symbolPath= m_arrowPath.toStdString(); m_arrowOut.tileName = ""; } @@ -397,10 +404,10 @@ void TaskWeldingSymbol::collectOtherData(void) m_otherOut.arrowSide = false; m_otherOut.row = -1; m_otherOut.col = 0; - m_otherOut.leftText = Base::Tools::toStdString(ui->leOtherTextL->text()); - m_otherOut.centerText = Base::Tools::toStdString(ui->leOtherTextC->text()); - m_otherOut.rightText = Base::Tools::toStdString(ui->leOtherTextR->text()); - m_otherOut.symbolPath = Base::Tools::toStdString(m_otherPath); + m_otherOut.leftText = ui->leOtherTextL->text().toStdString(); + m_otherOut.centerText = ui->leOtherTextC->text().toStdString(); + m_otherOut.rightText = ui->leOtherTextR->text().toStdString(); + m_otherOut.symbolPath = m_otherPath.toStdString(); m_otherOut.tileName = ""; } @@ -462,7 +469,7 @@ TechDraw::DrawWeldSymbol* TaskWeldingSymbol::createWeldingSymbol(void) Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s", symbolName.c_str(), altWeldText.c_str()); - std::string tailText = Base::Tools::toStdString(ui->leTailText->text()); + std::string tailText = ui->leTailText->text().toStdString(); tailText = Base::Tools::escapeEncodeString(tailText); Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'", symbolName.c_str(), tailText.c_str()); @@ -497,7 +504,7 @@ void TaskWeldingSymbol::updateWeldingSymbol(void) Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s", symbolName.c_str(), altWeldText.c_str()); - std::string tailText = Base::Tools::toStdString(ui->leTailText->text()); + std::string tailText = ui->leTailText->text().toStdString(); tailText = Base::Tools::escapeEncodeString(tailText); Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'", symbolName.c_str(), tailText.c_str()); diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h index f3acf1007e..84f4b44530 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.h @@ -102,14 +102,15 @@ public: ~TaskWeldingSymbol(); public Q_SLOTS: - void onArrowSymbolClicked(bool b); - - void onOtherSymbolClicked(bool b); - void onOtherEraseClicked(bool b); - - void onArrowTextChanged(const QString& qs); - void onOtherTextChanged(const QString& qs); - + void onArrowSymbolCreateClicked(); + void onArrowSymbolClicked(); + void onOtherSymbolCreateClicked(); + void onOtherSymbolClicked(); + void onOtherEraseCreateClicked(); + void onOtherEraseClicked(); + void onArrowTextChanged(); + void onOtherTextChanged(); + void onWeldingChanged(); void onDirectorySelected(const QString& newDir); void onSymbolSelected(QString symbolPath, QString source); @@ -125,8 +126,6 @@ protected Q_SLOTS: protected: void changeEvent(QEvent *e); - - void blockButtons(bool b); void setUiPrimary(void); void setUiEdit(); @@ -141,7 +140,6 @@ protected: void collectOtherData(void); std::string prefSymbolDir(); - void saveState(void); QString m_currDir; @@ -163,14 +161,10 @@ private: QString m_arrowSymbol; QString m_otherSymbol; -/* std::vector m_toRemove;*/ - QPushButton* m_btnOK; QPushButton* m_btnCancel; bool m_createMode; - - bool m_arrowDirty; bool m_otherDirty; }; diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui index 22e2949735..c1955ee51a 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui @@ -6,12 +6,12 @@ 0 0 - 423 - 374 + 400 + 244 - + 0 0 @@ -29,268 +29,248 @@ :/icons/actions/techdraw-weldsymbol.svg:/icons/actions/techdraw-weldsymbol.svg - + - - - - 0 - 0 - + + + + + + + + + Text before arrow side symbol + + + + + + + Text after arrow side symbol + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 32 + + + + Pick arrow side symbol + + + + + + Symbol + + + false + + + + + + + Text above arrow side symbol + + + + + + + + + + + QFrame::Plain + + + 5 + + + Qt::Horizontal + + + + + + + + + + + Text after other side symbol + + + + + + + Pick other side symbol + + + Symbol + + + + + + + Text before other side symbol + + + + + + + Text below other side symbol + + + + + + + + 0 + 0 + + + + + 60 + 30 + + + + + 60 + 30 + + + + + 60 + 30 + + + + Remove other side symbol + + + Delete + + + + + + + + + + + + + Qt::Horizontal - - QFrame::Box - - - QFrame::Raised - - - - - - - - - - - - Text before arrow side symbol - - - - - - - Text after arrow side symbol - - - - - - - - 0 - 0 - - - - - 0 - 32 - - - - - 0 - 32 - - - - Pick arrow side symbol - - - - - - Symbol - - - false - - - - - - - Text above arrow side symbol - - - - - - - - - - - QFrame::Plain - - - 5 - - - Qt::Horizontal - - - - - - - - - - - Text after other side symbol - - - - - - - Pick other side symbol - - - Symbol - - - - - - - Text before other side symbol - - - - - - - Text below other side symbol - - - - - - - - 0 - 0 - - - - - 60 - 30 - - - - - 60 - 30 - - - - - 60 - 30 - - - - Remove other side symbol - - - Delete - - - - - - - - - - - - - Qt::Horizontal - - - - - - - - - - - Field Weld - - - - - - - All Around - - - - - - - Alternating - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Tail Text - - - - - - - Text at end of symbol - - - - - - - Symbol Directory - - - - - - - Pick a directory of welding symbols - - - Gui::FileChooser::Directory - - - *.svg - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + + + + Adds the 'Field Weld' symbol (flag) +at the kink in the leader line + + + Field Weld + + + + + + + Adds the 'All Around' symbol (circle) +at the kink in the leader line + + + All Around + + + + + + + Offsets the lower symbol to indicate alternating welds + + + Alternating + + + + + + + + + + + Directory to welding symbols. +This directory will be used for the symbol selection. + + + Gui::FileChooser::Directory + + + *.svg + + + + + + + + 0 + 0 + + + + Text at end of symbol + + + + + + + Symbol Directory + + + + + + + Tail Text + + + + +