GUI2/Addon List: restored extra version display for upgradable or outdated addons

The old GUI1 addon manager displayed both local and published versions of the addon directly in the list
if the addon was upgradable or outdated on the server. It seems to have gotten lost in the transition, so
this restores it.
This commit is contained in:
Charles Dang 2017-08-09 23:19:40 +11:00
parent 5e650d3bc1
commit 470d8956b8
2 changed files with 19 additions and 1 deletions

View file

@ -259,6 +259,7 @@
id = "version"
definition = "default_small"
linked_group = "version"
use_markup = true
characters_per_line = 10
wrap = true
[/label]

View file

@ -151,7 +151,24 @@ void addon_list::set_addons(const addons_list& addons)
item["label"] = describe_status(tracking_info);
data.emplace("installation_status", item);
item["label"] = addon.version.str();
// If the addon is upgradable or ourdated on server, we display the two relevant
// versions directly in the list for convenience.
const bool special_version_display =
tracking_info.state == ADDON_INSTALLED_UPGRADABLE ||
tracking_info.state == ADDON_INSTALLED_OUTDATED;
std::ostringstream ss;
if(special_version_display) {
ss << tracking_info.installed_version.str() << "\n";
}
ss << addon.version.str();
if(special_version_display) {
ss.str(colorify_addon_state_string(ss.str(), tracking_info.state, false));
}
item["label"] = ss.str();
data.emplace("version", item);
item["label"] = addon.author;