summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-08-19 22:04:15 +0000
committersvntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-08-19 22:04:15 +0000
commit02c6596cb35774e222840724a8843da593530b60 (patch)
tree05ddd2fda200e4ce60a7e5a54945e6c3b384a47a
parentb916f43b2d857d2f86aeae48016f9c55c8b4ca41 (diff)
downloadvdr-plugin-menuorg-02c6596cb35774e222840724a8843da593530b60.tar.gz
vdr-plugin-menuorg-02c6596cb35774e222840724a8843da593530b60.tar.bz2
add unconfigured plugins at the end of the root main menu
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5836 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
-rw-r--r--README7
-rw-r--r--src/menuconfiguration.cpp20
-rw-r--r--src/menuconfiguration.h3
3 files changed, 26 insertions, 4 deletions
diff --git a/README b/README
index c4ed74e..238a331 100644
--- a/README
+++ b/README
@@ -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