Add staged M.A.S.S. deletion.
This commit is contained in:
parent
8bf2866a17
commit
5a51a70ec8
7 changed files with 101 additions and 0 deletions
|
@ -203,6 +203,14 @@ void EvtMainFrame::stagingSelectionEvent(wxCommandEvent&) {
|
||||||
updateCommandsState();
|
updateCommandsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EvtMainFrame::deleteStagedEvent(wxCommandEvent&) {
|
||||||
|
int selection = _stagingList->GetSelection();
|
||||||
|
|
||||||
|
if(selection != wxNOT_FOUND) {
|
||||||
|
_manager.deleteStagedMass(selection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EvtMainFrame::stagingButtonEvent(wxCommandEvent&) {
|
void EvtMainFrame::stagingButtonEvent(wxCommandEvent&) {
|
||||||
wxExecute("explorer.exe " + Utility::Directory::toNativeSeparators(_manager.stagingAreaDirectory()));
|
wxExecute("explorer.exe " + Utility::Directory::toNativeSeparators(_manager.stagingAreaDirectory()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ class EvtMainFrame: public MainFrame {
|
||||||
void backupEvent(wxCommandEvent&);
|
void backupEvent(wxCommandEvent&);
|
||||||
void openSaveDirEvent(wxCommandEvent&);
|
void openSaveDirEvent(wxCommandEvent&);
|
||||||
void stagingSelectionEvent(wxCommandEvent&);
|
void stagingSelectionEvent(wxCommandEvent&);
|
||||||
|
void deleteStagedEvent(wxCommandEvent&);
|
||||||
void stagingButtonEvent(wxCommandEvent&);
|
void stagingButtonEvent(wxCommandEvent&);
|
||||||
void installedSelectionEvent(wxListEvent&);
|
void installedSelectionEvent(wxListEvent&);
|
||||||
void listColumnDragEvent(wxListEvent&);
|
void listColumnDragEvent(wxListEvent&);
|
||||||
|
|
|
@ -78,6 +78,9 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co
|
||||||
_stagingList = new wxListBox( sbSizerStagingArea->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB|wxLB_SINGLE );
|
_stagingList = new wxListBox( sbSizerStagingArea->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB|wxLB_SINGLE );
|
||||||
sbSizerStagingArea->Add( _stagingList, 1, wxALL|wxEXPAND, 5 );
|
sbSizerStagingArea->Add( _stagingList, 1, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
_deleteStagedButton = new wxButton( sbSizerStagingArea->GetStaticBox(), wxID_ANY, wxT("Delete staged M.A.S.S."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
sbSizerStagingArea->Add( _deleteStagedButton, 0, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
_stagingAreaButton = new wxButton( sbSizerStagingArea->GetStaticBox(), wxID_ANY, wxT("Open staging area directory"), wxDefaultPosition, wxDefaultSize, 0 );
|
_stagingAreaButton = new wxButton( sbSizerStagingArea->GetStaticBox(), wxID_ANY, wxT("Open staging area directory"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
sbSizerStagingArea->Add( _stagingAreaButton, 0, wxALL|wxEXPAND, 5 );
|
sbSizerStagingArea->Add( _stagingAreaButton, 0, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
@ -131,6 +134,7 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co
|
||||||
_importButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this );
|
_importButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this );
|
||||||
_exportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this );
|
_exportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this );
|
||||||
_stagingList->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainFrame::stagingSelectionEvent ), NULL, this );
|
_stagingList->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainFrame::stagingSelectionEvent ), NULL, this );
|
||||||
|
_deleteStagedButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::deleteStagedEvent ), NULL, this );
|
||||||
_stagingAreaButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this );
|
_stagingAreaButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this );
|
||||||
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) );
|
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) );
|
||||||
}
|
}
|
||||||
|
@ -145,6 +149,7 @@ MainFrame::~MainFrame()
|
||||||
_importButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this );
|
_importButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this );
|
||||||
_exportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this );
|
_exportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this );
|
||||||
_stagingList->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainFrame::stagingSelectionEvent ), NULL, this );
|
_stagingList->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainFrame::stagingSelectionEvent ), NULL, this );
|
||||||
|
_deleteStagedButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::deleteStagedEvent ), NULL, this );
|
||||||
_stagingAreaButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this );
|
_stagingAreaButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this );
|
||||||
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) );
|
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) );
|
||||||
|
|
||||||
|
|
|
@ -694,6 +694,79 @@
|
||||||
<event name="OnListBox">stagingSelectionEvent</event>
|
<event name="OnListBox">stagingSelectionEvent</event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALL|wxEXPAND</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxButton" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="bitmap"></property>
|
||||||
|
<property name="caption"></property>
|
||||||
|
<property name="caption_visible">1</property>
|
||||||
|
<property name="center_pane">0</property>
|
||||||
|
<property name="close_button">1</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="current"></property>
|
||||||
|
<property name="default">0</property>
|
||||||
|
<property name="default_pane">0</property>
|
||||||
|
<property name="disabled"></property>
|
||||||
|
<property name="dock">Dock</property>
|
||||||
|
<property name="dock_fixed">0</property>
|
||||||
|
<property name="docking">Left</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="floatable">1</property>
|
||||||
|
<property name="focus"></property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="label">Delete staged M.A.S.S.</property>
|
||||||
|
<property name="margins"></property>
|
||||||
|
<property name="markup">0</property>
|
||||||
|
<property name="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">_deleteStagedButton</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pin_button">1</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="position"></property>
|
||||||
|
<property name="pressed"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style"></property>
|
||||||
|
<property name="subclass">; ; forward_declare</property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="validator_data_type"></property>
|
||||||
|
<property name="validator_style">wxFILTER_NONE</property>
|
||||||
|
<property name="validator_type">wxDefaultValidator</property>
|
||||||
|
<property name="validator_variable"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<event name="OnButtonClick">deleteStagedEvent</event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALL|wxEXPAND</property>
|
<property name="flag">wxALL|wxEXPAND</property>
|
||||||
|
|
|
@ -45,6 +45,7 @@ class MainFrame : public wxFrame
|
||||||
wxButton* _importButton;
|
wxButton* _importButton;
|
||||||
wxButton* _exportButton;
|
wxButton* _exportButton;
|
||||||
wxListBox* _stagingList;
|
wxListBox* _stagingList;
|
||||||
|
wxButton* _deleteStagedButton;
|
||||||
wxButton* _stagingAreaButton;
|
wxButton* _stagingAreaButton;
|
||||||
wxStaticText* _riskLabel;
|
wxStaticText* _riskLabel;
|
||||||
wxStaticText* _gameStatusLabel;
|
wxStaticText* _gameStatusLabel;
|
||||||
|
@ -60,6 +61,7 @@ class MainFrame : public wxFrame
|
||||||
virtual void importEvent( wxCommandEvent& event ) { event.Skip(); }
|
virtual void importEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void exportEvent( wxCommandEvent& event ) { event.Skip(); }
|
virtual void exportEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void stagingSelectionEvent( wxCommandEvent& event ) { event.Skip(); }
|
virtual void stagingSelectionEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void deleteStagedEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void stagingButtonEvent( wxCommandEvent& event ) { event.Skip(); }
|
virtual void stagingButtonEvent( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void gameCheckTimerEvent( wxTimerEvent& event ) { event.Skip(); }
|
virtual void gameCheckTimerEvent( wxTimerEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
|
@ -471,6 +471,16 @@ auto MassManager::removeStagedMass(const std::string& filename) -> int {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MassManager::deleteStagedMass(int index) {
|
||||||
|
int i = 0;
|
||||||
|
for(auto it = _stagedMasses.begin(); it != _stagedMasses.end(); ++it, ++i) {
|
||||||
|
if(i == index) {
|
||||||
|
Utility::Directory::rm(Utility::Directory::join(_stagingAreaDirectory, it->first));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string MassManager::stagedMassName(int index) {
|
std::string MassManager::stagedMassName(int index) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(const auto& mass_info : _stagedMasses) {
|
for(const auto& mass_info : _stagedMasses) {
|
||||||
|
|
|
@ -74,6 +74,8 @@ class MassManager {
|
||||||
auto updateStagedMass(const std::string& filename) -> int;
|
auto updateStagedMass(const std::string& filename) -> int;
|
||||||
auto removeStagedMass(const std::string& filename) -> int;
|
auto removeStagedMass(const std::string& filename) -> int;
|
||||||
|
|
||||||
|
void deleteStagedMass(int index);
|
||||||
|
|
||||||
auto stagedMassName(int index) -> std::string;
|
auto stagedMassName(int index) -> std::string;
|
||||||
auto stagedMassName(const std::string& filename) -> std::string;
|
auto stagedMassName(const std::string& filename) -> std::string;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue