30#define GRID_CELL_MARGIN 4
34 wxWindow* parent, std::shared_ptr<PLUGIN_CONTENT_MANAGER> pcm ) :
52 wxMenu* addMenu =
m_buttonAdd->GetSplitButtonMenu();
53 wxMenuItem* menuItem = addMenu->Append( wxID_ANY,
_(
"Add Default Repository" ) );
63 for(
int col = 0; col <
m_grid->GetNumberCols(); col++ )
65 const wxString& heading =
m_grid->GetColLabelValue( col );
69 m_grid->SetColMinimalWidth( col, headingWidth );
80 m_grid->PopEventHandler(
true );
86 for(
int col = 0; col <
m_grid->GetNumberCols(); col++ )
89 m_grid->SetColSize( col,
m_grid->GetVisibleWidth( col,
true,
true ) );
96 wxTextEntryDialog entry_dialog(
this,
_(
"Fully qualified repository url:" ),
97 _(
"Add Repository" ) );
99 if( entry_dialog.ShowModal() == wxID_OK )
101 wxString url = entry_dialog.GetValue();
109 for(
int row = 0; row <
m_grid->GetNumberRows(); row++ )
111 if(
m_grid->GetCellValue( row, aCol ) == aVal )
123 if( ( matching_row =
findRow( 1, aUrl ) ) >= 0 )
132 if(
m_pcm->FetchRepository( aUrl, repository, &reporter ) )
138 name = wxString::Format(
"%s (%d)", repository.
name, increment++ );
143 int row =
m_grid->GetNumberRows() - 1;
146 m_grid->SetCellValue( row, 1, aUrl );
167 m_grid->DeleteRows( row );
178 m_grid->SwapRows( row, row - 1 );
188 m_grid->SwapRows( row, row + 1 );
202 m_grid->SelectRow( aRow );
210 m_grid->AppendRows( aData.size() );
212 for(
size_t i = 0; i < aData.size(); i++ )
214 m_grid->SetCellValue( i, 0, aData[i].first );
215 m_grid->SetCellValue( i, 1, aData[i].second );
226 std::vector<std::pair<wxString, wxString>>
result;
228 for(
int i = 0; i <
m_grid->GetNumberRows(); i++ )
231 std::make_pair(
m_grid->GetCellValue( i, 0 ),
m_grid->GetCellValue( i, 1 ) ) );
240 EndModal( wxID_SAVE );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
SPLIT_BUTTON * m_buttonAdd
STD_BITMAP_BUTTON * m_buttonRemove
STD_BITMAP_BUTTON * m_buttonMoveDown
STD_BITMAP_BUTTON * m_buttonMoveUp
DIALOG_MANAGE_REPOSITORIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Manage Repositories"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void OnRemoveButtonClicked(wxCommandEvent &event) override
void OnMoveDownButtonClicked(wxCommandEvent &event) override
std::vector< std::pair< wxString, wxString > > GetData()
void addRepository(const wxString &aUrl)
void OnSaveClicked(wxCommandEvent &event) override
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
void OnAdd(wxCommandEvent &event)
DIALOG_MANAGE_REPOSITORIES(wxWindow *parent, std::shared_ptr< PLUGIN_CONTENT_MANAGER > aPcm)
Constructor.
int findRow(int aCol, const wxString &aVal)
void SetData(const std::vector< std::pair< wxString, wxString > > &aData)
void OnMoveUpButtonClicked(wxCommandEvent &event) override
~DIALOG_MANAGE_REPOSITORIES()
void OnAddDefault(wxCommandEvent &event)
void OnGridCellClicked(wxGridEvent &event) override
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
#define PCM_DEFAULT_REPOSITORY_URL
Package installation entry.
wxString result
Test unit parsing edge cases and error handling.