aboutsummaryrefslogtreecommitdiff
path: root/src/compat/moulconfig/java/ProcessedCategoryFirm.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-12 17:02:08 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-12 17:02:08 +0100
commitb774daef5bd961f955d365ce07bd5aa4acb161f4 (patch)
tree8e5f8f92593f8c594cc25592901342cc8923cee9 /src/compat/moulconfig/java/ProcessedCategoryFirm.kt
parent9763a4caa44fb6629aae92f3ad696487d962b0d9 (diff)
downloadFirmament-b774daef5bd961f955d365ce07bd5aa4acb161f4.tar.gz
Firmament-b774daef5bd961f955d365ce07bd5aa4acb161f4.tar.bz2
Firmament-b774daef5bd961f955d365ce07bd5aa4acb161f4.zip
feat: MoulConfig config gui
Diffstat (limited to 'src/compat/moulconfig/java/ProcessedCategoryFirm.kt')
-rw-r--r--src/compat/moulconfig/java/ProcessedCategoryFirm.kt47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/compat/moulconfig/java/ProcessedCategoryFirm.kt b/src/compat/moulconfig/java/ProcessedCategoryFirm.kt
new file mode 100644
index 0000000..19e1112
--- /dev/null
+++ b/src/compat/moulconfig/java/ProcessedCategoryFirm.kt
@@ -0,0 +1,47 @@
+package moe.nea.firmament.compat.moulconfig
+
+import io.github.notenoughupdates.moulconfig.gui.editors.GuiOptionEditorAccordion
+import io.github.notenoughupdates.moulconfig.processor.ProcessedCategory
+import io.github.notenoughupdates.moulconfig.processor.ProcessedOption
+import moe.nea.firmament.gui.config.ManagedConfig
+
+class ProcessedCategoryFirm(
+ val category: ManagedConfig.Category,
+ private val options: List<ProcessedOptionFirm>
+) : ProcessedCategory {
+ val accordions = options.filter { it.editor is GuiOptionEditorAccordion }
+ .associateBy { (it.editor as GuiOptionEditorAccordion).accordionId }
+ init {
+ for (option in options) {
+ option.category = this
+ }
+ }
+
+ override fun getDebugDeclarationLocation(): String? {
+ return "FirmamentCategory.${category.name}"
+ }
+
+ override fun getDisplayName(): String {
+ return category.labelText.string
+ }
+
+ override fun getDescription(): String {
+ return "Missing description" // TODO: add description
+ }
+
+ override fun getIdentifier(): String {
+ return category.name
+ }
+
+ override fun getParentCategoryId(): String? {
+ return null
+ }
+
+ override fun getOptions(): List<ProcessedOption> {
+ return options
+ }
+
+ override fun getAccordionAnchors(): Map<Int, ProcessedOption> {
+ return accordions
+ }
+}