34#include <unordered_map> 
   35#include <unordered_set> 
  138                       const nlohmann::json_uri& aUri = nlohmann::json_uri( 
"#" ) ) 
const;
 
  147    bool VerifyHash( std::istream& aStream, 
const wxString& aHash ) 
const;
 
  175                        const wxString& aRepositoryId );
 
  263    void SetPinned( 
const wxString& aPackageId, 
const bool aPinned );
 
  308    std::unordered_map<wxString, wxBitmap>
 
  370    bool fetchPackages( 
const wxString& aUrl, 
const std::optional<wxString>& aHash,
 
 
Implementing pcm main dialog.
 
time_t getCurrentTimestamp() const
 
const std::vector< PCM_PACKAGE > & GetRepositoryPackages(const wxString &aRepositoryId) const
Get the packages metadata from a previously cached repository.
 
void SetRepositoryList(const STRING_PAIR_LIST &aRepositories)
Set list of repositories.
 
std::unique_ptr< JSON_SCHEMA_VALIDATOR > m_schema_validator
 
void ValidateJson(const nlohmann::json &aJson, const nlohmann::json_uri &aUri=nlohmann::json_uri("#")) const
Validates json against a specific definition in the PCM schema.
 
std::unordered_map< wxString, PCM_REPOSITORY > m_repository_cache
 
const PCM_REPOSITORY & getCachedRepository(const wxString &aRepositoryId) const
Get the cached repository metadata.
 
int GetPackageSearchRank(const PCM_PACKAGE &aPackage, const wxString &aSearchTerm)
Get the approximate measure of how much given package matches the search term.
 
const STRING_TUPLE_LIST & GetRepositoryList() const
Get list of repositories.
 
void SetDialogWindow(DIALOG_PCM *aDialog)
Set the Dialog Window.
 
const wxString & Get3rdPartyPath() const
 
void MarkUninstalled(const PCM_PACKAGE &aPackage)
Mark package as uninstalled.
 
bool CacheRepository(const wxString &aRepositoryId)
Cache specified repository packages and other metadata.
 
void SaveInstalledPackages()
Saves metadata of installed packages to disk.
 
~PLUGIN_CONTENT_MANAGER()
 
const std::vector< PCM_INSTALLATION_ENTRY > GetInstalledPackages() const
Get list of installed packages.
 
void SetPinned(const wxString &aPackageId, const bool aPinned)
Set the pinned status of a package.
 
static void PreparePackage(PCM_PACKAGE &aPackage)
Parses version strings and calculates compatibility.
 
PLUGIN_CONTENT_MANAGER(std::function< void(int)> aAvailableUpdateCallbac)
 
bool DownloadToStream(const wxString &aUrl, std::ostream *aOutput, PROGRESS_REPORTER *aReporter, const size_t aSizeLimit=DEFAULT_DOWNLOAD_MEM_LIMIT)
Downloads url to an output stream.
 
std::thread m_updateThread
 
PCM_PACKAGE_STATE GetPackageState(const wxString &aRepositoryId, const wxString &aPackageId)
Get current state of the package.
 
std::map< wxString, PCM_INSTALLATION_ENTRY > m_installed
 
void RunBackgroundUpdate()
Runs a background update thread that checks for new package versions.
 
std::unordered_map< wxString, wxBitmap > GetRepositoryPackageBitmaps(const wxString &aRepositoryId)
Get the icon bitmaps for repository packages.
 
const wxString GetPackageUpdateVersion(const PCM_PACKAGE &aPackage)
Get the preferred package update version or empty string if there is none.
 
void MarkInstalled(const PCM_PACKAGE &aPackage, const wxString &aVersion, const wxString &aRepositoryId)
Mark package as installed.
 
std::unordered_map< wxString, wxBitmap > GetInstalledPackageBitmaps()
Get the icon bitmaps for installed packages.
 
const wxString & GetInstalledPackageVersion(const wxString &aPackageId) const
Get the current version of an installed package.
 
void updateInstalledPackagesMetadata(const wxString &aRepositoryId)
Updates metadata of installed packages from freshly fetched repo.
 
bool IsPackagePinned(const wxString &aPackageId) const
Returns pinned status of a package.
 
static const std::tuple< int, int, int > m_kicad_version
 
std::shared_ptr< BACKGROUND_JOB > m_updateBackgroundJob
 
void StopBackgroundUpdate()
Interrupts and joins() the update thread.
 
static constexpr size_t DEFAULT_DOWNLOAD_MEM_LIMIT
< Default download limit of 10 Mb to not use too much memory
 
STRING_TUPLE_LIST m_repository_list
 
bool fetchPackages(const wxString &aUrl, const std::optional< wxString > &aHash, std::vector< PCM_PACKAGE > &aPackages, PROGRESS_REPORTER *aReporter)
Downloads packages metadata to in memory stream, verifies hash and attempts to parse it.
 
std::function< void(int)> m_availableUpdateCallback
 
bool FetchRepository(const wxString &aUrl, PCM_REPOSITORY &aRepository, PROGRESS_REPORTER *aReporter)
Fetches repository metadata from given url.
 
void DiscardRepositoryCache(const wxString &aRepositoryId)
Discard in-memory and on-disk cache of a repository.
 
bool VerifyHash(std::istream &aStream, const wxString &aHash) const
Verifies SHA256 hash of a binary stream.
 
void ReadEnvVar()
Stores 3rdparty path from environment variables.
 
A progress reporter interface for use in multi-threaded environments.
 
std::vector< std::pair< wxString, wxString > > STRING_PAIR_LIST
 
const std::unordered_set< wxString > PCM_PACKAGE_DIRECTORIES({ "plugins", "footprints", "3dmodels", "symbols", "resources", "colors", "templates", "scripts" })
< Contains list of all valid directories that get extracted from a package archive
 
std::vector< std::tuple< wxString, wxString, wxString > > STRING_TUPLE_LIST
 
Repository reference to a resource.
 
Package installation entry.