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

#include <panel_packages_view.h>

Inheritance diagram for PANEL_PACKAGES_VIEW:
PANEL_PACKAGES_VIEW_BASE

Public Member Functions

 PANEL_PACKAGES_VIEW (wxWindow *parent, std::shared_ptr< PLUGIN_CONTENT_MANAGER > aPcm, const ActionCallback &aCallback, const PinCallback &aPinCallback)
 
 ~PANEL_PACKAGES_VIEW ()
 
void SetData (const std::vector< PACKAGE_VIEW_DATA > &aPackageData)
 Recreates package panels and displays data.
 
void SetPackageState (const wxString &aPackageId, const PCM_PACKAGE_STATE aState, const bool aPinned)
 Set the state of package.
 
void ClearData ()
 Destroys package panels.
 
void OnVersionsCellClicked (wxGridEvent &event) override
 Selects full row of the clicked cell.
 
void OnDownloadVersionClicked (wxCommandEvent &event) override
 Opens file chooser dialog and downloads selected package version archive.
 
void OnVersionActionClicked (wxCommandEvent &event) override
 Schedules relevant action for selected package version.
 
void OnShowAllVersionsClicked (wxCommandEvent &event) override
 Shows all versions including incompatible ones.
 
void OnSearchTextChanged (wxCommandEvent &event)
 Ranks packages for entered search term and rearranges/hides panels according to their rank.
 
void OnSizeInfoBox (wxSizeEvent &aEvent) override
 
void OnURLClicked (wxHtmlLinkEvent &event) override
 Respond to a URL in the info window.
 
void OnInfoMouseWheel (wxMouseEvent &event) override
 Respond to scrolling over the window.
 
void SetSashOnIdle (wxIdleEvent &)
 Replacement of wxFormBuilder's ill-advised m_splitter1OnIdle.
 
void OnUpdateAllClicked (wxCommandEvent &event) override
 Enqueues all available package updates.
 
void m_splitter1OnIdle (wxIdleEvent &)
 

Protected Attributes

WX_SPLITTER_WINDOW * m_splitter1
 
WX_PANEL * m_panelList
 
wxSearchCtrl * m_searchCtrl
 
wxButton * m_buttonUpdateAll
 
wxScrolledWindow * m_packageListWindow
 
wxPanel * m_panelDetails
 
wxScrolledWindow * m_infoScrollWindow
 
HTML_WINDOW * m_infoText
 
wxBoxSizer * m_sizerVersions
 
WX_GRID * m_gridVersions
 
wxCheckBox * m_showAllVersions
 
wxButton * m_buttonDownload
 
wxButton * m_buttonAction
 

Private Types

enum  PACKAGE_VERSIONS_GRID_COLUMNS {
  COL_VERSION = 0 , COL_DOWNLOAD_SIZE , COL_INSTALL_SIZE , COL_COMPATIBILITY ,
  COL_STATUS
}
 

Private Member Functions

void updatePackageList ()
 Updates package listing according to search term.
 
void updateDetailsButtons ()
 Updates buttons below the package details: Download and Install.
 
void updateCommonState ()
 Called when package state changes, currently used to calculate Update All button state.
 
void setPackageDetails (const PACKAGE_VIEW_DATA &aPackageData)
 Updates details panel.
 
void unsetPackageDetails ()
 Clears details panel.
 
wxString toHumanReadableSize (const std::optional< uint64_t > size) const
 Bytes to Kb/Mb/Gb string or "-" if absent.
 
bool canDownload () const
 Returns true if it the download operation can be performed.
 
bool canRunAction () const
 Returns true if the package action can be performed.
 
PCM_PACKAGE_ACTION getAction () const
 Returns implied action for the action button.
 

Private Attributes

const ActionCallback & m_actionCallback
 
const PinCallback & m_pinCallback
 
std::unordered_map< wxString, PANEL_PACKAGE * > m_packagePanels
 
std::vector< wxString > m_packageInitialOrder
 
PANEL_PACKAGE * m_currentSelected
 
std::unordered_set< wxString > m_updateablePackages
 
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
 
int m_infoWheelRotation = 0
 

Static Private Attributes

static std::unordered_map< PCM_PACKAGE_VERSION_STATUS, wxString > STATUS_ENUM_TO_STR
 

Detailed Description

Definition at line 35 of file panel_packages_view.h.

Member Enumeration Documentation

◆ PACKAGE_VERSIONS_GRID_COLUMNS

Enumerator
COL_VERSION 
COL_DOWNLOAD_SIZE 
COL_INSTALL_SIZE 
COL_COMPATIBILITY 
COL_STATUS 

Definition at line 129 of file panel_packages_view.h.

Constructor & Destructor Documentation

◆ PANEL_PACKAGES_VIEW()

