KiCad PCB EDA Suite
|
#include <panel_packages_view.h>
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_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 () |
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 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 |
Static Private Attributes | |
static std::unordered_map< PCM_PACKAGE_VERSION_STATUS, wxString > | STATUS_ENUM_TO_STR |
Definition at line 35 of file panel_packages_view.h.
|
private |
Enumerator | |
---|---|
COL_VERSION | |
COL_DOWNLOAD_SIZE | |
COL_INSTALL_SIZE | |
COL_COMPATIBILITY | |
COL_STATUS |
Definition at line 128 of file panel_packages_view.h.
PANEL_PACKAGES_VIEW::PANEL_PACKAGES_VIEW | ( | wxWindow * | parent, |
std::shared_ptr< PLUGIN_CONTENT_MANAGER > | aPcm, | ||
const ActionCallback & | aCallback, | ||
const PinCallback & | aPinCallback | ||
) |
Definition at line 52 of file panel_packages_view.cpp.
References _, ClearData(), WX_GRID::GetVisibleWidth(), GRID_CELL_MARGIN, PANEL_PACKAGES_VIEW_BASE::m_gridVersions, PANEL_PACKAGES_VIEW_BASE::m_infoScrollWindow, PANEL_PACKAGES_VIEW_BASE::m_packageListWindow, PANEL_PACKAGES_VIEW_BASE::m_panelList, PANEL_PACKAGES_VIEW_BASE::m_searchCtrl, PANEL_PACKAGES_VIEW_BASE::m_splitter1, PANEL_PACKAGES_VIEW_BASE::m_splitter1OnIdle(), OnSearchTextChanged(), WX_PANEL::SetBorders(), WX_SPLITTER_WINDOW::SetPaneMinimums(), and SetSashOnIdle().
PANEL_PACKAGES_VIEW::~PANEL_PACKAGES_VIEW | ( | ) |
Definition at line 106 of file panel_packages_view.cpp.
References PGM_BASE::GetCommonSettings(), PANEL_PACKAGES_VIEW_BASE::m_gridVersions, COMMON_SETTINGS::m_PackageManager, PANEL_PACKAGES_VIEW_BASE::m_splitter1, Pgm(), COMMON_SETTINGS::PACKAGE_MANAGER::sash_pos, and SetSashOnIdle().
|
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().
|
private |
Returns implied action for the action button.
Definition at line 435 of file panel_packages_view.cpp.
References PANEL_PACKAGE::GetPackageData(), m_currentSelected, PANEL_PACKAGES_VIEW_BASE::m_gridVersions, PPS_PENDING_INSTALL, PPS_PENDING_UNINSTALL, PPS_PENDING_UPDATE, and PACKAGE_VIEW_DATA::state.
Referenced by OnVersionActionClicked(), and updateDetailsButtons().
void PANEL_PACKAGES_VIEW::ClearData | ( | ) |
Selects full row of the clicked cell.
Definition at line 118 of file panel_packages_view.cpp.
References m_currentSelected, m_packageInitialOrder, PANEL_PACKAGES_VIEW_BASE::m_packageListWindow, m_packagePanels, m_updateablePackages, and unsetPackageDetails().
Referenced by PANEL_PACKAGES_VIEW(), SetData(), and DIALOG_PCM::setInstalledPackages().
|
private |
Definition at line 730 of file panel_packages_view.cpp.
References COL_VERSION, PANEL_PACKAGES_VIEW_BASE::m_gridVersions, PPA_INSTALL, PPA_UNINSTALL, PPA_UPDATE, PPS_AVAILABLE, PPS_INSTALLED, PPS_UNAVAILABLE, and PPS_UPDATE_AVAILABLE.
Referenced by OnVersionActionClicked(), and updateDetailsButtons().
|
inlineinherited |
Definition at line 78 of file panel_packages_view_base.h.
References PANEL_PACKAGES_VIEW_BASE::m_splitter1, and PANEL_PACKAGES_VIEW_BASE::m_splitter1OnIdle().
Referenced by PANEL_PACKAGES_VIEW_BASE::m_splitter1OnIdle(), PANEL_PACKAGES_VIEW(), and PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE().
|
overridevirtual |
Schedules relevant action for selected package version.
Reimplemented from PANEL_PACKAGES_VIEW_BASE.
Definition at line 492 of file panel_packages_view.cpp.
References _, canDownload(), COL_VERSION, SETTINGS_MANAGER::GetAppSettings(), PGM_BASE::GetSettingsManager(), PANEL_PACKAGES_VIEW_BASE::m_gridVersions, KICAD_SETTINGS::m_PcmLastDownloadDir, path, Pgm(), and PCM_PACKAGE::versions.
|
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.
void PANEL_PACKAGES_VIEW::OnSearchTextChanged | ( | wxCommandEvent & | event | ) |
Definition at line 638 of file panel_packages_view.cpp.
References m_currentSelected, PANEL_PACKAGE::SetSelected(), unsetPackageDetails(), and updatePackageList().
Referenced by PANEL_PACKAGES_VIEW().
|
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().
|
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().
|
overridevirtual |
Reimplemented from PANEL_PACKAGES_VIEW_BASE.
Definition at line 812 of file panel_packages_view.cpp.
References m_actionCallback, m_packagePanels, m_updateablePackages, PPA_UPDATE, and PACKAGE_VIEW_DATA::update_version.
|
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.
|
overridevirtual |
Shows all versions including incompatible ones.
Reimplemented from PANEL_PACKAGES_VIEW_BASE.
Definition at line 579 of file panel_packages_view.cpp.
References _, canRunAction(), COL_VERSION, PACKAGE_VIEW_DATA::current_version, getAction(), PANEL_PACKAGE::GetPackageData(), m_actionCallback, m_currentSelected, PANEL_PACKAGES_VIEW_BASE::m_gridVersions, PPA_UNINSTALL, and PCM_PACKAGE::versions.
|
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().
void PANEL_PACKAGES_VIEW::SetData | ( | const std::vector< PACKAGE_VIEW_DATA > & | aPackageData | ) |
Recreates package panels and displays data.
aPackageData | list of package view data |
Definition at line 132 of file panel_packages_view.cpp.
References ClearData(), PANEL_PACKAGE::GetPackageData(), m_actionCallback, m_currentSelected, m_packageInitialOrder, PANEL_PACKAGES_VIEW_BASE::m_packageListWindow, m_packagePanels, m_pinCallback, m_updateablePackages, PPS_UPDATE_AVAILABLE, setPackageDetails(), PANEL_PACKAGE::SetSelectCallback(), PANEL_PACKAGE::SetSelected(), updateCommonState(), and updatePackageList().
Referenced by DIALOG_PCM::setInstalledPackages().
|
private |
Clears details panel.
Definition at line 166 of file panel_packages_view.cpp.
References _, PACKAGE_VERSION::compatible, PACKAGE_VERSION::download_size, dummy, EscapeHTML(), PACKAGE_VERSION::install_size, name, PCM_PACKAGE::name, PPS_INSTALLED, PPS_UPDATE_AVAILABLE, PACKAGE_VIEW_DATA::state, PACKAGE_VERSION::status, text, and PACKAGE_VERSION::version.
Referenced by SetData().
void PANEL_PACKAGES_VIEW::SetPackageState | ( | const wxString & | aPackageId, |
const PCM_PACKAGE_STATE | aState, | ||
const bool | aPinned | ||
) |
Set the state of package.
aPackageId | id of the package |
aState | new state |
aPinned | indicates 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().
void PANEL_PACKAGES_VIEW::SetSashOnIdle | ( | wxIdleEvent & | aEvent | ) |
Enqueues all available package updates.
Definition at line 794 of file panel_packages_view.cpp.
References PGM_BASE::GetCommonSettings(), PANEL_PACKAGES_VIEW_BASE::m_packageListWindow, COMMON_SETTINGS::m_PackageManager, PANEL_PACKAGES_VIEW_BASE::m_splitter1, Pgm(), COMMON_SETTINGS::PACKAGE_MANAGER::sash_pos, and SetSashOnIdle().
Referenced by PANEL_PACKAGES_VIEW(), SetSashOnIdle(), and ~PANEL_PACKAGES_VIEW().
|
private |
Returns true if it the download operation can be performed.
Definition at line 409 of file panel_packages_view.cpp.
|
private |
Bytes to Kb/Mb/Gb string or "-" if absent.
Definition at line 390 of file panel_packages_view.cpp.
References PANEL_PACKAGES_VIEW_BASE::m_gridVersions, PANEL_PACKAGES_VIEW_BASE::m_infoScrollWindow, PANEL_PACKAGES_VIEW_BASE::m_infoText, PANEL_PACKAGES_VIEW_BASE::m_sizerVersions, and HTML_WINDOW::SetPage().
Referenced by ClearData(), and OnSearchTextChanged().
|
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().
|
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().
|
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().
|
private |
Definition at line 120 of file panel_packages_view.h.
Referenced by OnUpdateAllClicked(), OnVersionActionClicked(), and SetData().
|
protectedinherited |
Definition at line 59 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), updateDetailsButtons(), and PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE().
|
protectedinherited |
Definition at line 58 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), updateDetailsButtons(), and PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE().
|
protectedinherited |
Definition at line 50 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), updateCommonState(), and PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE().
|
private |
Definition at line 124 of file panel_packages_view.h.
Referenced by canDownload(), canRunAction(), ClearData(), OnSearchTextChanged(), OnShowAllVersionsClicked(), OnVersionActionClicked(), SetData(), and SetPackageState().
|
protectedinherited |
Definition at line 56 of file panel_packages_view_base.h.
Referenced by canDownload(), canRunAction(), getAction(), OnDownloadVersionClicked(), OnVersionActionClicked(), OnVersionsCellClicked(), PANEL_PACKAGES_VIEW(), PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), unsetPackageDetails(), ~PANEL_PACKAGES_VIEW(), and PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE().
|
protectedinherited |
Definition at line 53 of file panel_packages_view_base.h.
Referenced by OnInfoMouseWheel(), PANEL_PACKAGES_VIEW(), PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), unsetPackageDetails(), and PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE().
|
protectedinherited |
Definition at line 54 of file panel_packages_view_base.h.
Referenced by OnSizeInfoBox(), PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), unsetPackageDetails(), and PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE().
|
private |
Definition at line 123 of file panel_packages_view.h.
Referenced by ClearData(), SetData(), and updatePackageList().
|
protectedinherited |
Definition at line 51 of file panel_packages_view_base.h.
Referenced by ClearData(), PANEL_PACKAGES_VIEW(), PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), SetData(), SetSashOnIdle(), and updatePackageList().
|
private |
Definition at line 122 of file panel_packages_view.h.
Referenced by ClearData(), OnUpdateAllClicked(), SetData(), SetPackageState(), and updatePackageList().
|
protectedinherited |
Definition at line 52 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE().
|
protectedinherited |
Definition at line 48 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW(), and PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE().
|
private |
Definition at line 126 of file panel_packages_view.h.
Referenced by updatePackageList().
|
private |
Definition at line 121 of file panel_packages_view.h.
Referenced by SetData().
|
protectedinherited |
Definition at line 49 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW(), PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), and updatePackageList().
|
protectedinherited |
Definition at line 57 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), and PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE().
|
protectedinherited |
Definition at line 55 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), and unsetPackageDetails().
|
protectedinherited |
Definition at line 47 of file panel_packages_view_base.h.
Referenced by PANEL_PACKAGES_VIEW_BASE::m_splitter1OnIdle(), PANEL_PACKAGES_VIEW(), PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE(), SetSashOnIdle(), and ~PANEL_PACKAGES_VIEW().
|
private |
Definition at line 125 of file panel_packages_view.h.
Referenced by ClearData(), OnUpdateAllClicked(), SetData(), SetPackageState(), and updateCommonState().
|
staticprivate |
Definition at line 137 of file panel_packages_view.h.