diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2022-05-27 14:11:41 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2022-06-09 13:46:58 +0200 |
commit | aec9a6edcab49be159391dffbcbd4259e356d43f (patch) | |
tree | 0a61707e3a4661d1095458c1388e548488aa3f6c | |
parent | dc1792ddc650d615abe11bc69b931432cf92eb6e (diff) | |
download | skin-nopacity-aec9a6edcab49be159391dffbcbd4259e356d43f.tar.gz skin-nopacity-aec9a6edcab49be159391dffbcbd4259e356d43f.tar.bz2 |
Use VolumeBox for DisplayMenu
Shows the volume box in menus. An setup option is added to activate the
volume box.
-rw-r--r-- | config.c | 2 | ||||
-rw-r--r-- | displaymenu.c | 2 | ||||
-rw-r--r-- | displaymenuview.c | 26 | ||||
-rw-r--r-- | displaymenuview.h | 5 | ||||
-rw-r--r-- | po/ca_ES.po | 8 | ||||
-rw-r--r-- | po/de_DE.po | 8 | ||||
-rw-r--r-- | po/it_IT.po | 8 | ||||
-rw-r--r-- | po/sk_SK.po | 8 | ||||
-rw-r--r-- | setup.c | 3 |
9 files changed, 66 insertions, 4 deletions
@@ -129,6 +129,8 @@ void cNopacityConfig::LoadDefaults(void) { conf.insert(std::pair<std::string, int>("posterHeight", 750)); conf.insert(std::pair<std::string, int>("useFolderPoster", 1)); conf.insert(std::pair<std::string, int>("menuChannelLogoBackground", 1)); + conf.insert(std::pair<std::string, int>("displayMenuVolume", 1)); + conf.insert(std::pair<std::string, int>("menuBorderVolumeBottom", 10)); conf.insert(std::pair<std::string, int>("borderDetailedEPG", 30)); conf.insert(std::pair<std::string, int>("borderDetailedRecordings", 30)); conf.insert(std::pair<std::string, int>("headerDetailedEPG", 20)); diff --git a/displaymenu.c b/displaymenu.c index 76e3078..8c25e66 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -651,6 +651,8 @@ void cNopacityDisplayMenu::Flush(void) { Start(); } } + if (config.GetValue("displayMenuVolume")) + menuView->DrawVolume(); osd->Flush(); initial = false; cDevice::PrimaryDevice()->ScaleVideo(videoWindowRect); diff --git a/displaymenuview.c b/displaymenuview.c index 0a7e4ee..0feea31 100644 --- a/displaymenuview.c +++ b/displaymenuview.c @@ -1,3 +1,4 @@ +#include "status.h" #include "displaymenuview.h" cNopacityDisplayMenuView::cNopacityDisplayMenuView(cOsd *osd) { @@ -5,6 +6,9 @@ cNopacityDisplayMenuView::cNopacityDisplayMenuView(cOsd *osd) { diskUsageAlert = 95; pixmapHeaderIcon = NULL; messageBox = NULL; + volumeBox = NULL; + lastVolume = statusMonitor->GetVolume(); + lastVolumeTime = time(NULL); menuAdjustLeft = config.GetValue("menuAdjustLeft"); SetDescriptionTextWindowSize(); CreatePixmaps(); @@ -29,6 +33,7 @@ cNopacityDisplayMenuView::~cNopacityDisplayMenuView(void) { if (pixmapHeaderIcon) osd->DestroyPixmap(pixmapHeaderIcon); delete messageBox; + delete volumeBox; } void cNopacityDisplayMenuView::SetDescriptionTextWindowSize(void) { @@ -195,6 +200,8 @@ void cNopacityDisplayMenuView::SetAlpha(int Alpha) { pixmapDiskUsageLabel->SetAlpha(Alpha); if (pixmapHeaderIcon) pixmapHeaderIcon->SetAlpha(Alpha); + if (volumeBox) + volumeBox->SetAlpha(Alpha); } void cNopacityDisplayMenuView::GetMenuItemSize(eMenuCategory menuCat, cPoint *itemSize) { @@ -652,6 +659,7 @@ void cNopacityDisplayMenuView::ClearScrollbar(void) { void cNopacityDisplayMenuView::DrawMessage(eMessageType Type, const char *Text) { + DELETENULL(volumeBox); DELETENULL(messageBox); if (!Text) return; @@ -661,3 +669,21 @@ void cNopacityDisplayMenuView::DrawMessage(eMessageType Type, const char *Text) geoManager->messageWidth, geoManager->messageHeight), Type, Text, true); } + +void cNopacityDisplayMenuView::DrawVolume(void) { + int volume = statusMonitor->GetVolume(); + if (volume != lastVolume) { + if (!volumeBox) { + int left = (geoManager->osdWidth - geoManager->volumeWidth) / 2; + int top = geoManager->osdHeight - geoManager->volumeHeight - config.GetValue("menuBorderVolumeBottom"); + 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/displaymenuview.h b/displaymenuview.h index d212693..baf3dce 100644 --- a/displaymenuview.h +++ b/displaymenuview.h @@ -10,6 +10,7 @@ #include "imagecache.h" #include "imageloader.h" #include "messagebox.h" +#include "volumebox.h" class cNopacityDisplayMenuView { private: @@ -17,6 +18,8 @@ class cNopacityDisplayMenuView { cString lastDate; int diskUsageAlert; bool menuAdjustLeft; + int lastVolume; + time_t lastVolumeTime; cPixmap *pixmapHeader; cPixmap *pixmapHeaderForeground; cPixmap *pixmapHeaderLogo; @@ -33,6 +36,7 @@ class cNopacityDisplayMenuView { cPixmap *pixmapDiskUsageIcon; cPixmap *pixmapDiskUsageLabel; cNopacityMessageBox *messageBox; + cNopacityVolumeBox *volumeBox; int feedNameLength; cRect textWindowSizeSchedules; cRect textWindowSizeRecordings; @@ -75,6 +79,7 @@ class cNopacityDisplayMenuView { void DrawScrollbar(double Height, double Offset); void ClearScrollbar(void); void DrawMessage(eMessageType Type, const char *Text); + void DrawVolume(void); cPixmap *GetPixmapScrollbar(void) { return pixmapScrollbar; }; cPixmap *GetPixmapScrollbarBack(void) { return pixmapScrollbarBack; }; }; diff --git a/po/ca_ES.po b/po/ca_ES.po index 3721845..2d588f9 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: skinnopacity 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2022-06-05 15:09+0200\n" +"POT-Creation-Date: 2022-06-01 17:59+0200\n" "PO-Revision-Date: 2013-03-19 22:56+0100\n" "Last-Translator: Gabychan <gbonich@gmail.com>\n" "Language-Team: \n" @@ -287,6 +287,12 @@ msgstr "Alçada de la capçalera (% Alçada OSD)" msgid "Footer Height (Percent of OSD Height)" msgstr "Alçada del peu de pà gina (% Alçada OSD)" +msgid "Display Volume" +msgstr "" + +msgid "Bottom Volume Border Height" +msgstr "" + msgid "Rounded Corners for menu items and buttons" msgstr "Cantells rodons als elements de menú i botons" diff --git a/po/de_DE.po b/po/de_DE.po index b7f1305..1a3f053 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: skinnopacity 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2022-06-05 15:09+0200\n" +"POT-Creation-Date: 2022-06-01 17:59+0200\n" "PO-Revision-Date: 2012-11-11 17:49+0200\n" "Last-Translator: louis\n" "Language-Team: \n" @@ -284,6 +284,12 @@ msgstr "Header Höhe (in % der OSD Höhe)" msgid "Footer Height (Percent of OSD Height)" msgstr "Footer Höhe (in % der OSD Höhe)" +msgid "Display Volume" +msgstr "Lautstärke anzeigen" + +msgid "Bottom Volume Border Height" +msgstr "Höhe des unteren Randes der Lautstärkeanzeige" + msgid "Rounded Corners for menu items and buttons" msgstr "Abgerundete Ecken für Menüelemente und Buttons" diff --git a/po/it_IT.po b/po/it_IT.po index 552e5cb..a41cf6c 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: skinnopacity 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2022-06-05 15:09+0200\n" +"POT-Creation-Date: 2022-06-01 17:59+0200\n" "PO-Revision-Date: 2013-03-19 22:56+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: \n" @@ -287,6 +287,12 @@ msgstr "Altezza intestazione (% altezza OSD)" msgid "Footer Height (Percent of OSD Height)" msgstr "Altezza piè pagina (% altezza OSD)" +msgid "Display Volume" +msgstr "" + +msgid "Bottom Volume Border Height" +msgstr "" + msgid "Rounded Corners for menu items and buttons" msgstr "Angoli smussati per voci menu e tasti" diff --git a/po/sk_SK.po b/po/sk_SK.po index 25ac763..517a523 100644 --- a/po/sk_SK.po +++ b/po/sk_SK.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skinnopacity\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2022-06-05 15:09+0200\n" +"POT-Creation-Date: 2022-06-01 17:59+0200\n" "PO-Revision-Date: 2013-11-11 20:52+0100\n" "Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n" "Language-Team: \n" @@ -284,6 +284,12 @@ msgstr "Vý¹ka hlavièky (percento z èasti OSD vý¹ky)" msgid "Footer Height (Percent of OSD Height)" msgstr "Vý¹ka zápätia (percento z èasti OSD vý¹ky)" +msgid "Display Volume" +msgstr "" + +msgid "Bottom Volume Border Height" +msgstr "" + msgid "Rounded Corners for menu items and buttons" msgstr "Zaoblené rohy pre polo¾ky menu a tlaèidiel" @@ -164,6 +164,9 @@ void cNopacitySetupMenuDisplay::Set(void) { Add(new cMenuEditStraItem(tr("Scale Video size to fit into menu window"), tmpConf->GetValueRef("scalePicture"), 3, scalePic)); Add(new cMenuEditIntItem(tr("Header Height (Percent of OSD Height)"), tmpConf->GetValueRef("headerHeight"), 5, 30)); Add(new cMenuEditIntItem(tr("Footer Height (Percent of OSD Height)"), tmpConf->GetValueRef("footerHeight"), 5, 30)); + Add(new cMenuEditBoolItem(tr("Display Volume"), tmpConf->GetValueRef("displayMenuVolume"))); + if (tmpConf->GetValue("displayMenuVolume")) + Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Bottom Volume Border Height")), tmpConf->GetValueRef("menuBorderVolumeBottom"), 0, 1000)); Add(new cMenuEditBoolItem(tr("Rounded Corners for menu items and buttons"), tmpConf->GetValueRef("roundedCorners"))); if (tmpConf->GetValue("roundedCorners")) Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Radius of rounded corners")), tmpConf->GetValueRef("cornerRadius"), 5, 30)); |