summaryrefslogtreecommitdiff
path: root/libcore/skinrepo.h
blob: c3daaf06f69bda94bbee6186af819c4260be2b2e (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
#ifndef __SKINREPO_H
#define __SKINREPO_H

#include <string>
#include <vector>
#include <map>
#include <set>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include <vdr/plugin.h>

using namespace std;

enum eRepoType {
    rtUndefined,
    rtGit,
    rtZipUrl
};

// --- cSkinRepo -------------------------------------------------------------

class cSkinRepo : public cThread {
private:
    string name;
    eRepoType repoType;
    string url;
    vector<string> specialFonts;
    vector<string> supportedPlugins;
    vector< pair < string, string > > screenshots;
    //helpers for execution
    string command;
    string tempfile;
    int result;
    virtual void Action(void);
public:
    cSkinRepo(void);
    virtual ~cSkinRepo(void);
    void SetName(string name) { this->name = name; };
    void SetRepoType(eRepoType type) { this->repoType = type; };
    void SetUrl(string url) { this->url = url; };
    void SetSpecialFont(string font) { specialFonts.push_back(font); };
    void SetSupportedPlugin(string plugin) { supportedPlugins.push_back(plugin); };
    void SetScreenshot(string desc, string url) { screenshots.push_back(pair<string, string>(desc, url)); };
    string Name(void) { return name; };
    void Install(string path);
    bool InstallationFinished(void) { return !(Running()); };
    void Debug(void);
};

// --- cSkinRepos -------------------------------------------------------------

class cSkinRepos {
private:
    string repoFile;
    xmlDocPtr doc;
    vector<cSkinRepo*> repos;
    void ReadRepository(xmlNodePtr node);
public:
    cSkinRepos(void);
    virtual ~cSkinRepos(void);
    void Read(string path);
    cSkinRepo *GetRepo(string name);
    void Debug(void);
};

#endif //__SKINREPO_H