PCM: Auto select on download/install if there is only one version
This commit is contained in:
parent
a87c68eaf7
commit
aa0a00dee7
|
@ -393,15 +393,18 @@ void PANEL_PACKAGES_VIEW::OnVersionsCellClicked( wxGridEvent& event )
|
||||||
|
|
||||||
void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
|
void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
const wxArrayInt rows = m_gridVersions->GetSelectedRows();
|
if( m_gridVersions->GetNumberRows() == 1 )
|
||||||
|
m_gridVersions->SelectRow( 0 );
|
||||||
|
|
||||||
if( !m_currentSelected || rows.size() != 1 )
|
const wxArrayInt selectedRows = m_gridVersions->GetSelectedRows();
|
||||||
|
|
||||||
|
if( !m_currentSelected || selectedRows.size() != 1 )
|
||||||
{
|
{
|
||||||
wxBell();
|
wxBell();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString version = m_gridVersions->GetCellValue( rows[0], COL_VERSION );
|
wxString version = m_gridVersions->GetCellValue( selectedRows[0], COL_VERSION );
|
||||||
const PCM_PACKAGE& package = m_currentSelected->GetPackageData().package;
|
const PCM_PACKAGE& package = m_currentSelected->GetPackageData().package;
|
||||||
|
|
||||||
auto ver_it = std::find_if( package.versions.begin(), package.versions.end(),
|
auto ver_it = std::find_if( package.versions.begin(), package.versions.end(),
|
||||||
|
@ -471,15 +474,18 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
|
||||||
|
|
||||||
void PANEL_PACKAGES_VIEW::OnInstallVersionClicked( wxCommandEvent& event )
|
void PANEL_PACKAGES_VIEW::OnInstallVersionClicked( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
const wxArrayInt rows = m_gridVersions->GetSelectedRows();
|
if( m_gridVersions->GetNumberRows() == 1 )
|
||||||
|
m_gridVersions->SelectRow( 0 );
|
||||||
|
|
||||||
if( !m_currentSelected || rows.size() != 1 )
|
const wxArrayInt selectedRows = m_gridVersions->GetSelectedRows();
|
||||||
|
|
||||||
|
if( !m_currentSelected || selectedRows.size() != 1 )
|
||||||
{
|
{
|
||||||
wxBell();
|
wxBell();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString version = m_gridVersions->GetCellValue( rows[0], COL_VERSION );
|
wxString version = m_gridVersions->GetCellValue( selectedRows[0], COL_VERSION );
|
||||||
const PCM_PACKAGE& package = m_currentSelected->GetPackageData().package;
|
const PCM_PACKAGE& package = m_currentSelected->GetPackageData().package;
|
||||||
|
|
||||||
auto ver_it = std::find_if( package.versions.begin(), package.versions.end(),
|
auto ver_it = std::find_if( package.versions.begin(), package.versions.end(),
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
~PANEL_PACKAGES_VIEW();
|
~PANEL_PACKAGES_VIEW();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Recreates package panels and displays daya
|
* @brief Recreates package panels and displays data
|
||||||
*
|
*
|
||||||
* @param aPackageData list of package view data
|
* @param aPackageData list of package view data
|
||||||
* @param aCallback (un)install button callback
|
* @param aCallback (un)install button callback
|
||||||
|
|
Loading…
Reference in New Issue