20#include <wx/aui/framemanager.h>
34 {
"name",
"KiCad official repository" },
69 [&]() -> nlohmann::json
71 nlohmann::json js = nlohmann::json::array();
75 js.push_back( nlohmann::json( { {
"name", pair.first.ToUTF8() },
76 {
"url", pair.second.ToUTF8() } } ) );
81 [&](
const nlohmann::json aObj )
85 if( !aObj.is_array() )
88 for(
const auto& entry : aObj )
90 if( entry.empty() || !entry.is_object() )
94 std::make_pair( wxString( entry[
"name"].get<std::string>() ),
95 wxString( entry[
"url"].get<std::string>() ) ) );
101 "libraries.overrides",
102 [&]() -> nlohmann::json
104 nlohmann::json js = nlohmann::json::object();
108 nlohmann::json tableJs = nlohmann::json::object();
110 for(
const auto& [nickname, override_] : libs )
112 nlohmann::json entry = nlohmann::json::object();
114 if( override_.disabled )
115 entry[
"disabled"] =
true;
117 if( override_.hidden )
118 entry[
"hidden"] =
true;
121 tableJs[std::string( nickname.ToUTF8() )] = entry;
124 if( !tableJs.empty() )
125 js[std::string( tablePath.ToUTF8() )] = tableJs;
130 [&](
const nlohmann::json& aObj )
134 if( !aObj.is_object() )
137 for(
const auto& [tablePath, tableObj] : aObj.items() )
139 if( !tableObj.is_object() )
142 std::map<wxString, LIB_OVERRIDE>& libs =
145 for(
const auto& [nickname, entry] : tableObj.items() )
147 if( !entry.is_object() )
152 if( entry.contains(
"disabled" ) && entry[
"disabled"].is_boolean() )
153 override_.
disabled = entry[
"disabled"].get<
bool>();
155 if( entry.contains(
"hidden" ) && entry[
"hidden"].is_boolean() )
156 override_.
hidden = entry[
"hidden"].get<
bool>();
158 libs[wxString::FromUTF8( nickname )] = override_;
162 nlohmann::json::object() ) );
165 m_params.back()->SetClearUnknownKeys();
187 ret &=
fromLegacy<int>( aCfg,
"LeftWinWidth",
"appearance.left_frame_width" );
191 Set(
"window.size_x", 0 );
192 Set(
"window.size_y", 0 );
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
bool fromLegacy(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig value to a given JSON pointer value.
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
wxString m_PcmLastSelectedRepoId
wxString m_lastDesignBlockLibDir
int m_TemplateFilterChoice
bool m_ShowGitCommitPanel
std::vector< wxString > m_RecentTemplates
wxSize m_TemplateWindowSize
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
wxString m_BrowsedTemplatesPath
std::map< wxString, std::map< wxString, LIB_OVERRIDE > > m_LibOverrides
Overrides for libraries in read-only nested tables.
wxPoint m_TemplateWindowPos
wxString m_lastUpdateCheckTime
wxString m_PcmLastDownloadDir
std::vector< wxString > m_OpenProjects
std::vector< std::pair< wxString, wxString > > m_PcmRepositories
wxString m_lastReceivedUpdate
wxString m_LastUsedTemplate
Like a normal param, but with custom getter and setter functions.
const nlohmann::json PCM_DEFAULT_REPOSITORIES
const int kicadSchemaVersion
! Update the schema version whenever a migration is required
#define PCM_DEFAULT_REPOSITORY_URL
Per-library override flags for libraries in read-only nested tables.