src/libraries.cpp

changeset 205
1a4342d80de7
parent 201
5d201ee4a9c3
child 218
63125c36de73
equal deleted inserted replaced
204:52e10e8d88cc 205:1a4342d80de7
218 /** 218 /**
219 * @brief Iterates over libraries and loads LDConfig.ldr from each of them. 219 * @brief Iterates over libraries and loads LDConfig.ldr from each of them.
220 * @param errors Where to stream any encountered errors 220 * @param errors Where to stream any encountered errors
221 * @return color table 221 * @return color table
222 */ 222 */
223 ldraw::ColorTable LibraryManager::loadColorTable(QTextStream& errors) const 223 ColorTable LibraryManager::loadColorTable(QTextStream& errors) const
224 { 224 {
225 ldraw::ColorTable result; 225 ColorTable result;
226 for (const Library& library : this->libraries) 226 for (const Library& library : this->libraries)
227 { 227 {
228 const QString path = library.path.filePath("LDConfig.ldr"); 228 const QString path = library.path.filePath("LDConfig.ldr");
229 QFile file{path}; 229 QFile file{path};
230 if (file.open(QIODevice::ReadOnly | QIODevice::Text)) 230 if (file.open(QIODevice::ReadOnly | QIODevice::Text))
231 { 231 {
232 (void) result.load(file, errors); 232 const auto loadedTable = ::loadColorTable(file, errors);
233 if (loadedTable) {
234 result = std::move(*loadedTable);
235 }
236 break;
233 } 237 }
234 } 238 }
235 return result; 239 return result;
236 } 240 }
237 241

mercurial