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
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 05/12/2010 Created this file. :-)
15 #include "imageoptions.h"
19 #include "actiondrawimage.h"
20 #include "actioninterface.h"
22 ImageOptions::ImageOptions(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
23 QWidget(parent, flags)
28 ImageOptions::~ImageOptions()
30 settings.beginGroup("Image");
31 settings.setValue("ImageAngle", ui.leAngle->text());
32 settings.setValue("ImageFactor", ui.leFactor->text());
36 void ImageOptions::setAction(ActionInterface * a, bool update)
38 if (a != NULL && a->rtti() == RS2::ActionDrawImage)
40 action = (ActionDrawImage *)a;
47 sAngle = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
48 sFactor = QString("%1").arg(action->getFactor());
52 settings.beginGroup("Image");
53 sAngle = settings.value("ImageAngle", "0.0").toString();
54 sFactor = settings.value("ImageFactor", "1.0").toString();
58 ui.leAngle->setText(sAngle);
59 ui.leFactor->setText(sFactor);
64 RS_DEBUG->print(RS_Debug::D_ERROR, "ImageOptions::setAction: wrong action type");
69 void ImageOptions::updateData()
73 action->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text())));
74 action->setFactor(RS_Math::eval(ui.leFactor->text()));