Support system-installed color themes
Install to ${KICAD_DATA}/colors/ Fixes https://gitlab.com/kicad/code/kicad/-/issues/15920
This commit is contained in:
parent
9271fde71d
commit
c6c808a7fa
|
@ -341,8 +341,14 @@ void SETTINGS_MANAGER::loadAllColorSettings()
|
|||
|
||||
third_party_path.AppendDir( wxS( "colors" ) );
|
||||
|
||||
// PCM-managed themes
|
||||
wxDir third_party_colors_dir( third_party_path.GetFullPath() );
|
||||
wxString color_settings_path = GetColorSettingsPath();
|
||||
|
||||
// System-installed themes
|
||||
wxDir system_colors_dir( PATHS::GetStockDataPath( false ) + "/colors" );
|
||||
|
||||
// User-created themes
|
||||
wxDir colors_dir( GetColorSettingsPath() );
|
||||
|
||||
// Search for and load any other settings
|
||||
JSON_DIR_TRAVERSER loader( [&]( const wxFileName& aFilename )
|
||||
|
@ -350,23 +356,22 @@ void SETTINGS_MANAGER::loadAllColorSettings()
|
|||
registerColorSettings( aFilename.GetName() );
|
||||
} );
|
||||
|
||||
JSON_DIR_TRAVERSER thirdPartyLoader(
|
||||
JSON_DIR_TRAVERSER readOnlyLoader(
|
||||
[&]( const wxFileName& aFilename )
|
||||
{
|
||||
COLOR_SETTINGS* settings = registerColorSettings( aFilename.GetFullPath(), true );
|
||||
settings->SetReadOnly( true );
|
||||
} );
|
||||
|
||||
wxDir colors_dir( color_settings_path );
|
||||
if( system_colors_dir.IsOpened() )
|
||||
system_colors_dir.Traverse( readOnlyLoader );
|
||||
|
||||
if( third_party_colors_dir.IsOpened() )
|
||||
third_party_colors_dir.Traverse( readOnlyLoader );
|
||||
|
||||
if( colors_dir.IsOpened() )
|
||||
{
|
||||
if( third_party_colors_dir.IsOpened() )
|
||||
third_party_colors_dir.Traverse( thirdPartyLoader );
|
||||
|
||||
colors_dir.Traverse( loader );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SETTINGS_MANAGER::ReloadColorSettings()
|
||||
|
|
Loading…
Reference in New Issue