Added update of C++ settings storage, fixed bugs.

Bugs fixed were removal of the "auto" default game option, and display
metadata being derived twice from the userlist instead of the masterlist
and the userlist.
This commit is contained in:
WrinklyNinja
2014-08-15 16:25:25 +01:00
parent cb2763e546
commit fcda2077f5
4 changed files with 16 additions and 5 deletions
+2 -2
View File
@@ -519,8 +519,8 @@ function updateSettingsUI() {
var gameTable = document.getElementById('gameTable');
/* First make sure game listing elements don't have any existing entries. */
while (gameSelect.firstElementChild) {
gameSelect.removeChild(gameSelect.firstElementChild);
while (gameSelect.children.length > 1) {
gameSelect.removeChild(gameSelect.lastElementChild);
}
while (gameMenu.firstElementChild) {
gameMenu.removeChild(gameMenu.firstElementChild);
+5 -1
View File
@@ -247,11 +247,15 @@ namespace loot {
Game& LootState::CurrentGame() {
return _games[_currentGame];
}
std::vector<Game>& LootState::InstalledGames() {
const std::vector<Game>& LootState::InstalledGames() const {
return _games;
}
const YAML::Node& LootState::GetSettings() const {
return _settings;
}
void LootState::UpdateSettings(const YAML::Node& settings) {
_settings = settings;
}
}
+2 -1
View File
@@ -70,9 +70,10 @@ namespace loot {
void ChangeGame(const std::string& newGameFolder);
Game& CurrentGame();
std::vector<Game>& InstalledGames();
const std::vector<Game>& InstalledGames() const;
const YAML::Node& GetSettings() const;
void UpdateSettings(const YAML::Node& settings);
private:
YAML::Node _settings;
+7 -1
View File
@@ -388,6 +388,12 @@ namespace loot {
callback->Success(JSON::stringify(GenerateDerivedMetadata(newUserlistEntry.Name())));
return true;
}
else if (requestName == "closeSettings") {
BOOST_LOG_TRIVIAL(trace) << "Settings dialog closed and changes accepted, updating settings object.";
g_app_state.UpdateSettings(req["args"][0]);
callback->Success("");
return true;
}
}
return false;
@@ -709,7 +715,7 @@ namespace loot {
auto pluginIt = g_app_state.CurrentGame().plugins.find(pluginName);
if (pluginIt != g_app_state.CurrentGame().plugins.end()) {
const Plugin master = g_app_state.CurrentGame().userlist.FindPlugin(pluginIt->first);
const Plugin master = g_app_state.CurrentGame().masterlist.FindPlugin(pluginIt->first);
const Plugin user = g_app_state.CurrentGame().userlist.FindPlugin(pluginIt->first);
return this->GenerateDerivedMetadata(pluginIt->second, master, user);