summaryrefslogtreecommitdiff
path: root/client/setup.c
blob: 46ad7affa776cb5ac6f105c213e815aea517d159 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 *  $Id: setup.c,v 1.7 2009/01/29 07:48:59 schmirl Exp $
 */
 
#include <vdr/menuitems.h>

#include "client/setup.h"
#include "client/device.h"

cStreamdevClientSetup StreamdevClientSetup;

cStreamdevClientSetup::cStreamdevClientSetup(void) {
	StartClient   = false;
	RemotePort    = 2004;
	StreamFilters = false;
	SyncEPG       = false;
	HideMenuEntry = false;
	MinPriority   = -1;
	MaxPriority   = MAXPRIORITY;
	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);
	else if (strcmp(Name, "SyncEPG") == 0)       SyncEPG = atoi(Value);
	else if (strcmp(Name, "HideMenuEntry") == 0) HideMenuEntry = atoi(Value);
	else if (strcmp(Name, "MinPriority") == 0) HideMenuEntry = atoi(Value);
	else if (strcmp(Name, "MaxPriority") == 0) HideMenuEntry = atoi(Value);
	else return false;
	return true;
}

cStreamdevClientMenuSetupPage::cStreamdevClientMenuSetupPage(void) {
	m_NewSetup = StreamdevClientSetup;

	AddBoolEdit (tr("Hide Mainmenu Entry"),m_NewSetup.HideMenuEntry);
	AddBoolEdit (tr("Start Client"),       m_NewSetup.StartClient);
	AddIpEdit   (tr("Remote IP"),          m_NewSetup.RemoteIp);
	AddShortEdit(tr("Remote Port"),        m_NewSetup.RemotePort);
	AddBoolEdit (tr("Filter Streaming"),   m_NewSetup.StreamFilters);
	AddBoolEdit (tr("Synchronize EPG"),    m_NewSetup.SyncEPG);
	AddRangeEdit (tr("Minimum Priority"),  m_NewSetup.MinPriority, -1, MAXPRIORITY);
	AddRangeEdit (tr("Maximum Priority"),  m_NewSetup.MaxPriority, -1, MAXPRIORITY);
	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);
	SetupStore("SyncEPG",       m_NewSetup.SyncEPG);
	SetupStore("HideMenuEntry", m_NewSetup.HideMenuEntry);
	SetupStore("MinPriority",   m_NewSetup.MinPriority);
	SetupStore("MaxPriority",   m_NewSetup.MaxPriority);

	StreamdevClientSetup = m_NewSetup;

	cStreamdevDevice::ReInit();
}