214 { |
214 { |
215 return libraryIndex >= 0 && libraryIndex < this->libraries.size(); |
215 return libraryIndex >= 0 && libraryIndex < this->libraries.size(); |
216 } |
216 } |
217 |
217 |
218 /** |
218 /** |
|
219 * @brief Iterates over libraries and loads LDConfig.ldr from each of them. |
|
220 * @param errors Where to stream any encountered errors |
|
221 * @return color table |
|
222 */ |
|
223 ColorTable LibraryManager::loadColorTable(QTextStream& errors) |
|
224 { |
|
225 ColorTable result; |
|
226 for (const Library& library : this->libraries) |
|
227 { |
|
228 const QString path = library.path.filePath("LDConfig.ldr"); |
|
229 QFile file{path}; |
|
230 if (file.open(QIODevice::ReadOnly | QIODevice::Text)) |
|
231 { |
|
232 (void) result.load(file, errors); |
|
233 } |
|
234 } |
|
235 return result; |
|
236 } |
|
237 |
|
238 /** |
219 * @brief Gets a human-readable string for the specified role |
239 * @brief Gets a human-readable string for the specified role |
220 * @param role Role to get a string for |
240 * @param role Role to get a string for |
221 * @returns string |
241 * @returns string |
222 */ |
242 */ |
223 QString Library::libraryRoleName(const Role role) |
243 QString Library::libraryRoleName(const Role role) |