From b3c5e1dcb764171c46b8397414b61cddc3d7005a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sat, 22 Jul 2023 14:39:16 +0200 Subject: [PATCH] Update theme extensions. --- src/inibakery.h | 5 +++ themes/CMakeLists.txt | 4 +- themes/dark-theme/metadata.json | 14 ++++--- themes/dracula-theme/metadata.json | 12 +++--- themes/make-metadata.ps1 | 59 ++++++++++++++++++--------- themes/nighteyes-theme/metadata.json | 12 +++--- themes/parchment-theme/metadata.json | 12 +++--- themes/skyrim-theme/metadata.json | 12 +++--- themes/vs15-themes/metadata.json | 60 ++++++++++++++-------------- 9 files changed, 115 insertions(+), 75 deletions(-) diff --git a/src/inibakery.h b/src/inibakery.h index 2707085aa..a32ef55aa 100644 --- a/src/inibakery.h +++ b/src/inibakery.h @@ -7,6 +7,11 @@ class OrganizerCore; +// small classes that deal with preparing profiles before runs for local saves, bsa +// invalidation, etc., and providing mapping for local profile files when needed +// +// this class replaces the old INI Bakery plugin +// class IniBakery { public: diff --git a/themes/CMakeLists.txt b/themes/CMakeLists.txt index 18871c885..58fc857d6 100644 --- a/themes/CMakeLists.txt +++ b/themes/CMakeLists.txt @@ -6,6 +6,8 @@ file(GLOB theme_directories foreach(theme_directory ${theme_directories}) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${theme_directory}") - install(DIRECTORY ${theme_directory} DESTINATION bin/extensions) + file(READ ${theme_directory}/metadata.json JSON_METADATA) + string(JSON theme_identifier GET ${JSON_METADATA} id) + install(DIRECTORY ${theme_directory}/ DESTINATION bin/extensions/${theme_identifier}) endif() endforeach() diff --git a/themes/dark-theme/metadata.json b/themes/dark-theme/metadata.json index 0bd00fa70..9075b2c5f 100644 --- a/themes/dark-theme/metadata.json +++ b/themes/dark-theme/metadata.json @@ -1,13 +1,15 @@ { - "identifier": "dark-theme", - "type": "theme", + "id": "mo2-theme-dark", "name": "Dark Theme", "description": "Dark theme for ModOrganizer2.", "version": "1.0.0", - "themes": { - "dark": { - "name": "Dark", - "path": "dark.qss" + "type": "theme", + "content": { + "themes": { + "dark": { + "name": "Dark", + "path": "dark.qss" + } } } } diff --git a/themes/dracula-theme/metadata.json b/themes/dracula-theme/metadata.json index 4e1cb8543..b811bf853 100644 --- a/themes/dracula-theme/metadata.json +++ b/themes/dracula-theme/metadata.json @@ -1,13 +1,15 @@ { - "identifier": "dracula-theme", + "id": "mo2-theme-dracula", "type": "theme", "name": "Dracula Theme", "description": "Dracula theme for ModOrganizer2.", "version": "1.0.0", - "themes": { - "dracula": { - "name": "Dracula", - "path": "dracula.qss" + "content": { + "themes": { + "dracula": { + "name": "Dracula", + "path": "dracula.qss" + } } } } diff --git a/themes/make-metadata.ps1 b/themes/make-metadata.ps1 index 4143291c8..1625f3377 100644 --- a/themes/make-metadata.ps1 +++ b/themes/make-metadata.ps1 @@ -1,25 +1,46 @@ -$fixNames = @{ - dark = "Dark"; - dracula = "Dracula"; - nighteyes = "Night Eyes"; - parchment = "Parchment"; - skyrim = "Skyrim"; -} - -Get-ChildItem -Directory -Exclude "vs15" | ForEach-Object { - $name = $fixNames[$_.Name]; +Get-ChildItem -Directory | ForEach-Object { + $metadata = Get-Content "$_/metadata.json" | ConvertFrom-Json + $metadata + $name = $metadata.identifier -replace "-themes?" $data = [ordered]@{ - identifier = $_.Name + "-theme"; + id = "mo2-theme-" + $name; type = "theme"; - name = "$name Theme"; - description = "$name theme for ModOrganizer2."; + name = $metadata.name; + description = $metadata.description; version = "1.0.0"; - themes = @{ - $_.Name = [ordered]@{ - name = $name; - path = (Get-ChildItem $_ -Filter "*.qss")[0].Name; - } + content = @{ + themes = $metadata.themes; }; } - ConvertTo-Json -InputObject $data | Set-Content (Join-Path $_ "metadata.json") + $data + # ConvertTo-Json -InputObject $data # | Set-Content (Join-Path $_ "metadata.json") } + +# $fixNames = @{ +# dark = "Dark"; +# dracula = "Dracula"; +# nighteyes = "Night Eyes"; +# parchment = "Parchment"; +# skyrim = "Skyrim"; +# } + +# Get-ChildItem -Directory -Exclude "vs15" | ForEach-Object { +# $name = $fixNames[$_.Name]; +# $data = [ordered]@{ +# identifier = "mo2-theme-" + $_.Name; +# type = "theme"; +# name = "$name Theme"; +# description = "$name theme for ModOrganizer2."; +# version = "1.0.0"; +# content = @{ +# themes = @{ +# $_.Name = [ordered]@{ +# name = $name; +# path = (Get-ChildItem $_ -Filter "*.qss")[0].Name; +# } +# }; +# }; +# ; +# } +# ConvertTo-Json -InputObject $data | Set-Content (Join-Path $_ "metadata.json") +# } diff --git a/themes/nighteyes-theme/metadata.json b/themes/nighteyes-theme/metadata.json index f8d8b3261..cf9d8fc7b 100644 --- a/themes/nighteyes-theme/metadata.json +++ b/themes/nighteyes-theme/metadata.json @@ -1,13 +1,15 @@ { - "identifier": "nighteyes-theme", + "id": "mo2-theme-nighteyes", "type": "theme", "name": "Night Eyes Theme", "description": "Night Eyes theme for ModOrganizer2.", "version": "1.0.0", - "themes": { - "nighteyes": { - "name": "Night Eyes", - "path": "nigheyes.qss" + "content": { + "themes": { + "nighteyes": { + "name": "Night Eyes", + "path": "nigheyes.qss" + } } } } diff --git a/themes/parchment-theme/metadata.json b/themes/parchment-theme/metadata.json index 4e53ba407..09448ec76 100644 --- a/themes/parchment-theme/metadata.json +++ b/themes/parchment-theme/metadata.json @@ -1,13 +1,15 @@ { - "identifier": "parchment-theme", + "id": "mo2-theme-parchment", "type": "theme", "name": "Parchment Theme", "description": "Parchment theme for ModOrganizer2.", "version": "1.0.0", - "themes": { - "parchment": { - "name": "Parchment", - "path": "parchment.qss" + "content": { + "themes": { + "parchment": { + "name": "Parchment", + "path": "parchment.qss" + } } } } diff --git a/themes/skyrim-theme/metadata.json b/themes/skyrim-theme/metadata.json index b28358b1b..f2f78ec09 100644 --- a/themes/skyrim-theme/metadata.json +++ b/themes/skyrim-theme/metadata.json @@ -1,13 +1,15 @@ { - "identifier": "skyrim-theme", + "id": "mo2-theme-skyrim", "type": "theme", "name": "Skyrim Theme", "description": "Skyrim theme for ModOrganizer2.", "version": "1.0.0", - "themes": { - "skyrim": { - "name": "Skyrim", - "path": "skyrim.qss" + "content": { + "themes": { + "skyrim": { + "name": "Skyrim", + "path": "skyrim.qss" + } } } } diff --git a/themes/vs15-themes/metadata.json b/themes/vs15-themes/metadata.json index 0f6ea552d..c6404d462 100644 --- a/themes/vs15-themes/metadata.json +++ b/themes/vs15-themes/metadata.json @@ -1,37 +1,39 @@ { - "identifier": "vs15-dark-themes", + "id": "mo2-theme-vs15-dark", "type": "theme", "name": "VS15 Themes", "description": "Set of dark themes, inspired by Visual Studio, for ModOrganizer2.", "version": "1.0.0", - "themes": { - "vs15-dark-blue": { - "name": "VS15 - Dark Blue", - "path": "vs15 Dark-Blue.qss" - }, - "vs15-dark-green": { - "name": "VS15 - Dark Green", - "path": "vs15 Dark-Green.qss" - }, - "vs15-dark-orange": { - "name": "VS15 - Dark Orange", - "path": "vs15 Dark-Orange.qss" - }, - "vs15-dark-pink": { - "name": "VS15 - Dark Pink", - "path": "vs15 Dark-Pink.qss" - }, - "vs15-dark-purple": { - "name": "VS15 - Dark Purple", - "path": "vs15 Dark-Purple.qss" - }, - "vs15-dark-red": { - "name": "VS15 - Dark Red", - "path": "vs15 Dark-Red.qss" - }, - "vs15-dark-yellow": { - "name": "VS15 - Dark Yellow", - "path": "vs15 Dark-Yellow.qss" + "content": { + "themes": { + "vs15-dark-blue": { + "name": "VS15 - Dark Blue", + "path": "vs15 Dark-Blue.qss" + }, + "vs15-dark-green": { + "name": "VS15 - Dark Green", + "path": "vs15 Dark-Green.qss" + }, + "vs15-dark-orange": { + "name": "VS15 - Dark Orange", + "path": "vs15 Dark-Orange.qss" + }, + "vs15-dark-pink": { + "name": "VS15 - Dark Pink", + "path": "vs15 Dark-Pink.qss" + }, + "vs15-dark-purple": { + "name": "VS15 - Dark Purple", + "path": "vs15 Dark-Purple.qss" + }, + "vs15-dark-red": { + "name": "VS15 - Dark Red", + "path": "vs15 Dark-Red.qss" + }, + "vs15-dark-yellow": { + "name": "VS15 - Dark Yellow", + "path": "vs15 Dark-Yellow.qss" + } } } }