22 #include "../ldDocument.h" |
22 #include "../ldDocument.h" |
23 #include "../mainwindow.h" |
23 #include "../mainwindow.h" |
24 #include "newpartdialog.h" |
24 #include "newpartdialog.h" |
25 #include "ui_newpartdialog.h" |
25 #include "ui_newpartdialog.h" |
26 |
26 |
27 NewPartDialog::NewPartDialog (QWidget *parent) : |
27 NewPartDialog::NewPartDialog(QWidget *parent) : |
28 QDialog (parent), |
28 QDialog(parent), |
29 HierarchyElement (parent), |
29 HierarchyElement(parent), |
30 ui (*new Ui_NewPart) |
30 ui(*new Ui_NewPart) |
31 { |
31 { |
32 ui.setupUi (this); |
32 ui.setupUi(this); |
33 |
33 |
34 QString authortext = config.defaultName(); |
34 QString authortext = config.defaultName(); |
35 |
35 |
36 if (not config.defaultUser().isEmpty()) |
36 if (not config.defaultUser().isEmpty()) |
37 authortext.append (format (" [%1]", config.defaultUser())); |
37 authortext.append(format(" [%1]", config.defaultUser())); |
38 |
38 |
39 ui.author->setText (authortext); |
39 ui.author->setText(authortext); |
40 ui.useCaLicense->setChecked (config.useCaLicense()); |
40 ui.useCaLicense->setChecked(config.useCaLicense()); |
41 } |
41 } |
42 |
42 |
43 BfcStatement NewPartDialog::getWinding() const |
43 BfcStatement NewPartDialog::getWinding() const |
44 { |
44 { |
45 if (ui.windingCcw->isChecked()) |
45 if (ui.windingCcw->isChecked()) |
64 QString NewPartDialog::title() const |
64 QString NewPartDialog::title() const |
65 { |
65 { |
66 return ui.title->text(); |
66 return ui.title->text(); |
67 } |
67 } |
68 |
68 |
69 void NewPartDialog::fillHeader (LDDocument* newdoc) const |
69 void NewPartDialog::fillHeader(LDDocument* newdoc) const |
70 { |
70 { |
71 LDObjectList objs; |
71 LDObjectList objs; |
72 objs << new LDComment (title()); |
72 objs << new LDComment(title()); |
73 objs << new LDComment ("Name: <untitled>.dat"); |
73 objs << new LDComment("Name: <untitled>.dat"); |
74 objs << new LDComment ("Author: " + author()); |
74 objs << new LDComment("Author: " + author()); |
75 objs << new LDComment ("!LDRAW_ORG Unofficial_Part"); |
75 objs << new LDComment("!LDRAW_ORG Unofficial_Part"); |
76 |
76 |
77 if (useCaLicense()) |
77 if (useCaLicense()) |
78 objs << new LDComment (CALicenseText); |
78 objs << new LDComment(CALicenseText); |
79 |
79 |
80 objs << new LDEmpty(); |
80 objs << new LDEmpty(); |
81 objs << new LDBfc (getWinding()); |
81 objs << new LDBfc(getWinding()); |
82 objs << new LDEmpty(); |
82 objs << new LDEmpty(); |
83 newdoc->addObjects (objs); |
83 newdoc->addObjects(objs); |
84 } |
84 } |