]> Shamusworld >> Repos - architektonas/blob - src/forms/dlgmove.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / forms / dlgmove.cpp
1 // dlgmove.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 "dlgmove.h"
18
19 #include "modification.h"
20 #include "settings.h"
21
22 DlgMove::DlgMove(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
23         QDialog(parent, flags)
24 {
25         ui.setupUi(this);
26
27         settings.beginGroup("Modify");
28         copies = settings.value("MoveCopies", "10").toString();
29         numberMode = settings.value("MoveMode", 0).toInt();
30         useCurrentLayer = settings.value("MoveUseCurrentLayer", false).toBool();
31         useCurrentAttributes = settings.value("MoveUseCurrentAttributes", false).toBool();
32         settings.endGroup();
33
34         switch (numberMode)
35         {
36         case 0:
37                 ui.rbMove->setChecked(true);
38                 break;
39
40         case 1:
41                 ui.rbCopy->setChecked(true);
42                 break;
43
44         case 2:
45                 ui.rbMultiCopy->setChecked(true);
46                 break;
47
48         default:
49                 break;
50         }
51
52         ui.leNumber->setText(copies);
53         ui.cbCurrentAttributes->setChecked(useCurrentAttributes);
54         ui.cbCurrentLayer->setChecked(useCurrentLayer);
55 }
56
57 DlgMove::~DlgMove()
58 {
59         settings.beginGroup("Modify");
60         settings.setValue("MoveCopies", ui.leNumber->text());
61
62         if (ui.rbMove->isChecked())
63                 numberMode = 0;
64         else if (ui.rbCopy->isChecked())
65                 numberMode = 1;
66         else
67                 numberMode = 2;
68
69         settings.setValue("MoveMode", numberMode);
70         settings.setValue("MoveUseCurrentLayer", ui.cbCurrentLayer->isChecked());
71         settings.setValue("MoveUseCurrentAttributes", ui.cbCurrentAttributes->isChecked());
72         settings.endGroup();
73 }
74
75 void DlgMove::setData(MoveData * d)
76 {
77         data = d;
78 }
79
80 void DlgMove::updateData()
81 {
82         if (ui.rbMove->isChecked())
83                 data->number = 0;
84         else if (ui.rbCopy->isChecked())
85                 data->number = 1;
86         else
87                 data->number = ui.leNumber->text().toInt();
88
89         data->useCurrentAttributes = ui.cbCurrentAttributes->isChecked();
90         data->useCurrentLayer = ui.cbCurrentLayer->isChecked();
91 }