summaryrefslogtreecommitdiff
path: root/Config.h
blob: 41994dd2b175bb1ad30d0414f7a0ae8f6f541201 (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
#ifndef CONFIG_H
#define CONFIG_H

#include <Poco/UUID.h>
#include <Poco/UUIDGenerator.h>
#include <string>
#include <vector>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

//VDR
#include <vdr/osd.h>
#include <vdr/menuitems.h>

#define STRING_SIZE 256

struct ViewEntry {
	std::string Name;
	std::string PlexPath;
};

enum ViewMode {
	Cover = 0,
	List = 1,
	Detail = 2
};

class Config
{
	
public:
	static Config& GetInstance() {
		static Config instance;
		return instance;
	}
	static const char* viewModeNames[];

	std::string s_username;
	std::string s_password;
	std::string s_serverHost;
	int ServerPort;
	
	bool HideMainMenuEntry;
	bool UseCustomTranscodeProfile;
	bool UsePlexAccount;
	bool UseConfiguredServer;
	
	int CoverGridColumns;
	int CoverGridRows;
	
	int ListGridColumns;
	int ListGridRows;
	
	int DetailGridColumns;
	int DetailGridRows;
	
	ViewMode DefaultViewMode;
	
	std::vector<ViewEntry> m_viewentries;
	std::vector<ViewEntry> m_serverViewentries;
	
	bool ScrollByPage;
	bool ScrollAllAround;
	bool UseMpv;
	
	std::string GetUUID();
	void SetUUID(const char* uuid);
	std::string GetHostname();
	std::string GetLanguage();
	std::string GetUsername();
	std::string GetPassword();
	int ThumbHeight() { return 1080 / CoverGridRows; };
	int ThumbWidth() { return 1920 / CoverGridColumns; };
	int ArtHeight() { return 1080 / 4; };
	int ArtWidth() { return 1920 / 4; };
	int BannerHeight() { return 1080 / 2; };
	int BannerWidth() { return 1920 / 2; };
	
	bool Parse(const char *name, const char *value);
	

private:
	Config();
	std::string s_uuid;
	std::string s_hostname;
};


//////////////////////////////////////////////////////////////////////////////
//	cMenuSetupPage
//////////////////////////////////////////////////////////////////////////////

/**
**	Play plugin menu setup page class.
*/
class cMyMenuSetupPage:public cMenuSetupPage
{
  protected:
	char Username[STRING_SIZE];
	char Password[STRING_SIZE];
	char Uuid[STRING_SIZE];
	char ServerHost[STRING_SIZE];
	int ServerPort;
	int UseConfiguredServer;
	int HideMainMenuEntry;
	int UseCustomTranscodeProfile;
	int UsePlexAccount;
	int CoverGridColumns;
	int CoverGridRows;
	int DetailGridColumns;
	int DetailGridRows;
	int ListGridColumns;
	int ListGridRows;
	int DefaultViewMode;
	int UseMpv;
	int ScrollByPage;
	int ScrollAllAround;

    virtual void Store(void);

  public:
     cMyMenuSetupPage(void);
    virtual eOSState ProcessKey(eKeys);	// handle input
};

#endif // CONFIG_H