summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--live.cpp4
-rw-r--r--setup.cpp45
-rw-r--r--setup.h34
3 files changed, 80 insertions, 3 deletions
diff --git a/live.cpp b/live.cpp
index e5f97ff..9997a8d 100644
--- a/live.cpp
+++ b/live.cpp
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: live.cpp,v 1.13 2007/01/18 18:29:30 lordjaxom Exp $
+ * $Id: live.cpp,v 1.14 2007/04/26 16:17:36 thomas Exp $
*/
#include <vdr/plugin.h>
@@ -69,7 +69,7 @@ cString Plugin::Active(void)
cMenuSetupPage *Plugin::SetupMenu(void)
{
- return NULL;
+ return new cMenuSetupLive();
}
bool Plugin::SetupParse(const char *Name, const char *Value)
diff --git a/setup.cpp b/setup.cpp
index 0c78d5a..7b48cd9 100644
--- a/setup.cpp
+++ b/setup.cpp
@@ -8,8 +8,10 @@
#include <getopt.h>
#include <stdint.h>
#include <unistd.h>
+#include <string>
#include <arpa/inet.h>
#include <vdr/tools.h>
+#include <vdr/menuitems.h>
#include "setup.h"
namespace vdrlive {
@@ -19,7 +21,10 @@ using namespace std;
Setup::Setup():
m_serverPort( 8001 ),
m_lastChannel( 0 ),
- m_screenshotInterval( 1000 )
+ m_screenshotInterval( 1000 ),
+ m_useAuth( 1 ),
+ m_adminLogin("admin"),
+ m_adminPassword("live")
{
}
@@ -62,6 +67,9 @@ bool Setup::ParseSetupEntry( char const* name, char const* value )
{
if ( strcmp( name, "LastChannel" ) == 0 ) m_lastChannel = atoi( value );
else if ( strcmp( name, "ScreenshotInterval" ) == 0 ) m_screenshotInterval = atoi( value );
+ else if ( strcmp( name, "UseAuth" ) == 0 ) m_useAuth = atoi( value );
+ else if ( strcmp( name, "AdminLogin" ) == 0 ) m_adminLogin = value;
+ else if ( strcmp( name, "AdminPassword" ) == 0 ) m_adminPassword = value;
else return false;
return true;
}
@@ -100,3 +108,38 @@ Setup& LiveSetup()
}
} // namespace vdrlive
+
+cMenuSetupLive::cMenuSetupLive():
+ cMenuSetupPage()
+{
+ m_lastChannel = vdrlive::LiveSetup().GetLastChannel();
+ m_useAuth = vdrlive::LiveSetup().UseAuth();
+ strcpy(m_adminLogin, vdrlive::LiveSetup().GetAdminLogin().c_str());
+ strcpy(m_adminPassword, vdrlive::LiveSetup().GetAdminPassword().c_str());
+
+ Clear();
+ //Add(new cMenuEditIntItem(tr("Last channel to display"), &m_lastChannel, 0, 65536));
+ Add(new cMenuEditChanItem(tr("Last channel to display"), &m_lastChannel, tr("No limit")));
+ //Add(new cMenuEditIntItem(tr("Screenshot interval"), &m_lastChannel, 0, 65536));
+ Add(new cMenuEditBoolItem(tr("Use authentication"), &m_useAuth, tr("No"), tr("Yes")));
+ Add(new cMenuEditStrItem( tr("Admin login"), m_adminLogin, 12, tr(FileNameChars)));
+ Add(new cMenuEditStrItem( tr("Admin password"), m_adminPassword, 12, tr(FileNameChars)));
+ Display();
+}
+
+void cMenuSetupLive::Store(void)
+{
+ vdrlive::LiveSetup().SetLastChannel(m_lastChannel);
+ SetupStore("LastChannel", m_lastChannel);
+
+ vdrlive::LiveSetup().SetUseAuth(m_useAuth);
+ SetupStore("UseAuth", m_useAuth);
+
+ vdrlive::LiveSetup().SetAdminLogin(m_adminLogin);
+ SetupStore("AdminLogin", m_adminLogin);
+
+ vdrlive::LiveSetup().SetAdminPassword(m_adminPassword);
+ SetupStore("AdminPassword", m_adminPassword);
+}
+
+
diff --git a/setup.h b/setup.h
index b3e39f0..a41baa1 100644
--- a/setup.h
+++ b/setup.h
@@ -5,12 +5,14 @@
#include <numeric>
#include <string>
#include "live.h"
+#include <vdr/menuitems.h>
namespace vdrlive {
class Setup
{
friend Setup& LiveSetup();
+ friend class cMenuSetupLive;
public:
typedef std::list< std::string > IpList;
@@ -21,6 +23,15 @@ public:
// vdr-setup
int GetLastChannel() const { return m_lastChannel == 0 ? std::numeric_limits< int >::max() : m_lastChannel; }
int GetScreenshotInterval() const { return m_screenshotInterval; }
+ std::string GetAdminLogin() const { return m_adminLogin; }
+ std::string GetAdminPassword() const { return m_adminPassword; }
+ bool UseAuth() const { return m_useAuth; }
+
+ void SetLastChannel(int lastChannel) { m_lastChannel = lastChannel; }
+ void SetAdminLogin(std::string login) { m_adminLogin = login; }
+ void SetAdminPassword(std::string password) { m_adminPassword = password; }
+ void SetUseAuth(int auth) { m_useAuth = auth; }
+ void SetScrenshotInterval(int interval) { m_screenshotInterval = interval; }
bool ParseCommandLine( int argc, char* argv[] );
char const* CommandLineHelp() const;
@@ -38,6 +49,10 @@ private:
// setup options
int m_lastChannel;
int m_screenshotInterval;
+
+ int m_useAuth;
+ std::string m_adminLogin;
+ std::string m_adminPassword;
bool CheckServerPort();
bool CheckServerIps();
@@ -47,4 +62,23 @@ Setup& LiveSetup();
} // namespace vdrlive
+class cMenuSetupLive : public cMenuSetupPage {
+
+protected:
+ virtual void Store(void);
+// virtual eOSState ProcessKey(eKeys Key);
+
+public:
+ cMenuSetupLive();
+
+private:
+ int m_lastChannel;
+ int m_screenshotInterval;
+
+ int m_useAuth;
+ char m_adminLogin[20];
+ char m_adminPassword[20];
+};
+
+
#endif // VDR_LIVE_SETUP_H