src/toolsets/filetoolset.cpp

changeset 1308
dcc8c02530c2
parent 1288
d1e45f90654b
child 1326
69a90bd2dba2
equal deleted inserted replaced
1307:adb9d32a1426 1308:dcc8c02530c2
91 void FileToolset::settings() 91 void FileToolset::settings()
92 { 92 {
93 (new ConfigDialog {m_window})->exec(); 93 (new ConfigDialog {m_window})->exec();
94 } 94 }
95 95
96 void FileToolset::setLDrawPath()
97 {
98 LDrawPathDialog* dialog = new LDrawPathDialog {m_config->lDrawPath(), true};
99
100 if (dialog->exec())
101 m_config->setLDrawPath (dialog->path());
102 }
103
104 void FileToolset::exit() 96 void FileToolset::exit()
105 { 97 {
106 ::exit(EXIT_SUCCESS); 98 ::exit(EXIT_SUCCESS);
107 } 99 }
108 100
153 145
154 if (file.open(QIODevice::WriteOnly | QIODevice::Text)) 146 if (file.open(QIODevice::WriteOnly | QIODevice::Text))
155 { 147 {
156 for (LDObject* obj : selectedObjects()) 148 for (LDObject* obj : selectedObjects())
157 { 149 {
158 QString contents = obj->asText(); 150 file.write(obj->asText().toUtf8());
159 QByteArray data = contents.toUtf8(); 151 file.write("\r\n");
160 file.write(data, countof(data));
161 file.write("\r\n", 2);
162 } 152 }
163 } 153 }
164 else 154 else
165 { 155 {
166 QMessageBox::critical(m_window, tr("Error"), format(tr("Unable to open %1 for writing: %2"), filePath, file.errorString())); 156 QMessageBox::critical(m_window, tr("Error"), format(tr("Unable to open %1 for writing: %2"), filePath, file.errorString()));

mercurial