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,
_(
"Please enter 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 );
164 auto selectedRows =
m_grid->GetSelectedRows();
167 if( selectedRows.size() != 1 )
173 int selectedRow = selectedRows[0];
174 m_grid->DeleteRows( selectedRow );
177 if(
m_grid->GetNumberRows() > 0 )
178 m_grid->SelectRow( selectedRow ==
m_grid->GetNumberRows() ? selectedRow - 1 : selectedRow );
184 auto selectedRows =
m_grid->GetSelectedRows();
187 if( selectedRows.size() != 1 )
190 int selectedRow = selectedRows[0];
193 if( selectedRow == 0 )
199 swapRows( selectedRow, selectedRow - 1 );
207 auto selectedRows =
m_grid->GetSelectedRows();
210 if( selectedRows.size() != 1 )
213 int selectedRow = selectedRows[0];
216 if( selectedRow + 1 ==
m_grid->GetNumberRows() )
222 swapRows( selectedRow, selectedRow + 1 );
234 for(
int column = 0; column <
m_grid->GetNumberCols(); column++ )
236 tempStr =
m_grid->GetCellValue( aRowA, column );
237 m_grid->SetCellValue( aRowA, column,
m_grid->GetCellValue( aRowB, column ) );
238 m_grid->SetCellValue( aRowB, column, tempStr );
254 m_grid->SelectRow( aRow );
263 m_grid->AppendRows( aData.size() );
265 for(
size_t i = 0; i < aData.size(); i++ )
267 m_grid->SetCellValue( i, 0, aData[i].first );
268 m_grid->SetCellValue( i, 1, aData[i].second );
279 std::vector<std::pair<wxString, wxString>> result;
281 for(
int i = 0; i <
m_grid->GetNumberRows(); i++ )
284 std::make_pair(
m_grid->GetCellValue( i, 0 ),
m_grid->GetCellValue( i, 1 ) ) );
293 EndModal( wxID_SAVE );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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 swapRows(int aRowA, int aRowB)
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)
Calculates the specified column based on the actual size of the text on screen.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
#define PCM_DEFAULT_REPOSITORY_URL
Package installation entry.