30#define GRID_CELL_MARGIN 4
34 wxWindow* parent, std::shared_ptr<PLUGIN_CONTENT_MANAGER> pcm ) :
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++ )
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 );
202 m_grid->SelectRow( aRow );
211 m_grid->AppendRows( aData.size() );
213 for(
size_t i = 0; i < aData.size(); i++ )
215 m_grid->SetCellValue( i, 0, aData[i].first );
216 m_grid->SetCellValue( i, 1, aData[i].second );
227 std::vector<std::pair<wxString, wxString>> result;
229 for(
int i = 0; i <
m_grid->GetNumberRows(); i++ )
232 std::make_pair(
m_grid->GetCellValue( i, 0 ),
m_grid->GetCellValue( i, 1 ) ) );
241 EndModal( wxID_SAVE );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Class DIALOG_MANAGE_REPOSITORIES_BASE.
SPLIT_BUTTON * m_buttonAdd
STD_BITMAP_BUTTON * m_buttonRemove
STD_BITMAP_BUTTON * m_buttonMoveDown
STD_BITMAP_BUTTON * m_buttonMoveUp
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.
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculate the specified column based on the actual size of the text on screen.
void OnMoveRowUp(const std::function< void(int row)> &aMover)
void SwapRows(int aRowA, int aRowB)
These aren't that tricky, but might as well share code.
void OnMoveRowDown(const std::function< void(int row)> &aMover)
void OnDeleteRows(const std::function< void(int row)> &aDeleter)
Handles a row deletion event.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
#define PCM_DEFAULT_REPOSITORY_URL
Package installation entry.