Implemented "Clear All User Metadata" feature.

This commit is contained in:
WrinklyNinja
2014-08-12 13:07:40 +01:00
parent c04f97f594
commit 9579440ad4
4 changed files with 21 additions and 1 deletions
+10 -1
View File
@@ -306,7 +306,16 @@ function redatePlugins(evt) {
//showMessageBox('info', 'Redate Plugins', 'Plugins were successfully redated.');
}
function clearAllMetadata(evt) {
showMessageDialog('Clear All Metadata', 'Are you sure you want to clear all existing user-added metadata from all plugins?');
showMessageDialog('Clear All Metadata', 'Are you sure you want to clear all existing user-added metadata from all plugins?', function(result){
if (result) {
loot.query('clearAllMetadata').then(function(result){
/* Need to also empty the UI-side user metadata. */
loot.game.plugins.forEach(function(plugin){
plugin.userlist = undefined;
});
}).catch(processCefError);
}
});
}
function handlePluginDrop(evt) {
evt.stopPropagation();
+5
View File
@@ -116,6 +116,11 @@ namespace loot {
uout.close();
}
void MetadataList::clear() {
plugins.clear();
messages.clear();
}
bool MetadataList::operator == (const MetadataList& rhs) const {
if (this->plugins.size() != rhs.plugins.size() || this->messages.size() != rhs.messages.size()) {
BOOST_LOG_TRIVIAL(info) << "Metadata edited for some plugin, new and old userlists differ in size.";
+1
View File
@@ -57,6 +57,7 @@ namespace loot {
public:
void Load(const boost::filesystem::path& filepath);
void Save(const boost::filesystem::path& filepath);
void clear();
bool operator == (const MetadataList& rhs) const; //Compares content.
+5
View File
@@ -130,6 +130,11 @@ namespace loot {
callback->Success("");
return true;
}
else if (request == "clearAllMetadata") {
g_app_state.CurrentGame().userlist.clear();
callback->Success("");
return true;
}
else {
// May be a request with arguments.
YAML::Node req;