KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_pcm.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2021 Andrew Lutsenko, anlutsenko at gmail dot com
5 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21// kicad_curl_easy.h **must be** included before any wxWidgets header to avoid conflicts
22// at least on Windows/msys2
24
25#include "bitmaps.h"
27#include "dialog_pcm.h"
28#include "grid_tricks.h"
29#include "ki_exception.h"
30#include "pcm_task_manager.h"
31#include "pgm_base.h"
34#include "thread"
35#include "widgets/wx_grid.h"
36
37#include <fstream>
38#include <launch_ext.h>
39#include <sstream>
40#include <vector>
41#include <wx/filedlg.h>
42#include <wx/msgdlg.h>
43
44
45#define GRID_CELL_MARGIN 4
46
47// Notes: These strings are static, so wxGetTranslation must be called to display the
48// transalted text
49static std::vector<std::pair<PCM_PACKAGE_TYPE, wxString>> PACKAGE_TYPE_LIST = {
50 { PT_PLUGIN, _( "Plugins (%d)" ) },
51 { PT_FAB, _( "Fabrication plugins (%d)" ) },
52 { PT_LIBRARY, _( "Libraries (%d)" ) },
53 { PT_COLORTHEME, _( "Color themes (%d)" ) },
54};
55
56
57DIALOG_PCM::DIALOG_PCM( wxWindow* parent, std::shared_ptr<PLUGIN_CONTENT_MANAGER> pcm ) :
58 DIALOG_PCM_BASE( parent ),
59 m_pcm( pcm )
60{
61 // correct the min size from wxfb with fromdip
62 SetMinSize( FromDIP( GetMinSize() ) );
63
64 SetDoubleBuffered( true );
65
66 m_defaultBitmap = KiBitmap( BITMAPS::icon_pcm );
67
68 m_pcm->SetDialogWindow( this );
69 m_pcm->StopBackgroundUpdate();
70
71 m_gridPendingActions->PushEventHandler( new GRID_TRICKS( m_gridPendingActions ) );
72
73 m_discardActionButton->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
74 m_panelPending->Layout();
75
76 m_actionCallback = [this]( const PACKAGE_VIEW_DATA& aData, PCM_PACKAGE_ACTION aAction,
77 const wxString& aVersion )
78 {
79 if( aAction == PPA_UPDATE && m_pcm->IsPackagePinned( aData.package.identifier ) )
80 {
81 if( wxMessageBox( wxString::Format( _( "Are you sure you want to update pinned package "
82 "from version %s to %s?" ),
83 aData.current_version, aVersion ),
84 _( "Confirm update" ), wxICON_QUESTION | wxYES_NO, this )
85 == wxNO )
86 {
87 return;
88 }
89 }
90
91 m_gridPendingActions->Freeze();
92
93 PCM_PACKAGE_STATE new_state;
94
95 m_gridPendingActions->AppendRows();
96 int row = m_gridPendingActions->GetNumberRows() - 1;
97
98 m_gridPendingActions->SetCellValue( row, PENDING_COL_NAME, aData.package.name );
100
101 switch( aAction )
102 {
103 default:
104 case PPA_INSTALL:
105 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Install" ) );
106 m_gridPendingActions->SetCellValue( row, PENDING_COL_VERSION, aVersion );
107 new_state = PPS_PENDING_INSTALL;
108 break;
109
110 case PPA_UPDATE:
111 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Update" ) );
112 m_gridPendingActions->SetCellValue(
114 wxString::Format( wxT( "%s \u279C %s" ), aData.current_version, aVersion ) );
115 new_state = PPS_PENDING_UPDATE;
116 break;
117
118 case PPA_UNINSTALL:
119 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Uninstall" ) );
120 m_gridPendingActions->SetCellValue(
122 m_pcm->GetInstalledPackageVersion( aData.package.identifier ) );
123 new_state = PPS_PENDING_UNINSTALL;
124 break;
125 }
126
127 m_pendingActions.emplace_back( aAction, aData.repository_id, aData.package, aVersion );
128
129 m_gridPendingActions->Thaw();
130
132
133 updatePackageState( aData.package.identifier, new_state );
134 };
135
137 [this]( const wxString& aPackageId, const PCM_PACKAGE_STATE aState, const bool aPinned )
138 {
139 m_pcm->SetPinned( aPackageId, aPinned );
140
141 updatePackageState( aPackageId, aState );
142 };
143
146 m_panelInstalledHolder->GetSizer()->Add( m_installedPanel, 1, wxEXPAND );
147 m_panelInstalledHolder->Layout();
148
149 for( const std::pair<PCM_PACKAGE_TYPE, wxString>& entry : PACKAGE_TYPE_LIST )
150 {
153 wxString label = wxGetTranslation( entry.second );
154 m_contentNotebook->AddPage( panel, wxString::Format( label, 0 ) );
155 m_repositoryContentPanels.insert( { entry.first, panel } );
156 }
157
158 m_dialogNotebook->SetPageText( 0, wxString::Format( _( "Repository (%d)" ), 0 ) );
159
162
163 m_dialogNotebook->SetSelection( 0 );
164
165 SetupStandardButtons( { { wxID_OK, _( "Close" ) },
166 { wxID_APPLY, _( "Apply Pending Changes" ) },
167 { wxID_CANCEL, _( "Discard Pending Changes" ) } } );
168
169 Bind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );
170 m_sdbSizer1Cancel->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
171 m_sdbSizer1Apply->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
172
174
175 for( int col = 0; col < m_gridPendingActions->GetNumberCols(); col++ )
176 {
177 const wxString& heading = m_gridPendingActions->GetColLabelValue( col );
178 int headingWidth = GetTextExtent( heading ).x + 2 * GRID_CELL_MARGIN;
179
180 // Set the minimal width to the column label size.
181 m_gridPendingActions->SetColMinimalWidth( col, headingWidth );
182 }
183
184 // fix sizers now widgets are set.
186}
187
188
190{
191 Unbind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );
192 m_sdbSizer1Cancel->Unbind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
193 m_sdbSizer1Apply->Unbind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
194
195 m_pcm->SaveInstalledPackages();
196 m_pcm->SetDialogWindow( nullptr );
197 m_pcm->RunBackgroundUpdate();
198
199 m_gridPendingActions->PopEventHandler( true );
200}
201
202
203void DIALOG_PCM::OnUpdateEventButtons( wxUpdateUIEvent& event )
204{
205 event.Enable( !m_pendingActions.empty() );
206}
207
208
209void DIALOG_PCM::OnCloseClicked( wxCommandEvent& event )
210{
211 if( m_pendingActions.size() == 0
212 || wxMessageBox( _( "Are you sure you want to close the package manager "
213 "and discard pending changes?" ),
214 _( "Plugin and Content Manager" ), wxICON_QUESTION | wxYES_NO, this )
215 == wxYES )
216 {
217 EndModal( wxID_OK );
218 }
219}
220
221
222void DIALOG_PCM::OnCloseWindow( wxCloseEvent& aEvent )
223{
224 wxCommandEvent dummy;
225
227}
228
229
230void DIALOG_PCM::OnManageRepositoriesClicked( wxCommandEvent& event )
231{
233
234 std::vector<std::pair<wxString, wxString>> dialog_data;
235 std::vector<std::tuple<wxString, wxString, wxString>> repo_list = m_pcm->GetRepositoryList();
236
237 for( const std::tuple<wxString, wxString, wxString>& repo : repo_list )
238 dialog_data.push_back( std::make_pair( std::get<1>( repo ), std::get<2>( repo ) ) );
239
240 dialog->SetData( dialog_data );
241
242 if( dialog->ShowModal() == wxID_SAVE )
243 {
244 dialog_data = dialog->GetData();
245 m_pcm->SetRepositoryList( dialog_data );
246
248 KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
249
250 cfg->m_PcmRepositories = std::move( dialog_data );
251
253 }
254
255 dialog->Destroy();
256}
257
258
260{
261 std::vector<std::tuple<wxString, wxString, wxString>> repositories = m_pcm->GetRepositoryList();
262
263 m_choiceRepository->Clear();
264
265 for( const std::tuple<wxString, wxString, wxString>& entry : repositories )
266 {
267 m_choiceRepository->Append( std::get<1>( entry ),
268 new wxStringClientData( std::get<0>( entry ) ) );
269 }
270
271 if( repositories.size() > 0 )
272 {
273 m_choiceRepository->SetSelection( 0 );
274 m_selectedRepositoryId = std::get<0>( repositories[0] );
276 }
277 else
278 {
280 }
281}
282
283
284void DIALOG_PCM::OnRefreshClicked( wxCommandEvent& event )
285{
286 m_pcm->DiscardRepositoryCache( m_selectedRepositoryId );
288}
289
290
291void DIALOG_PCM::OnInstallFromFileClicked( wxCommandEvent& event )
292{
293 wxFileDialog open_file_dialog( this, _( "Install Package" ), wxEmptyString, wxEmptyString,
294 wxT( "Zip files (*.zip)|*.zip" ),
295 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
296
297 if( open_file_dialog.ShowModal() == wxID_CANCEL )
298 return;
299
300 PCM_TASK_MANAGER task_manager( m_pcm );
301 task_manager.InstallFromFile( this, open_file_dialog.GetPath() );
302
303 m_changed_package_types.merge( task_manager.GetChangedPackageTypes() );
304
306
307 if( !m_selectedRepositoryId.IsEmpty() )
309}
310
311
312void DIALOG_PCM::OnRepositoryChoice( wxCommandEvent& event )
313{
314 wxStringClientData* data = static_cast<wxStringClientData*>(
315 m_choiceRepository->GetClientObject( m_choiceRepository->GetSelection() ) );
316
317 m_selectedRepositoryId = data->GetData();
318
320}
321
322
323void DIALOG_PCM::setRepositoryData( const wxString& aRepositoryId )
324{
325 m_dialogNotebook->Freeze();
326
327 if( m_pcm->CacheRepository( aRepositoryId ) )
328 {
329 for( const auto& [ packageType, packagesView ] : m_repositoryContentPanels )
330 packagesView->ClearData();
331
332 m_packageBitmaps = m_pcm->GetRepositoryPackageBitmaps( aRepositoryId );
333
334 const std::vector<PCM_PACKAGE> packages = m_pcm->GetRepositoryPackages( aRepositoryId );
335
336 std::unordered_map<PCM_PACKAGE_TYPE, std::vector<PACKAGE_VIEW_DATA>> data;
337
338 for( const PCM_PACKAGE& pkg : packages )
339 {
340 PACKAGE_VIEW_DATA package_data( pkg );
341
342 if( m_packageBitmaps.count( package_data.package.identifier ) > 0 )
343 package_data.bitmap = &m_packageBitmaps.at( package_data.package.identifier );
344 else
345 package_data.bitmap = &m_defaultBitmap;
346
347 package_data.state = m_pcm->GetPackageState( aRepositoryId, pkg.identifier );
348
349 if( package_data.state == PPS_INSTALLED || package_data.state == PPS_UPDATE_AVAILABLE )
350 {
351 package_data.current_version = m_pcm->GetInstalledPackageVersion( pkg.identifier );
352 package_data.pinned = m_pcm->IsPackagePinned( pkg.identifier );
353 }
354
355 if( package_data.state == PPS_UPDATE_AVAILABLE )
356 package_data.update_version = m_pcm->GetPackageUpdateVersion( pkg );
357
358
359 for( const PENDING_ACTION& action : m_pendingActions )
360 {
361 if( action.package.identifier != pkg.identifier )
362 continue;
363
364 switch( action.action )
365 {
366 case PPA_INSTALL: package_data.state = PPS_PENDING_INSTALL; break;
367 case PPA_UPDATE: package_data.state = PPS_PENDING_UPDATE; break;
368 case PPA_UNINSTALL: package_data.state = PPS_PENDING_UNINSTALL; break;
369 }
370
371 break;
372 }
373
374 package_data.repository_id = aRepositoryId;
375 package_data.repository_name = m_choiceRepository->GetStringSelection();
376
377 // Fabrication plugins are displayed in a different tab although they are still plugins
378 PCM_PACKAGE_TYPE type = pkg.category == PC_FAB ? PT_FAB : pkg.type;
379
380 data[type].emplace_back( package_data );
381 }
382
383 for( size_t i = 0; i < PACKAGE_TYPE_LIST.size(); i++ )
384 {
385 PCM_PACKAGE_TYPE type = PACKAGE_TYPE_LIST[i].first;
386 const wxString& label = PACKAGE_TYPE_LIST[i].second;
387 m_repositoryContentPanels[type]->SetData( data[type] );
388 m_contentNotebook->SetPageText( i, wxString::Format( wxGetTranslation( label ),
389 (int) data[type].size() ) );
390 }
391
392 m_dialogNotebook->SetPageText( 0, wxString::Format( _( "Repository (%d)" ),
393 (int) packages.size() ) );
394 }
395
396 m_dialogNotebook->Thaw();
397}
398
399
401{
402 m_gridPendingActions->ClearSelection();
403 m_gridPendingActions->SelectRow( event.GetRow() );
404}
405
406
408{
409 m_dialogNotebook->SetPageText( 2, wxString::Format( _( "Pending (%d)" ),
410 (int) m_pendingActions.size() ) );
411
412 for( int col = 0; col < m_gridPendingActions->GetNumberCols(); col++ )
413 {
414 // Set the width to see the full contents
416 }
417}
418
419
421{
423
424 const std::vector<PCM_INSTALLATION_ENTRY> installed = m_pcm->GetInstalledPackages();
425 std::vector<PACKAGE_VIEW_DATA> package_list;
426
427 m_installedBitmaps = m_pcm->GetInstalledPackageBitmaps();
428
429 for( const PCM_INSTALLATION_ENTRY& entry : installed )
430 {
431 PACKAGE_VIEW_DATA package_data( entry );
432
433 if( m_installedBitmaps.count( package_data.package.identifier ) > 0 )
434 package_data.bitmap = &m_installedBitmaps.at( package_data.package.identifier );
435 else
436 package_data.bitmap = &m_defaultBitmap;
437
438 package_data.state = m_pcm->GetPackageState( entry.repository_id,
439 entry.package.identifier );
440
441 if( package_data.state == PPS_UPDATE_AVAILABLE )
442 package_data.update_version = m_pcm->GetPackageUpdateVersion( entry.package );
443
444 package_list.emplace_back( package_data );
445 }
446
447 m_installedPanel->SetData( package_list );
448
449 m_dialogNotebook->SetPageText( 1, wxString::Format( _( "Installed (%d)" ),
450 (int) package_list.size() ) );
451}
452
453
454void DIALOG_PCM::OnApplyChangesClicked( wxCommandEvent& event )
455{
456 if( m_pendingActions.size() == 0 )
457 return;
458
459 m_sdbSizer1OK->Disable();
460 m_sdbSizer1Apply->Disable();
461 m_sdbSizer1Cancel->Disable();
462
463 PCM_TASK_MANAGER task_manager( m_pcm );
464
465 for( const PENDING_ACTION& action : m_pendingActions )
466 {
467 if( action.action == PPA_UNINSTALL )
468 {
469 task_manager.Uninstall( action.package );
470 }
471 else
472 {
473 bool isUpdate = action.action == PPA_UPDATE;
474 task_manager.DownloadAndInstall( action.package, action.version, action.repository_id,
475 isUpdate );
476 }
477 }
478
479 task_manager.RunQueue( this );
480
481 m_changed_package_types.merge( task_manager.GetChangedPackageTypes() );
482
483 m_sdbSizer1OK->Enable();
484 m_sdbSizer1Apply->Enable();
485 m_sdbSizer1Cancel->Enable();
486
488 wxCommandEvent dummy;
490
491 if( !m_selectedRepositoryId.IsEmpty() )
493}
494
495
496void DIALOG_PCM::OnDiscardChangesClicked( wxCommandEvent& event )
497{
498 m_gridPendingActions->Freeze();
499
500 for( int i = m_pendingActions.size() - 1; i >= 0; i-- )
501 discardAction( i );
502
504 m_gridPendingActions->Thaw();
505}
506
507
508void DIALOG_PCM::OnDiscardActionClicked( wxCommandEvent& event )
509{
510 wxArrayInt rows = m_gridPendingActions->GetSelectedRows();
511
512 std::sort( rows.begin(), rows.end(),
513 []( const int& a, const int& b )
514 {
515 return a > b;
516 } );
517
518 m_gridPendingActions->Freeze();
519
520 for( int row : rows )
521 discardAction( row );
522
524 m_gridPendingActions->Thaw();
525}
526
527
529{
530 m_gridPendingActions->DeleteRows( aIndex );
531
532 PENDING_ACTION action = m_pendingActions[aIndex];
533
534 PCM_PACKAGE_STATE state = m_pcm->GetPackageState( action.repository_id,
535 action.package.identifier );
536
537 updatePackageState( action.package.identifier, state );
538
539 m_pendingActions.erase( m_pendingActions.begin() + aIndex );
540}
541
542
543void DIALOG_PCM::updatePackageState( const wxString& aPackageId, const PCM_PACKAGE_STATE aState )
544{
545 bool pinned = m_pcm->IsPackagePinned( aPackageId );
546
547 m_installedPanel->SetPackageState( aPackageId, aState, pinned );
548
549 for( const auto& [ packageType, packagesView ] : m_repositoryContentPanels )
550 packagesView->SetPackageState( aPackageId, aState, pinned );
551}
552
553
554void DIALOG_PCM::OnOpenPackageDirClicked( wxCommandEvent& event )
555{
556 LaunchExternal( m_pcm->Get3rdPartyPath() );
557}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
Implementing DIALOG_MANAGE_REPOSITORIES_BASE.
std::vector< std::pair< wxString, wxString > > GetData()
void SetData(const std::vector< std::pair< wxString, wxString > > &aData)
Class DIALOG_PCM_BASE.
wxChoice * m_choiceRepository
wxNotebook * m_contentNotebook
WX_GRID * m_gridPendingActions
wxButton * m_sdbSizer1OK
wxButton * m_sdbSizer1Cancel
wxBitmapButton * m_discardActionButton
wxNotebook * m_dialogNotebook
wxButton * m_sdbSizer1Apply
wxPanel * m_panelInstalledHolder
wxPanel * m_panelPending
ActionCallback m_actionCallback
Definition: dialog_pcm.h:106
void OnDiscardChangesClicked(wxCommandEvent &event) override
Switches to another repository.
Definition: dialog_pcm.cpp:496
std::unordered_map< wxString, wxBitmap > m_installedBitmaps
Definition: dialog_pcm.h:112
std::unordered_map< wxString, wxBitmap > m_packageBitmaps
Definition: dialog_pcm.h:111
void OnManageRepositoriesClicked(wxCommandEvent &event) override
Discards current repo cache, fetches it anew and displays.
Definition: dialog_pcm.cpp:230
void updatePackageState(const wxString &aPackageId, const PCM_PACKAGE_STATE aState)
Discards specified pending action.
Definition: dialog_pcm.cpp:543
void OnApplyChangesClicked(wxCommandEvent &event) override
Discards all pending changes.
Definition: dialog_pcm.cpp:454
void OnDiscardActionClicked(wxCommandEvent &event) override
Handles modification of the buttons' status.
Definition: dialog_pcm.cpp:508
void OnUpdateEventButtons(wxUpdateUIEvent &event)
Returns types of packages that were installed/uninstalled.
Definition: dialog_pcm.cpp:203
std::unordered_map< PCM_PACKAGE_TYPE, PANEL_PACKAGES_VIEW * > m_repositoryContentPanels
Definition: dialog_pcm.h:109
void OnOpenPackageDirClicked(wxCommandEvent &event) override
Enqueues current pending actions in PCM_TASK_MANAGER and runs the queue.
Definition: dialog_pcm.cpp:554
PinCallback m_pinCallback
Definition: dialog_pcm.h:107
DIALOG_PCM(wxWindow *parent, std::shared_ptr< PLUGIN_CONTENT_MANAGER > pcm)
Constructor.
Definition: dialog_pcm.cpp:57
std::unordered_set< PCM_PACKAGE_TYPE > m_changed_package_types
Definition: dialog_pcm.h:114
void updatePendingActionsTab()
Gets installed packages list from PCM and displays it on installed tab.
Definition: dialog_pcm.cpp:407
std::vector< PENDING_ACTION > m_pendingActions
Definition: dialog_pcm.h:130
void setRepositoryListFromPcm()
Updates pending actions tab caption and content-fits the grid.
Definition: dialog_pcm.cpp:259
void OnInstallFromFileClicked(wxCommandEvent &event) override
Opens local directory where packages are installed in file manager.
Definition: dialog_pcm.cpp:291
@ PENDING_COL_NAME
Definition: dialog_pcm.h:135
@ PENDING_COL_REPOSITORY
Definition: dialog_pcm.h:137
@ PENDING_COL_VERSION
Definition: dialog_pcm.h:136
@ PENDING_COL_ACTION
Definition: dialog_pcm.h:134
void OnCloseWindow(wxCloseEvent &aEvent)
Opens repository management dialog, saves changes to PCM.
Definition: dialog_pcm.cpp:222
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
Definition: dialog_pcm.h:105
void OnRepositoryChoice(wxCommandEvent &event) override
Selects the whole row in the grid if a cell is clicked.
Definition: dialog_pcm.cpp:312
wxString m_selectedRepositoryId
Definition: dialog_pcm.h:110
PANEL_PACKAGES_VIEW * m_installedPanel
Definition: dialog_pcm.h:108
~DIALOG_PCM()
Closes the window, asks user confirmation if there are pending actions.
Definition: dialog_pcm.cpp:189
void setInstalledPackages()
Reflects new state of the package in all panels where it is displayed.
Definition: dialog_pcm.cpp:420
void OnPendingActionsCellClicked(wxGridEvent &event) override
Discards selected pending actions.
Definition: dialog_pcm.cpp:400
void setRepositoryData(const wxString &aRepositoryId)
Gets package data from PCM and displays it on repository tab.
Definition: dialog_pcm.cpp:323
void discardAction(int aIndex)
Definition: dialog_pcm.cpp:528
wxBitmap m_defaultBitmap
Definition: dialog_pcm.h:113
void OnRefreshClicked(wxCommandEvent &event) override
Opens file selection dialog and installs selected package archive.
Definition: dialog_pcm.cpp:284
void OnCloseClicked(wxCommandEvent &event) override
Definition: dialog_pcm.cpp:209
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
int ShowModal() override
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:61
std::vector< std::pair< wxString, wxString > > m_PcmRepositories
void ClearData()
Selects full row of the clicked cell.
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.
Helper class that handles package (un)installation.
std::unordered_set< PCM_PACKAGE_TYPE > & GetChangedPackageTypes()
PCM_TASK_MANAGER::STATUS DownloadAndInstall(const PCM_PACKAGE &aPackage, const wxString &aVersion, const wxString &aRepositoryId, const bool isUpdate)
Enqueue package download and installation.
void RunQueue(wxWindow *aParent)
Run queue of pending actions.
PCM_TASK_MANAGER::STATUS Uninstall(const PCM_PACKAGE &aPackage)
Enqueue package uninstallation.
PCM_TASK_MANAGER::STATUS InstallFromFile(wxWindow *aParent, const wxString &aFilePath)
Installs package from an archive file on disk.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
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.
Definition: wx_grid.cpp:769
#define GRID_CELL_MARGIN
static std::vector< std::pair< PCM_PACKAGE_TYPE, wxString > > PACKAGE_TYPE_LIST
Definition: dialog_pcm.cpp:49
#define _(s)
bool LaunchExternal(const wxString &aPath)
Launches the given file or folder in the host OS.
Definition: launch_ext.cpp:25
PCM_PACKAGE_STATE
Definition: pcm.h:58
@ PPS_INSTALLED
Definition: pcm.h:61
@ PPS_PENDING_UPDATE
Definition: pcm.h:65
@ PPS_UPDATE_AVAILABLE
Definition: pcm.h:64
@ PPS_PENDING_UNINSTALL
Definition: pcm.h:63
@ PPS_PENDING_INSTALL
Definition: pcm.h:62
PCM_PACKAGE_ACTION
Definition: pcm.h:71
@ PPA_UNINSTALL
Definition: pcm.h:73
@ PPA_UPDATE
Definition: pcm.h:74
@ PPA_INSTALL
Definition: pcm.h:72
@ PC_FAB
Definition: pcm_data.h:55
PCM_PACKAGE_TYPE
< Supported package types
Definition: pcm_data.h:42
@ PT_COLORTHEME
Definition: pcm_data.h:47
@ PT_PLUGIN
Definition: pcm_data.h:44
@ PT_LIBRARY
Definition: pcm_data.h:46
@ PT_FAB
Definition: pcm_data.h:45
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
std::vector< FAB_LAYER_COLOR > dummy
< Collection of data relevant to the package display panel Callback for (un)install button
Definition: panel_package.h:31
wxString update_version
Definition: panel_package.h:39
wxString repository_id
Definition: panel_package.h:36
wxString current_version
Definition: panel_package.h:38
const PCM_PACKAGE package
Definition: panel_package.h:32
wxString repository_name
Definition: panel_package.h:37
wxBitmap * bitmap
Definition: panel_package.h:33
PCM_PACKAGE_STATE state
Definition: panel_package.h:34
Definition: pcm_data.h:149
Repository reference to a resource.
Definition: pcm_data.h:105
wxString identifier
Definition: pcm_data.h:109
wxString name
Definition: pcm_data.h:106