src/actions.cc

changeset 848
68410477c8bb
parent 847
274a7fac44fc
child 850
a3d72b0e916d
equal deleted inserted replaced
847:274a7fac44fc 848:68410477c8bb
41 41
42 EXTERN_CFGENTRY (Bool, drawWireframe); 42 EXTERN_CFGENTRY (Bool, drawWireframe);
43 EXTERN_CFGENTRY (Bool, bfcRedGreenView); 43 EXTERN_CFGENTRY (Bool, bfcRedGreenView);
44 EXTERN_CFGENTRY (String, defaultName); 44 EXTERN_CFGENTRY (String, defaultName);
45 EXTERN_CFGENTRY (String, defaultUser); 45 EXTERN_CFGENTRY (String, defaultUser);
46 EXTERN_CFGENTRY (Int, defaultLicense); 46 EXTERN_CFGENTRY (Bool, UseCALicense);
47 EXTERN_CFGENTRY (Bool, drawAngles); 47 EXTERN_CFGENTRY (Bool, drawAngles);
48 EXTERN_CFGENTRY (Bool, randomColors) 48 EXTERN_CFGENTRY (Bool, randomColors)
49 EXTERN_CFGENTRY (Bool, drawSurfaces) 49 EXTERN_CFGENTRY (Bool, drawSurfaces)
50 EXTERN_CFGENTRY (Bool, drawEdgeLines) 50 EXTERN_CFGENTRY (Bool, drawEdgeLines)
51 EXTERN_CFGENTRY (Bool, drawConditionalLines) 51 EXTERN_CFGENTRY (Bool, drawConditionalLines)
62 62
63 if (not cfg::defaultUser.isEmpty()) 63 if (not cfg::defaultUser.isEmpty())
64 authortext.append (format (" [%1]", cfg::defaultUser)); 64 authortext.append (format (" [%1]", cfg::defaultUser));
65 65
66 ui.le_author->setText (authortext); 66 ui.le_author->setText (authortext);
67 67 ui.caLicense->setChecked (cfg::UseCALicense);
68 switch (cfg::defaultLicense)
69 {
70 case 0:
71 ui.rb_license_ca->setChecked (true);
72 break;
73
74 case 1:
75 ui.rb_license_nonca->setChecked (true);
76 break;
77
78 case 2:
79 ui.rb_license_none->setChecked (true);
80 break;
81
82 default:
83 QMessageBox::warning (null, "Warning",
84 format ("Unknown ld_defaultlicense value %1!", cfg::defaultLicense));
85 break;
86 }
87 68
88 if (dlg->exec() == QDialog::Rejected) 69 if (dlg->exec() == QDialog::Rejected)
89 return; 70 return;
90 71
91 newFile(); 72 newFile();
92 73
93 BFCStatement const bfctype = ui.rb_bfc_ccw->isChecked() ? BFCStatement::CertifyCCW 74 BFCStatement const bfctype = ui.rb_bfc_ccw->isChecked() ? BFCStatement::CertifyCCW
94 : ui.rb_bfc_cw->isChecked() ? BFCStatement::CertifyCW 75 : ui.rb_bfc_cw->isChecked() ? BFCStatement::CertifyCW
95 : BFCStatement::NoCertify; 76 : BFCStatement::NoCertify;
96 77 QString const license = ui.caLicense->isChecked() ? CALicenseText : "";
97 QString const license =
98 ui.rb_license_ca->isChecked() ? g_CALicense :
99 ui.rb_license_nonca->isChecked() ? g_nonCALicense : "";
100 78
101 LDObjectList objs; 79 LDObjectList objs;
102 objs << spawn<LDComment> (ui.le_title->text()); 80 objs << spawn<LDComment> (ui.le_title->text());
103 objs << spawn<LDComment> ("Name: <untitled>.dat"); 81 objs << spawn<LDComment> ("Name: <untitled>.dat");
104 objs << spawn<LDComment> (format ("Author: %1", ui.le_author->text())); 82 objs << spawn<LDComment> (format ("Author: %1", ui.le_author->text()));
752 730
753 // Comment containing the title of the parent document 731 // Comment containing the title of the parent document
754 LDCommentPtr titleobj (getCurrentDocument()->getObject (0).dynamicCast<LDComment>()); 732 LDCommentPtr titleobj (getCurrentDocument()->getObject (0).dynamicCast<LDComment>());
755 733
756 // License text for the subfile 734 // License text for the subfile
757 QString license (getLicenseText (cfg::defaultLicense)); 735 QString license (PreferredLicenseText());
758 736
759 // LDraw code body of the new subfile (i.e. code of the selection) 737 // LDraw code body of the new subfile (i.e. code of the selection)
760 QStringList code; 738 QStringList code;
761 739
762 // Full path of the subfile to be 740 // Full path of the subfile to be

mercurial