summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMountainMan <MountainMan@e10066b5-e1e2-0310-b819-94efdf66514b>2004-02-02 22:33:24 +0000
committerMountainMan <MountainMan@e10066b5-e1e2-0310-b819-94efdf66514b>2004-02-02 22:33:24 +0000
commita1e64b757a9363827797732a3785034e216f0678 (patch)
tree2ab20e0fe31152a4d493b45e3aeeefd9eb6b88e1
parent9655ee972793a013efd5af1cf9000e7109533a95 (diff)
downloadvdr-plugin-muggle-a1e64b757a9363827797732a3785034e216f0678.tar.gz
vdr-plugin-muggle-a1e64b757a9363827797732a3785034e216f0678.tar.bz2
changes in mgFilter classes (and ttheir use in the osd)
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@20 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r--mg_media.c44
-rw-r--r--mg_media.h42
-rw-r--r--vdr_menu.c23
3 files changed, 74 insertions, 35 deletions
diff --git a/mg_media.c b/mg_media.c
index 2f9c1d2..6f00ea1 100644
--- a/mg_media.c
+++ b/mg_media.c
@@ -3,10 +3,10 @@
* \brief Top level access to media in vdr plugin muggle
* for the vdr muggle plugindatabase
********************************************************************
- * \version $Revision: 1.5 $
- * \date $Date: 2004/02/02 19:42:18 $
+ * \version $Revision: 1.6 $
+ * \date $Date: 2004/02/02 22:33:24 $
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
- * \author file owner: $Author: LarsAC $
+ * \author file owner: $Author: MountainMan $
*
*
*/
@@ -78,11 +78,14 @@ int mgFilterInt::getMax()
//-------------------------------------------------------------------
// mgFilterString
//-------------------------------------------------------------------
-mgFilterString::mgFilterString(const char *name, const char* value)
+mgFilterString::mgFilterString(const char *name, const char* value,
+ int maxlen, string allowedchar)
: mgFilter(name)
{
m_type = STRING;
m_strval = strdup(value);
+ m_allowedchar = allowedchar;
+ m_maxlen = maxlen;
}
mgFilterString::~mgFilterString()
{
@@ -91,7 +94,16 @@ mgFilterString::~mgFilterString()
free(m_strval);
}
}
+
+int mgFilterString::getMaxLength()
+{
+ return m_maxlen;
+}
+string mgFilterString::getAllowedChars()
+{
+ return m_allowedchar;
+}
string mgFilterString::getStrVal()
{
@@ -101,11 +113,15 @@ string mgFilterString::getStrVal()
//-------------------------------------------------------------------
// mgFilterBool
//-------------------------------------------------------------------
-mgFilterBool::mgFilterBool(const char *name, bool value)
+mgFilterBool::mgFilterBool(const char *name, bool value,
+ string truestr, string falsestr)
: mgFilter(name)
{
m_type = BOOL;
- m_bval = value;
+ m_bval = (bool) value;
+ m_truestr = truestr;
+ m_falsestr = falsestr;
+
}
mgFilterBool::~mgFilterBool()
{
@@ -118,11 +134,23 @@ string mgFilterBool::getStrVal()
else
return "false";
}
+string mgFilterBool::getTrueString()
+{
+ return m_truestr;
+}
+string mgFilterBool::getFalseString()
+{
+ return m_falsestr;
+}
+bool mgFilterBool::getVal()
+{
+ return (bool) m_bval;
+}
//-------------------------------------------------------------------
// mgFilterChoice
//-------------------------------------------------------------------
-mgFilterChoice::mgFilterChoice(const char *name, int val, vector<char*> *choices)
+mgFilterChoice::mgFilterChoice(const char *name, int val, vector<string> *choices)
: mgFilter(name)
{
m_choices = *choices;
@@ -145,7 +173,7 @@ string mgFilterChoice::getStrVal()
}
return m_choices[m_selval];
}
-vector<char*> &mgFilterChoice::getChoices()
+vector<string> &mgFilterChoice::getChoices()
{
return m_choices;
}
diff --git a/mg_media.h b/mg_media.h
index 0df4bd9..e073cbf 100644
--- a/mg_media.h
+++ b/mg_media.h
@@ -3,8 +3,8 @@
* \brief Top level access to media in vdr plugin muggle
* for the vdr muggle plugindatabase
********************************************************************
- * \version $Revision: 1.4 $
- * \date $Date: 2004/02/02 18:34:34 $
+ * \version $Revision: 1.5 $
+ * \date $Date: 2004/02/02 22:33:24 $
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
* \author file owner: $Author: MountainMan $
*
@@ -39,11 +39,11 @@ class mgFilter
char* m_name;
public:
- mgFilter(const char* name);
- virtual ~mgFilter();
- filterType getType();
- const char* getName();
- virtual std::string getStrVal()=0;
+ mgFilter(const char* name);
+ virtual ~mgFilter();
+ filterType getType();
+ const char* getName();
+ virtual std::string getStrVal()=0;
};
/*!
@@ -75,13 +75,18 @@ class mgFilterInt : public mgFilter
class mgFilterString : public mgFilter
{
private:
-
+ std::string m_allowedchar;
+ int m_maxlen;
public:
char* m_strval;
- mgFilterString(const char *name, const char* value);
+ mgFilterString(const char *name, const char* value, int maxlen=255,
+ std::string allowedchar="abcdefghijklmnopqrstuvwxyz0123456789-");
+
virtual ~mgFilterString();
+ int getMaxLength();
+ std::string getAllowedChars();
virtual std::string getStrVal();
};
@@ -92,15 +97,20 @@ class mgFilterString : public mgFilter
class mgFilterBool : public mgFilter
{
private:
-
+ std::string m_truestr;
+ std::string m_falsestr;
+
public:
- bool m_bval;
+ int m_bval;
- mgFilterBool(const char *name, bool value);
+ mgFilterBool(const char *name, bool value,
+ std::string truestr="yes", std::string falsestr="no");
virtual ~mgFilterBool();
virtual std::string getStrVal();
-
+ std::string getTrueString();
+ std::string getFalseString();
+ bool getVal();
};
/*!
@@ -110,16 +120,16 @@ class mgFilterBool : public mgFilter
class mgFilterChoice : public mgFilter
{
private:
- std::vector<char* > m_choices;
+ std::vector<std::string> m_choices;
public:
int m_selval; // index of the currently selected item
- mgFilterChoice(const char *name, int val, std::vector<char* > *choices);
+ mgFilterChoice(const char *name, int val, std::vector<std::string> *choices);
virtual ~mgFilterChoice();
virtual std::string getStrVal();
- virtual std::vector<char*> &getChoices();
+ virtual std::vector<std::string> &getChoices();
};
diff --git a/vdr_menu.c b/vdr_menu.c
index 699af2c..e57e997 100644
--- a/vdr_menu.c
+++ b/vdr_menu.c
@@ -2,12 +2,15 @@
/*! \file vdr_menu.c
* \brief Implements menu handling for broswing media libraries within VDR
********************************************************************
- * \version $Revision: 1.3 $
- * \date $Date: 2004/02/02 19:42:37 $
+ * \version $Revision: 1.4 $
+ * \date $Date: 2004/02/02 22:33:24 $
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
- * \author file owner: $Author: LarsAC $
+ * \author file owner: $Author: MountainMan $
*
* $Log: vdr_menu.c,v $
+ * Revision 1.4 2004/02/02 22:33:24 MountainMan
+ * changes in mgFilter classes (and ttheir use in the osd)
+ *
* Revision 1.3 2004/02/02 19:42:37 LarsAC
* Added positioning of menubar when collapsing nodes.
*
@@ -550,19 +553,17 @@ void mgMainMenu::DisplayFilter()
case mgFilter::STRING:
{
mgFilterString *fs = (mgFilterString *) (*iter);
- /*
- Add( new cMenuEditStrItem( fs->getName(), &( fs->m_strval),
- fs->getMaxLength(), fs->getAllowedChars() );
+ Add( new cMenuEditStrItem( fs->getName(), fs->m_strval,
+ fs->getMaxLength(),
+ fs->getAllowedChars().c_str() ) );
- */
} break;
case mgFilter::BOOL:
{
mgFilterBool *fb = (mgFilterBool *) (*iter);
- /*
- Add( new cMenuEditIntItem( fb->getName(), &( fb->m_bval),
- fb->getTrueString(), fb->getFalseString() );
- */
+ Add( new cMenuEditBoolItem( fb->getName(), &( fb->m_bval),
+ fb->getTrueString().c_str(),
+ fb->getFalseString().c_str() ) );
} break;
default:
case mgFilter::UNDEF: