diff options
-rw-r--r-- | config.c | 2 | ||||
-rw-r--r-- | displaychannel.c | 3 | ||||
-rw-r--r-- | displaychannelview.c | 25 | ||||
-rw-r--r-- | displaychannelview.h | 5 | ||||
-rw-r--r-- | geometrymanager.c | 8 | ||||
-rw-r--r-- | setup.c | 4 |
6 files changed, 43 insertions, 4 deletions
@@ -195,6 +195,8 @@ void cNopacityConfig::LoadDefaults(void) { conf.insert(std::pair<std::string, int>("progressCurrentSchedule", 0)); conf.insert(std::pair<std::string, int>("displayPoster", 1)); conf.insert(std::pair<std::string, int>("channelPosterBorder", 10)); + conf.insert(std::pair<std::string, int>("displayChannelVolume", 1)); + conf.insert(std::pair<std::string, int>("channelBorderVolumeBottom", 10)); //Display Replay conf.insert(std::pair<std::string, int>("replayHeight", 25)); conf.insert(std::pair<std::string, int>("replayBorderVertical", 15)); diff --git a/displaychannel.c b/displaychannel.c index 7a71db5..4561a0c 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -136,6 +136,9 @@ void cNopacityDisplayChannel::Flush(void) { } else channelView->ClearSourceInfo(); + if (config.GetValue("displayChannelVolume")) + channelView->DrawVolume(); + if (initial && config.GetValue("animation") && config.GetValue("channelFadeTime")) { channelView->SetAlpha(0); Start(); diff --git a/displaychannelview.c b/displaychannelview.c index 3e5c759..9f20953 100644 --- a/displaychannelview.c +++ b/displaychannelview.c @@ -5,6 +5,7 @@ #include "fontmanager.h" #include "geometrymanager.h" #include "imageloader.h" +#include "status.h" #include <vdr/menu.h> cNopacityDisplayChannelView::cNopacityDisplayChannelView(cOsd *osd) { @@ -25,6 +26,9 @@ cNopacityDisplayChannelView::cNopacityDisplayChannelView(cOsd *osd) { pixmapSignalLabel = NULL; pixmapPoster = NULL; messageBox = NULL; + volumeBox = NULL; + lastVolume = statusMonitor->GetVolume(); + lastVolumeTime = time(NULL); CreatePixmaps(); DrawBackground(); if (config.GetValue("displaySignalStrength")) { @@ -55,6 +59,7 @@ cNopacityDisplayChannelView::~cNopacityDisplayChannelView(void) { if (pixmapPoster) osd->DestroyPixmap(pixmapPoster); delete messageBox; + delete volumeBox; } void cNopacityDisplayChannelView::CreatePixmaps(void) { @@ -171,6 +176,8 @@ void cNopacityDisplayChannelView::SetAlpha(int alpha) { pixmapSignalLabel->SetAlpha(alpha); if (pixmapPoster) pixmapPoster->SetAlpha(alpha); + if (volumeBox) + volumeBox->SetAlpha(alpha); } void cNopacityDisplayChannelView::DrawBackground(void) { @@ -771,3 +778,21 @@ void cNopacityDisplayChannelView::DisplayMessage(eMessageType Type, const char * geoManager->messageWidth, geoManager->messageHeight), Type, Text); } + +void cNopacityDisplayChannelView::DrawVolume(void) { + int volume = statusMonitor->GetVolume(); + if (volume != lastVolume) { + if (!volumeBox) { + int left = (geoManager->channelOsdWidth - geoManager->volumeWidth) / 2; + int top = geoManager->channelOsdHeight - geoManager->volumeHeight - config.GetValue("channelBorderVolumeBottom"); + 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); + } +} diff --git a/displaychannelview.h b/displaychannelview.h index 808017b..5689ca7 100644 --- a/displaychannelview.h +++ b/displaychannelview.h @@ -3,6 +3,7 @@ #include "imagecache.h" #include "messagebox.h" +#include "volumebox.h" #include <vdr/osd.h> class cNopacityDisplayChannelView { @@ -16,6 +17,8 @@ private: int lastSignalDisplay; int lastSignalStrength; int lastSignalQuality; + int lastVolume; + time_t lastVolumeTime; cPixmap *pixmapBackground; cPixmap *pixmapTop; cPixmap *pixmapLogo; @@ -33,6 +36,7 @@ private: cPixmap *pixmapSourceInfo; cPixmap *pixmapPoster; cNopacityMessageBox *messageBox; + cNopacityVolumeBox *volumeBox; std::string GetChannelSep(const cChannel *channel, bool prev); void CreatePixmaps(void); void DrawBackground(void); @@ -63,5 +67,6 @@ public: void DrawSourceInfo(void); void ClearSourceInfo(void); void DisplayMessage(eMessageType Type, const char *Text); + void DrawVolume(void); }; #endif //__NOPACITY_DISPLAYCHANNELVIEW_H diff --git a/geometrymanager.c b/geometrymanager.c index 1f2dd4e..e8a3361 100644 --- a/geometrymanager.c +++ b/geometrymanager.c @@ -102,12 +102,12 @@ void cGeometryManager::SetGeometry(void) { channelOsdLeft = osdLeft; channelOsdTop = osdTop; channelOsdWidth = osdWidth; - channelOsdHeight = osdHeight; + channelOsdHeight = osdHeight - config.GetValue("channelBorderBottom"); channelX = config.GetValue("channelBorderVertical"); - channelWidth = osdWidth - 2 * config.GetValue("channelBorderVertical"); - channelHeight = osdHeight * config.GetValue("channelHeight") / 100; - channelTop = osdHeight - channelHeight - config.GetValue("channelBorderBottom"); + channelWidth = channelOsdWidth - 2 * config.GetValue("channelBorderVertical"); + channelHeight = channelOsdHeight * config.GetValue("channelHeight") / 100; + channelTop = channelOsdHeight - channelHeight; if (!(config.GetValue("scraperInfo") && config.GetValue("displayPoster"))) { channelOsdLeft += channelX; @@ -441,6 +441,10 @@ void cNopacitySetupChannelDisplay::Set(void) { Add(new cMenuEditStraItem(tr("Kind of time display for current schedule"), tmpConf->GetValueRef("progressCurrentSchedule"), 2, progressStyleCurrentSchedule)); Add(new cMenuEditBoolItem(tr("Display Signal Strength & Quality"), tmpConf->GetValueRef("displaySignalStrength"))); Add(new cMenuEditBoolItem(tr("Display Channel Source & Rec. Info"), tmpConf->GetValueRef("displaySourceInfo"))); + Add(new cMenuEditBoolItem(tr("Display Volume"), tmpConf->GetValueRef("displayChannelVolume"))); + if (tmpConf->GetValue("displayChannelVolume")) + Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Bottom Volume Border Height")), tmpConf->GetValueRef("channelBorderVolumeBottom"), 0, 1000)); + Add(new cMenuEditBoolItem(tr("Display Poster or Fanart from TVScraper"), tmpConf->GetValueRef("displayPoster"))); if (tmpConf->GetValue("displayPoster")) { Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Border in Pixel")), tmpConf->GetValueRef("channelPosterBorder"), 0, 200)); |