Added option to remove all userlist data.

Closes #144.
This commit is contained in:
WrinklyNinja
2014-05-14 17:48:13 +01:00
parent 897b096c0e
commit 60b6ca8dd2
3 changed files with 31 additions and 5 deletions
+28 -4
View File
@@ -571,9 +571,11 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli
dirtyList->AppendColumn(translate("Cleaning Utility"));
//Set up plugin right-click menu.
pluginMenu->Append(MENU_CopyName, translate("Copy Name"));
pluginMenu->Append(MENU_CopyMetadata, translate("Copy Metadata As Text"));
pluginMenu->Append(MENU_ClearMetadata, translate("Remove All User-Added Metadata"));
pluginMenu->Append(MENU_CopyName, translate("Copy Plugin Name"));
pluginMenu->Append(MENU_CopyMetadata, translate("Copy Plugin Metadata As Text"));
pluginMenu->Append(MENU_ClearPluginMetadata, translate("Remove Plugin User-Added Metadata"));
pluginMenu->AppendSeparator();
pluginMenu->Append(MENU_ClearAllMetadata, translate("Remove All User-Added Metadata"));
//Initialise control states.
addBtn->Enable(false);
@@ -605,7 +607,8 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli
Bind(wxEVT_LIST_ITEM_RIGHT_CLICK, &Editor::OnPluginListRightClick, this);
Bind(wxEVT_MENU, &Editor::OnPluginCopyName, this, MENU_CopyName);
Bind(wxEVT_MENU, &Editor::OnPluginCopyMetadata, this, MENU_CopyMetadata);
Bind(wxEVT_MENU, &Editor::OnPluginClearMetadata, this, MENU_ClearMetadata);
Bind(wxEVT_MENU, &Editor::OnPluginClearMetadata, this, MENU_ClearPluginMetadata);
Bind(wxEVT_MENU, &Editor::OnClearAllMetadata, this, MENU_ClearAllMetadata);
//Set up tooltips.
pluginList->SetToolTip(translate("Select a plugin to edit its load order metadata."));
@@ -878,6 +881,27 @@ void Editor::OnPluginClearMetadata(wxCommandEvent& event) {
}
}
void Editor::OnClearAllMetadata(wxCommandEvent& event) {
wxMessageDialog dialog(this,
translate("Are you sure you want to clear all existing user-added metadata from all plugins?"),
translate("LOOT: Warning"),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION);
if (dialog.ShowModal() == wxID_YES) {
//Delete all existing userlist entries.
_editedPlugins.clear();
//Also clear any unapplied data. Easiest way to do this is to simulate loading the plugin's data again.
pluginText->SetLabelText("");
long i = pluginList->GetFirstSelected();
pluginList->Select(i, false);
pluginList->Select(i, true);
for (int i = 0, max = pluginList->GetItemCount(); i < max; ++i) {
pluginList->SetItemFont(i, wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
}
}
}
void Editor::OnListBookChange(wxBookCtrlEvent& event) {
BOOST_LOG_TRIVIAL(trace) << "Changed list tab.";
if (event.GetSelection() == 0 || event.GetSelection() == 1) {
+1
View File
@@ -119,6 +119,7 @@ public:
void OnPluginCopyName(wxCommandEvent& event);
void OnPluginCopyMetadata(wxCommandEvent& event);
void OnPluginClearMetadata(wxCommandEvent& event);
void OnClearAllMetadata(wxCommandEvent& event);
void OnListBookChange(wxBookCtrlEvent& event);
void OnAddRow(wxCommandEvent& event);
void OnEditRow(wxCommandEvent& event);
+2 -1
View File
@@ -67,7 +67,8 @@ enum {
BOOK_Lists,
MENU_CopyName,
MENU_CopyMetadata,
MENU_ClearMetadata,
MENU_ClearPluginMetadata,
MENU_ClearAllMetadata,
//Main window - dynamically created IDs.
MENU_LowestDynamicGameID,
LIST_LoadOrder,