diff --git a/src/Mod/Sketcher/Gui/CMakeLists.txt b/src/Mod/Sketcher/Gui/CMakeLists.txt index 2b10cdc9aa..505caff974 100644 --- a/src/Mod/Sketcher/Gui/CMakeLists.txt +++ b/src/Mod/Sketcher/Gui/CMakeLists.txt @@ -38,6 +38,7 @@ set(SketcherGui_MOC_HDRS SketchMirrorDialog.h SketcherSettings.h SketchRectangularArrayDialog.h + SketcherRegularPolygonDialog.h PropertyConstraintListItem.h ) fc_wrap_cpp(SketcherGui_MOC_SRCS ${SketcherGui_MOC_HDRS}) @@ -62,6 +63,7 @@ set(SketcherGui_UIC_SRCS SketcherSettings.ui SketcherSettingsColors.ui SketchRectangularArrayDialog.ui + SketcherRegularPolygonDialog.ui ) if(BUILD_QT5) @@ -127,6 +129,8 @@ SET(SketcherGui_SRCS SketcherSettings.h SketchRectangularArrayDialog.h SketchRectangularArrayDialog.cpp + SketcherRegularPolygonDialog.h + SketcherRegularPolygonDialog.cpp TaskDlgEditSketch.cpp TaskDlgEditSketch.h ViewProviderPython.cpp diff --git a/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.cpp b/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.cpp new file mode 100644 index 0000000000..c1b8d92a7f --- /dev/null +++ b/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (c) 2017 Abdullah Tahiri * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library 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 Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#include "PreCompiled.h" + +#ifndef _PreComp_ +# include +# include +#endif + +#include +#include +#include +#include + +#include "ui_SketcherRegularPolygonDialog.h" +#include "SketcherRegularPolygonDialog.h" + +using namespace SketcherGui; + +SketcherRegularPolygonDialog::SketcherRegularPolygonDialog(void) +: QDialog(Gui::getMainWindow()), ui(new Ui_SketcherRegularPolygonDialog) +{ + ui->setupUi(this); + + ui->sidesQuantitySpinBox->onRestore(); + + updateValues(); +} + +SketcherRegularPolygonDialog::~SketcherRegularPolygonDialog() +{ + +} + +void SketcherRegularPolygonDialog::accept() +{ + ui->sidesQuantitySpinBox->onSave(); + + updateValues(); + + QDialog::accept(); +} + +void SketcherRegularPolygonDialog::updateValues(void) +{ + sides = ui->sidesQuantitySpinBox->value(); +} + +#include "moc_SketcherRegularPolygonDialog.cpp" diff --git a/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.h b/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.h new file mode 100644 index 0000000000..f450693620 --- /dev/null +++ b/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * Copyright (c) 2017 Abdullah Tahiri * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library 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 Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#ifndef SKETCHERGUI_SketcherRegularPolygonDialog_H +#define SKETCHERGUI_SketcherRegularPolygonDialog_H + +#include +#include + +namespace SketcherGui { + +class Ui_SketcherRegularPolygonDialog; +class SketcherRegularPolygonDialog : public QDialog +{ + Q_OBJECT + +public: + SketcherRegularPolygonDialog(void); + ~SketcherRegularPolygonDialog(); + + void accept(); + + int sides; + +protected: + void updateValues(void); +private: + Ui_SketcherRegularPolygonDialog* ui; +}; + +} + +#endif // SKETCHERGUI_SketcherRegularPolygonDialog_H diff --git a/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.ui b/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.ui new file mode 100644 index 0000000000..8ce63abcc4 --- /dev/null +++ b/src/Mod/Sketcher/Gui/SketcherRegularPolygonDialog.ui @@ -0,0 +1,120 @@ + + + SketcherGui::SketcherRegularPolygonDialog + + + Qt::ApplicationModal + + + + 0 + 0 + 287 + 86 + + + + Create array + + + + + + + + Number of Sides: + + + + + + + Number of columns of the linear array + + + 3 + + + 9 + + + DefaultRegularPolygonSides + + + Mod/Sketcher + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + true + + + + + + + + Gui::PrefSpinBox + QSpinBox +
Gui/PrefWidgets.h
+
+
+ + + + buttonBox + accepted() + SketcherGui::SketcherRegularPolygonDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SketcherGui::SketcherRegularPolygonDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +