]> Shamusworld >> Repos - architektonas/blob - src/forms/dlgspline.cpp
Final round of dialogs/forms needing to be converted from Qt3 to 4
[architektonas] / src / forms / dlgspline.cpp
1 // dlgspline.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  06/10/2010  Added this file. :-)
13 //
14
15 #include "dlgspline.h"
16
17 #include "drawing.h"
18 #include "rs_spline.h"
19
20 DlgSpline::DlgSpline(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21         QDialog(parent, flags)
22 {
23         ui.setupUi(this);
24 }
25
26 DlgSpline::~DlgSpline()
27 {
28 }
29
30 void DlgSpline::setSpline(RS_Spline & e)
31 {
32         spline = &e;
33         //pen = spline->getPen();
34         ui.wPen->setPen(spline->getPen(false), true, false, "Pen");
35         Drawing * graphic = spline->getGraphic();
36         RS_Layer * lay = spline->getLayer(false);
37
38         if (graphic)
39                 ui.cbLayer->init(*(graphic->getLayerList()), false, false);
40
41         if (lay)
42                 ui.cbLayer->setLayer(*lay);
43
44         QString s;
45         s.setNum(spline->getDegree());
46         ui.cbDegree->setCurrentIndex(ui.cbDegree->findText(s));
47 //      cbDegree->setCurrentIndex(cbDegree->findText(QString("%1").arg(degree)));
48
49         ui.cbClosed->setChecked(spline->isClosed());
50 }
51
52 void DlgSpline::updateSpline()
53 {
54         spline->setDegree(RS_Math::round(RS_Math::eval(ui.cbDegree->currentText())));
55         spline->setClosed(ui.cbClosed->isChecked());
56         spline->setPen(ui.wPen->getPen());
57         spline->setLayer(ui.cbLayer->currentText());
58         spline->update();
59 }