From ada64305c03f343653cab640ea0b5078b6cc04d0 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 5 Apr 2016 20:14:12 +0300 Subject: [PATCH] Dialog Group. --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 6 +- src/app/valentina/dialogs/dialoghistory.cpp | 3 +- src/app/valentina/mainwindow.cpp | 80 ++++++++++++- src/app/valentina/mainwindow.h | 6 +- src/app/valentina/share/resources/cursor.qrc | 2 + .../resources/cursor/group_plus_cursor.png | Bin 0 -> 830 bytes .../resources/cursor/group_plus_cursor@2x.png | Bin 0 -> 1843 bytes src/app/valentina/xml/vpattern.cpp | 3 +- src/libs/ifc/xml/vabstractpattern.cpp | 6 + src/libs/ifc/xml/vabstractpattern.h | 2 + src/libs/vmisc/def.h | 1 + src/libs/vtools/dialogs/dialogs.pri | 9 +- src/libs/vtools/dialogs/tooldialogs.h | 1 + src/libs/vtools/dialogs/tools/dialoggroup.cpp | 106 ++++++++++++++++++ src/libs/vtools/dialogs/tools/dialoggroup.h | 66 +++++++++++ src/libs/vtools/dialogs/tools/dialoggroup.ui | 91 +++++++++++++++ src/libs/vtools/dialogs/tools/dialogtool.cpp | 8 ++ src/libs/vtools/dialogs/tools/dialogtool.h | 1 + .../drawTools/toolcurve/vabstractspline.cpp | 10 +- .../tooldoublepoint/vtooldoublepoint.cpp | 14 +++ .../tooldoublepoint/vtooldoublepoint.h | 2 + .../toolsinglepoint/vtoolsinglepoint.cpp | 13 +-- src/libs/vtools/tools/drawTools/vdrawtool.h | 4 + src/libs/vtools/tools/drawTools/vtoolline.cpp | 15 +-- src/libs/vwidgets/vgraphicssimpletextitem.cpp | 4 + src/libs/vwidgets/vgraphicssimpletextitem.h | 1 + src/libs/vwidgets/vmaingraphicsscene.cpp | 12 ++ src/libs/vwidgets/vmaingraphicsscene.h | 4 + src/libs/vwidgets/vsimplepoint.cpp | 21 ++++ src/libs/vwidgets/vsimplepoint.h | 11 +- 30 files changed, 453 insertions(+), 49 deletions(-) create mode 100644 src/app/valentina/share/resources/cursor/group_plus_cursor.png create mode 100644 src/app/valentina/share/resources/cursor/group_plus_cursor@2x.png create mode 100644 src/libs/vtools/dialogs/tools/dialoggroup.cpp create mode 100644 src/libs/vtools/dialogs/tools/dialoggroup.h create mode 100644 src/libs/vtools/dialogs/tools/dialoggroup.ui diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index b508af5f5..117787659 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -74,7 +74,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser() void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 42, "Not all tools was used in switch."); switch (item->type()) { @@ -191,7 +191,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions() } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 42, "Not all tools was used in switch."); switch (currentItem->type()) { @@ -323,7 +323,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 42, "Not all tools was used in switch."); switch (currentItem->type()) { diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index 5c5c462de..bddd259f3 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -208,7 +208,7 @@ void DialogHistory::FillTable() QString DialogHistory::Record(const VToolRecord &tool) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 42, "Not all tools was used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -383,6 +383,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Tool::NodePoint: case Tool::NodeSpline: case Tool::NodeSplinePath: + case Tool::Group: return QString(); } } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 08c842102..b37aab18c 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -305,6 +305,7 @@ void MainWindow::InitScenes() connect(this, &MainWindow::EnableLabelSelection, sceneDraw, &VMainGraphicsScene::ToggleLabelSelection); connect(this, &MainWindow::EnablePointSelection, sceneDraw, &VMainGraphicsScene::TogglePointSelection); + connect(this, &MainWindow::EnableLineSelection, sceneDraw, &VMainGraphicsScene::ToggleLineSelection); connect(this, &MainWindow::EnableArcSelection, sceneDraw, &VMainGraphicsScene::ToggleArcSelection); connect(this, &MainWindow::EnableSplineSelection, sceneDraw, &VMainGraphicsScene::ToggleSplineSelection); connect(this, &MainWindow::EnableSplinePathSelection, sceneDraw, &VMainGraphicsScene::ToggleSplinePathSelection); @@ -551,6 +552,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons SCASSERT(scene != nullptr); connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); + connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool, &DialogTool::SelectedObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); ui->view->itemClicked(nullptr); @@ -906,7 +908,7 @@ void MainWindow::ToolPointOfContact(bool checked) */ void MainWindow::ToolDetail(bool checked) { - ToolSelectAllObjects(); + ToolSelectAllDrawObjects(); SetToolButton(checked, Tool::Detail, "://cursor/new_detail_cursor.png", tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail); } @@ -991,6 +993,33 @@ void MainWindow::ClosedDialogUnionDetails(int result) doc->LiteParseTree(Document::LiteParse); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolGroup(bool checked) +{ + ToolSelectGroupObjects(); + SetToolButton(checked, Tool::Group, ":/cursor/group_plus_cursor.png", + tr("Select objects, Enter - finish creation"), &MainWindow::ClosedDialogGroup); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ClosedDialogGroup(int result) +{ + SCASSERT(dialogTool != nullptr); + if (result == QDialog::Accepted) + { + VMainGraphicsScene *scene = qobject_cast(currentScene); + SCASSERT(scene != nullptr); + + DialogGroup *dialog = qobject_cast(dialogTool); + SCASSERT(dialog != nullptr); + const QString name = dialog->GetName(); + const QMap group = dialog->GetGroup(); + const quint32 id = pattern->getNextId(); + doc->AddGroup(id, name, group); + } + ArrowTool(); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ToolCutArc handler tool cutArc. @@ -1018,7 +1047,7 @@ void MainWindow::ToolLineIntersectAxis(bool checked) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ToolCurveIntersectAxis(bool checked) { - ToolSelectAllObjects(); + ToolSelectAllDrawObjects(); SetToolButtonWithApply(checked, Tool::CurveIntersectAxis, ":/cursor/curve_intersect_axis_cursor.png", tr("Select curve"), @@ -1029,7 +1058,7 @@ void MainWindow::ToolCurveIntersectAxis(bool checked) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ToolArcIntersectAxis(bool checked) { - ToolSelectAllObjects(); + ToolSelectAllDrawObjects(); // Reuse ToolCurveIntersectAxis but with different cursor and tool tip SetToolButtonWithApply(checked, Tool::CurveIntersectAxis, ":/cursor/arc_intersect_axis_cursor.png", @@ -1739,7 +1768,7 @@ void MainWindow::mouseMove(const QPointF &scenePos) void MainWindow::CancelTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 42, "Not all tools was handled."); qCDebug(vMainWindow, "Canceling tool."); delete dialogTool; @@ -1863,6 +1892,9 @@ void MainWindow::CancelTool() case Tool::TrueDarts: ui->toolButtonTrueDarts->setChecked(false); break; + case Tool::Group: + ui->toolButtonGroup->setChecked(false); + break; } currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); @@ -1895,6 +1927,7 @@ void MainWindow::ArrowTool() // Only true for rubber band selection emit EnableLabelSelection(true); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -3317,7 +3350,7 @@ void MainWindow::CreateMenus() void MainWindow::LastUsedTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 42, "Not all tools was handled."); if (currentTool == lastUsedTool) { @@ -3464,6 +3497,10 @@ void MainWindow::LastUsedTool() ui->toolButtonTrueDarts->setChecked(true); ToolTrueDarts(true); break; + case Tool::Group: + ui->toolButtonGroup->setChecked(true); + ToolGroup(true); + break; } } @@ -4460,6 +4497,7 @@ void MainWindow::ToolSelectPoint() const // Only true for rubber band selection emit EnableLabelSelection(false); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -4495,6 +4533,7 @@ void MainWindow::ToolSelectSpline() const // Only true for rubber band selection emit EnableLabelSelection(false); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -4518,6 +4557,7 @@ void MainWindow::ToolSelectSplinePath() const // Only true for rubber band selection emit EnableLabelSelection(false); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -4541,6 +4581,7 @@ void MainWindow::ToolSelectArc() const // Only true for rubber band selection emit EnableLabelSelection(false); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -4564,6 +4605,7 @@ void MainWindow::ToolSelectPointArc() const // Only true for rubber band selection emit EnableLabelSelection(false); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -4587,6 +4629,7 @@ void MainWindow::ToolSelectCurve() const // Only true for rubber band selection emit EnableLabelSelection(false); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -4605,11 +4648,12 @@ void MainWindow::ToolSelectCurve() const } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ToolSelectAllObjects() const +void MainWindow::ToolSelectAllDrawObjects() const { // Only true for rubber band selection emit EnableLabelSelection(false); emit EnablePointSelection(false); + emit EnableLineSelection(false); emit EnableArcSelection(false); emit EnableSplineSelection(false); emit EnableSplinePathSelection(false); @@ -4627,6 +4671,30 @@ void MainWindow::ToolSelectAllObjects() const ui->view->AllowRubberBand(false); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolSelectGroupObjects() const +{ + // Only true for rubber band selection + emit EnableLabelSelection(true); + emit EnablePointSelection(true); + emit EnableLineSelection(true); + emit EnableArcSelection(true); + emit EnableSplineSelection(true); + emit EnableSplinePathSelection(true); + + // Hovering + emit EnableLabelHover(true); + emit EnablePointHover(true); + emit EnableLineHover(true); + emit EnableArcHover(true); + emit EnableSplineHover(true); + emit EnableSplinePathHover(true); + + emit ItemsSelection(SelectionType::ByMouseRelease); + + ui->view->AllowRubberBand(false); +} + //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ToolSelectDetail() const { diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index f241b3526..52602520e 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -120,6 +120,7 @@ public slots: void ToolTriangle(bool checked); void ToolPointOfIntersection(bool checked); void ToolUnionDetails(bool checked); + void ToolGroup(bool checked); void ToolCutArc(bool checked); void ToolLineIntersectAxis(bool checked); void ToolCurveIntersectAxis(bool checked); @@ -134,6 +135,7 @@ public slots: void ClosedDialogDetail(int result); void ClosedDialogUnionDetails(int result); + void ClosedDialogGroup(int result); //tmp void LastUsedTool(); @@ -161,6 +163,7 @@ signals: void EnableLabelSelection(bool enable) const; void EnablePointSelection(bool enable) const; + void EnableLineSelection(bool enable) const; void EnableArcSelection(bool enable) const; void EnableSplineSelection(bool enable) const; void EnableSplinePathSelection(bool enable) const; @@ -360,7 +363,8 @@ private: void ToolSelectArc() const; void ToolSelectPointArc() const; void ToolSelectCurve() const; - void ToolSelectAllObjects() const; + void ToolSelectAllDrawObjects() const; + void ToolSelectGroupObjects() const; void ToolSelectDetail() const; }; diff --git a/src/app/valentina/share/resources/cursor.qrc b/src/app/valentina/share/resources/cursor.qrc index a52e2b468..1063918f4 100644 --- a/src/app/valentina/share/resources/cursor.qrc +++ b/src/app/valentina/share/resources/cursor.qrc @@ -64,5 +64,7 @@ cursor/cubic_bezier_cursor@2x.png cursor/cubic_bezier_path_cursor.png cursor/cubic_bezier_path_cursor@2x.png + cursor/group_plus_cursor.png + cursor/group_plus_cursor@2x.png diff --git a/src/app/valentina/share/resources/cursor/group_plus_cursor.png b/src/app/valentina/share/resources/cursor/group_plus_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..e1b00a75359d064f7ab90591c0d32f780a27554c GIT binary patch literal 830 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::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 42, "Not all tools was used."); QRectF rec; @@ -3237,6 +3237,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::NodePoint: case Tool::NodeSpline: case Tool::NodeSplinePath: + case Tool::Group: break; } } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 32220e939..2709dbe32 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1355,3 +1355,9 @@ QDomElement VAbstractPattern::GetDraw(const QString &name) const } return QDomElement(); } + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractPattern::AddGroup(quint32 id, const QString &name, const QMap &group) +{ + +} diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 46c99eb85..e7ba57630 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -114,6 +114,8 @@ public: QDomElement GetDraw(const QString &name) const; + void AddGroup(quint32 id, const QString &name, const QMap &group); + static const QString TagPattern; static const QString TagCalculation; static const QString TagModeling; diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 6987cc452..5083bbb38 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -101,6 +101,7 @@ enum class Tool : ToolVisHolderType PointFromArcAndTangent, TrueDarts, UnionDetails, + Group, LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used }; diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index fd77d2ce3..26bcfaad6 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -36,7 +36,8 @@ HEADERS += \ $$PWD/tools/dialogtruedarts.h \ $$PWD/tools/dialogpointofintersectioncurves.h \ $$PWD/tools/dialogcubicbezier.h \ - $$PWD/tools/dialogcubicbezierpath.h + $$PWD/tools/dialogcubicbezierpath.h \ + $$PWD/tools/dialoggroup.h SOURCES += \ $$PWD/tools/dialogalongline.cpp \ @@ -72,7 +73,8 @@ SOURCES += \ $$PWD/tools/dialogtruedarts.cpp \ $$PWD/tools/dialogpointofintersectioncurves.cpp \ $$PWD/tools/dialogcubicbezier.cpp \ - $$PWD/tools/dialogcubicbezierpath.cpp + $$PWD/tools/dialogcubicbezierpath.cpp \ + $$PWD/tools/dialoggroup.cpp FORMS += \ $$PWD/tools/dialogalongline.ui \ @@ -107,4 +109,5 @@ FORMS += \ $$PWD/tools/dialogtruedarts.ui \ $$PWD/tools/dialogpointofintersectioncurves.ui \ $$PWD/tools/dialogcubicbezier.ui \ - $$PWD/tools/dialogcubicbezierpath.ui + $$PWD/tools/dialogcubicbezierpath.ui \ + $$PWD/tools/dialoggroup.ui diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index 08326cce0..b9ac6d496 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -60,6 +60,7 @@ #include "dialogs/tools/dialogpointfromcircleandtangent.h" #include "dialogs/tools/dialogpointfromarcandtangent.h" #include "dialogs/tools/dialogtruedarts.h" +#include "dialogs/tools/dialoggroup.h" #include "dialogs/support/dialogeditwrongformula.h" #include "dialogs/support/dialogundo.h" diff --git a/src/libs/vtools/dialogs/tools/dialoggroup.cpp b/src/libs/vtools/dialogs/tools/dialoggroup.cpp new file mode 100644 index 000000000..d9e64ef23 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialoggroup.cpp @@ -0,0 +1,106 @@ +/************************************************************************ + ** + ** @file dialoggroup.cpp + ** @author Roman Telezhynskyi + ** @date 4 4, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "dialoggroup.h" +#include "ui_dialoggroup.h" +#include "../vtools/tools/drawTools/drawtools.h" + +//--------------------------------------------------------------------------------------------------------------------- +DialogGroup::DialogGroup(const VContainer *data, const quint32 &toolId, QWidget *parent) + : DialogTool(data, toolId, parent), + ui(new Ui::DialogGroup), + group() +{ + ui->setupUi(this); + InitOkCancel(ui); + CheckState(); + + connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogGroup::NameChanged); +} + +//--------------------------------------------------------------------------------------------------------------------- +DialogGroup::~DialogGroup() +{ + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogGroup::SetName(const QString &name) +{ + ui->lineEditName->setText(name); +} + +//--------------------------------------------------------------------------------------------------------------------- +QString DialogGroup::GetName() const +{ + return ui->lineEditName->text(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogGroup::ShowDialog(bool click) +{ + if (not click) + { + if (group.isEmpty()) + { + return; + } + + SetName(tr("New group")); + + setModal(true); + emit ToolTip(""); + show(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogGroup::SelectedObject(bool selected, quint32 object, quint32 tool) +{ + if (selected) + { + group.insert(object, tool); + } + else + { + group.remove(object); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogGroup::NameChanged() +{ + ui->lineEditName->text().isEmpty() ? flagName = false : flagName = true; + CheckState(); +} + +//--------------------------------------------------------------------------------------------------------------------- +QMap DialogGroup::GetGroup() const +{ + return group; +} diff --git a/src/libs/vtools/dialogs/tools/dialoggroup.h b/src/libs/vtools/dialogs/tools/dialoggroup.h new file mode 100644 index 000000000..249e0e5f7 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialoggroup.h @@ -0,0 +1,66 @@ +/************************************************************************ + ** + ** @file dialoggroup.h + ** @author Roman Telezhynskyi + ** @date 4 4, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef DIALOGGROUP_H +#define DIALOGGROUP_H + +#include "dialogtool.h" + +namespace Ui +{ + class DialogGroup; +} + +class DialogGroup : public DialogTool +{ + Q_OBJECT + +public: + explicit DialogGroup(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); + ~DialogGroup(); + + void SetName(const QString &name); + QString GetName() const; + + QMap GetGroup() const; + + virtual void ShowDialog(bool click) Q_DECL_OVERRIDE; + +public slots: + virtual void SelectedObject(bool selected, quint32 object, quint32 tool) Q_DECL_OVERRIDE; + +private slots: + void NameChanged(); + +private: + Q_DISABLE_COPY(DialogGroup) + Ui::DialogGroup *ui; + QMap group; +}; + +#endif // DIALOGGROUP_H diff --git a/src/libs/vtools/dialogs/tools/dialoggroup.ui b/src/libs/vtools/dialogs/tools/dialoggroup.ui new file mode 100644 index 000000000..3983b99f8 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialoggroup.ui @@ -0,0 +1,91 @@ + + + DialogGroup + + + + 0 + 0 + 397 + 80 + + + + Group + + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + + + + + + + + Group name: + + + + + + + Unique pattern piece name + + + Choose group name + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + DialogGroup + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogGroup + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 8e1d66333..c288f9fb8 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -694,6 +694,14 @@ void DialogTool::ChosenObject(quint32 id, const SceneObject &type) Q_UNUSED(type); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogTool::SelectedObject(bool selected, quint32 object, quint32 tool) +{ + Q_UNUSED(selected); + Q_UNUSED(object); + Q_UNUSED(tool); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief NamePointChanged check name of point diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index fb70cb1ad..86e752be2 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -92,6 +92,7 @@ signals: public slots: void ShowVisToolTip(const QString &toolTip); virtual void ChosenObject(quint32 id, const SceneObject &type); + virtual void SelectedObject(bool selected, quint32 object, quint32 tool); void NamePointChanged(); virtual void DialogAccepted(); /** diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index fdc8d6c4b..042a3f640 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -166,15 +166,7 @@ QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, c { if (change == QGraphicsItem::ItemSelectedChange) { - if (value == true) - { - // do stuff if selected - this->setFocus(); - } - else - { - // do stuff if not selected - } + emit ChangedToolSelection(value.toBool(), id, id); } return QGraphicsItem::itemChange(change, value); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp index 000991f4e..b8eaf3359 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp @@ -42,6 +42,7 @@ VToolDoublePoint::VToolDoublePoint(VAbstractPattern *doc, VContainer *data, quin firstPoint = new VSimplePoint(p1id, QColor(baseColor), *data->GetPatternUnit(), &factor); firstPoint->setParentItem(this); connect(firstPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point1Choosed); + connect(firstPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point1Selected); connect(firstPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::contextMenuEvent); connect(firstPoint, &VSimplePoint::Delete, this, &VToolDoublePoint::DeleteFromLabel); connect(firstPoint, &VSimplePoint::NameChangedPosition, this, &VToolDoublePoint::Label1ChangePosition); @@ -50,6 +51,7 @@ VToolDoublePoint::VToolDoublePoint(VAbstractPattern *doc, VContainer *data, quin secondPoint = new VSimplePoint(p2id, QColor(baseColor), *data->GetPatternUnit(), &factor); secondPoint->setParentItem(this); connect(secondPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point2Choosed); + connect(secondPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point2Selected); connect(secondPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::contextMenuEvent); connect(secondPoint, &VSimplePoint::Delete, this, &VToolDoublePoint::DeleteFromLabel); connect(secondPoint, &VSimplePoint::NameChangedPosition, this, &VToolDoublePoint::Label2ChangePosition); @@ -138,6 +140,18 @@ void VToolDoublePoint::Point2Choosed() emit ChoosedTool(p2id, SceneObject::Point); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolDoublePoint::Point1Selected(bool selected) +{ + emit ChangedToolSelection(selected, p1id, id); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolDoublePoint::Point2Selected(bool selected) +{ + emit ChangedToolSelection(selected, p2id, id); +} + //--------------------------------------------------------------------------------------------------------------------- void VToolDoublePoint::FullUpdateFromFile() { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h index 0062b954c..c1cae4c8f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h @@ -64,6 +64,8 @@ public slots: virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE; void Point1Choosed(); void Point2Choosed(); + void Point1Selected(bool selected); + void Point2Selected(bool selected); virtual void FullUpdateFromFile() Q_DECL_OVERRIDE; virtual void DoChangePosition(quint32 id, qreal mx, qreal my) Q_DECL_OVERRIDE; virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index 2794bd0dc..3e4f79b2c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -270,15 +270,10 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, { if (change == QGraphicsItem::ItemSelectedChange) { - if (value == true) - { - // do stuff if selected - this->setFocus(); - } - else - { - // do stuff if not selected - } + namePoint->blockSignals(true); + namePoint->setSelected(value.toBool()); + namePoint->blockSignals(false); + emit ChangedToolSelection(value.toBool(), id, id); } return QGraphicsEllipseItem::itemChange(change, value); diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index ddf9eb0ca..dcabb0288 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -61,6 +61,9 @@ public: QString GetLineColor() const; virtual void SetLineColor(const QString &value); +signals: + void ChangedToolSelection(bool selected, quint32 object, quint32 tool); + public slots: virtual void ShowTool(quint32 id, bool enable); virtual void ChangedActivDraw(const QString &newName); @@ -238,6 +241,7 @@ void VDrawTool::InitDrawToolConnections(VMainGraphicsScene *scene, T *tool) SCASSERT(tool != nullptr); QObject::connect(tool, &T::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + QObject::connect(tool, &T::ChangedToolSelection, scene, &VMainGraphicsScene::SelectedItem); QObject::connect(scene, &VMainGraphicsScene::NewFactor, tool, &T::SetFactor); QObject::connect(scene, &VMainGraphicsScene::DisableItem, tool, &T::Disable); QObject::connect(scene, &VMainGraphicsScene::EnableToolMove, tool, &T::EnableToolMove); diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 5cd75cea1..9e66ec18b 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -149,9 +149,8 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con { VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, lineColor, typeCreation); scene->addItem(line); - connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor); - connect(scene, &VMainGraphicsScene::DisableItem, line, &VToolLine::Disable); + InitDrawToolConnections(scene, line); + connect(scene, &VMainGraphicsScene::EnablePointItemSelection, line, &VToolLine::AllowSelecting); connect(scene, &VMainGraphicsScene::EnableLineItemHover, line, &VToolLine::AllowHover); doc->AddTool(id, line); @@ -327,15 +326,7 @@ QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const Q { if (change == QGraphicsItem::ItemSelectedChange) { - if (value == true) - { - // do stuff if selected - this->setFocus(); - } - else - { - // do stuff if not selected - } + emit ChangedToolSelection(value.toBool(), id, id); } return QGraphicsItem::itemChange(change, value); diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 60abcc02a..093a14051 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -152,6 +152,10 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV changeFinished = true; } } + if (change == QGraphicsItem::ItemSelectedChange) + { + emit PointSelected(value.toBool()); + } return QGraphicsItem::itemChange(change, value); } diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.h b/src/libs/vwidgets/vgraphicssimpletextitem.h index dd5db5118..031879075 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.h +++ b/src/libs/vwidgets/vgraphicssimpletextitem.h @@ -63,6 +63,7 @@ signals: void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); void DeleteTool(); void PointChoosed(); + void PointSelected(bool selected); protected: QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent *event ) Q_DECL_OVERRIDE; diff --git a/src/libs/vwidgets/vmaingraphicsscene.cpp b/src/libs/vwidgets/vmaingraphicsscene.cpp index 6ad0b7ce7..d1940cdac 100644 --- a/src/libs/vwidgets/vmaingraphicsscene.cpp +++ b/src/libs/vwidgets/vmaingraphicsscene.cpp @@ -258,6 +258,12 @@ void VMainGraphicsScene::ChoosedItem(quint32 id, const SceneObject &type) emit ChoosedObject(id, type); } +//--------------------------------------------------------------------------------------------------------------------- +void VMainGraphicsScene::SelectedItem(bool selected, quint32 object, quint32 tool) +{ + emit SelectedObject(selected, object, tool); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief SetFactor set current scale factor of scene. @@ -299,6 +305,12 @@ void VMainGraphicsScene::TogglePointSelection(bool enabled) emit EnablePointItemSelection(enabled); } +//--------------------------------------------------------------------------------------------------------------------- +void VMainGraphicsScene::ToggleLineSelection(bool enabled) +{ + emit EnableLineItemSelection(enabled); +} + //--------------------------------------------------------------------------------------------------------------------- void VMainGraphicsScene::ToggleArcSelection(bool enabled) { diff --git a/src/libs/vwidgets/vmaingraphicsscene.h b/src/libs/vwidgets/vmaingraphicsscene.h index fc9b99c6e..e65896965 100644 --- a/src/libs/vwidgets/vmaingraphicsscene.h +++ b/src/libs/vwidgets/vmaingraphicsscene.h @@ -55,6 +55,7 @@ public: void SetOriginsVisible(bool visible); public slots: void ChoosedItem(quint32 id, const SceneObject &type); + void SelectedItem(bool selected, quint32 object, quint32 tool); void SetFactor(qreal factor); void EnableItemMove(bool move); void EnableDetailsMode(bool mode); @@ -62,6 +63,7 @@ public slots: void ToggleLabelSelection(bool enabled); void TogglePointSelection(bool enabled); + void ToggleLineSelection(bool enabled); void ToggleArcSelection(bool enabled); void ToggleSplineSelection(bool enabled); void ToggleSplinePathSelection(bool enabled); @@ -98,6 +100,7 @@ signals: * @param type object scene type. */ void ChoosedObject(quint32 id, SceneObject type); + void SelectedObject(bool selected, quint32 object, quint32 tool); /** * @brief NewFactor send new scale factor. * @param factor scene scale factor. @@ -110,6 +113,7 @@ signals: void EnableLabelItemSelection(bool enable); void EnablePointItemSelection(bool enable); + void EnableLineItemSelection(bool enable); void EnableArcItemSelection(bool enable); void EnableSplineItemSelection(bool enable); void EnableSplinePathItemSelection(bool enable); diff --git a/src/libs/vwidgets/vsimplepoint.cpp b/src/libs/vwidgets/vsimplepoint.cpp index 87624351f..0fafd4051 100644 --- a/src/libs/vwidgets/vsimplepoint.cpp +++ b/src/libs/vwidgets/vsimplepoint.cpp @@ -46,6 +46,7 @@ VSimplePoint::VSimplePoint(quint32 id, const QColor ¤tColor, Unit patternU connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VSimplePoint::ContextMenu); connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VSimplePoint::DeleteFromLabel); connect(namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VSimplePoint::PointChoosed); + connect(namePoint, &VGraphicsSimpleTextItem::PointSelected, this, &VSimplePoint::PointSelected); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VSimplePoint::ChangedPosition); lineName = new QGraphicsLineItem(this); this->setBrush(QBrush(Qt::NoBrush)); @@ -165,6 +166,12 @@ void VSimplePoint::PointChoosed() emit Choosed(id); } +//--------------------------------------------------------------------------------------------------------------------- +void VSimplePoint::PointSelected(bool selected) +{ + emit Selected(selected, id); +} + //--------------------------------------------------------------------------------------------------------------------- void VSimplePoint::ChangedPosition(const QPointF &pos) { @@ -222,6 +229,20 @@ void VSimplePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) QGraphicsEllipseItem::hoverLeaveEvent(event); } +//--------------------------------------------------------------------------------------------------------------------- +QVariant VSimplePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) +{ + if (change == QGraphicsItem::ItemSelectedChange) + { + namePoint->blockSignals(true); + namePoint->setSelected(value.toBool()); + namePoint->blockSignals(false); + emit Selected(value.toBool(), id); + } + + return QGraphicsEllipseItem::itemChange(change, value); +} + //--------------------------------------------------------------------------------------------------------------------- // cppcheck-suppress unusedFunction QColor VSimplePoint::GetCurrentColor() const diff --git a/src/libs/vwidgets/vsimplepoint.h b/src/libs/vwidgets/vsimplepoint.h index cba340a0b..c412ee594 100644 --- a/src/libs/vwidgets/vsimplepoint.h +++ b/src/libs/vwidgets/vsimplepoint.h @@ -65,6 +65,7 @@ signals: * @param id point id. */ void Choosed(quint32 id); + void Selected(bool selected, quint32 id); void ShowContextMenu(QGraphicsSceneContextMenuEvent * event); void Delete(); void NameChangedPosition(const QPointF &pos); @@ -72,14 +73,16 @@ signals: public slots: void DeleteFromLabel(); void PointChoosed(); + void PointSelected(bool selected); void ChangedPosition(const QPointF &pos); void ContextMenu(QGraphicsSceneContextMenuEvent * event); protected: - virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE; - virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; + virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE; + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE; + virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; + virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VSimplePoint)