summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2022-06-03 11:19:50 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2022-06-09 13:46:58 +0200
commitd00bbd3cdd6b4b93ba723feb5cc8ca10c13c57d9 (patch)
tree3d83b0ed65f5a7399f70e64fbc30354d9f560424
parent20a614b36949b34c43ceff2581ac31b71d2be656 (diff)
downloadskin-nopacity-d00bbd3cdd6b4b93ba723feb5cc8ca10c13c57d9.tar.gz
skin-nopacity-d00bbd3cdd6b4b93ba723feb5cc8ca10c13c57d9.tar.bz2
Use VolumeBox for DisplayReplay
Shows the volume box in DisplayReplay. An setup option is added to activate the volume box.
-rw-r--r--config.c2
-rw-r--r--displayreplay.c30
-rw-r--r--displayreplay.h5
-rw-r--r--setup.c3
4 files changed, 40 insertions, 0 deletions
diff --git a/config.c b/config.c
index 17167f2..e306f2a 100644
--- a/config.c
+++ b/config.c
@@ -203,6 +203,8 @@ void cNopacityConfig::LoadDefaults(void) {
conf.insert(std::pair<std::string, int>("replayBorderBottom", 15));
conf.insert(std::pair<std::string, int>("replayFadeTime", 300));
conf.insert(std::pair<std::string, int>("replayFadeOutTime", 300));
+ conf.insert(std::pair<std::string, int>("displayReplayVolume", 1));
+ conf.insert(std::pair<std::string, int>("replayBorderVolumeBottom", 0));
conf.insert(std::pair<std::string, int>("fontReplayHeader", 0));
conf.insert(std::pair<std::string, int>("fontReplay", 0));
//DisplayMessage
diff --git a/displayreplay.c b/displayreplay.c
index 644ce2a..8baa897 100644
--- a/displayreplay.c
+++ b/displayreplay.c
@@ -2,6 +2,7 @@
#include "config.h"
#include "helpers.h"
#include "imageloader.h"
+#include "status.h"
cNopacityDisplayReplay::cNopacityDisplayReplay(bool ModeOnly) : cThread("DisplayReplay") {
initial = true;
@@ -13,6 +14,9 @@ cNopacityDisplayReplay::cNopacityDisplayReplay(bool ModeOnly) : cThread("Display
DrawBackground();
LoadControlIcons();
messageBox = NULL;
+ volumeBox = NULL;
+ lastVolume = statusMonitor->GetVolume();
+ lastVolumeTime = time(NULL);
}
cNopacityDisplayReplay::~cNopacityDisplayReplay() {
@@ -46,6 +50,7 @@ cNopacityDisplayReplay::~cNopacityDisplayReplay() {
osd->DestroyPixmap(pixmapPlay);
osd->DestroyPixmap(pixmapFwd);
delete messageBox;
+ delete volumeBox;
delete osd;
}
@@ -176,6 +181,8 @@ void cNopacityDisplayReplay::SetAlpha(int Alpha) {
pixmapPause->SetAlpha(Alpha);
pixmapPlay->SetAlpha(Alpha);
pixmapFwd->SetAlpha(Alpha);
+ if (volumeBox)
+ volumeBox->SetAlpha(Alpha);
}
void cNopacityDisplayReplay::DrawBackground(void) {
@@ -461,6 +468,7 @@ void cNopacityDisplayReplay::SetJump(const char *Jump) {
}
void cNopacityDisplayReplay::SetMessage(eMessageType Type, const char *Text) {
+ DELETENULL(volumeBox);
DELETENULL(messageBox);
if (!Text)
return;
@@ -471,6 +479,24 @@ void cNopacityDisplayReplay::SetMessage(eMessageType Type, const char *Text) {
Type, Text);
}
+void cNopacityDisplayReplay::DrawVolume(void) {
+ int volume = statusMonitor->GetVolume();
+ if (volume != lastVolume) {
+ if (!volumeBox) {
+ int left = (geoManager->replayWidth - geoManager->volumeWidth) / 2;
+ int top = geoManager->replayHeight - geoManager->volumeHeight - config.GetValue("replayBorderVolumeBottom");
+ volumeBox = new cNopacityVolumeBox(osd, cRect(left, top, geoManager->volumeWidth, geoManager->volumeHeight), fontManager->volumeText);
+ }
+ volumeBox->SetVolume(volume, MAXVOLUME, volume ? false : true);
+ lastVolumeTime = time(NULL);
+ lastVolume = volume;
+ }
+ else {
+ if (volumeBox && (time(NULL) - lastVolumeTime > 2))
+ DELETENULL(volumeBox);
+ }
+}
+
void cNopacityDisplayReplay::Flush(void) {
if (Running())
return;
@@ -478,6 +504,10 @@ void cNopacityDisplayReplay::Flush(void) {
if (!modeOnly) {
DrawDate();
}
+
+ if (config.GetValue("displayReplayVolume"))
+ DrawVolume();
+
if (initial && config.GetValue("animation") && config.GetValue("replayFadeTime")) {
SetAlpha(0);
Start();
diff --git a/displayreplay.h b/displayreplay.h
index 58be8cc..dfcf3d6 100644
--- a/displayreplay.h
+++ b/displayreplay.h
@@ -5,6 +5,7 @@
#include <vdr/thread.h>
#include "imagecache.h"
#include "messagebox.h"
+#include "volumebox.h"
class cNopacityDisplayReplay : public cSkinDisplayReplay , cThread{
private:
@@ -13,6 +14,8 @@ private:
bool modeOnly;
cString lastDate;
bool fadeout;
+ int lastVolume;
+ time_t lastVolumeTime;
cPixmap *pixmapBackground;
cPixmap *pixmapTop;
cPixmap *pixmapInfo;
@@ -30,6 +33,7 @@ private:
cPixmap *pixmapFwd;
cPixmap *pixmapJump;
cNopacityMessageBox *messageBox;
+ cNopacityVolumeBox *volumeBox;
virtual void Action(void);
void createOSD(void);
void CreatePixmaps(void);
@@ -38,6 +42,7 @@ private:
void DrawDate(void);
void LoadControlIcons(void);
void DrawScreenResolution(void);
+ void DrawVolume(void);
public:
cNopacityDisplayReplay(bool ModeOnly);
virtual ~cNopacityDisplayReplay(void);
diff --git a/setup.c b/setup.c
index c2e04a3..289cd27 100644
--- a/setup.c
+++ b/setup.c
@@ -476,6 +476,9 @@ void cNopacitySetupReplayDisplay::Set(void) {
Add(new cMenuEditIntItem(tr("Height of Replay Display (Percent of OSD Height)"), tmpConf->GetValueRef("replayHeight"), 15, 80));
Add(new cMenuEditIntItem(tr("Left & Right Border Width"), tmpConf->GetValueRef("replayBorderVertical"), 0, 300));
Add(new cMenuEditIntItem(tr("Bottom Border Height"), tmpConf->GetValueRef("replayBorderBottom"), 0, 300));
+ Add(new cMenuEditBoolItem(tr("Display Volume"), tmpConf->GetValueRef("displayReplayVolume")));
+ if (tmpConf->GetValue("displayReplayVolume"))
+ Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Bottom Volume Border Height")), tmpConf->GetValueRef("replayBorderVolumeBottom"), 0, 1000));
Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), tmpConf->GetValueRef("fontReplayHeader"), -20, 20));
Add(new cMenuEditIntItem(tr("Adjust Font Size - Text"), tmpConf->GetValueRef("fontReplay"), -20, 20));