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 ()
 Selects full row of the clicked cell.
 
void OnVersionsCellClicked (wxGridEvent &event) override
 Opens file chooser dialog and downloads selected package version archive.
 
void OnDownloadVersionClicked (wxCommandEvent &event) override
 Schedules relevant action for selected package version.
 
void OnVersionActionClicked (wxCommandEvent &event) override
 Shows all versions including incompatible ones.
 
void OnShowAllVersionsClicked (wxCommandEvent &event) override
 Ranks packages for entered search term and rearranges/hides panels according to their rank.
 
void OnSearchTextChanged (wxCommandEvent &event)
 
void OnSizeInfoBox (wxSizeEvent &aEvent) override
 Respond to a URL in the info window.
 
void OnURLClicked (wxHtmlLinkEvent &event) override
 Respond to scrolling over the window.
 
void OnInfoMouseWheel (wxMouseEvent &event) override
 Replacement of wxFormBuilder's ill-advised m_splitter1OnIdle.
 
void SetSashOnIdle (wxIdleEvent &)
 Enqueues all available package updates.
 
void OnUpdateAllClicked (wxCommandEvent &event) override
 
void m_splitter1OnIdle (wxIdleEvent &)
 

Protected Attributes

WX_SPLITTER_WINDOWm_splitter1
 
WX_PANELm_panelList
 
wxSearchCtrl * m_searchCtrl
 
wxButton * m_buttonUpdateAll
 
wxScrolledWindow * m_packageListWindow
 
wxPanel * m_panelDetails
 
wxScrolledWindow * m_infoScrollWindow
 
HTML_WINDOWm_infoText
 
wxBoxSizer * m_sizerVersions
 
WX_GRIDm_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 ()
 Called when package state changes, currently used to calculate Update All button state.
 
void updateCommonState ()
 Updates details panel.
 
void setPackageDetails (const PACKAGE_VIEW_DATA &aPackageData)
 Clears details panel.
 
void unsetPackageDetails ()
 Bytes to Kb/Mb/Gb string or "-" if absent.
 
wxString toHumanReadableSize (const std::optional< uint64_t > size) const
 Returns true if it the download operation can be performed.
 
bool canDownload () const
 Returns true if the package action can be performed.
 
bool canRunAction () const
 Returns implied action for the action button.
 
PCM_PACKAGE_ACTION getAction () const
 

Private Attributes

const ActionCallbackm_actionCallback
 
const PinCallbackm_pinCallback
 
std::unordered_map< wxString, PANEL_PACKAGE * > m_packagePanels
 
std::vector< wxString > m_packageInitialOrder
 
PANEL_PACKAGEm_currentSelected
 
std::unordered_set< wxString > m_updateablePackages
 
std::shared_ptr< PLUGIN_CONTENT_MANAGERm_pcm
 

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 128 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 the package action can be performed.

Definition at line 426 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()

◆ 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

Replacement of wxFormBuilder's ill-advised m_splitter1OnIdle.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 787 of file panel_packages_view.cpp.

References PANEL_PACKAGES_VIEW_BASE::m_infoScrollWindow.

◆ OnSearchTextChanged()

void PANEL_PACKAGES_VIEW::OnSearchTextChanged ( wxCommandEvent &  event)

◆ OnShowAllVersionsClicked()

void PANEL_PACKAGES_VIEW::OnShowAllVersionsClicked ( wxCommandEvent &  event)
overridevirtual

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

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 626 of file panel_packages_view.cpp.

References dummy, m_currentSelected, PANEL_PACKAGE::OnClick(), and updateDetailsButtons().

◆ OnSizeInfoBox()

void PANEL_PACKAGES_VIEW::OnSizeInfoBox ( wxSizeEvent &  aEvent)
overridevirtual

Respond to a URL in the info window.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 761 of file panel_packages_view.cpp.

References KIPLATFORM::UI::GetUnobscuredSize(), PANEL_PACKAGES_VIEW_BASE::m_infoText, and Refresh().

◆ OnUpdateAllClicked()

