diff options
-rw-r--r-- | config.h | 2 | ||||
-rw-r--r-- | displayvolume.c | 2 | ||||
-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-- | volumebox.c | 122 | ||||
-rw-r--r-- | volumebox.h | 5 |
8 files changed, 100 insertions, 63 deletions
@@ -16,6 +16,8 @@ enum eDisplayType { dtGraphical }; +enum eVolumeBoxStyle {vbNone = 0, vbSimple, vbFull}; + class cNopacityConfig { private: std::map<std::string, int> conf; diff --git a/displayvolume.c b/displayvolume.c index ed5fbee..a5f75dd 100644 --- a/displayvolume.c +++ b/displayvolume.c @@ -12,7 +12,7 @@ cNopacityDisplayVolume::cNopacityDisplayVolume(void) : cThread("DisplayVolume") int top = geoManager->osdTop + geoManager->osdHeight - geoManager->volumeHeight - config.GetValue("volumeBorderBottom"); int left = geoManager->osdLeft + ((geoManager->osdWidth - geoManager->volumeWidth) / 2); osd = CreateOsd(left, top, geoManager->volumeWidth, geoManager->volumeHeight); - volumeBox = new cNopacityVolumeBox(osd, cRect(0, 0, geoManager->volumeWidth, geoManager->volumeHeight)); + volumeBox = new cNopacityVolumeBox(osd, cRect(0, 0, geoManager->volumeWidth, geoManager->volumeHeight), fontManager->volumeText); } cNopacityDisplayVolume::~cNopacityDisplayVolume(void) { diff --git a/po/ca_ES.po b/po/ca_ES.po index 002e1e2..3721845 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-05-12 13:42+0200\n" +"POT-Creation-Date: 2022-06-05 15:09+0200\n" "PO-Revision-Date: 2013-03-19 22:56+0100\n" "Last-Translator: Gabychan <gbonich@gmail.com>\n" "Language-Team: \n" @@ -125,9 +125,6 @@ msgstr "" msgid "free" msgstr "lliure" -msgid "Volume" -msgstr "Volum" - msgid "images" msgstr "imatges" @@ -239,6 +236,9 @@ msgstr "Pistes d'à udio" msgid "Messages" msgstr "Missatges" +msgid "Volume" +msgstr "Volum" + msgid "Image Caching" msgstr "Cache d'imatge" diff --git a/po/de_DE.po b/po/de_DE.po index 646de0d..b7f1305 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-05-12 13:42+0200\n" +"POT-Creation-Date: 2022-06-05 15:09+0200\n" "PO-Revision-Date: 2012-11-11 17:49+0200\n" "Last-Translator: louis\n" "Language-Team: \n" @@ -122,9 +122,6 @@ msgstr "TheMovieDB durchschnittliche Bewertung" msgid "free" msgstr "frei" -msgid "Volume" -msgstr "Lautstärke" - msgid "images" msgstr "Bilder" @@ -236,6 +233,9 @@ msgstr "Audio Spuren" msgid "Messages" msgstr "Nachrichten" +msgid "Volume" +msgstr "Lautstärke" + msgid "Image Caching" msgstr "Bilder Cache" diff --git a/po/it_IT.po b/po/it_IT.po index 5488522..552e5cb 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-05-12 13:42+0200\n" +"POT-Creation-Date: 2022-06-05 15:09+0200\n" "PO-Revision-Date: 2013-03-19 22:56+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: \n" @@ -125,9 +125,6 @@ msgstr "" msgid "free" msgstr "disponibili" -msgid "Volume" -msgstr "Volume" - msgid "images" msgstr "" @@ -239,6 +236,9 @@ msgstr "Tracce audio" msgid "Messages" msgstr "Messaggi" +msgid "Volume" +msgstr "Volume" + msgid "Image Caching" msgstr "" diff --git a/po/sk_SK.po b/po/sk_SK.po index 01d71e3..25ac763 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-05-12 13:42+0200\n" +"POT-Creation-Date: 2022-06-05 15:09+0200\n" "PO-Revision-Date: 2013-11-11 20:52+0100\n" "Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n" "Language-Team: \n" @@ -122,9 +122,6 @@ msgstr "" msgid "free" msgstr "voµné" -msgid "Volume" -msgstr "Hlasitos»" - msgid "images" msgstr "obrázkov" @@ -236,6 +233,9 @@ msgstr "Zvuková stopa" msgid "Messages" msgstr "Správy" +msgid "Volume" +msgstr "Hlasitos»" + msgid "Image Caching" msgstr "Vyrovnávacia pamä» obrázkov" diff --git a/volumebox.c b/volumebox.c index 5f3cefe..c0897a4 100644 --- a/volumebox.c +++ b/volumebox.c @@ -4,52 +4,86 @@ #include "config.h" #include "helpers.h" -cNopacityVolumeBox::cNopacityVolumeBox(cOsd *osd, const cRect &Rect) { +cNopacityVolumeBox::cNopacityVolumeBox(cOsd *osd, const cRect &Rect, cFont *Font, bool simple, bool altcolor) { this->osd = osd; - - pixmapBackgroundVolume = osd->CreatePixmap(6, cRect(Rect)); - pixmapBackgroundVolume->Fill(clrTransparent); + font = Font; + this->simple = simple; + barWidth = 0; + barHeight = 0; + textLeft = 0; + textTop = 0; - if (config.GetValue("displayType") == dtGraphical) { - cImage *imgBack = imgCache->GetSkinElement(seVolumeBackground); - if (imgBack) { - pixmapBackgroundVolume->DrawImage(cPoint(0, 0), *imgBack); + cString testlabel = cString::sprintf("%s: %s", tr("Volume"), "999"); + if (simple) { + if (altcolor) { + tColor altBackgroundColor = Theme.Color(clrChannelBackground); + pixmapBackgroundVolume = osd->CreatePixmap(6, cRect(Rect.Left() - Rect.Height() / 4, Rect.Top(), Rect.Width() + Rect.Height() / 2, Rect.Height())); + pixmapBackgroundVolume->Fill(clrTransparent); + pixmapBackgroundVolume->DrawEllipse(cRect(0, 0, Rect.Height() / 2, Rect.Height()), altBackgroundColor, 7); + pixmapBackgroundVolume->DrawEllipse(cRect(Rect.Width(), 0, Rect.Height() / 2, Rect.Height()), altBackgroundColor, 5); + pixmapBackgroundVolume->DrawRectangle(cRect(Rect.Height() / 2, 0, Rect.Width() - Rect.Height() / 2, Rect.Height()), altBackgroundColor); + } else { + pixmapBackgroundVolume = osd->CreatePixmap(6, cRect(Rect)); + pixmapBackgroundVolume->Fill(clrTransparent); } + int textHeight = font->Height(); + int textWidth = font->Width(*testlabel); + pixmapLabelVolume = osd->CreatePixmap(7, cRect(Rect.Left(), Rect.Top() + (Rect.Height() - textHeight) / 2, textWidth, textHeight)); + pixmapLabelVolume->Fill(clrTransparent); + + barWidth = Rect.Width() - textWidth - 10; + barHeight = Rect.Height() * 2 / 3; + if (barHeight % 2 != 0) + barHeight++; + int barTop = (Rect.Height() - barHeight) / 2 + 1; + pixmapProgressBarVolume = osd->CreatePixmap(7, cRect(Rect.Left() + textWidth + 10, Rect.Top() + barTop, barWidth, barHeight)); + pixmapProgressBarVolume->Fill(clrTransparent); } else { - pixmapBackgroundVolume->Fill(Theme.Color(clrChannelBackground)); - if (config.GetValue("displayType") == dtBlending) { - DrawBlendedBackground(pixmapBackgroundVolume, - 0, - geoManager->volumeWidth, - Theme.Color(clrChannelBackground), - Theme.Color(clrChannelBackBlend), - true); - DrawBlendedBackground(pixmapBackgroundVolume, - 0, - geoManager->volumeWidth, - Theme.Color(clrChannelBackground), - Theme.Color(clrChannelBackBlend), - false); - } - int cornerRadius = geoManager->volumeHeight/4; - if (cornerRadius > 2) { - DrawRoundedCorners(pixmapBackgroundVolume, - cornerRadius, - 0, - 0, - geoManager->volumeWidth, - geoManager->volumeHeight); + pixmapBackgroundVolume = osd->CreatePixmap(6, cRect(Rect)); + pixmapBackgroundVolume->Fill(clrTransparent); + if (config.GetValue("displayType") == dtGraphical) { + cImage *imgBack = imgCache->GetSkinElement(seVolumeBackground); + if (imgBack) { + pixmapBackgroundVolume->DrawImage(cPoint(0, 0), *imgBack); + } + } else { + pixmapBackgroundVolume->Fill(Theme.Color(clrChannelBackground)); + if (config.GetValue("displayType") == dtBlending) { + DrawBlendedBackground(pixmapBackgroundVolume, + 0, + geoManager->volumeWidth, + Theme.Color(clrChannelBackground), + Theme.Color(clrChannelBackBlend), + true); + DrawBlendedBackground(pixmapBackgroundVolume, + 0, + geoManager->volumeWidth, + Theme.Color(clrChannelBackground), + Theme.Color(clrChannelBackBlend), + false); + } + int cornerRadius = geoManager->volumeHeight/4; + if (cornerRadius > 2) { + DrawRoundedCorners(pixmapBackgroundVolume, + cornerRadius, + 0, + 0, + geoManager->volumeWidth, + geoManager->volumeHeight); + } } - } - barWidth = geoManager->volumeProgressBarWidth; - barHeight = geoManager->volumeProgressBarHeight; - - pixmapLabelVolume = osd->CreatePixmap(7, cRect(Rect.Left(), Rect.Top() + 5, geoManager->volumeWidth, geoManager->volumeLabelHeight)); - pixmapLabelVolume->Fill(clrTransparent); - pixmapProgressBarVolume = osd->CreatePixmap(7, cRect((Rect.Left() + (geoManager->volumeWidth - barWidth) / 2), Rect.Top() + ((geoManager->volumeHeight - barHeight) * 2 / 3), barWidth, barHeight)); - pixmapProgressBarVolume->Fill(clrTransparent); + textLeft = (geoManager->volumeWidth - font->Width(*testlabel)) / 2; + textTop = (geoManager->volumeLabelHeight - font->Height()) / 2; + barWidth = geoManager->volumeProgressBarWidth; + barHeight = geoManager->volumeProgressBarHeight; + + pixmapLabelVolume = osd->CreatePixmap(7, cRect(Rect.Left(), Rect.Top() + 5, geoManager->volumeWidth, geoManager->volumeLabelHeight)); + pixmapLabelVolume->Fill(clrTransparent); + pixmapProgressBarVolume = osd->CreatePixmap(7, cRect((Rect.Left() + (geoManager->volumeWidth - barWidth) / 2), Rect.Top() + ((geoManager->volumeHeight - barHeight) * 2 / 3), barWidth, barHeight)); + pixmapProgressBarVolume->Fill(clrTransparent); + } } cNopacityVolumeBox::~cNopacityVolumeBox(void) { @@ -67,18 +101,16 @@ void cNopacityVolumeBox::SetVolume(int Current, int Total, bool Mute) { return; } - cString label = cString::sprintf("%s: %d", tr("Volume"), Current); - pixmapLabelVolume->DrawText(cPoint((geoManager->volumeWidth - fontManager->volumeText->Width(*label)) / 2, - (geoManager->volumeLabelHeight - fontManager->volumeText->Height()) / 2), - *label, Theme.Color(clrVolumeFont), clrTransparent, fontManager->volumeText); - pixmapProgressBarVolume->DrawEllipse(cRect(0, 0, barHeight, barHeight), Theme.Color(clrProgressBarBack)); pixmapProgressBarVolume->DrawEllipse(cRect(barWidth - barHeight, 0, barHeight, barHeight), Theme.Color(clrProgressBarBack)); pixmapProgressBarVolume->DrawRectangle(cRect(barHeight / 2, 0, barWidth - barHeight, barHeight), Theme.Color(clrProgressBarBack)); DrawProgressbar(pixmapProgressBarVolume, 1, 1, barWidth - 2, barHeight - 2, Current, Total, Theme.Color(clrProgressBar), Theme.Color(clrProgressBarBlend), true); - if (Mute) { + cString label = cString::sprintf("%s: %d", tr("Volume"), Current); + pixmapLabelVolume->DrawText(cPoint(textLeft, textTop), *label, Theme.Color(clrChannelHead), clrTransparent, font); + + if (!simple && Mute) { cBitmap bmMute(mute_xpm); pixmapLabelVolume->DrawBitmap(cPoint(geoManager->volumeWidth - 2 * bmMute.Width(), (geoManager->volumeLabelHeight - bmMute.Height()) / 2), bmMute, Theme.Color(clrDiskAlert), clrTransparent); } diff --git a/volumebox.h b/volumebox.h index a9c42bd..27736a0 100644 --- a/volumebox.h +++ b/volumebox.h @@ -7,12 +7,15 @@ class cNopacityVolumeBox { private: cOsd *osd; + cFont *font; + bool simple; int barWidth, barHeight; + int textLeft, textTop; cPixmap *pixmapBackgroundVolume; cPixmap *pixmapProgressBarVolume; cPixmap *pixmapLabelVolume; public: - cNopacityVolumeBox(cOsd *Osd, const cRect &Rect); + cNopacityVolumeBox(cOsd *Osd, const cRect &Rect, cFont *Font, bool simple = false, bool altcolor = false); ~cNopacityVolumeBox(void); void SetVolume(int Current = 0, int Total = 0, bool Mute = false); void SetAlpha(int Alpha = 0); |