summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-06-06 13:39:29 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-07-12 12:31:14 +0200
commit274750d5fb676361f65a4037129bc6f8017c38e7 (patch)
tree428b982c8940c75bed1fbed9c2e9792b0b37776e
parent15172f07452c60f044383b9e73585b3c41aaa898 (diff)
downloadskin-nopacity-274750d5fb676361f65a4037129bc6f8017c38e7.tar.gz
skin-nopacity-274750d5fb676361f65a4037129bc6f8017c38e7.tar.bz2
Add fade-out to display channel
-rw-r--r--config.c1
-rw-r--r--displaychannel.c26
-rw-r--r--displaychannel.h3
-rw-r--r--displaychannelview.c8
-rw-r--r--displaychannelview.h2
-rw-r--r--po/ca_ES.po5
-rw-r--r--po/de_DE.po5
-rw-r--r--po/it_IT.po5
-rw-r--r--po/sk_SK.po5
-rw-r--r--setup.c1
10 files changed, 40 insertions, 21 deletions
diff --git a/config.c b/config.c
index 812954d..7283e69 100644
--- a/config.c
+++ b/config.c
@@ -155,6 +155,7 @@ void cNopacityConfig::LoadDefaults(void) {
conf.insert(std::pair<std::string, int>("channelBorderVertical", 15));
conf.insert(std::pair<std::string, int>("channelBorderBottom", 15));
conf.insert(std::pair<std::string, int>("channelFadeTime", 300));
+ conf.insert(std::pair<std::string, int>("channelFadeOutTime", 300));
conf.insert(std::pair<std::string, int>("channelBackgroundTransparency", 0));
conf.insert(std::pair<std::string, int>("channelUseLogoBackground", 1));
conf.insert(std::pair<std::string, int>("logoPosition", 1));
diff --git a/displaychannel.c b/displaychannel.c
index 8e60a9d..e026655 100644
--- a/displaychannel.c
+++ b/displaychannel.c
@@ -13,18 +13,25 @@ cNopacityDisplayChannel::cNopacityDisplayChannel(bool WithInfo) : cThread("Displ
following = NULL;
currentLast = 0;
channelChange = false;
+ fadeout = false;
initial = true;
- FadeTime = config.GetValue("channelFadeTime");
- FrameTime = FadeTime / 10;
osd = CreateOsd(geoManager->osdLeft, geoManager->osdTop, geoManager->osdWidth, geoManager->osdHeight);
channelView = new cNopacityDisplayChannelView(osd);
}
cNopacityDisplayChannel::~cNopacityDisplayChannel() {
- Cancel(-1);
- while (Active())
+ if (config.GetValue("channelFadeOutTime")) {
+ fadeout = true;
+ Start();
+ }
+ int count = 0;
+ while (Active()) {
cCondWait::SleepMs(10);
+ count++;
+ if (count > 150)
+ Cancel(1);
+ }
delete channelView;
delete osd;
}
@@ -132,9 +139,9 @@ void cNopacityDisplayChannel::Flush(void) {
} else
channelView->ClearSourceInfo();
- if (initial) {
- if (config.GetValue("channelFadeTime"))
- Start();
+ if (initial && config.GetValue("channelFadeTime")) {
+ channelView->SetAlpha(0);
+ Start();
}
initial = false;
channelChange = false;
@@ -142,6 +149,9 @@ void cNopacityDisplayChannel::Flush(void) {
}
void cNopacityDisplayChannel::Action(void) {
+ int x = (fadeout) ? 255 : 0;
+ int FadeTime = (fadeout) ? config.GetValue("channelFadeOutTime") : config.GetValue("channelFadeTime");
+ int FrameTime = FadeTime / 10;
uint64_t First = cTimeMs::Now();
cPixmap::Lock();
cPixmap::Unlock();
@@ -150,7 +160,7 @@ void cNopacityDisplayChannel::Action(void) {
while (Running()) {
uint64_t Now = cTimeMs::Now();
double t = std::min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = std::abs(x - (int(t * ALPHA_OPAQUE)));
cPixmap::Lock();
channelView->SetAlpha(Alpha);
if (Running())
diff --git a/displaychannel.h b/displaychannel.h
index 7a906d5..fa3c3ce 100644
--- a/displaychannel.h
+++ b/displaychannel.h
@@ -8,8 +8,7 @@ class cNopacityDisplayChannel : public cSkinDisplayChannel, cThread {
private:
cOsd *osd;
cNopacityDisplayChannelView *channelView;
- int FrameTime;
- int FadeTime;
+ bool fadeout;
bool initial;
bool groupSep;
bool channelChange;
diff --git a/displaychannelview.c b/displaychannelview.c
index baf1c68..daf8c71 100644
--- a/displaychannelview.c
+++ b/displaychannelview.c
@@ -144,12 +144,8 @@ void cNopacityDisplayChannelView::CreatePixmaps(void) {
geoManager->channelFooterHeight)
);
- if (config.GetValue("channelFadeTime")) {
- SetAlpha(0);
- } else {
- int alphaBack = (100 - config.GetValue("channelBackgroundTransparency"))*255/100;
- pixmapBackground->SetAlpha(alphaBack);
- }
+ int alphaBack = (100 - config.GetValue("channelBackgroundTransparency"))*255/100;
+ pixmapBackground->SetAlpha(alphaBack);
}
void cNopacityDisplayChannelView::SetAlpha(int alpha) {
diff --git a/displaychannelview.h b/displaychannelview.h
index a686486..2c071ce 100644
--- a/displaychannelview.h
+++ b/displaychannelview.h
@@ -42,7 +42,7 @@ private:
public:
cNopacityDisplayChannelView(cOsd *osd);
virtual ~cNopacityDisplayChannelView(void);
- void SetAlpha(int alpha);
+ void SetAlpha(int alpha = 0);
void DrawChannelLogo(const cChannel *Channel);
void ClearChannelLogo(void);
void DrawChannelName(cString number, cString name);
diff --git a/po/ca_ES.po b/po/ca_ES.po
index d2c04ca..4a4a22e 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: 2014-05-24 15:11+0200\n"
+"POT-Creation-Date: 2021-06-06 13:13+0200\n"
"PO-Revision-Date: 2013-03-19 22:56+0100\n"
"Last-Translator: Gabychan <gbonich@gmail.com>\n"
"Language-Team: \n"
@@ -524,6 +524,9 @@ msgstr "mostra temps transcorregut"
msgid "show remaining time"
msgstr "mostra temps restant"
+msgid "Fade-Out Time in ms (Zero for switching off fading)"
+msgstr ""
+
msgid "Height of Channel Display (Percent of OSD Height)"
msgstr "Alçada Visualització Canal (% alçada OSD)"
diff --git a/po/de_DE.po b/po/de_DE.po
index 350c532..a3eb4a3 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: 2014-05-24 15:11+0200\n"
+"POT-Creation-Date: 2021-06-06 13:13+0200\n"
"PO-Revision-Date: 2012-11-11 17:49+0200\n"
"Last-Translator: louis\n"
"Language-Team: \n"
@@ -521,6 +521,9 @@ msgstr "vergangene Zeit anzeigen"
msgid "show remaining time"
msgstr "verbleibende Zeit anzeigen"
+msgid "Fade-Out Time in ms (Zero for switching off fading)"
+msgstr "Fade-Out Zeit in ms (Null zum Abschalten)"
+
msgid "Height of Channel Display (Percent of OSD Height)"
msgstr "Höhe der Kanalwechsel Anzeige (% der OSD Höhe)"
diff --git a/po/it_IT.po b/po/it_IT.po
index 54ec2ac..6c5ee55 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: 2014-05-24 15:11+0200\n"
+"POT-Creation-Date: 2021-06-06 13:13+0200\n"
"PO-Revision-Date: 2013-03-19 22:56+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: \n"
@@ -524,6 +524,9 @@ msgstr ""
msgid "show remaining time"
msgstr ""
+msgid "Fade-Out Time in ms (Zero for switching off fading)"
+msgstr ""
+
msgid "Height of Channel Display (Percent of OSD Height)"
msgstr "Altezza di Mostra canale (% altezza OSD)"
diff --git a/po/sk_SK.po b/po/sk_SK.po
index 0c77330..cd0497f 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: 2014-05-24 15:11+0200\n"
+"POT-Creation-Date: 2021-06-06 13:13+0200\n"
"PO-Revision-Date: 2013-11-11 20:52+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n"
@@ -521,6 +521,9 @@ msgstr "zobrazi» uplynulý èas"
msgid "show remaining time"
msgstr "zobrazi» zostávajúci èas"
+msgid "Fade-Out Time in ms (Zero for switching off fading)"
+msgstr ""
+
msgid "Height of Channel Display (Percent of OSD Height)"
msgstr "Vý¹ka zobrazeného kanálu"
diff --git a/setup.c b/setup.c
index 6f749b8..d88343a 100644
--- a/setup.c
+++ b/setup.c
@@ -394,6 +394,7 @@ void cNopacitySetupChannelDisplay::Set(void) {
int currentItem = Current();
Clear();
Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("channelFadeTime"), 0, 1000));
+ Add(new cMenuEditIntItem(tr("Fade-Out Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("channelFadeOutTime"), 0, 1000));
Add(new cMenuEditIntItem(tr("Height of Channel Display (Percent of OSD Height)"), tmpConf->GetValueRef("channelHeight"), 15, 80));
Add(new cMenuEditIntItem(tr("Left & Right Border Width"), tmpConf->GetValueRef("channelBorderVertical"), 0, 300));
Add(new cMenuEditIntItem(tr("Bottom Border Height"), tmpConf->GetValueRef("channelBorderBottom"), 0, 300));