◆ ~PANEL_PACKAGES_VIEW()

Member Function Documentation

◆ canDownload()

bool PANEL_PACKAGES_VIEW::canDownload ( ) const
private

Returns true if it the download operation can be performed.

Definition at line 432 of file panel_packages_view.cpp.

References m_currentSelected, and PANEL_PACKAGES_VIEW_BASE::m_gridVersions.

Referenced by OnDownloadVersionClicked(), and updateDetailsButtons().

◆ canRunAction()

bool PANEL_PACKAGES_VIEW::canRunAction ( ) const
private

◆ ClearData()

void PANEL_PACKAGES_VIEW::ClearData ( )

◆ getAction()

PCM_PACKAGE_ACTION PANEL_PACKAGES_VIEW::getAction ( ) const
private

Returns implied action for the action button.

Definition at line 735 of file panel_packages_view.cpp.

References COL_VERSION, and PANEL_PACKAGES_VIEW_BASE::m_gridVersions.

Referenced by OnVersionActionClicked(), and updateDetailsButtons().

◆ m_splitter1OnIdle()

void PANEL_PACKAGES_VIEW_BASE::m_splitter1OnIdle ( wxIdleEvent & )
inlineinherited

◆ OnDownloadVersionClicked()

void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked ( wxCommandEvent & event)
overridevirtual

◆ OnInfoMouseWheel()

void PANEL_PACKAGES_VIEW::OnInfoMouseWheel ( wxMouseEvent & event)
overridevirtual

Respond to scrolling over the window.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 791 of file panel_packages_view.cpp.

References PANEL_PACKAGES_VIEW_BASE::m_infoScrollWindow, and m_infoWheelRotation.

◆ OnSearchTextChanged()

void PANEL_PACKAGES_VIEW::OnSearchTextChanged ( wxCommandEvent & event)

Ranks packages for entered search term and rearranges/hides panels according to their rank.

Definition at line 638 of file panel_packages_view.cpp.

References m_currentSelected, unsetPackageDetails(), and updatePackageList().

Referenced by PANEL_PACKAGES_VIEW().

◆ OnShowAllVersionsClicked()

void PANEL_PACKAGES_VIEW::OnShowAllVersionsClicked ( wxCommandEvent & event)
overridevirtual

Shows all versions including incompatible ones.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 626 of file panel_packages_view.cpp.

References dummy, m_currentSelected, and updateDetailsButtons().

◆ OnSizeInfoBox()

void PANEL_PACKAGES_VIEW::OnSizeInfoBox ( wxSizeEvent & aEvent)
overridevirtual

◆ OnUpdateAllClicked()

void PANEL_PACKAGES_VIEW::OnUpdateAllClicked ( wxCommandEvent & event)
overridevirtual

Enqueues all available package updates.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 831 of file panel_packages_view.cpp.

References m_actionCallback, m_packagePanels, m_updateablePackages, PPA_UPDATE, and PACKAGE_VIEW_DATA::update_version.

◆ OnURLClicked()

void PANEL_PACKAGES_VIEW::OnURLClicked ( wxHtmlLinkEvent & event)
overridevirtual

Respond to a URL in the info window.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 784 of file panel_packages_view.cpp.

References info.

◆ OnVersionActionClicked()

void PANEL_PACKAGES_VIEW::OnVersionActionClicked ( wxCommandEvent & event)
overridevirtual

Schedules relevant action for selected package version.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 580 of file panel_packages_view.cpp.

References _, canRunAction(), COL_VERSION, getAction(), m_actionCallback, m_currentSelected, PANEL_PACKAGES_VIEW_BASE::m_gridVersions, m_pcm, PPA_UNINSTALL, and PCM_PACKAGE::versions.

◆ OnVersionsCellClicked()

void PANEL_PACKAGES_VIEW::OnVersionsCellClicked ( wxGridEvent & event)
overridevirtual

Selects full row of the clicked cell.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 488 of file panel_packages_view.cpp.

References PANEL_PACKAGES_VIEW_BASE::m_gridVersions, and updateDetailsButtons().

◆ SetData()

◆ setPackageDetails()

◆ SetPackageState()

void PANEL_PACKAGES_VIEW::SetPackageState ( const wxString & aPackageId,
const PCM_PACKAGE_STATE aState,
const bool aPinned )

Set the state of package.

Parameters
aPackageIdid of the package
aStatenew state
aPinnedindicates pinned version

Definition at line 463 of file panel_packages_view.cpp.

References dummy, m_currentSelected, m_packagePanels, m_updateablePackages, PPS_UPDATE_AVAILABLE, and updateCommonState().

◆ SetSashOnIdle()

void PANEL_PACKAGES_VIEW::SetSashOnIdle ( wxIdleEvent & aEvent)

