summaryrefslogtreecommitdiff
path: root/displayvolume.c
blob: 5efa32ff998a81982a1cd6d049b57a1225567292 (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
#include "displayvolume.h"

#include "config.h"
#include "libcore/helpers.h"

cSDDisplayVolume::cSDDisplayVolume(cTemplate *volumeTemplate) {
    doOutput = true;
    initial = true;
    if (!volumeTemplate) {
        doOutput = false;
        esyslog("skindesigner: displayVolume no valid template - aborting");
        return;
    }
    volumeView = new cDisplayVolumeView(volumeTemplate->GetRootView());
    if (!volumeView->createOsd()) {
        doOutput = false;
    } else {
        volumeView->DrawBackground();
    }
}

cSDDisplayVolume::~cSDDisplayVolume() {
    if (!doOutput)
        return;
    delete volumeView;
}

void cSDDisplayVolume::SetVolume(int Current, int Total, bool Mute) {
    if (!doOutput)
        return;
    volumeView->DrawVolume(Current, Total, Mute);
}

void cSDDisplayVolume::Flush(void) {
    if (!doOutput)
        return;
    if (initial) {
        volumeView->DoFadeIn();
        initial = false;
    } else {
        volumeView->Flush();
    }
}