summaryrefslogtreecommitdiff
path: root/vdr_setup.c
blob: 9749380fb2faefa6ae27ae839d5f680e79c94ee4 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*!
 * \file vdr_setup.c
 * \brief A setup class for a VDR media plugin (muggle)
 *
 * \version $Revision: 1.3 $
 * \date    $Date$
 * \author  Ralf Klueber, Lars von Wedel, Andreas Kellner
 * \author  Responsible author: $Author$
 *
 * $Id$
 *
 * Partially adapted from
 * MP3/MPlayer plugin to VDR (C++)
 * (C) 2001,2002 Stefan Huelswitt <huels@iname.com>
 */

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <cstring>

#include "vdr_setup.h"
#include "vdr_actions.h"
#include <vdr/i18n.h>

static const char* chars_allowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_./";

static const char *bgmodes[5];

// --- mgMenuSetup -----------------------------------------------------------

mgMenuSetup::mgMenuSetup () {
	SetSection (tr ("Muggle"));

	// Audio stuff
	Add (new
		cMenuEditBoolItem (tr ("Initial loop mode"),&the_setup.InitLoopMode,
		tr("off"), tr("on") ) );
	Add (new
		cMenuEditBoolItem (tr ("Initial shuffle mode"), &the_setup.InitShuffleMode,
		tr("off"), tr("on") ) );

	Add (new
		cMenuEditBoolItem (tr ("Audio mode"), &the_setup.AudioMode,
		tr ("Round"), tr ("Dither")));

	Add (new
		cMenuEditBoolItem (tr ("Use 48kHz mode only"), &the_setup.Only48kHz,
		tr("no"), tr("yes") ) );

	Add (new
		cMenuEditIntItem (tr ("Normalizer level"),
		&the_setup.TargetLevel, 0, MAX_TARGET_LEVEL));

	Add (new
		cMenuEditIntItem (tr ("Limiter level"),
		&the_setup.LimiterLevel, MIN_LIMITER_LEVEL, 100));

	// Image/cover display
	bgmodes[imgBlack] = tr("Black");
	bgmodes[imgCoverSmall] = tr("Cover small");
	bgmodes[imgCoverBig] = tr("Cover big");
	bgmodes[imgLive] = tr("Live");
	bgmodes[imgBitmap] = tr("Bitmap");
	Add (new
		cMenuEditStraItem (tr ("Image mode"), &the_setup.ImgMode,
		5, bgmodes ) );
	Add (new
		cMenuEditIntItem (tr ("Image show duration (secs)"),
		&the_setup.ImageShowDuration, 1, 100));
	the_setup.CacheDir=(char*)realloc(the_setup.CacheDir,MAX_PATH+1);
	Add (new
		cMenuEditStrItem (tr ("Cache directory"),
		the_setup.CacheDir, MAX_PATH, chars_allowed ) );
	Add (new
		cMenuEditBoolItem (tr ("Use DVB still picture"), &the_setup.UseDeviceStillPicture,
		tr("no"), tr("yes") ) );
	Add (new
		cMenuEditBoolItem (tr ("Show artist first"), &the_setup.ArtistFirst,
		tr("no"), tr("yes") ));
	Add (new
		cMenuEditIntItem (tr ("Fastforward jump (secs)"),
		&the_setup.Jumptime, 1, 100));
	Add (new
		cMenuEditIntItem (tr("Setup.muggle$Transparency for cover"),
		&the_setup.ImgAlpha,1,255));
	// Synchronization
	Add (new
		cMenuEditBoolItem (tr ("Delete stale references"), &the_setup.DeleteStaleReferences,
		tr("no"), tr("yes") ));

	mgAction *a = actGenerate(actSync);
	const char *mn = a->MenuName();
	a->SetText(mn);
	free(const_cast<char*>(mn));
	Add(dynamic_cast<cOsdItem*>(a));
}

void
mgMenuSetup::Store (void) {
	SetupStore ("InitLoopMode", the_setup.InitLoopMode);
	SetupStore ("InitShuffleMode", the_setup.InitShuffleMode);
	SetupStore ("AudioMode", the_setup.AudioMode);
	SetupStore ("DisplayMode", the_setup.DisplayMode);
	SetupStore ("ImgMode", the_setup.ImgMode);
	SetupStore ("TargetLevel", the_setup.TargetLevel);
	SetupStore ("LimiterLevel", the_setup.LimiterLevel);
	SetupStore ("Only48kHz", the_setup.Only48kHz);
	SetupStore ("DeleteStaleReferences", the_setup.DeleteStaleReferences);
	SetupStore ("ImageShowDuration", the_setup.ImageShowDuration);
	SetupStore ("ImgAlpha", the_setup.ImgAlpha);
	SetupStore ("CacheDir", the_setup.CacheDir);
	SetupStore ("ArtistFirst", the_setup.ArtistFirst);
	SetupStore ("Jumptime", the_setup.Jumptime);
	SetupStore ("UseStillPicture", the_setup.UseDeviceStillPicture );
}