void PANEL_PACKAGES_VIEW::OnUpdateAllClicked ( wxCommandEvent &  event)
overridevirtual

◆ OnURLClicked()

void PANEL_PACKAGES_VIEW::OnURLClicked ( wxHtmlLinkEvent &  event)
overridevirtual

Respond to scrolling over the window.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 780 of file panel_packages_view.cpp.

References info.

◆ OnVersionActionClicked()

void PANEL_PACKAGES_VIEW::OnVersionActionClicked ( wxCommandEvent &  event)
overridevirtual

◆ OnVersionsCellClicked()

void PANEL_PACKAGES_VIEW::OnVersionsCellClicked ( wxGridEvent &  event)
overridevirtual

Opens file chooser dialog and downloads selected package version archive.

Reimplemented from PANEL_PACKAGES_VIEW_BASE.

Definition at line 483 of file panel_packages_view.cpp.

References PANEL_PACKAGES_VIEW_BASE::m_gridVersions, and updateDetailsButtons().

◆ SetData()

◆ setPackageDetails()

void PANEL_PACKAGES_VIEW::setPackageDetails ( const PACKAGE_VIEW_DATA aPackageData)
private

◆ 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 Destroys package panels

Definition at line 454 of file panel_packages_view.cpp.

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

Referenced by DIALOG_PCM::updatePackageState().

◆ SetSashOnIdle()

◆ toHumanReadableSize()

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

Returns true if it the download operation can be performed.

Definition at line 409 of file panel_packages_view.cpp.

◆ unsetPackageDetails()

void PANEL_PACKAGES_VIEW::unsetPackageDetails ( )
private

◆ updateCommonState()

void PANEL_PACKAGES_VIEW::updateCommonState ( )
private

Updates details panel.

Definition at line 806 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

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

Definition at line 705 of file panel_packages_view.cpp.

References _, canDownload(), canRunAction(), getAction(), PANEL_PACKAGES_VIEW_BASE::m_buttonAction, PANEL_PACKAGES_VIEW_BASE::m_buttonDownload, PPA_INSTALL, PPA_UNINSTALL, and PPA_UPDATE.

Referenced by OnShowAllVersionsClicked(), and OnVersionsCellClicked().

◆ updatePackageList()

void PANEL_PACKAGES_VIEW::updatePackageList ( )
private

< Updates package listing according to search term

Updates buttons below the package details: Download and Install

Definition at line 651 of file panel_packages_view.cpp.

References m_packageInitialOrder, PANEL_PACKAGES_VIEW_BASE::m_packageListWindow, m_packagePanels, m_pcm, PANEL_PACKAGES_VIEW_BASE::m_searchCtrl, and PCM_PACKAGE::versions.

Referenced by OnSearchTextChanged(), and SetData().

Member Data Documentation

◆ m_actionCallback

const ActionCallback& PANEL_PACKAGES_VIEW::m_actionCallback
private

Definition at line 120 of file panel_packages_view.h.

Referenced by OnUpdateAllClicked(), OnVersionActionClicked(), and SetData().

◆ 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

wxScrolledWindow* PANEL_PACKAGES_VIEW_BASE::m_infoScrollWindow
protectedinherited

◆ m_infoText

◆ 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

wxScrolledWindow* PANEL_PACKAGES_VIEW_BASE::m_packageListWindow
protectedinherited

◆ m_packagePanels

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

◆ m_panelDetails

wxPanel* PANEL_PACKAGES_VIEW_BASE::m_panelDetails
protectedinherited

◆ 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

Definition at line 126 of file panel_packages_view.h.

Referenced by updatePackageList().

◆ m_pinCallback

const PinCallback& PANEL_PACKAGES_VIEW::m_pinCallback
private

Definition at line 121 of file panel_packages_view.h.

Referenced by 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:62
@ PVS_DEVELOPMENT
Definition: pcm_data.h:65
@ PVS_STABLE
Definition: pcm_data.h:63
@ PVS_TESTING
Definition: pcm_data.h:64
@ PVS_DEPRECATED
Definition: pcm_data.h:66

Definition at line 137 of file panel_packages_view.h.


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