]> Shamusworld >> Repos - architektonas/blob - src/forms/dlgmirror.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / forms / dlgmirror.cpp
1 // dlgmirror.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 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  06/11/2010  Created this file. :-)
15 //
16
17 #include "dlgmirror.h"
18
19 #include "modification.h"
20 #include "settings.h"
21
22 DlgMirror::DlgMirror(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
23         QDialog(parent, flags)
24 {
25         ui.setupUi(this);
26
27         settings.beginGroup("Modify");
28         numberMode = settings.value("MirrorMode", 0).toInt();
29         useCurrentLayer = settings.value("MirrorUseCurrentLayer", false).toBool();
30         useCurrentAttributes = settings.value("MirrorUseCurrentAttributes", false).toBool();
31         settings.endGroup();
32
33         switch (numberMode)
34         {
35         case 0:
36                 ui.rbMove->setChecked(true);
37                 break;
38
39         case 1:
40                 ui.rbCopy->setChecked(true);
41                 break;
42
43         default:
44                 break;
45         }
46
47         ui.cbCurrentAttributes->setChecked(useCurrentAttributes);
48         ui.cbCurrentLayer->setChecked(useCurrentLayer);
49 }
50
51 DlgMirror::~DlgMirror()
52 {
53         settings.beginGroup("Modify");
54
55         if (ui.rbMove->isChecked())
56                 numberMode = 0;
57         else if (ui.rbCopy->isChecked())
58                 numberMode = 1;
59         else
60                 numberMode = 2;
61
62         settings.setValue("MirrorMode", numberMode);
63         settings.setValue("MirrorUseCurrentLayer", ui.cbCurrentLayer->isChecked());
64         settings.setValue("MirrorUseCurrentAttributes", ui.cbCurrentAttributes->isChecked());
65         settings.endGroup();
66 }
67
68 void DlgMirror::setData(MirrorData * d)
69 {
70         data = d;
71 }
72
73 void DlgMirror::updateData()
74 {
75         if (ui.rbMove->isChecked())
76                 data->copy = false;
77         else if (ui.rbCopy->isChecked())
78                 data->copy = true;
79
80         data->useCurrentAttributes = ui.cbCurrentAttributes->isChecked();
81         data->useCurrentLayer = ui.cbCurrentLayer->isChecked();
82 }