m_repository_url("http://localhost:8000/index-0_4_0.nfo"),
m_ignored_addon_ids(ignored_addon_ids),
m_installed_addons(),
- m_repository_addons()
+ m_repository_addons(),
+ m_has_been_updated(false)
{
PHYSFS_mkdir(m_addon_directory.c_str());
return true;
}
+bool
+AddonManager::has_been_updated() const
+{
+ return m_has_been_updated;
+}
+
void
AddonManager::check_online()
{
std::string addoninfos = m_downloader.download(m_repository_url);
m_repository_addons = parse_addon_infos(addoninfos);
+ m_has_been_updated = true;
}
void
AddonList m_installed_addons;
AddonList m_repository_addons;
+ bool m_has_been_updated;
+
public:
AddonManager(const std::string& addon_directory,
std::vector<std::string>& enabled_addons_);
~AddonManager();
bool has_online_support() const;
+ bool has_been_updated() const;
void check_online();
std::vector<AddonId> get_repository_addons() const;
add_hl();
- if (!m_installed_addons.empty())
+ if (m_installed_addons.empty())
+ {
+ add_inactive(MNID_NOTHING_NEW, _("No Addons installed"));
+ }
+ else
{
int idx = 0;
for (const auto& addon_id : m_installed_addons)
add_toggle(MAKE_INSTALLED_MENU_ID(idx), text, addon.is_enabled());
idx += 1;
}
-
- add_hl();
}
- if (!m_addon_manager.has_online_support())
- {
- add_inactive(MNID_CHECK_ONLINE, std::string(_("Check Online (disabled)")));
- }
- else
- {
- add_entry(MNID_CHECK_ONLINE, std::string(_("Check Online")));
- }
+ add_hl();
{
+ bool have_new_stuff = false;
int idx = 0;
for (const auto& addon_id : m_repository_addons)
{
<< std::endl;
std::string text = generate_menu_item_text(addon);
add_entry(MAKE_REPOSITORY_MENU_ID(idx), "Install " + text + " *NEW*");
+ have_new_stuff = true;
}
}
catch(const std::exception& err)
// addon is not installed
std::string text = generate_menu_item_text(addon);
add_entry(MAKE_REPOSITORY_MENU_ID(idx), "Install " + text);
+ have_new_stuff = true;
}
idx += 1;
}
+
+ if (!have_new_stuff && m_addon_manager.has_been_updated())
+ {
+ add_inactive(MNID_NOTHING_NEW, _("No new Addons found"));
+ }
+ }
+
+ if (!m_addon_manager.has_online_support())
+ {
+ add_inactive(MNID_CHECK_ONLINE, std::string(_("Check Online (disabled)")));
+ }
+ else
+ {
+ add_entry(MNID_CHECK_ONLINE, std::string(_("Check Online")));
}
add_hl();