addon/mg: Implement 'Installed' add-ons view

Just checking whether it's worth it per http://r.wesnoth.org/p526549 .
This commit is contained in:
Ignacio R. Morelle 2012-05-01 20:14:47 +00:00
parent e9e718d633
commit 1f29724deb
3 changed files with 12 additions and 2 deletions

View file

@ -831,7 +831,7 @@ To search add-ons by keywords, just type them in any order in the <bold>text='Fi
To install an add-on, select it from the list and click on <bold>text='OK'</bold>, or simply double click on the add-ons title. The <bold>text='Description'</bold> button provides you with additional details about the add-on, such as its full description, installation status, and available languages.
By default, you will see the <bold>text='All Add-ons'</bold> view, displaying all add-ons regardless of whether you have them installed or not. You can click on the button to change the view as necessary. The <bold>text='Upgradable'</bold> add-ons view provides you with the option to upgrade all your installed add-ons whenever applicable. Use the <bold>text='Not Installed'</bold> view to display only those add-ons you have not yet acquired from the server."
By default, you will see the <bold>text='All Add-ons'</bold> view, displaying all add-ons regardless of whether you have them installed or not. You can click on the button to change the view as necessary. To see only add-ons you have already installed, choose the <bold>text='Installed'</bold> view. The <bold>text='Upgradable'</bold> view allows you display only those add-ons that have been updated on the server, along with their versions and the option to upgrade them all together. Use the <bold>text='Not Installed'</bold> view to display only add-ons you have not acquired from the server yet."
[/topic]
#wmllint: markcheck on

View file

@ -65,6 +65,7 @@ namespace {
enum VIEW_MODE
{
VIEW_ALL,
VIEW_INSTALLED,
VIEW_UPGRADABLE,
VIEW_NOT_INSTALLED,
VIEW_MODE_COUNT
@ -77,6 +78,8 @@ std::string view_mode_display_label(VIEW_MODE m)
return _("addons_view^Not Installed");
case VIEW_UPGRADABLE:
return _("addons_view^Upgradable");
case VIEW_INSTALLED:
return _("addons_view^Installed");
default:
return _("addons_view^All Add-ons");
}
@ -451,7 +454,9 @@ void show_addons_manager_dialog(display& disp, addons_client& client, addons_lis
const ADDON_STATUS state = tracking[addon.id].state;
if((view == VIEW_UPGRADABLE && state != ADDON_INSTALLED_UPGRADABLE) ||
(view == VIEW_NOT_INSTALLED && state != ADDON_NONE))
(view == VIEW_NOT_INSTALLED && state != ADDON_NONE) ||
(view == VIEW_INSTALLED && !is_installed_addon_status(state))
)
continue;
option_ids.push_back(addon.id);

View file

@ -35,6 +35,11 @@ enum ADDON_STATUS {
ADDON_NOT_TRACKED
};
inline bool is_installed_addon_status(ADDON_STATUS s)
{
return s >= ADDON_INSTALLED && s <= ADDON_INSTALLED_BROKEN;
}
/** Stores additional status information about add-ons. */
struct addon_tracking_info
{