◆ toHumanReadableSize()

wxString PANEL_PACKAGES_VIEW::toHumanReadableSize ( const std::optional< uint64_t > size) const
private

Bytes to Kb/Mb/Gb string or "-" if absent.

Definition at line 415 of file panel_packages_view.cpp.

Referenced by setPackageDetails().

◆ unsetPackageDetails()

void PANEL_PACKAGES_VIEW::unsetPackageDetails ( )
private

◆ updateCommonState()

void PANEL_PACKAGES_VIEW::updateCommonState ( )
private

Called when package state changes, currently used to calculate Update All button state.

Definition at line 825 of file panel_packages_view.cpp.

References PANEL_PACKAGES_VIEW_BASE::m_buttonUpdateAll, and m_updateablePackages.

Referenced by SetData(), and SetPackageState().

◆ updateDetailsButtons()

void PANEL_PACKAGES_VIEW::updateDetailsButtons ( )
private

◆ updatePackageList()

void PANEL_PACKAGES_VIEW::updatePackageList ( )
private

Member Data Documentation

◆ m_actionCallback

const ActionCallback& PANEL_PACKAGES_VIEW::m_actionCallback
private

◆ m_buttonAction

wxButton* PANEL_PACKAGES_VIEW_BASE::m_buttonAction
protectedinherited

◆ m_buttonDownload

wxButton* PANEL_PACKAGES_VIEW_BASE::m_buttonDownload
protectedinherited

◆ m_buttonUpdateAll

wxButton* PANEL_PACKAGES_VIEW_BASE::m_buttonUpdateAll
protectedinherited

◆ m_currentSelected

◆ m_gridVersions

◆ m_infoScrollWindow

◆ m_infoText

◆ m_infoWheelRotation

int PANEL_PACKAGES_VIEW::m_infoWheelRotation = 0
private

Definition at line 127 of file panel_packages_view.h.

Referenced by OnInfoMouseWheel().

◆ m_packageInitialOrder

std::vector<wxString> PANEL_PACKAGES_VIEW::m_packageInitialOrder
private

Definition at line 123 of file panel_packages_view.h.

Referenced by ClearData(), SetData(), and updatePackageList().

◆ m_packageListWindow

◆ m_packagePanels

std::unordered_map<wxString, PANEL_PACKAGE*> PANEL_PACKAGES_VIEW::m_packagePanels
private

◆ m_panelDetails

wxPanel* PANEL_PACKAGES_VIEW_BASE::m_panelDetails
protectedinherited

Definition at line 52 of file panel_packages_view_base.h.

Referenced by PANEL_PACKAGES_VIEW_BASE().

◆ m_panelList

WX_PANEL* PANEL_PACKAGES_VIEW_BASE::m_panelList
protectedinherited

◆ m_pcm

std::shared_ptr<PLUGIN_CONTENT_MANAGER> PANEL_PACKAGES_VIEW::m_pcm
private

◆ m_pinCallback

const PinCallback& PANEL_PACKAGES_VIEW::m_pinCallback
private

Definition at line 121 of file panel_packages_view.h.

Referenced by PANEL_PACKAGES_VIEW(), and SetData().

◆ m_searchCtrl

wxSearchCtrl* PANEL_PACKAGES_VIEW_BASE::m_searchCtrl
protectedinherited

◆ m_showAllVersions

wxCheckBox* PANEL_PACKAGES_VIEW_BASE::m_showAllVersions
protectedinherited

◆ m_sizerVersions

wxBoxSizer* PANEL_PACKAGES_VIEW_BASE::m_sizerVersions
protectedinherited

◆ m_splitter1

◆ m_updateablePackages

std::unordered_set<wxString> PANEL_PACKAGES_VIEW::m_updateablePackages
private

◆ STATUS_ENUM_TO_STR

std::unordered_map< PCM_PACKAGE_VERSION_STATUS, wxString > PANEL_PACKAGES_VIEW::STATUS_ENUM_TO_STR
staticprivate
Initial value:
= {
{ PVS_INVALID, wxS( "invalid" ) },
{ PVS_STABLE, wxS( "stable" ) },
{ PVS_TESTING, wxS( "testing" ) },
{ PVS_DEVELOPMENT, wxS( "development" ) },
{ PVS_DEPRECATED, wxS( "deprecated" ) }
}
@ PVS_INVALID
Definition pcm_data.h:63
@ PVS_DEVELOPMENT
Definition pcm_data.h:66
@ PVS_STABLE
Definition pcm_data.h:64
@ PVS_TESTING
Definition pcm_data.h:65
@ PVS_DEPRECATED
Definition pcm_data.h:67

Definition at line 43 of file panel_packages_view.h.

Referenced by setPackageDetails().


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