mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-14 17:03:34 +02:00
lcd4l: porting color and font support from TangoCash
Origin commit data
------------------
Commit: 7359f1f38d
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-05-23 (Mon, 23 May 2016)
Origin message was:
------------------
- lcd4l: porting color and font support from TangoCash
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
Copyright (C) 2012-2016 'vanhofen'
|
||||
Homepage: http://www.neutrino-images.de/
|
||||
|
||||
Modded (C) 2016 'TangoCash'
|
||||
|
||||
License: GPL
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -33,6 +35,7 @@
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <iomanip>
|
||||
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
@@ -87,6 +90,10 @@ extern CRemoteControl *g_RemoteControl;
|
||||
#define START LCD_DATADIR "start"
|
||||
#define END LCD_DATADIR "end"
|
||||
|
||||
#define FONT LCD_DATADIR "font"
|
||||
#define FGCOLOR LCD_DATADIR "fgcolor"
|
||||
#define BGCOLOR LCD_DATADIR "bgcolor"
|
||||
|
||||
#define FLAG_LCD4LINUX "/tmp/.lcd4linux"
|
||||
#define PIDFILE "/tmp/lcd4linux.pid"
|
||||
|
||||
@@ -166,7 +173,8 @@ int CLCD4l::RemoveFile(const char *file)
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if (access(file, F_OK) == 0) {
|
||||
if (access(file, F_OK) == 0)
|
||||
{
|
||||
if (unlink(file) != 0)
|
||||
ret = 1;
|
||||
}
|
||||
@@ -260,6 +268,44 @@ void* CLCD4l::LCD4lProc(void* arg)
|
||||
|
||||
void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
|
||||
{
|
||||
SNeutrinoTheme &t = g_settings.theme;
|
||||
|
||||
std::string font = g_settings.font_file;
|
||||
|
||||
if (m_font.compare(font))
|
||||
{
|
||||
WriteFile(FONT, font);
|
||||
m_font = font;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
std::string fgcolor = hexStr(&t.infobar_Text_red)
|
||||
+ hexStr(&t.infobar_Text_green)
|
||||
+ hexStr(&t.infobar_Text_blue)
|
||||
+ hexStr(&t.infobar_Text_alpha);
|
||||
|
||||
if (m_fgcolor.compare(fgcolor))
|
||||
{
|
||||
WriteFile(FGCOLOR, fgcolor);
|
||||
m_fgcolor = fgcolor;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
std::string bgcolor = hexStr(&t.infobar_red)
|
||||
+ hexStr(&t.infobar_green)
|
||||
+ hexStr(&t.infobar_blue)
|
||||
+ hexStr(&t.infobar_alpha);
|
||||
|
||||
if (m_bgcolor.compare(bgcolor))
|
||||
{
|
||||
WriteFile(BGCOLOR, bgcolor);
|
||||
m_bgcolor = bgcolor;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
int Tuner = 1 + CFEManager::getInstance()->getLiveFE()->getNumber();
|
||||
|
||||
if (m_Tuner != Tuner)
|
||||
@@ -794,6 +840,15 @@ void CLCD4l::strReplace(std::string & orig, const char *fstr, const std::string
|
||||
}
|
||||
}
|
||||
|
||||
std::string CLCD4l::hexStr(unsigned char* data)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::hex;
|
||||
for(int i=0; i<1; ++i)
|
||||
ss << std::setw(2) << std::setfill('0') << (int)data[i];
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
bool CLCD4l::GetLogoName(uint64_t channel_id, std::string channel_name, std::string &logo)
|
||||
{
|
||||
int h, i, j;
|
||||
|
@@ -7,6 +7,8 @@
|
||||
Copyright (C) 2012-2016 'vanhofen'
|
||||
Homepage: http://www.neutrino-images.de/
|
||||
|
||||
Modded (C) 2016 'TangoCash'
|
||||
|
||||
License: GPL
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -78,6 +80,7 @@ class CLCD4l
|
||||
bool GetLogoName(uint64_t channel_id, std::string channel_name, std::string & logo);
|
||||
|
||||
std::string Int2String(int iconvert);
|
||||
std::string hexStr(unsigned char* data);
|
||||
void strReplace(std::string & orig, const char *fstr, const std::string rstr);
|
||||
bool WriteFile(const char *file, std::string content = "", bool convert = false);
|
||||
|
||||
@@ -106,6 +109,10 @@ class CLCD4l
|
||||
std::string m_Event;
|
||||
int m_Progress;
|
||||
char m_Duration[15];
|
||||
|
||||
std::string m_font;
|
||||
std::string m_fgcolor;
|
||||
std::string m_bgcolor;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user