summaryrefslogtreecommitdiff
path: root/mymenusetup.h
blob: fe1319c97b6ae711895bbca777eed704c51ed8cb (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
#include <vdr/menu.h>

#if VDRVERSNUM >= 10713
extern cNestedItemList RecordingDirCommands;
#else
extern cCommands RecordingDirCommands;
#endif

#define STRN0CPY(dst, src) \
  do { \
    strn0cpy(dst, src, sizeof(dst)); \
  } while(0)
/*
#define STRN0CPYLOG(dst, src, Name) \
  do { \
    strn0cpy(dst, src, sizeof(dst)); \
    if(strlen(src) >= sizeof(dst)) \
      LOGMSG("WARNING: Setting %s truncated to %s !", Name, dst); \
  } while(0)
*/

#define MAX_RECLIST_COLUMNS 4

#define COLTYPE_NONE		0
#define COLTYPE_BLANK		1
#define COLTYPE_DATE		2
#define COLTYPE_TIME		3
#define COLTYPE_DATETIME	4
#define COLTYPE_LENGTH		5
#define COLTYPE_RATING		6
#define COLTYPE_FILE		7
#define COLTYPE_FILETHENCOMMAND	8
#define MAX_COLTYPES		9



static const char * const RecsPerDir_texts[] = {
  trNOOP("0-9"),
  trNOOP("0-99"),
  trNOOP("0-999"),
  trNOOP("0-9999"),
  trNOOP("0-99999"),
  NULL};


typedef struct {
  int Type;
  char Name[64];
  int Width;
  int Align;
  char Op1[1024];
  char Op2[1024];
} RecListColumnType;



class mySetup
{
 public:
  mySetup();
  RecListColumnType RecListColumn[MAX_RECLIST_COLUMNS];
  int HideMainMenuEntry;
  int ReplaceOrgRecMenu;
  int PatchNew;
  int ShowNewRecs;
  int RecsPerDir;
  int DescendSorting;
  int GoLastReplayed;
  int ReturnToPlugin;
  int ReturnToRec;
  int LimitBandwidth;
  int UseVDRsRecInfoMenu;
  int PatchFont;
  int FileSystemFreeMB;
#if VDRVERSNUM >= 10728
  int SetRecordingCat;
#endif
  int UseCutterQueue;
};

extern mySetup mysetup;

class myMenuSetup:public cMenuSetupPage
{
 private:
  const char *sortingtypetexts[2];
  RecListColumnType reclistcolumn[MAX_RECLIST_COLUMNS];
  int hidemainmenuentry;
  int replaceorgrecmenu;
  int patchnew;
  int shownewrecs;
  int recsperdir;
  int descendsorting;
  int golastreplayed;
  int returntoplugin;
  int limitbandwidth;
  int usevdrsrecinfomenu;
  int patchfont;
  int filesystemfreemb;
#if VDRVERSNUM >= 10728
  int setrecordingcat;
#endif
  int usecutterqueue;
 protected:
  virtual void Store();
 public:
  myMenuSetup();
//  virtual ~myMenuSetup();
  virtual void Set();
  virtual eOSState ProcessKey(eKeys Key);
};

class myMenuSetupColumns:public cOsdMenu
{
 private:
  RecListColumnType * preclistcolumns;
  const char* ColumnType_descriptions[9];
  const char* AlignmentType_names[3];
 public:
  myMenuSetupColumns(RecListColumnType *prlcs);
//  virtual ~myMenuSetupColumns();
  virtual void Set();
  virtual eOSState ProcessKey(eKeys Key);
};

char* IndentMenuItem(const char*, int indentions=1);

static inline cString Label_SubMenu(const char *Label) {
  return cString::sprintf("%s ...", Label);
}
static inline cOsdItem *SubMenuItem(const char *Label, eOSState state) {
  return new cOsdItem(Label_SubMenu(Label), state);
}