src/libraries.cpp

changeset 26
3a9e761e4faa
parent 24
1a0faaaceb84
child 35
98906a94732f
--- a/src/libraries.cpp	Sun Jan 19 14:25:57 2020 +0200
+++ b/src/libraries.cpp	Wed Jan 22 00:23:29 2020 +0200
@@ -216,6 +216,26 @@
 }
 
 /**
+ * @brief Iterates over libraries and loads LDConfig.ldr from each of them.
+ * @param errors Where to stream any encountered errors
+ * @return color table
+ */
+ColorTable LibraryManager::loadColorTable(QTextStream& errors)
+{
+	ColorTable result;
+	for (const Library& library : this->libraries)
+	{
+		const QString path = library.path.filePath("LDConfig.ldr");
+		QFile file{path};
+		if (file.open(QIODevice::ReadOnly | QIODevice::Text))
+		{
+			(void) result.load(file, errors);
+		}
+	}
+	return result;
+}
+
+/**
  * @brief Gets a human-readable string for the specified role
  * @param role Role to get a string for
  * @returns string

mercurial