diff options
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | src/menuconfiguration.cpp | 20 | ||||
-rw-r--r-- | src/menuconfiguration.h | 3 |
3 files changed, 26 insertions, 4 deletions
@@ -85,10 +85,9 @@ The name of a <plugin> node describes the plug-ins name, not it's main menu text With the name attribute in <menu> nodes, the main menu title of this sub menu will be set. -<system> or <plugin> items not configured in the menu configuration will not -be visible in VDR's OSD. This means, if you install a new plug-in, you must -manually add it to the menu file, in order to make it available for the -VDR menu. +<system> items not configured in the menu configuration will not be visible in +VDR's OSD. Plug-ins that are not configured in the xml file, will be shown +at the end of the root main menu. e.g.: diff --git a/src/menuconfiguration.cpp b/src/menuconfiguration.cpp index ec3de5e..78df2ac 100644 --- a/src/menuconfiguration.cpp +++ b/src/menuconfiguration.cpp @@ -60,6 +60,8 @@ MenuNode* MenuConfiguration::LoadMenu(string menuFileName) const Element* rootElement = parser.get_document()->get_root_node(); ParseElement(rootElement, menuRoot); + + AddUnconfiguredPlugins(menuRoot); } catch(const std::exception& ex) { @@ -123,6 +125,7 @@ void MenuConfiguration::AddPluginMenuNode(string pluginName, MenuNode* menu) if (FindPluginByName(pluginName, &pluginMainMenuEntry, pluginIndex)) { + _configuredPlugins.push_back(pluginName); menu->AddChild(new PluginMenuNode(pluginMainMenuEntry, pluginIndex)); } } @@ -177,3 +180,20 @@ bool MenuConfiguration::FindPluginByName(string name, const char** mainMenuEntry return false; } + +void MenuConfiguration::AddUnconfiguredPlugins(MenuNode* menu) +{ + int i = 0; + + while (cPlugin *plugin = cPluginManager::GetPlugin(i)) + { + if (const char *item = plugin->MainMenuEntry()) + { + if (find(_configuredPlugins.begin(), _configuredPlugins.end(), plugin->Name()) == _configuredPlugins.end()) + { + menu->AddChild(new PluginMenuNode(item, i)); + } + } + i++; + } +} diff --git a/src/menuconfiguration.h b/src/menuconfiguration.h index ca24e1e..5518e4e 100644 --- a/src/menuconfiguration.h +++ b/src/menuconfiguration.h @@ -24,6 +24,7 @@ #define ___MENUCONFIGURATION_H #include <string> +#include <vector> #include <vdr/osdbase.h> namespace xmlpp { class Element; } @@ -33,6 +34,7 @@ class MenuConfiguration { private: static const std::string _dtd; + std::vector<std::string> _configuredPlugins; public: MenuNode* LoadMenu(std::string menuFileName); @@ -44,6 +46,7 @@ class MenuConfiguration MenuNode* AddSubMenuNode(std::string name, MenuNode* menu); void AddSystemMenuNode(std::string name, MenuNode* menu); void AddPluginMenuNode(std::string pluginName, MenuNode* menu); + void AddUnconfiguredPlugins(MenuNode* menu); }; #endif |