Skip to content

Commit

Permalink
GUI2/Addon List: restored extra version display for upgradable or out…
Browse files Browse the repository at this point in the history
…dated 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.
  • Loading branch information
Vultraz committed Aug 9, 2017
1 parent 5e650d3 commit 470d895
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/gui/widget/addon_list.cfg
Expand Up @@ -259,6 +259,7 @@
id = "version"
definition = "default_small"
linked_group = "version"
use_markup = true
characters_per_line = 10
wrap = true
[/label]
Expand Down
19 changes: 18 additions & 1 deletion src/gui/widgets/addon_list.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 470d895

Please sign in to comment.