summaryrefslogtreecommitdiff
path: root/setup.c
blob: 0b8578288924db792291e084e96e77e41fc7e139 (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
#include "setup.h"

cSkinDesignerSetup::cSkinDesignerSetup() {
    data = config;
    Setup();
}

cSkinDesignerSetup::~cSkinDesignerSetup() {
}


void cSkinDesignerSetup::Setup(void) {
    int current = Current();
    Clear();

    Add(new cMenuEditBoolItem(tr("Debug Image Loading"), &data.debugImageLoading));

    Add(new cMenuEditBoolItem(tr("Limit Channel Logo Cache"), &data.limitLogoCache));
    Add(new cMenuEditIntItem(tr("Number to cache initially (per size)"), &data.numLogosPerSizeInitial, 0, 1000));
    Add(new cMenuEditIntItem(tr("Number to cache in maximum"), &data.numLogosMax, 0, 1000));

    cString message = cString::sprintf("--------------------- %s ---------------------", tr("Cache Statistics"));
    Add(new cOsdItem(*message));
    cList<cOsdItem>::Last()->SetSelectable(false);

    int sizeIconCache = 0;
    int numIcons = 0;
    imgCache->GetIconCacheSize(numIcons, sizeIconCache);
    cString iconCacheInfo = cString::sprintf("%s %d %s - %s %d %s", tr("cached"), numIcons, tr("icons"), tr("size"), sizeIconCache, tr("byte"));
    Add(new cOsdItem(*iconCacheInfo));
    cList<cOsdItem>::Last()->SetSelectable(false);
    
    int sizeLogoCache = 0;
    int numLogos = 0;
    imgCache->GetLogoCacheSize(numLogos, sizeLogoCache);
    cString logoCacheInfo = cString::sprintf("%s %d %s - %s %d %s", tr("cached"), numLogos, tr("logos"), tr("size"), sizeLogoCache, tr("byte"));
    Add(new cOsdItem(*logoCacheInfo));
    cList<cOsdItem>::Last()->SetSelectable(false);

    int sizeSkinpartCache = 0;
    int numSkinparts = 0;
    imgCache->GetSkinpartsCacheSize(numSkinparts, sizeSkinpartCache);
    cString skinpartCacheInfo = cString::sprintf("%s %d %s - %s %d %s", tr("cached"), numSkinparts, tr("skinparts"), tr("size"), sizeSkinpartCache, tr("byte"));
    Add(new cOsdItem(*skinpartCacheInfo));
    cList<cOsdItem>::Last()->SetSelectable(false);

    SetCurrent(Get(current));
    Display();
}

eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
    eOSState state = cMenuSetupPage::ProcessKey(Key);
    switch (state) {
        case osContinue: {
            if (NORMALKEY(Key) == kUp || NORMALKEY(Key) == kDown) {
                cOsdItem* item = Get(Current());
                if (item)
                    item->ProcessKey(kNone);
            }
            break; }
        default: break;
    }
    return state;
}

void cSkinDesignerSetup::Store(void) {
    config = data;

    SetupStore("DebugImageLoading", config.debugImageLoading);
    SetupStore("LimitChannelLogoCache", config.limitLogoCache);
    SetupStore("NumberLogosInitially", config.numLogosPerSizeInitial);
    SetupStore("NumberLogosMax", config.numLogosMax);
}