2014-09-27 09:25:14 +02:00
|
|
|
#include "displayvolume.h"
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "libcore/helpers.h"
|
|
|
|
|
|
|
|
cSDDisplayVolume::cSDDisplayVolume(cTemplate *volumeTemplate) {
|
2015-01-18 12:03:06 +01:00
|
|
|
volumeView = NULL;
|
2014-09-27 09:25:14 +02:00
|
|
|
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() {
|
2015-01-18 12:03:06 +01:00
|
|
|
if (volumeView)
|
|
|
|
delete volumeView;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|