Tue, 15 Nov 2016 17:37:31 +0200
Cleanup PartDownloader
1020
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
1 | /* |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
3 | * Copyright (C) 2013 - 2016 Teemu Piippo |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
4 | * |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
8 | * (at your option) any later version. |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
9 | * |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
13 | * GNU General Public License for more details. |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
14 | * |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
17 | */ |
815a040d4039
Reformatted primitives.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1019
diff
changeset
|
18 | |
1019
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "../ldObject.h" |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "generateprimitivedialog.h" |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "ui_generateprimitivedialog.h" |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | GeneratePrimitiveDialog::GeneratePrimitiveDialog (QWidget* parent, Qt::WindowFlags f) : |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | QDialog (parent, f), |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | ui(*new Ui_GeneratePrimitiveDialog) |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | { |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | ui.setupUi (this); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | connect (ui.highResolution, &QCheckBox::toggled, this, &GeneratePrimitiveDialog::highResolutionToggled); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | } |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | GeneratePrimitiveDialog::~GeneratePrimitiveDialog() |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | { |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | delete &ui; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | } |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | void GeneratePrimitiveDialog::highResolutionToggled (bool on) |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | { |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | ui.segments->setMaximum (on ? HighResolution : LowResolution); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | // If the current value is 16 and we switch to hi-res, default the |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | // spinbox to 48. (should we scale this?) |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | if (on and ui.segments->value() == LowResolution) |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | ui.segments->setValue(HighResolution); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | } |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | PrimitiveSpec GeneratePrimitiveDialog::spec() const |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | { |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | PrimitiveSpec result; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | result.type = |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | ui.typeCircle->isChecked() ? Circle : |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | ui.typeCylinder->isChecked() ? Cylinder : |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | ui.typeDisc->isChecked() ? Disc : |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | ui.typeDiscNegative->isChecked() ? DiscNegative : |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | ui.typeRing->isChecked() ? Ring : |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | Cone; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | result.divisions = ui.highResolution->isChecked() ? HighResolution : LowResolution; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | result.segments = ui.segments->value(); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | result.ringNumber = ui.ringNumber->value(); |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | return result; |
a2e4286adb0d
Split PrimitivePrompt into its new source files, renamed it to GeneratePrimitivePrompt
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | } |