KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PANEL_REMOTE_SYMBOL Class Reference

#include <panel_remote_symbol.h>

Inheritance diagram for PANEL_REMOTE_SYMBOL:

Public Member Functions

 PANEL_REMOTE_SYMBOL (SCH_EDIT_FRAME *aParent)
 
 ~PANEL_REMOTE_SYMBOL () override
 
void Activate ()
 
void RefreshDataSources ()
 
bool HasDataSources () const
 
void BindWebViewLoaded ()
 
void SaveCookies ()
 
void LoadCookies ()
 

Private Member Functions

void ensureWebView ()
 
void onDataSourceChanged (wxCommandEvent &aEvent)
 
void onConfigure (wxCommandEvent &aEvent)
 
void onRefresh (wxCommandEvent &aEvent)
 
void onWebViewLoaded (wxWebViewEvent &aEvent)
 
void onDarkModeToggle (wxSysColourChangedEvent &aEvent)
 
void onOAuthLoopback (wxCommandEvent &aEvent)
 
bool loadProvider (int aIndex)
 
void loadProviderPage (const REMOTE_PROVIDER_METADATA &aMetadata, const wxString &aAccessToken)
 
void bootstrapAuthenticatedSession (const REMOTE_PROVIDER_METADATA &aMetadata, const wxString &aAccessToken)
 
void showMessage (const wxString &aMessage)
 
void onKicadMessage (const wxString &aMessage)
 
void handleRpcMessage (const nlohmann::json &aMessage)
 
void beginSessionHandshake ()
 
void sendRpcReply (const wxString &aCommand, int aResponseTo, nlohmann::json aParameters=nlohmann::json::object())
 
void sendRpcError (const wxString &aCommand, int aResponseTo, const wxString &aErrorCode, const wxString &aErrorMessage)
 
void sendRpcNotification (const wxString &aCommand, nlohmann::json aParameters=nlohmann::json::object())
 
void sendRpcEnvelope (nlohmann::json aEnvelope)
 
bool startInteractiveLogin (const REMOTE_PROVIDER_ENTRY &aProvider, const REMOTE_PROVIDER_METADATA &aMetadata, wxString &aError)
 
bool signOutProvider (const REMOTE_PROVIDER_ENTRY &aProvider, wxString &aError)
 
std::optional< OAUTH_TOKEN_SETloadTokens (const REMOTE_PROVIDER_ENTRY &aProvider) const
 
wxString loadAccessToken (const REMOTE_PROVIDER_ENTRY &aProvider)
 
wxFileName cookieFilePath (const wxString &aProviderId) const
 
void clearCookies (bool aDeleteSavedCookieFile=true)
 
bool receiveComponent (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, bool aPlaceSymbol, wxString &aError)
 
bool receiveFootprint (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receiveSymbol (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receive3DModel (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receiveSPICEModel (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receiveComponentManifest (const nlohmann::json &aParams, bool aPlaceSymbol, wxString &aError)
 
wxString sanitizeForScript (const std::string &aJson) const
 
bool decodeBase64Payload (const std::string &aMessage, std::vector< uint8_t > &aOutPayload, wxString &aError) const
 
bool decompressIfNeeded (const std::string &aCompression, const std::vector< uint8_t > &aInput, std::vector< uint8_t > &aOutput, wxString &aError) const
 
std::unique_ptr< LIB_SYMBOLloadSymbolFromPayload (const std::vector< uint8_t > &aPayload, const wxString &aLibItemName, wxString &aError) const
 

Private Attributes

SCH_EDIT_FRAMEm_frame
 
wxChoice * m_dataSourceChoice
 
BITMAP_BUTTONm_configButton
 
BITMAP_BUTTONm_refreshButton
 
WEBVIEW_PANELm_webView
 
std::vector< REMOTE_PROVIDER_ENTRYm_providerEntries
 
int m_selectedProviderIndex
 
REMOTE_PROVIDER_METADATA m_selectedProviderMetadata
 
bool m_hasSelectedProviderMetadata
 
KIID m_sessionId
 
int m_messageIdCounter
 
bool m_pendingHandshake
 
REMOTE_PROVIDER_CLIENT m_providerClient
 
SECURE_TOKEN_STORE m_tokenStore
 
std::unique_ptr< OAUTH_LOOPBACK_SERVERm_oauthLoopbackServer
 
REMOTE_PROVIDER_OAUTH_SERVER_METADATA m_pendingOAuthMetadata
 
OAUTH_SESSION m_pendingOAuthSession
 
wxString m_pendingProviderId
 

Detailed Description

Definition at line 53 of file panel_remote_symbol.h.

Constructor & Destructor Documentation

◆ PANEL_REMOTE_SYMBOL()

◆ ~PANEL_REMOTE_SYMBOL()

PANEL_REMOTE_SYMBOL::~PANEL_REMOTE_SYMBOL ( )
override

Definition at line 273 of file panel_remote_symbol.cpp.

References onDarkModeToggle(), and SaveCookies().

Member Function Documentation

◆ Activate()

void PANEL_REMOTE_SYMBOL::Activate ( )

Definition at line 280 of file panel_remote_symbol.cpp.

References ensureWebView(), and RefreshDataSources().

◆ beginSessionHandshake()

void PANEL_REMOTE_SYMBOL::beginSessionHandshake ( )
private

◆ BindWebViewLoaded()

void PANEL_REMOTE_SYMBOL::BindWebViewLoaded ( )

Definition at line 309 of file panel_remote_symbol.cpp.

References m_webView, and onWebViewLoaded().

◆ bootstrapAuthenticatedSession()

void PANEL_REMOTE_SYMBOL::bootstrapAuthenticatedSession ( const REMOTE_PROVIDER_METADATA & aMetadata,
const wxString & aAccessToken )
private

◆ clearCookies()

void PANEL_REMOTE_SYMBOL::clearCookies ( bool aDeleteSavedCookieFile = true)
private

◆ cookieFilePath()

wxFileName PANEL_REMOTE_SYMBOL::cookieFilePath ( const wxString & aProviderId) const
private

Definition at line 316 of file panel_remote_symbol.cpp.

References SanitizeRemoteFileComponent().

Referenced by clearCookies(), LoadCookies(), and SaveCookies().

◆ decodeBase64Payload()

bool PANEL_REMOTE_SYMBOL::decodeBase64Payload ( const std::string & aMessage,
std::vector< uint8_t > & aOutPayload,
wxString & aError ) const
private

Definition at line 70 of file panel_remote_symbol.cpp.

References _.

Referenced by handleRpcMessage(), and receiveComponent().

◆ decompressIfNeeded()

bool PANEL_REMOTE_SYMBOL::decompressIfNeeded ( const std::string & aCompression,
const std::vector< uint8_t > & aInput,
std::vector< uint8_t > & aOutput,
wxString & aError ) const
private

◆ ensureWebView()

void PANEL_REMOTE_SYMBOL::ensureWebView ( )
private

Definition at line 287 of file panel_remote_symbol.cpp.

References m_webView, onKicadMessage(), and onWebViewLoaded().

Referenced by Activate().

◆ handleRpcMessage()

◆ HasDataSources()

bool PANEL_REMOTE_SYMBOL::HasDataSources ( ) const
inline

Definition at line 61 of file panel_remote_symbol.h.

References m_providerEntries.

◆ loadAccessToken()

◆ LoadCookies()

void PANEL_REMOTE_SYMBOL::LoadCookies ( )

◆ loadProvider()

◆ loadProviderPage()

void PANEL_REMOTE_SYMBOL::loadProviderPage ( const REMOTE_PROVIDER_METADATA & aMetadata,
const wxString & aAccessToken )
private

◆ loadSymbolFromPayload()

std::unique_ptr< LIB_SYMBOL > PANEL_REMOTE_SYMBOL::loadSymbolFromPayload ( const std::vector< uint8_t > & aPayload,
const wxString & aLibItemName,
wxString & aError ) const
private

Definition at line 163 of file panel_remote_symbol.cpp.

References _, and IO_ERROR::What().

Referenced by receiveSymbol().

◆ loadTokens()

std::optional< OAUTH_TOKEN_SET > PANEL_REMOTE_SYMBOL::loadTokens ( const REMOTE_PROVIDER_ENTRY & aProvider) const
private

Definition at line 659 of file panel_remote_symbol.cpp.

References m_tokenStore, and REMOTE_PROVIDER_ENTRY::provider_id.

Referenced by loadAccessToken(), and signOutProvider().

◆ onConfigure()

void PANEL_REMOTE_SYMBOL::onConfigure ( wxCommandEvent & aEvent)
private

Definition at line 429 of file panel_remote_symbol.cpp.

References RefreshDataSources(), and DIALOG_SHIM::ShowModal().

Referenced by PANEL_REMOTE_SYMBOL().

◆ onDarkModeToggle()

void PANEL_REMOTE_SYMBOL::onDarkModeToggle ( wxSysColourChangedEvent & aEvent)
private

Definition at line 448 of file panel_remote_symbol.cpp.

References loadProvider(), and m_selectedProviderIndex.

Referenced by PANEL_REMOTE_SYMBOL(), and ~PANEL_REMOTE_SYMBOL().

◆ onDataSourceChanged()

void PANEL_REMOTE_SYMBOL::onDataSourceChanged ( wxCommandEvent & aEvent)
private

Definition at line 423 of file panel_remote_symbol.cpp.

References loadProvider().

Referenced by PANEL_REMOTE_SYMBOL().

◆ onKicadMessage()

void PANEL_REMOTE_SYMBOL::onKicadMessage ( const wxString & aMessage)
private

Definition at line 641 of file panel_remote_symbol.cpp.

References handleRpcMessage().

Referenced by ensureWebView().

◆ onOAuthLoopback()

◆ onRefresh()

void PANEL_REMOTE_SYMBOL::onRefresh ( wxCommandEvent & aEvent)
private

Definition at line 439 of file panel_remote_symbol.cpp.

References loadProvider(), and m_selectedProviderIndex.

Referenced by PANEL_REMOTE_SYMBOL().

◆ onWebViewLoaded()

void PANEL_REMOTE_SYMBOL::onWebViewLoaded ( wxWebViewEvent & aEvent)
private

Definition at line 544 of file panel_remote_symbol.cpp.

References beginSessionHandshake(), and m_pendingHandshake.

Referenced by BindWebViewLoaded(), and ensureWebView().

◆ receive3DModel()

bool PANEL_REMOTE_SYMBOL::receive3DModel ( const nlohmann::json & aParams,
const std::vector< uint8_t > & aPayload,
wxString & aError )
private

◆ receiveComponent()

bool PANEL_REMOTE_SYMBOL::receiveComponent ( const nlohmann::json & aParams,
const std::vector< uint8_t > & aPayload,
bool aPlaceSymbol,
wxString & aError )
private

◆ receiveComponentManifest()

◆ receiveFootprint()

◆ receiveSPICEModel()

bool PANEL_REMOTE_SYMBOL::receiveSPICEModel ( const nlohmann::json & aParams,
const std::vector< uint8_t > & aPayload,
wxString & aError )
private

◆ receiveSymbol()

◆ RefreshDataSources()

◆ sanitizeForScript()

wxString PANEL_REMOTE_SYMBOL::sanitizeForScript ( const std::string & aJson) const
private

Definition at line 154 of file panel_remote_symbol.cpp.

Referenced by sendRpcEnvelope().

◆ SaveCookies()

void PANEL_REMOTE_SYMBOL::SaveCookies ( )

◆ sendRpcEnvelope()

void PANEL_REMOTE_SYMBOL::sendRpcEnvelope ( nlohmann::json aEnvelope)
private

Definition at line 580 of file panel_remote_symbol.cpp.

References m_webView, and sanitizeForScript().

Referenced by sendRpcError(), sendRpcNotification(), and sendRpcReply().

◆ sendRpcError()

void PANEL_REMOTE_SYMBOL::sendRpcError ( const wxString & aCommand,
int aResponseTo,
const wxString & aErrorCode,
const wxString & aErrorMessage )
private

◆ sendRpcNotification()

void PANEL_REMOTE_SYMBOL::sendRpcNotification ( const wxString & aCommand,
nlohmann::json aParameters = nlohmann::json::object() )
private

◆ sendRpcReply()

void PANEL_REMOTE_SYMBOL::sendRpcReply ( const wxString & aCommand,
int aResponseTo,
nlohmann::json aParameters = nlohmann::json::object() )
private

◆ showMessage()

void PANEL_REMOTE_SYMBOL::showMessage ( const wxString & aMessage)
private

Definition at line 523 of file panel_remote_symbol.cpp.

References EscapeHTML(), and m_webView.

Referenced by loadProvider(), onOAuthLoopback(), and RefreshDataSources().

◆ signOutProvider()

bool PANEL_REMOTE_SYMBOL::signOutProvider ( const REMOTE_PROVIDER_ENTRY & aProvider,
wxString & aError )
private

◆ startInteractiveLogin()

Member Data Documentation

◆ m_configButton

BITMAP_BUTTON* PANEL_REMOTE_SYMBOL::m_configButton
private

Definition at line 122 of file panel_remote_symbol.h.

Referenced by PANEL_REMOTE_SYMBOL().

◆ m_dataSourceChoice

wxChoice* PANEL_REMOTE_SYMBOL::m_dataSourceChoice
private

Definition at line 121 of file panel_remote_symbol.h.

Referenced by PANEL_REMOTE_SYMBOL(), and RefreshDataSources().

◆ m_frame

SCH_EDIT_FRAME* PANEL_REMOTE_SYMBOL::m_frame
private

◆ m_hasSelectedProviderMetadata

bool PANEL_REMOTE_SYMBOL::m_hasSelectedProviderMetadata
private

◆ m_messageIdCounter

int PANEL_REMOTE_SYMBOL::m_messageIdCounter
private

◆ m_oauthLoopbackServer

std::unique_ptr<OAUTH_LOOPBACK_SERVER> PANEL_REMOTE_SYMBOL::m_oauthLoopbackServer
private

Definition at line 134 of file panel_remote_symbol.h.

Referenced by onOAuthLoopback(), and startInteractiveLogin().

◆ m_pendingHandshake

bool PANEL_REMOTE_SYMBOL::m_pendingHandshake
private

◆ m_pendingOAuthMetadata

REMOTE_PROVIDER_OAUTH_SERVER_METADATA PANEL_REMOTE_SYMBOL::m_pendingOAuthMetadata
private

Definition at line 135 of file panel_remote_symbol.h.

Referenced by onOAuthLoopback(), and startInteractiveLogin().

◆ m_pendingOAuthSession

OAUTH_SESSION PANEL_REMOTE_SYMBOL::m_pendingOAuthSession
private

Definition at line 136 of file panel_remote_symbol.h.

Referenced by onOAuthLoopback(), and startInteractiveLogin().

◆ m_pendingProviderId

wxString PANEL_REMOTE_SYMBOL::m_pendingProviderId
private

Definition at line 137 of file panel_remote_symbol.h.

Referenced by onOAuthLoopback(), and startInteractiveLogin().

◆ m_providerClient

◆ m_providerEntries

std::vector<REMOTE_PROVIDER_ENTRY> PANEL_REMOTE_SYMBOL::m_providerEntries
private

◆ m_refreshButton

BITMAP_BUTTON* PANEL_REMOTE_SYMBOL::m_refreshButton
private

Definition at line 123 of file panel_remote_symbol.h.

Referenced by PANEL_REMOTE_SYMBOL().

◆ m_selectedProviderIndex

int PANEL_REMOTE_SYMBOL::m_selectedProviderIndex
private

◆ m_selectedProviderMetadata

REMOTE_PROVIDER_METADATA PANEL_REMOTE_SYMBOL::m_selectedProviderMetadata
private

◆ m_sessionId

KIID PANEL_REMOTE_SYMBOL::m_sessionId
private

◆ m_tokenStore

SECURE_TOKEN_STORE PANEL_REMOTE_SYMBOL::m_tokenStore
private

◆ m_webView


The documentation for this class was generated from the following files: