Skip to content

Commit

Permalink
Addon Manager: include outdated addons in dependency check (fixes #1494)
Browse files Browse the repository at this point in the history
Also added missing border around addon list in Install Dependencies.
  • Loading branch information
Vultraz committed Feb 9, 2018
1 parent 8ebbcda commit 3b6da9a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
3 changes: 3 additions & 0 deletions changelog
@@ -1,4 +1,7 @@
Version 1.13.11:
* Add-ons client:
* Players will now be prompted to update outdated dependencies alongside
missing once when installing an add-on.

This comment has been minimized.

Copy link
@soliton-

soliton- Feb 9, 2018

Member

missing ones

This comment has been minimized.

Copy link
@CelticMinstrel

CelticMinstrel Feb 10, 2018

Member

I think it's actually a typo (once -> ones).

This comment has been minimized.

Copy link
@soliton-

soliton- Feb 10, 2018

Member

That is what I was trying to point out...

* Campaigns:
* The Cutscene_Minimal theme is now used in all dialog only scenarios that
have linger=no in [end_level].
Expand Down
26 changes: 14 additions & 12 deletions data/gui/window/install_dependencies.cfg
Expand Up @@ -7,33 +7,33 @@
[window]
id = "install_dependencies"
description = "Install dependencies prompt."

[resolution]
definition = "default"

automatic_placement = true
horizontal_placement = "center"
vertical_placement = "center"

[tooltip]
id = "tooltip"
[/tooltip]

[helptip]
id = "helptip"
[/helptip]

[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"

[label]
id = "title"
definition = "title"

label = _ "Install Dependencies"
[/label]
[/column]
Expand All @@ -46,23 +46,25 @@
[label]
id = "label"
definition = "default"

wrap = true
characters_per_line = 70

# This isn't localizable because the final text is set from C++ code (in order to support singular and plural forms properly)
label = "The selected add-on has the following dependencies, which are not currently installed. Do you wish to install them before continuing?"
label = "The selected add-on has the following dependencies, which are outdated or not currently installed. Do you wish to install them before continuing?"
[/label]
[/column]
[/row]
[row]
grow_factor = 1
[column]
horizontal_grow = true
border = "all"
border_size = 5

[addon_list]
id = "dependencies"
definition = "default"
install_status_visibility = "invisible"
install_buttons_visibility = "invisible"
[/addon_list]
[/column]
Expand All @@ -75,7 +77,7 @@
[column]
border = "all"
border_size = 5

[button]
id = "ok"
definition = "default"
Expand Down
20 changes: 15 additions & 5 deletions src/addon/client.cpp
Expand Up @@ -15,6 +15,7 @@

#include "addon/info.hpp"
#include "addon/manager.hpp"
#include "addon/state.hpp"
#include "addon/validation.hpp"
#include "cursor.hpp"
#include "font/pango/escape.hpp"
Expand Down Expand Up @@ -342,10 +343,20 @@ addons_client::install_result addons_client::do_resolve_addon_dependencies(const
std::vector<std::string> broken_deps;

for(const std::string& dep : deps) {
if(!is_addon_installed(dep)) {
if(addons.find(dep) != addons.end()) {
try {
addon_tracking_info info = get_addon_tracking_info(addons.at(dep));

// ADDON_NONE means not installed.
if(info.state == ADDON_NONE) {
missing_deps.push_back(dep);
} else if(info.state == ADDON_INSTALLED_UPGRADABLE) {
// Tight now, we don't need to distinguish the lists of missing
// and outdated addons, so just add them to missing.
missing_deps.push_back(dep);
} else {
}
} catch(const std::out_of_range&) {
// Dependency wasn't found on server, check locally directly.
if(!is_addon_installed(dep)) {
broken_deps.push_back(dep);
}
}
Expand Down Expand Up @@ -380,8 +391,7 @@ addons_client::install_result addons_client::do_resolve_addon_dependencies(const
{
addons_list options;
for(const std::string& dep : missing_deps) {
const addon_info& missing_addon = addons.at(dep);
options[dep] = missing_addon;
options[dep] = addons.at(dep);
}

gui2::dialogs::install_dependencies dlg(options);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/dialogs/addon/install_dependencies.cpp
Expand Up @@ -35,8 +35,8 @@ void install_dependencies::pre_show(window& window)
{
find_widget<label>(&window, "label", false).set_label(t_string(
_n(
"The selected add-on has the following dependency, which is not currently installed. Do you wish to install it before continuing?",
"The selected add-on has the following dependencies, which are not currently installed. Do you wish to install them before continuing?",
"The selected add-on has the following dependency, which is outdated or not currently installed. Do you wish to install it before continuing?",
"The selected add-on has the following dependencies, which are outdated or not currently installed. Do you wish to install them before continuing?",
addons_.size())
));

Expand Down

0 comments on commit 3b6da9a

Please sign in to comment.