-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.c
92 lines (81 loc) · 4.38 KB
/
setup.c
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
//////////////////////////////////////////////////////////////////////////////
/// ///
/// This file is part of the VDR mpv plugin and licensed under AGPLv3 ///
/// ///
/// See the README file for copyright information ///
/// ///
//////////////////////////////////////////////////////////////////////////////
#include "setup.h"
#include "config.h"
cMpvPluginSetup::cMpvPluginSetup()
{
SetupHideMainMenuEntry = MpvPluginConfig->HideMainMenuEntry;
SetupUseDeinterlace = MpvPluginConfig->UseDeinterlace;
SetupUsePassthrough = MpvPluginConfig->UsePassthrough;
SetupUseDtsHdPassthrough = MpvPluginConfig->UseDtsHdPassthrough;
SetupPlaylistOnNextKey = MpvPluginConfig->PlaylistOnNextKey;
SetupPlaylistIfNoChapters = MpvPluginConfig->PlaylistIfNoChapters;
SetupStereoDownmix = MpvPluginConfig->StereoDownmix;
SetupShowMediaTitle = MpvPluginConfig->ShowMediaTitle;
SetupShowSubtitles = MpvPluginConfig->ShowSubtitles;
SetupExitAtEnd = MpvPluginConfig->ExitAtEnd;
SetupShowAfterStop = MpvPluginConfig->ShowAfterStop;
SetupSavePos = MpvPluginConfig->SavePos;
SetupSoftVol = MpvPluginConfig->SoftVol;
Setup();
}
eOSState cMpvPluginSetup::ProcessKey(eKeys key)
{
int oldUsePassthrough = SetupUsePassthrough;
int oldSoftVol = SetupSoftVol;
int oldPlaylistOnNextKey = SetupPlaylistOnNextKey;
int oldSetupExitAtEnd = SetupExitAtEnd;
eOSState state = cMenuSetupPage::ProcessKey(key);
if (key != kNone && (SetupUsePassthrough != oldUsePassthrough || SetupPlaylistOnNextKey != oldPlaylistOnNextKey ||
SetupSoftVol != oldSoftVol || SetupExitAtEnd != oldSetupExitAtEnd))
Setup();
return state;
}
void cMpvPluginSetup::Setup()
{
static const char *const show_after_stop[] = {
tr("Black screen"), tr("Filebrowser"),
};
int current = Current();
Clear();
Add(new cMenuEditBoolItem(tr("Hide main menu entry"), &SetupHideMainMenuEntry, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Video Deinterlace"), &SetupUseDeinterlace));
Add(new cMenuEditBoolItem(tr("Audio Passthrough"), &SetupUsePassthrough));
if (SetupUsePassthrough)
Add(new cMenuEditBoolItem(tr("DTS-HD Passthrough"), &SetupUseDtsHdPassthrough));
else
Add(new cMenuEditBoolItem(tr("Enable stereo downmix"), &SetupStereoDownmix));
Add(new cMenuEditBoolItem(tr("Software volume control"), &SetupSoftVol));
Add(new cMenuEditBoolItem(tr("Use prev/next keys for playlist control"), &SetupPlaylistOnNextKey));
if (!SetupPlaylistOnNextKey)
Add(new cMenuEditBoolItem(tr("Control playlist if no chapters in file"), &SetupPlaylistIfNoChapters));
Add(new cMenuEditBoolItem(tr("Show media title instead of filename"), &SetupShowMediaTitle));
Add(new cMenuEditBoolItem(tr("Show subtitles"), &SetupShowSubtitles));
Add(new cMenuEditBoolItem(tr("Exit at the end"), &SetupExitAtEnd));
if (!SetupExitAtEnd)
Add(new cMenuEditStraItem(tr("Show after stop"), &SetupShowAfterStop, 2, show_after_stop));
Add(new cMenuEditBoolItem(tr("Save position on quit"), &SetupSavePos));
SetCurrent(Get(current));
Display();
}
void cMpvPluginSetup::Store()
{
SetupStore("HideMainMenuEntry", MpvPluginConfig->HideMainMenuEntry = SetupHideMainMenuEntry);
SetupStore("UseDeinterlace", MpvPluginConfig->UseDeinterlace = SetupUseDeinterlace);
SetupStore("UsePassthrough", MpvPluginConfig->UsePassthrough = SetupUsePassthrough);
SetupStore("UseDtsHdPassthrough", MpvPluginConfig->UseDtsHdPassthrough = SetupUseDtsHdPassthrough);
SetupStore("StereoDownmix", MpvPluginConfig->StereoDownmix = SetupStereoDownmix);
SetupStore("PlaylistOnNextKey", MpvPluginConfig->PlaylistOnNextKey = SetupPlaylistOnNextKey);
SetupStore("PlaylistIfNoChapters", MpvPluginConfig->PlaylistIfNoChapters = SetupPlaylistIfNoChapters);
SetupStore("ShowMediaTitle", MpvPluginConfig->ShowMediaTitle = SetupShowMediaTitle);
SetupStore("ShowSubtitles", MpvPluginConfig->ShowSubtitles = SetupShowSubtitles);
SetupStore("ExitAtEnd", MpvPluginConfig->ExitAtEnd = SetupExitAtEnd);
SetupStore("ShowAfterStop", MpvPluginConfig->ShowAfterStop = SetupShowAfterStop);
SetupStore("SavePos", MpvPluginConfig->SavePos = SetupSavePos);
SetupStore("SoftVol", MpvPluginConfig->SoftVol = SetupSoftVol);
}