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 05/12/2010 Created this file. :-)
17 #include "imageoptions.h"
20 #include "actiondrawimage.h"
21 #include "actioninterface.h"
25 ImageOptions::ImageOptions(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
26 QWidget(parent, flags)
31 ImageOptions::~ImageOptions()
33 settings.beginGroup("Image");
34 settings.setValue("ImageAngle", ui.leAngle->text());
35 settings.setValue("ImageFactor", ui.leFactor->text());
39 void ImageOptions::setAction(ActionInterface * a, bool update)
41 if (a != NULL && a->rtti() == RS2::ActionDrawImage)
43 action = (ActionDrawImage *)a;
50 sAngle = QString("%1").arg(Math::rad2deg(action->getAngle()));
51 sFactor = QString("%1").arg(action->getFactor());
55 settings.beginGroup("Image");
56 sAngle = settings.value("ImageAngle", "0.0").toString();
57 sFactor = settings.value("ImageFactor", "1.0").toString();
61 ui.leAngle->setText(sAngle);
62 ui.leFactor->setText(sFactor);
67 DEBUG->print(Debug::D_ERROR, "ImageOptions::setAction: wrong action type");
72 void ImageOptions::updateData()
76 action->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text())));
77 action->setFactor(Math::eval(ui.leFactor->text()));