diff options
author | svntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f> | 2007-07-22 13:51:47 +0000 |
---|---|---|
committer | svntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f> | 2007-07-22 13:51:47 +0000 |
commit | 1e8d4c38cf55f3995a3d02c6c275fec0d1b7326f (patch) | |
tree | cf9e5a2f477405e789a8613bf37ae6d81cb5b97a | |
parent | 2e1c7361dce4d44d980628537a679a9fbebd5546 (diff) | |
download | vdr-plugin-menuorg-1e8d4c38cf55f3995a3d02c6c275fec0d1b7326f.tar.gz vdr-plugin-menuorg-1e8d4c38cf55f3995a3d02c6c275fec0d1b7326f.tar.bz2 |
initial submenu checkin
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5628 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
-rw-r--r-- | CREDITS | 0 | ||||
-rw-r--r-- | HISTORY | 6 | ||||
-rw-r--r-- | Makefile | 101 | ||||
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | debian/README.Debian | 6 | ||||
-rw-r--r-- | debian/changelog | 12 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 13 | ||||
-rw-r--r-- | debian/copyright | 21 | ||||
-rw-r--r-- | debian/docs | 1 | ||||
-rw-r--r-- | debian/install | 1 | ||||
-rw-r--r-- | debian/links.ex | 1 | ||||
-rw-r--r-- | debian/postinst.ex | 41 | ||||
-rw-r--r-- | debian/postrm.ex | 39 | ||||
-rw-r--r-- | debian/preinst.ex | 37 | ||||
-rw-r--r-- | debian/prerm.ex | 40 | ||||
-rwxr-xr-x | debian/rules | 93 | ||||
-rw-r--r-- | debian/watch.ex | 22 | ||||
-rw-r--r-- | sources.mk | 4 | ||||
-rw-r--r-- | src/plugincreator.cc | 7 | ||||
-rw-r--r-- | src/submenu.cc | 3 | ||||
-rw-r--r-- | src/submenu.h | 10 | ||||
-rw-r--r-- | src/submenuplugin.cc | 134 | ||||
-rw-r--r-- | src/submenuplugin.h | 40 | ||||
-rw-r--r-- | src/submenuprovider.cc | 56 | ||||
-rw-r--r-- | src/submenuprovider.h | 21 | ||||
-rw-r--r-- | src/version.h | 6 | ||||
-rwxr-xr-x | vdr-patch/opt-37_submenu.dpatch | 223 |
28 files changed, 950 insertions, 0 deletions
@@ -0,0 +1,6 @@ +VDR Plugin 'submenu' Revision History +------------------------------------- + +2007-07-22: Version 0.0.1 + +- Initial revision. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0fbfcfb --- /dev/null +++ b/Makefile @@ -0,0 +1,101 @@ +# +# Makefile for the submenu VDR plugin +# +# $Id: Makefile 4096 2006-08-20 21:11:08Z svntobi $ + +# The official name of this plugin. +# This name will be used in the '-P...' option of VDR to load the plugin. +# By default the main source file also carries this name. +# +PLUGIN = submenu + +### The version number of this plugin (taken from the main source file): + +VERSION = $(shell grep 'static const char VERSION\[\] =' src/version.h | \ + awk '{ print $$6 }' | sed -e 's/[";]//g') + +### The C++ compiler and options: + +CXX ?= g++ +CXXFLAGS ?= -fPIC -O2 -Wall -Woverloaded-virtual + +### The directory environment: + +DVBDIR = ../../../../DVB +VDRDIR = ../../.. +LIBDIR = ../../lib +TMPDIR = /tmp + +### Allow user defined options to overwrite defaults: + +-include $(VDRDIR)/Make.config + +### The version number of VDR's plugin API (taken from VDR's "config.h"): + +APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' \ + $(VDRDIR)/config.h) + +### The name of the distribution archive: + +ARCHIVE = $(PLUGIN)-$(VERSION) +PACKAGE = vdr-$(ARCHIVE) + +### Includes, Libs and Defines (add further entries here): + +# LIBS += `curl-config --libs` + +INCLUDES += -I. -I$(VDRDIR)/include -I$(DVBDIR)/include + +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' + +### The source files (add further files here): + +-include sources.mk + +### The object files + +OBJS := $(addsuffix .o,$(basename ${SRCS})) + +### Implicit rules: + +%.o: %.cpp + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< -o $@ + +%.o: %.cc + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< -o $@ + +# Dependencies: + +MAKEDEP = $(CXX) -MM +BUILD_DEPFILE = .dependencies + +$(BUILD_DEPFILE): Makefile + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(SRCS) $(SRCS_TESTABLE) \ + | sed "s/.*: \([^ ]*\/\).*/\1\0/" > $@ + +$(TESTS_DEPFILE): Makefile $(SRCS_TESTPARTS) + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(SRCS_TESTABLE) $(SRCS_TESTONLY) \ + $(SRCS_TESTPARTS) | sed "s/.*: \([^ ]*\/\).*/\1\0/" > $@ + +-include $(BUILD_DEPFILE) + +### Targets: + +all: libvdr-$(PLUGIN).so + +libvdr-$(PLUGIN).so: $(OBJS) + $(CXX) $(CXXFLAGS) -shared $(OBJS) -L. $(LIBS) -o $@ + @cp $@ $(LIBDIR)/$@.$(APIVERSION) + +dist: clean + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @mkdir $(TMPDIR)/$(ARCHIVE) + @cp -a * $(TMPDIR)/$(ARCHIVE) + @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) --exclude debian --exclude CVS \ + --exclude .svn --exclude tools $(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @echo Distribution package created as $(PACKAGE).tar.gz + +clean: + @-rm -f $(BUILD_DEPFILE) $(TESTS_DEPFILE) *.so* *.tar.gz core* *~ + @-find . -name \*.\o -exec rm -f {} \; @@ -0,0 +1,11 @@ +This is a "plugin" for the Video Disk Recorder (VDR). + +Written by: Your Name <email@host.dom> + +Project's homepage: URL + +Latest version available at: URL + +See the file COPYING for license information. + +Description: diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..3e0e4ee --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,6 @@ +vdr-plugin-submenu for Debian +----------------------------- + +<possible notes regarding this package - if none, delete this file> + + -- Tobias Grimm <tg@e-tobi.net> Sun, 22 Jul 2007 00:25:20 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3e39c46 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,12 @@ +vdr-plugin-submenu (0.0.1-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP> + + Important: + + If you intend to make this plugin available to others, please create an + ITP-bug (see http://www.debian.org/devel/wnpp ) and contact the + Debian VDR packaging team: pkg-vdr-dvb-devel@lists.alioth.debian.org + + -- Tobias Grimm <tg@e-tobi.net> Sun, 22 Jul 2007 00:25:20 +0200 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..8a40fce --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: vdr-plugin-submenu +Section: misc +Priority: extra +Maintainer: Tobias Grimm <tg@e-tobi.net> +Build-Depends: debhelper (>= 5), vdr-dev (>= 1.4.7-2ctvdr1.2) +Standards-Version: 3.7.2 + +Package: vdr-plugin-submenu +Architecture: any +Depends: ${shlibs:Depends}, ${vdr:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> +XB-VDR-Patchlevel: ${vdr:Patchlevel} diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..3bbb511 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +This package was debianized by Tobias Grimm <tg@e-tobi.net> on +Sun, 22 Jul 2007 00:25:20 +0200. + +It was downloaded from <fill in http/ftp site> + +Upstream Author: <put author(s) name and email here> + +Copyright: <put the year(s) of the copyright, and the names of the + copyright holder(s) here> + + +The Debian packaging is (C) 2007, Tobias Grimm <tg@e-tobi.net> and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. + +License: + +It may be redistributed under the terms of the GNU GPL, Version 2 +found on Debian systems in the file /usr/share/common-licenses/GPL . + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..28b7b2b --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +libvdr-submenu.so.* usr/lib/vdr/plugins/ diff --git a/debian/links.ex b/debian/links.ex new file mode 100644 index 0000000..d8b3131 --- /dev/null +++ b/debian/links.ex @@ -0,0 +1 @@ +usr/share/vdr-plugin-submenu/submenu var/lib/vdr/plugins/submenu diff --git a/debian/postinst.ex b/debian/postinst.ex new file mode 100644 index 0000000..e37e6c2 --- /dev/null +++ b/debian/postinst.ex @@ -0,0 +1,41 @@ +#!/bin/sh +# postinst script for vdr-plugin-submenu +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <postinst> `abort-remove' +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/postrm.ex b/debian/postrm.ex new file mode 100644 index 0000000..267fa48 --- /dev/null +++ b/debian/postrm.ex @@ -0,0 +1,39 @@ +#!/bin/sh +# postrm script for vdr-plugin-submenu +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <overwriter> +# <overwriter-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/preinst.ex b/debian/preinst.ex new file mode 100644 index 0000000..0f037d3 --- /dev/null +++ b/debian/preinst.ex @@ -0,0 +1,37 @@ +#!/bin/sh +# preinst script for vdr-plugin-submenu +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <new-preinst> `install' +# * <new-preinst> `install' <old-version> +# * <new-preinst> `upgrade' <old-version> +# * <old-preinst> `abort-upgrade' <new-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/prerm.ex b/debian/prerm.ex new file mode 100644 index 0000000..32c317b --- /dev/null +++ b/debian/prerm.ex @@ -0,0 +1,40 @@ +#!/bin/sh +# prerm script for vdr-plugin-submenu +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <prerm> `remove' +# * <old-prerm> `upgrade' <new-version> +# * <new-prerm> `failed-upgrade' <old-version> +# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version> +# * <deconfigured's-prerm> `deconfigure' `in-favour' +# <package-being-installed> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ca4b1db --- /dev/null +++ b/debian/rules @@ -0,0 +1,93 @@ +#! /bin/sh /usr/share/vdr-dev/make-special-vdr.sh +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +# To use dpatch uncomment the following line and set Build-Depends to dpatch +# DPATCH=yes + +ifdef DPATCH +include /usr/share/dpatch/dpatch.make +else +patch: +patch-stamp: +unpatch: +endif + +MAKE_OPTIONS = DVBDIR=/usr VDRDIR=/usr/include/vdr LIBDIR=. + +configure: configure-stamp +configure-stamp: patch-stamp + dh_testdir + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + $(MAKE) all $(MAKE_OPTIONS) + touch build-stamp + +clean: clean-patched unpatch +clean-patched: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + -$(MAKE) -o .dependencies clean $(MAKE_OPTIONS) + rm -f libvdr-*.so.* + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_install + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs + dh_installexamples +# dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installman +# dh_installinfo +# dh_undocumented + dh_installchangelogs HISTORY + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + sh /usr/share/vdr-dev/patchlevel.sh subst + sh /usr/share/vdr-dev/dependencies.sh + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure \ + clean-patched patch unpatch diff --git a/debian/watch.ex b/debian/watch.ex new file mode 100644 index 0000000..1eaf929 --- /dev/null +++ b/debian/watch.ex @@ -0,0 +1,22 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# <Webpage URL> <string match> +#http://www.example.com/downloads.php vdr-plugin-submenu-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/vdr-plugin-submenu-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/vdr-plugin-submenu-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for debscripts >= 2.9 +# http://sf.net/vdr-plugin-submenu/vdr-plugin-submenu-(.*)\.tar\.gz + + diff --git a/sources.mk b/sources.mk new file mode 100644 index 0000000..761ef55 --- /dev/null +++ b/sources.mk @@ -0,0 +1,4 @@ +SRCS = \ + src/plugincreator.cc \ + src/submenuplugin.cc \ + src/submenuprovider.cc \ diff --git a/src/plugincreator.cc b/src/plugincreator.cc new file mode 100644 index 0000000..6b87179 --- /dev/null +++ b/src/plugincreator.cc @@ -0,0 +1,7 @@ +#include "submenuplugin.h" + +extern "C" void *VDRPluginCreator() +{ + SubMenuPlugin* plugin = new SubMenuPlugin(); + return plugin; +} diff --git a/src/submenu.cc b/src/submenu.cc new file mode 100644 index 0000000..d9c3ab7 --- /dev/null +++ b/src/submenu.cc @@ -0,0 +1,3 @@ +eOSState SubMenu::ProcessKey(eKeys Key) +{ +} diff --git a/src/submenu.h b/src/submenu.h new file mode 100644 index 0000000..b26c47f --- /dev/null +++ b/src/submenu.h @@ -0,0 +1,10 @@ +#ifndef ___SUBMENU_H +#define ___SUBMENU_H + +class SubMenu : public cOsdMenu +{ + public: + virtual eOSState ProcessKey(eKeys Key); +}; + +#endif diff --git a/src/submenuplugin.cc b/src/submenuplugin.cc new file mode 100644 index 0000000..cd5f43a --- /dev/null +++ b/src/submenuplugin.cc @@ -0,0 +1,134 @@ +/* + * submenu.c: A plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + * $Id$ + */ + +#include <vdr/plugin.h> +#include <vdr/config.h> +#include <vdr/tools.h> +#include <vdr/submenupatch.h> +#include <vector> +#include "version.h" +#include "submenuplugin.h" + +using namespace SubMenuPatch; + +SubMenuPlugin::SubMenuPlugin(void) +{ + // Initialize any member variables here. + // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL + // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! +} + + +SubMenuPlugin::~SubMenuPlugin() +{ + // Clean up after yourself! +} + +const char* SubMenuPlugin::Version(void) +{ + return VERSION; +} + +const char* SubMenuPlugin::Description(void) +{ + return tr("TODO: Insert Description"); +} + +const char* SubMenuPlugin::MainMenuEntry(void) +{ + return tr("TODO: MainMenuEntry"); +} + +const char *SubMenuPlugin::CommandLineHelp(void) +{ + // Return a string that describes all known command line options. + return NULL; +} + +bool SubMenuPlugin::ProcessArgs(int argc, char *argv[]) +{ + // Implement command line argument processing here if applicable. + return true; +} + +bool SubMenuPlugin::Initialize(void) +{ + // Initialize any background activities the plugin shall perform. + return true; +} + +bool SubMenuPlugin::Start(void) +{ + // Start any background activities the plugin shall perform. + return true; +} + +void SubMenuPlugin::Stop(void) +{ + // Stop any background activities the plugin shall perform. +} + +void SubMenuPlugin::Housekeeping(void) +{ + // Perform any cleanup or other regular tasks. +} + +void SubMenuPlugin::MainThreadHook(void) +{ + // Perform actions in the context of the main program thread. + // WARNING: Use with great care - see PLUGINS.html! +} + +cString SubMenuPlugin::Active(void) +{ + // Return a message string if shutdown should be postponed + return NULL; +} + +cOsdObject *SubMenuPlugin::MainMenuAction(void) +{ + // Perform the action when selected from the main VDR menu. + return NULL; +} + +cMenuSetupPage *SubMenuPlugin::SetupMenu(void) +{ + // Return a setup menu in case the plugin supports one. + return NULL; +} + +bool SubMenuPlugin::SetupParse(const char *Name, const char *Value) +{ + // Parse your own setup parameters and store their values. + return false; +} + +bool SubMenuPlugin::Service(const char *Id, void *Data) +{ + if (strcmp(Id, "SubMenuPatch-v0.1::SubMenuProvider") == 0) + { + ISubMenuProvider** ptr = (ISubMenuProvider**)Data; + *ptr = &_subMenuProvider; + + return true; + } + + return false; +} + +const char **SubMenuPlugin::SVDRPHelpPages(void) +{ + // Return help text for SVDRP commands this plugin implements + return NULL; +} + +cString SubMenuPlugin::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) +{ + // Process SVDRP commands this plugin implements + return NULL; +} diff --git a/src/submenuplugin.h b/src/submenuplugin.h new file mode 100644 index 0000000..504af9c --- /dev/null +++ b/src/submenuplugin.h @@ -0,0 +1,40 @@ +#ifndef ___SUBMENUPLUGIN_H +#define ___SUBMENUPLUGIN_H + +#include <vdr/plugin.h> +//#include <vdr/config.h> +//#include <vdr/tools.h> +#include "submenuprovider.h" + +using namespace SubMenuPatch; + +class SubMenuPlugin : public cPlugin +{ + private: + SubMenuProvider _subMenuProvider; + + public: + SubMenuPlugin(void); + virtual ~SubMenuPlugin(); + virtual const char *Version(void); + virtual const char *Description(void); + virtual const char *CommandLineHelp(void); + virtual bool ProcessArgs(int argc, char *argv[]); + virtual bool Initialize(void); + virtual bool Start(void); + virtual void Stop(void); + virtual void Housekeeping(void); + virtual void MainThreadHook(void); + virtual cString Active(void); + virtual const char *MainMenuEntry(void); + virtual cOsdObject *MainMenuAction(void); + virtual cMenuSetupPage *SetupMenu(void); + virtual bool SetupParse(const char *Name, const char *Value); + virtual bool Service(const char *Id, void *Data = NULL); + virtual const char **SVDRPHelpPages(void); + virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); +}; + +extern "C" void* VDRPluginCreator(); + +#endif diff --git a/src/submenuprovider.cc b/src/submenuprovider.cc new file mode 100644 index 0000000..ccbb3fc --- /dev/null +++ b/src/submenuprovider.cc @@ -0,0 +1,56 @@ +#include "submenuprovider.h" +#include <vdr/plugin.h> + +MainMenuItemsList* SubMenuProvider::MainMenuItems() +{ + ResetMainMenuItemsList(); + + + _osdItems.push_back(MainMenuItem::CreateCustomMenuItem(new cOsdItem("A custom sub menu", osUser1))); +// _osdItems.push_back(MainMenuItem::CreateCustomMenuItem(new cOsdItem(tr("Schedule"), osSchedule))); +// _osdItems.push_back(MainMenuItem::CreateCustomMenuItem(new cOsdItem(tr("Channels"), osChannels))); +// _osdItems.push_back(MainMenuItem::CreateCustomMenuItem(new cOsdItem(tr("Timers"), osTimers))); +// _osdItems.push_back(MainMenuItem::CreateCustomMenuItem(new cOsdItem(tr("Recordings"), osRecordings))); + + for (int i = 0; ; i++) { + cPlugin *p = cPluginManager::GetPlugin(i); + if (p) { + const char *item = p->MainMenuEntry(); + if (item) + _osdItems.push_back(MainMenuItem::CreatePluginMenuItem(item, i)); + } + else + break; + } + + _osdItems.push_back(MainMenuItem::CreateCustomMenuItem(new cOsdItem(tr("Setup"), osSetup))); + + if (Commands.Count()) + _osdItems.push_back(MainMenuItem::CreateCustomMenuItem(new cOsdItem(tr("Commands"), osCommands))); + + return &_osdItems; +} + +void SubMenuProvider::ResetMainMenuItemsList() +{ + for( MainMenuItemsList::iterator i = _osdItems.begin(); i != _osdItems.end(); i++) + { + delete *i; + } + _osdItems.clear(); +} + +cOsdMenu* SubMenuProvider::OpenSubMenu(int mainMenuItemIndex) +{ + if (mainMenuItemIndex == 0) + { + cOsdMenu* fooMenu = new cOsdMenu("Foo-Submenu"); + fooMenu->Add(new cOsdItem(tr("Schedule"), osSchedule)); + fooMenu->Add(new cOsdItem(tr("Channels"), osChannels)); + fooMenu->Add(new cOsdItem(tr("Timers"), osTimers)); + fooMenu->Add(new cOsdItem(tr("Recordings"), osRecordings)); + return fooMenu; + } + + return NULL; +} diff --git a/src/submenuprovider.h b/src/submenuprovider.h new file mode 100644 index 0000000..f15daf6 --- /dev/null +++ b/src/submenuprovider.h @@ -0,0 +1,21 @@ +#ifndef ___SUBMENUPROVIDER_H +#define ___SUBMENUPROVIDER_H + +#include <vdr/submenupatch.h> + +using namespace SubMenuPatch; + +class SubMenuProvider: public ISubMenuProvider +{ + private: + MainMenuItemsList _osdItems; + + public: + virtual MainMenuItemsList* MainMenuItems(); + virtual cOsdMenu* OpenSubMenu(int mainMenuItemIndex); + + private: + void ResetMainMenuItemsList(); +}; + +#endif diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..65226ac --- /dev/null +++ b/src/version.h @@ -0,0 +1,6 @@ +#ifndef ___VERSION_H +#define ___VERSION_H + +static const char VERSION[] = "0.1"; + +#endif diff --git a/vdr-patch/opt-37_submenu.dpatch b/vdr-patch/opt-37_submenu.dpatch new file mode 100755 index 0000000..7435f64 --- /dev/null +++ b/vdr-patch/opt-37_submenu.dpatch @@ -0,0 +1,223 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## opt-37_submenu.dpatch by Tobias Grimm <tg@e-tobi.net> +## DP: This patch is needed for the submenu plugin. + +@DPATCH@ +diff -urNad vdr-1.4.7~/Makefile vdr-1.4.7/Makefile +--- vdr-1.4.7~/Makefile 2007-07-22 15:14:29.000000000 +0200 ++++ vdr-1.4.7/Makefile 2007-07-22 15:14:30.000000000 +0200 +@@ -38,7 +38,7 @@ + lirc.o menu.o menuitems.o nit.o osdbase.o osd.o pat.o player.o plugin.o rcu.o\ + receiver.o recorder.o recording.o remote.o remux.o ringbuffer.o sdt.o sections.o\ + skinclassic.o skins.o skinsttng.o sources.o spu.o status.o svdrp.o themes.o thread.o\ +- timers.o tools.o transfer.o vdr.o videodir.o ++ timers.o tools.o transfer.o vdr.o videodir.o submenupatch.o + + OBJS += osdcontroller.o rcontroller.o dvbsub.o vdrttxtsubshooks.o + +diff -urNad vdr-1.4.7~/menu.c vdr-1.4.7/menu.c +--- vdr-1.4.7~/menu.c 2007-07-22 15:14:29.000000000 +0200 ++++ vdr-1.4.7/menu.c 2007-07-22 15:25:10.000000000 +0200 +@@ -31,6 +31,7 @@ + #include "vdrttxtsubshooks.h" + #include "dvbsub.h" + #include "videodir.h" ++#include "submenupatch.h" + + #define MAXWAIT4EPGINFO 3 // seconds + #define MODETIMEOUT 3 // seconds +@@ -3084,6 +3085,25 @@ + Clear(); + SetTitle("VDR"); + SetHasHotkeys(); ++ ++ SubMenuPatch::ISubMenuProvider* subMenuProvider; ++ ++ if (cPluginManager::CallFirstService("SubMenuPatch-v0.1::SubMenuProvider", &subMenuProvider)) { ++ SubMenuPatch::MainMenuItemsList* menuItems = subMenuProvider->MainMenuItems(); ++ SubMenuPatch::MainMenuItemsList::iterator i; ++ ++ for (i = menuItems->begin(); i != menuItems->end(); i++) { ++ if ((*i)->IsCustomMenuItem()) { ++ cOsdItem* osdItem = (*i)->CustomMenuItem(); ++ osdItem->SetText(hk(osdItem->Text())); ++ Add(osdItem); ++ } ++ else if ((*i)->IsPluginMenuItem()) { ++ Add(new cMenuPluginItem(hk((*i)->PluginMenuEntry()), (*i)->PluginIndex())); ++ } ++ } ++ } ++ else { + + // Basic menu items: + +@@ -3111,6 +3131,8 @@ + if (Commands.Count()) + Add(new cOsdItem(hk(tr("Commands")), osCommands)); + ++ } ++ + Update(true); + + Display(); +@@ -3238,6 +3260,17 @@ + state = osEnd; + } + break; ++ case osUser1: { ++ SubMenuPatch::ISubMenuProvider* subMenuProvider; ++ ++ if (cPluginManager::CallFirstService("SubMenuPatch-v0.1::SubMenuProvider", &subMenuProvider)) { ++ cOsdMenu* subMenu = subMenuProvider->OpenSubMenu(Current()); ++ if (subMenu) { ++ AddSubMenu(subMenu); ++ } ++ break; ++ } ++ } + default: switch (Key) { + case kRecord: + case kRed: if (!HadSubMenu) +diff -urNad vdr-1.4.7~/submenupatch.c vdr-1.4.7/submenupatch.c +--- vdr-1.4.7~/submenupatch.c 1970-01-01 01:00:00.000000000 +0100 ++++ vdr-1.4.7/submenupatch.c 2007-07-22 15:14:30.000000000 +0200 +@@ -0,0 +1,75 @@ ++/* ++ * vdr-submenu - A plugin for the Linux Video Disk Recorder ++ * Copyright (c) 2007 Tobias Grimm <vdr@e-tobi.net> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * $Id: $ ++ * ++ */ ++ ++#include "submenupatch.h" ++ ++namespace SubMenuPatch ++{ ++ ++class CustomMainMenuItem: public MainMenuItem ++{ ++ private: ++ cOsdItem* _osdItem; ++ ++ public: ++ CustomMainMenuItem(cOsdItem* osdItem) {_osdItem = osdItem; }; ++ virtual bool IsCustomMenuItem() { return true; }; ++ virtual bool IsPluginMenuItem() { return false; }; ++ virtual cOsdItem* CustomMenuItem() { return _osdItem; }; ++ virtual const char* PluginMenuEntry() { return NULL; }; ++ virtual int PluginIndex() { return 0; }; ++}; ++ ++class PluginMainMenuItem: public MainMenuItem ++{ ++ private: ++ const char* _mainMenuEntry; ++ int _pluginIndex; ++ ++ public: ++ PluginMainMenuItem(const char* mainMenuEntry, int pluginIndex) ++ { ++ _mainMenuEntry = mainMenuEntry; ++ _pluginIndex = pluginIndex; ++ }; ++ virtual bool IsCustomMenuItem() { return false; }; ++ virtual bool IsPluginMenuItem() { return true; }; ++ virtual cOsdItem* CustomMenuItem() { return NULL; }; ++ virtual const char* PluginMenuEntry() { return _mainMenuEntry; }; ++ virtual int PluginIndex() { return _pluginIndex; }; ++}; ++ ++ISubMenuProvider::~ISubMenuProvider() ++{ ++} ++ ++MainMenuItem* MainMenuItem::CreateCustomMenuItem(cOsdItem* item) ++{ ++ return new CustomMainMenuItem(item); ++} ++ ++MainMenuItem* MainMenuItem::CreatePluginMenuItem(const char* pluginMainMenuEntry, int pluginIndex) ++{ ++ return new PluginMainMenuItem(pluginMainMenuEntry, pluginIndex); ++} ++ ++}; +diff -urNad vdr-1.4.7~/submenupatch.h vdr-1.4.7/submenupatch.h +--- vdr-1.4.7~/submenupatch.h 1970-01-01 01:00:00.000000000 +0100 ++++ vdr-1.4.7/submenupatch.h 2007-07-22 15:21:59.000000000 +0200 +@@ -0,0 +1,59 @@ ++/* ++ * vdr-submenu - A plugin for the Linux Video Disk Recorder ++ * Copyright (c) 2007 Tobias Grimm <vdr@e-tobi.net> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * $Id: $ ++ * ++ */ ++ ++#ifndef __SUBMENUPATCH_H ++#define __SUBMENUPATCH_H ++ ++#include "osdbase.h" ++#include <vector> ++ ++namespace SubMenuPatch ++{ ++ ++class MainMenuItem ++{ ++ public: ++ static MainMenuItem* CreateCustomMenuItem(cOsdItem* item); ++ static MainMenuItem* CreatePluginMenuItem(const char* pluginMainMenuEntry, int pluginIndex); ++ ++ public: ++ virtual ~MainMenuItem() {}; ++ virtual bool IsCustomMenuItem() = 0; ++ virtual bool IsPluginMenuItem() = 0; ++ virtual cOsdItem* CustomMenuItem() = 0; ++ virtual const char* PluginMenuEntry() = 0; ++ virtual int PluginIndex() = 0; ++}; ++ ++typedef std::vector<MainMenuItem*> MainMenuItemsList; ++ ++class ISubMenuProvider ++{ ++ public: ++ virtual ~ISubMenuProvider(); ++ virtual MainMenuItemsList* MainMenuItems() = 0; ++ virtual cOsdMenu* OpenSubMenu(int mainMenuItemIndex) = 0; ++}; ++ ++}; ++ ++#endif //__SUBMENUPATCH_H |