2004-12-30 23:43:55 +01:00
|
|
|
/*
|
2010-06-08 07:56:14 +02:00
|
|
|
* $Id: setup.c,v 1.5.2.4 2010/06/08 05:56:15 schmirl Exp $
|
2004-12-30 23:43:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <vdr/menuitems.h>
|
|
|
|
|
|
|
|
#include "client/setup.h"
|
|
|
|
#include "client/device.h"
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
cStreamdevClientSetup StreamdevClientSetup;
|
|
|
|
|
|
|
|
cStreamdevClientSetup::cStreamdevClientSetup(void) {
|
|
|
|
StartClient = false;
|
|
|
|
RemotePort = 2004;
|
|
|
|
StreamFilters = false;
|
2008-04-07 16:50:32 +02:00
|
|
|
HideMenuEntry = false;
|
2009-01-29 08:49:04 +01:00
|
|
|
MinPriority = -1;
|
|
|
|
MaxPriority = MAXPRIORITY;
|
2004-12-30 23:43:55 +01:00
|
|
|
strcpy(RemoteIp, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cStreamdevClientSetup::SetupParse(const char *Name, const char *Value) {
|
|
|
|
if (strcmp(Name, "StartClient") == 0) StartClient = atoi(Value);
|
|
|
|
else if (strcmp(Name, "RemoteIp") == 0) {
|
|
|
|
if (strcmp(Value, "-none-") == 0)
|
|
|
|
strcpy(RemoteIp, "");
|
|
|
|
else
|
|
|
|
strcpy(RemoteIp, Value);
|
|
|
|
}
|
|
|
|
else if (strcmp(Name, "RemotePort") == 0) RemotePort = atoi(Value);
|
|
|
|
else if (strcmp(Name, "StreamFilters") == 0) StreamFilters = atoi(Value);
|
2008-04-07 16:50:32 +02:00
|
|
|
else if (strcmp(Name, "HideMenuEntry") == 0) HideMenuEntry = atoi(Value);
|
2009-02-03 11:26:23 +01:00
|
|
|
else if (strcmp(Name, "MinPriority") == 0) MinPriority = atoi(Value);
|
|
|
|
else if (strcmp(Name, "MaxPriority") == 0) MaxPriority = atoi(Value);
|
2004-12-30 23:43:55 +01:00
|
|
|
else return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
cStreamdevClientMenuSetupPage::cStreamdevClientMenuSetupPage(void) {
|
|
|
|
m_NewSetup = StreamdevClientSetup;
|
|
|
|
|
2009-09-18 12:41:11 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Hide Mainmenu Entry"), &m_NewSetup.HideMenuEntry));
|
|
|
|
Add(new cMenuEditBoolItem(tr("Start Client"), &m_NewSetup.StartClient));
|
|
|
|
Add(new cMenuEditIpItem (tr("Remote IP"), m_NewSetup.RemoteIp));
|
|
|
|
Add(new cMenuEditIntItem (tr("Remote Port"), &m_NewSetup.RemotePort, 0, 65535));
|
|
|
|
Add(new cMenuEditBoolItem(tr("Filter Streaming"), &m_NewSetup.StreamFilters));
|
|
|
|
Add(new cMenuEditIntItem (tr("Minimum Priority"), &m_NewSetup.MinPriority, -1, MAXPRIORITY));
|
|
|
|
Add(new cMenuEditIntItem (tr("Maximum Priority"), &m_NewSetup.MaxPriority, -1, MAXPRIORITY));
|
2004-12-30 23:43:55 +01:00
|
|
|
SetCurrent(Get(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
cStreamdevClientMenuSetupPage::~cStreamdevClientMenuSetupPage() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void cStreamdevClientMenuSetupPage::Store(void) {
|
|
|
|
if (m_NewSetup.StartClient != StreamdevClientSetup.StartClient) {
|
|
|
|
if (m_NewSetup.StartClient)
|
|
|
|
cStreamdevDevice::Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
SetupStore("StartClient", m_NewSetup.StartClient);
|
|
|
|
if (strcmp(m_NewSetup.RemoteIp, "") == 0)
|
|
|
|
SetupStore("RemoteIp", "-none-");
|
|
|
|
else
|
|
|
|
SetupStore("RemoteIp", m_NewSetup.RemoteIp);
|
|
|
|
SetupStore("RemotePort", m_NewSetup.RemotePort);
|
|
|
|
SetupStore("StreamFilters", m_NewSetup.StreamFilters);
|
2008-04-07 16:50:32 +02:00
|
|
|
SetupStore("HideMenuEntry", m_NewSetup.HideMenuEntry);
|
2009-01-29 08:49:04 +01:00
|
|
|
SetupStore("MinPriority", m_NewSetup.MinPriority);
|
|
|
|
SetupStore("MaxPriority", m_NewSetup.MaxPriority);
|
2004-12-30 23:43:55 +01:00
|
|
|
|
|
|
|
StreamdevClientSetup = m_NewSetup;
|
|
|
|
|
|
|
|
cStreamdevDevice::ReInit();
|
|
|
|
}
|
|
|
|
|