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 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 06/10/2010 Created this file. :-)
17 #include "roundoptions.h"
19 #include "actionmodifyround.h"
23 RoundOptions::RoundOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
24 QWidget(parent, flags),
25 cbTrim(new QCheckBox(tr("Trim"))),
26 sep1(new QFrame(this)),
27 lRadius(new QLabel(tr("Radius:"))),
28 leRadius(new QLineEdit(this))
30 QHBoxLayout * layout = new QHBoxLayout(this);
31 layout->setContentsMargins(0, 0, 0, 0);
33 sep1->setFrameShape(QFrame::VLine);
34 sep1->setFrameShadow(QFrame::Sunken);
35 leRadius->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
37 layout->addWidget(cbTrim);
38 layout->addWidget(sep1);
39 layout->addWidget(lRadius);
40 layout->addWidget(leRadius);
42 connect(cbTrim, SIGNAL(toggled(bool)), this, SLOT(updateData()));
43 connect(leRadius, SIGNAL(textChanged(QString)), this, SLOT(updateData()));
45 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
46 // nothing will show up on the screen. :-)
48 parent->addWidget(this);
51 RoundOptions::~RoundOptions()
53 settings.beginGroup("Modify");
54 settings.setValue("RoundRadius", leRadius->text());
55 settings.setValue("RoundTrim", cbTrim->isChecked());
59 void RoundOptions::setAction(ActionInterface * a, bool update)
61 if (a != NULL && a->rtti() == RS2::ActionModifyRound)
63 action = (ActionModifyRound *)a;
70 sr = QString("%1").arg(action->getRadius());
71 st = action->isTrimOn();
75 settings.beginGroup("Modify");
76 sr = settings.value("RoundRadius", "1.0").toString();
77 st = settings.value("RoundTrim", true).toBool();
81 leRadius->setText(sr);
82 cbTrim->setChecked(st);
86 DEBUG->print(Debug::D_ERROR, "LineParallelOptions::setAction: wrong action type");
91 void RoundOptions::updateData()
95 action->setTrim(cbTrim->isChecked());
96 action->setRadius(Math::eval(leRadius->text()));