summaryrefslogtreecommitdiff
path: root/setup.c
blob: bed7b06bf556e6997bc34660242d62a2e77b5b4c (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#include <vdr/menuitems.h>
#include "config.h"
#include "setup.h"

extern cSkinPearlHDConfig PearlHDConfig;

// --- cSkinPearlHDSetupMenu ------------------------------------------------------
class cSkinPearlHDSetupMenu : public cOsdMenu
{
private:
   cSkinPearlHDConfig *tmpconfig;
   void Setup(void);
   const char *EpgImagesFormatItems[2];
   const char *RecTitleInfoItems[3];

protected:
   virtual eOSState ProcessKey(eKeys Key);

public:
   cSkinPearlHDSetupMenu(cSkinPearlHDConfig *tmpPearlHDConfig);
   virtual ~cSkinPearlHDSetupMenu();
};

cSkinPearlHDSetupMenu::cSkinPearlHDSetupMenu(cSkinPearlHDConfig *tmpConfig)
:cOsdMenu("", 33)
{
   SetTitle(cString::sprintf("%s - '%s' %s", trVDR("Setup"), "PearlHD", tr("General")));

   tmpconfig = tmpConfig;
   EpgImagesFormatItems[0] = "png";
   EpgImagesFormatItems[1] = "jpg";
   
   RecTitleInfoItems[0] = tr("Don't show");
   RecTitleInfoItems[1] = tr("Top");
   RecTitleInfoItems[2] = tr("Bottom");

   Setup();
}

cSkinPearlHDSetupMenu::~cSkinPearlHDSetupMenu()
{
}


void cSkinPearlHDSetupMenu::Setup(void)
{
  Add(new cMenuEditBoolItem(tr("Display oClock text"), &tmpconfig->oClockText));
  Add(new cMenuEditBoolItem(tr("Display clock in Recordings/Timer menu"), &tmpconfig->RecShowClock));
  Add(new cMenuEditBoolItem(tr("Display epg images"), &tmpconfig->DisplayEpgImages));
  Add(new cMenuEditStraItem(tr("Epg images format"), &tmpconfig->EpgImagesFormat, 2, EpgImagesFormatItems));
  Add(new cMenuEditIntItem(tr("Padding sides"), &tmpconfig->MenuPaddingWidth));
  Add(new cMenuEditIntItem(tr("Padding top/bottom"), &tmpconfig->MenuPaddingHeight));
  Add(new cMenuEditIntItem(tr("Item line height"), &tmpconfig->LineHeight));
  Add(new cMenuEditBoolItem(tr("Show running recordings in the header"), &tmpconfig->RecTitleInfoHead));
  Add(new cMenuEditStraItem(tr("Show timers in the right bar at"), &tmpconfig->RecTitleInfo, 3, RecTitleInfoItems));
}

eOSState cSkinPearlHDSetupMenu::ProcessKey(eKeys Key)
{
   eOSState state = cOsdMenu::ProcessKey(Key);

   if (state == osUnknown) {
      switch (Key) {
         case kOk:
         case kBack:
               state = osBack;
               break;
         default: break;
      }
   }

   return state;
}

// --- cSkinPearlHDSetupChannelInfo ------------------------------------------------------
class cSkinPearlHDSetupChannelInfo : public cOsdMenu
{
private:
   cSkinPearlHDConfig *tmpconfig;
   void Setup(void);
   const char * ChannelLogoPosItems[3];
   const char * ChannelLogoFormatItems[2];

protected:
   virtual eOSState ProcessKey(eKeys Key);

public:
   cSkinPearlHDSetupChannelInfo(cSkinPearlHDConfig *tmpConfig);
   virtual ~cSkinPearlHDSetupChannelInfo();
};

cSkinPearlHDSetupChannelInfo::cSkinPearlHDSetupChannelInfo(cSkinPearlHDConfig *tmpConfig)
:cOsdMenu("", 33)
{
   SetTitle(cString::sprintf("%s - '%s' %s", trVDR("Setup"), "PearlHD", tr("Channel Info")));

   tmpconfig = tmpConfig;
   
   ChannelLogoPosItems[0] = tr("Don't show");
   ChannelLogoPosItems[1] = tr("Left");
   ChannelLogoPosItems[2] = tr("Right");
   
   ChannelLogoFormatItems[0] = "png";
   ChannelLogoFormatItems[1] = "jpg";

   Setup();
}

cSkinPearlHDSetupChannelInfo::~cSkinPearlHDSetupChannelInfo()
{
}

void cSkinPearlHDSetupChannelInfo::Setup(void)
{
  Add(new cMenuEditStraItem(tr("Channel logo position"), &tmpconfig->ChannelLogoPos, 3,  ChannelLogoPosItems));
  Add(new cMenuEditStraItem(tr("Channel logo format"), &tmpconfig->ChannelLogoFormat, 2,  ChannelLogoFormatItems));
  Add(new cMenuEditStrItem(tr("Button red text"), &tmpconfig->ButtonRedText[0], 20));
  Add(new cMenuEditStrItem(tr("Button green text"), &tmpconfig->ButtonGreenText[0], 20));
  Add(new cMenuEditStrItem(tr("Button yellow text"), &tmpconfig->ButtonYellowText[0], 20));
  Add(new cMenuEditStrItem(tr("Button blue text"), &tmpconfig->ButtonBlueText[0], 20));
  Add(new cMenuEditBoolItem(tr("Display crypt symbols"), &tmpconfig->CryptSymbols));
  Add(new cMenuEditIntItem(tr("Padding sides"), &tmpconfig->ChannelInfoPadding));
}

eOSState cSkinPearlHDSetupChannelInfo::ProcessKey(eKeys Key)
{
   eOSState state = cOsdMenu::ProcessKey(Key);

   if (state == osUnknown) {
      switch (Key) {
         case kOk:
         case kBack:
               state = osBack;
               break;
         default: break;
      }
   }
   return state;
}


// --- cSkinPearlHDSetup ------------------------------------------------------
cSkinPearlHDSetup::cSkinPearlHDSetup(void)
{
   tmpPearlHDConfig = PearlHDConfig;

   Setup();
}

cSkinPearlHDSetup::~cSkinPearlHDSetup()
{
}

void cSkinPearlHDSetup::Setup(void)
{
   Add(new cOsdItem(tr("Channel Info"), osUser1));
   Add(new cOsdItem(tr("Menu"), osUser2));
}

eOSState cSkinPearlHDSetup::ProcessKey(eKeys Key)
{
   bool hadSubMenu = HasSubMenu();
   eOSState state = cOsdMenu::ProcessKey(Key);

   if (hadSubMenu && !HasSubMenu() && Key == kOk)
      Store();

   switch (state) {
      case osUser1:
         AddSubMenu(new cSkinPearlHDSetupChannelInfo(&tmpPearlHDConfig));
         state=osContinue;
         break;
      case osUser2:
	     AddSubMenu(new cSkinPearlHDSetupMenu(&tmpPearlHDConfig));
         state=osContinue;
         break;
      default:
         break;
   }
   return state;
}

void cSkinPearlHDSetup::Store(void)
{
   PearlHDConfig = tmpPearlHDConfig;

   SetupStore("ChannelLogoPos", PearlHDConfig.ChannelLogoPos);
   SetupStore("ChannelLogoFormat", PearlHDConfig.ChannelLogoFormat);
   SetupStore("ButtonRedText", PearlHDConfig.ButtonRedText);
   SetupStore("ButtonGreenText", PearlHDConfig.ButtonGreenText);
   SetupStore("ButtonYellowText", PearlHDConfig.ButtonYellowText);
   SetupStore("ButtonBlueText", PearlHDConfig.ButtonBlueText);
   SetupStore("CryptSymbols", PearlHDConfig.CryptSymbols);
   SetupStore("oClockText", PearlHDConfig.oClockText);
   SetupStore("RecShowClock", PearlHDConfig.RecShowClock);
   SetupStore("DisplayEpgImages", PearlHDConfig.DisplayEpgImages);
   SetupStore("EpgImagesFormat", PearlHDConfig.EpgImagesFormat);
   SetupStore("MenuPaddingWidth", PearlHDConfig.MenuPaddingWidth);
   SetupStore("MenuPaddingHeight", PearlHDConfig.MenuPaddingHeight);
   SetupStore("LineHeight", PearlHDConfig.LineHeight);
   SetupStore("ChannelInfoPadding", PearlHDConfig.ChannelInfoPadding);
   SetupStore("RecTitleInfoHead", PearlHDConfig.RecTitleInfoHead);
   SetupStore("RecTitleInfo", PearlHDConfig.RecTitleInfo);
}