diff options
| author | Martin Schirrmacher <vdr.skinflat@schirrmacher.eu> | 2013-08-05 22:20:26 +0200 |
|---|---|---|
| committer | Martin Schirrmacher <vdr.skinflat@schirrmacher.eu> | 2013-08-05 22:20:26 +0200 |
| commit | 6805c7897f386e630c9d9adadbdd6ff8424103f2 (patch) | |
| tree | 4171a4a90fd6ebc4dff0d919255e3f5dcff54a74 | |
| parent | 4e6f677b254f138e2f0deefea3f29553c6d4a41b (diff) | |
| download | skin-flat-6805c7897f386e630c9d9adadbdd6ff8424103f2.tar.gz skin-flat-6805c7897f386e630c9d9adadbdd6ff8424103f2.tar.bz2 | |
add logopath parameter
| -rw-r--r-- | HISTORY | 1 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | baserender.c | 4 | ||||
| -rw-r--r-- | flat.c | 1 | ||||
| -rw-r--r-- | flat.h | 39 | ||||
| -rwxr-xr-x | generate_theme.sh | 16 | ||||
| -rw-r--r-- | imageloader.c | 165 | ||||
| -rw-r--r-- | imageloader.h | 15 | ||||
| -rw-r--r-- | skinflat.c | 18 | ||||
| -rw-r--r-- | themes/flat-white.theme | 36 |
10 files changed, 76 insertions, 221 deletions
@@ -1,6 +1,7 @@ VDR Plugin 'skinflat' Revision History --------------------------------------- 2013-XX-XX: Version 0.0.3 +- [add] parameter to set channel logos path - [update] display tracks margin, background color - [update] display volume margin - [update] top bar, 2 rows date, color @@ -58,7 +58,7 @@ LIBS += $(shell pkg-config --libs Magick++) ### The object files (add further files here): -OBJS = imageloader.o baserender.o displaychannel.o displaymenu.o displaymessage.o \ +OBJS = config.o imageloader.o baserender.o displaychannel.o displaymenu.o displaymessage.o \ displayreplay.o displaytracks.o displayvolume.o flat.o $(PLUGIN).o ### The main target: diff --git a/baserender.c b/baserender.c index d83f438..8ada248 100644 --- a/baserender.c +++ b/baserender.c @@ -112,8 +112,8 @@ void cFlatBaseRender::TopBarUpdate(void) { int fullWidth = max(weekdayWidth, dateWidth); int fontSmlTop = (topBarHeight - fontSmlHeight*2) / 2; - topBarPixmap->DrawText(cPoint(osdWidth - timeWidth - fullWidth - marginItem*2, fontSmlTop), weekday, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, 0, taCenter); - topBarPixmap->DrawText(cPoint(osdWidth - timeWidth - fullWidth - marginItem*2, fontSmlTop + fontSmlHeight), date, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, 0, taCenter); + topBarPixmap->DrawText(cPoint(osdWidth - timeWidth - fullWidth - marginItem*2, fontSmlTop), weekday, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, fullWidth, 0, taCenter); + topBarPixmap->DrawText(cPoint(osdWidth - timeWidth - fullWidth - marginItem*2, fontSmlTop + fontSmlHeight), date, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, fullWidth, 0, taCenter); } } @@ -10,6 +10,7 @@ #include "displaytracks.h" #include "displayvolume.h" +class cFlatConfig Config; cTheme Theme; static bool menuActive = false; @@ -3,6 +3,9 @@ #include <vdr/skins.h> #include <vdr/videodir.h> +#include "config.h" +extern class cFlatConfig Config; + class cFlatDisplayMenu; extern cTheme Theme; @@ -19,13 +22,13 @@ extern cTheme Theme; #define CLR_MESSAGEERROR 0xFFBB0000 // TopBar -THEME_CLR(Theme, clrTopBarBg, 0xBB101010); +THEME_CLR(Theme, clrTopBarBg, 0xCC101010); THEME_CLR(Theme, clrTopBarFont, 0xFFEEEEEE); THEME_CLR(Theme, clrTopBarTimeFont, 0xFFEEEEEE); THEME_CLR(Theme, clrTopBarDateFont, 0xFFA0A0A0); // Buttons -THEME_CLR(Theme, clrButtonBg, 0xBB101010); +THEME_CLR(Theme, clrButtonBg, 0xCC101010); THEME_CLR(Theme, clrButtonFont, 0xFFEEEEEE); THEME_CLR(Theme, clrButtonRed, CLR_BUTTONRED); THEME_CLR(Theme, clrButtonGreen, CLR_BUTTONGREEN); @@ -33,7 +36,7 @@ THEME_CLR(Theme, clrButtonYellow, CLR_BUTTONYELLOW); THEME_CLR(Theme, clrButtonBlue, CLR_BUTTONBLUE); // Messages -THEME_CLR(Theme, clrMessageBg, 0xBB101010); +THEME_CLR(Theme, clrMessageBg, 0xCC101010); THEME_CLR(Theme, clrMessageFont, 0xFFEEEEEE); THEME_CLR(Theme, clrMessageStatus, CLR_MESSAGESTATUS); @@ -42,57 +45,57 @@ THEME_CLR(Theme, clrMessageWarning, CLR_MESSAGEWARNING); THEME_CLR(Theme, clrMessageError, CLR_MESSAGEERROR); // Channel -THEME_CLR(Theme, clrChannelBg, 0xBB101010); +THEME_CLR(Theme, clrChannelBg, 0xCC101010); THEME_CLR(Theme, clrChannelFontTitle, 0xFF3090B0); THEME_CLR(Theme, clrChannelFontEpg, 0xFFEEEEEE); THEME_CLR(Theme, clrChannelFontEpgFollow, 0xFFA0A0A0); THEME_CLR(Theme, clrChannelProgressFg, 0xFFEEEEEE); THEME_CLR(Theme, clrChannelProgressBarFg, 0xFFEEEEEE); -THEME_CLR(Theme, clrChannelProgressBg, 0xBB101010); +THEME_CLR(Theme, clrChannelProgressBg, 0xCC101010); // Menu -THEME_CLR(Theme, clrItemBg, 0xBB909090); +THEME_CLR(Theme, clrItemBg, 0xCC909090); THEME_CLR(Theme, clrItemFont, 0xFFEEEEEE); -THEME_CLR(Theme, clrItemCurrentBg, 0xBB3090B0); +THEME_CLR(Theme, clrItemCurrentBg, 0xCC3090B0); THEME_CLR(Theme, clrItemCurrentFont, 0xFFEEEEEE); -THEME_CLR(Theme, clrItemSelableBg, 0xBB101010); +THEME_CLR(Theme, clrItemSelableBg, 0xCC101010); THEME_CLR(Theme, clrItemSelableFont, 0xFFEEEEEE); THEME_CLR(Theme, clrScrollbarFg, 0xFFEEEEEE); THEME_CLR(Theme, clrScrollbarBarFg, 0xFFEEEEEE); -THEME_CLR(Theme, clrScrollbarBg, 0xBB101010); +THEME_CLR(Theme, clrScrollbarBg, 0xCC101010); // Menu Event -THEME_CLR(Theme, clrMenuEventBg, 0xBB101010); +THEME_CLR(Theme, clrMenuEventBg, 0xCC101010); THEME_CLR(Theme, clrMenuEventFontTitle, 0xFF3090B0); THEME_CLR(Theme, clrMenuEventFontInfo, 0xFFEEEEEE); // Menu Recording -THEME_CLR(Theme, clrMenuRecBg, 0xBB101010); +THEME_CLR(Theme, clrMenuRecBg, 0xCC101010); THEME_CLR(Theme, clrMenuRecFontTitle, 0xFF3090B0); THEME_CLR(Theme, clrMenuRecFontInfo, 0xFFEEEEEE); // Menu Text (Multiline) -THEME_CLR(Theme, clrMenuTextBg, 0xBB101010); +THEME_CLR(Theme, clrMenuTextBg, 0xCC101010); THEME_CLR(Theme, clrMenuTextFont, 0xFFEEEEEE); // Replay -THEME_CLR(Theme, clrReplayBg, 0xBB101010); +THEME_CLR(Theme, clrReplayBg, 0xCC101010); THEME_CLR(Theme, clrReplayFont, 0xFFEEEEEE); THEME_CLR(Theme, clrReplayProgressFg, 0xFFEEEEEE); THEME_CLR(Theme, clrReplayProgressBarFg, 0xFFEEEEEE); -THEME_CLR(Theme, clrReplayProgressBg, 0xBB101010); +THEME_CLR(Theme, clrReplayProgressBg, 0xCC101010); THEME_CLR(Theme, clrReplayMarkFg, 0xFFEEEEEE); THEME_CLR(Theme, clrReplayMarkCurrentFg, 0xFF3090B0); // Tracks -THEME_CLR(Theme, clrTrackItemBg, 0xBB101010); +THEME_CLR(Theme, clrTrackItemBg, 0xCC101010); THEME_CLR(Theme, clrTrackItemFont, 0xFFEEEEEE); -THEME_CLR(Theme, clrTrackItemCurrentBg, 0xBB3090B0); +THEME_CLR(Theme, clrTrackItemCurrentBg, 0xCC3090B0); THEME_CLR(Theme, clrTrackItemCurrentFont, 0xFFEEEEEE); // Volume -THEME_CLR(Theme, clrVolumeBg, 0xBB101010); +THEME_CLR(Theme, clrVolumeBg, 0xCC101010); THEME_CLR(Theme, clrVolumeFont, 0xFFEEEEEE); THEME_CLR(Theme, clrVolumeProgressFg, 0xFFEEEEEE); THEME_CLR(Theme, clrVolumeProgressBarFg, 0xFFEEEEEE); -THEME_CLR(Theme, clrVolumeProgressBg, 0xBB101010); +THEME_CLR(Theme, clrVolumeProgressBg, 0xCC101010); class cFlat : public cSkin { private: diff --git a/generate_theme.sh b/generate_theme.sh index 00a9a5a..51273a4 100755 --- a/generate_theme.sh +++ b/generate_theme.sh @@ -88,16 +88,16 @@ echo "clrTopBarTimeFont = $Font" >> $FILE echo "clrTopBarDateFont = $Font" >> $FILE echo "clrButtonBg = $Background" >> $FILE echo "clrButtonFont = $Font" >> $FILE -echo "clrButtonRed = 99BB0000" >> $FILE -echo "clrButtonGreen = 9900BB00" >> $FILE -echo "clrButtonYellow = 99BBBB00" >> $FILE -echo "clrButtonBlue = 990000BB" >> $FILE +echo "clrButtonRed = FFBB0000" >> $FILE +echo "clrButtonGreen = FF00BB00" >> $FILE +echo "clrButtonYellow = FFBBBB00" >> $FILE +echo "clrButtonBlue = FF0000BB" >> $FILE echo "clrMessageBg = $Background" >> $FILE echo "clrMessageFont = $Font" >> $FILE -echo "clrMessageStatus = 900000FF" >> $FILE -echo "clrMessageInfo = 90009900" >> $FILE -echo "clrMessageWarning = 90BBBB00" >> $FILE -echo "clrMessageError = 90BB0000" >> $FILE +echo "clrMessageStatus = FF0000FF" >> $FILE +echo "clrMessageInfo = FF009900" >> $FILE +echo "clrMessageWarning = FFBBBB00" >> $FILE +echo "clrMessageError = FFBB0000" >> $FILE echo "clrChannelBg = $Background" >> $FILE echo "clrChannelFontTitle = $TitleFont" >> $FILE echo "clrChannelFontEpg = $Font" >> $FILE diff --git a/imageloader.c b/imageloader.c index e1b625b..64dc4da 100644 --- a/imageloader.c +++ b/imageloader.c @@ -8,10 +8,6 @@ using namespace Magick; cImageLoader::cImageLoader() { InitializeMagick(NULL); - logoPathDefault = cString::sprintf("%s/logos/", PLUGINPATH); - iconPathDefault = cString::sprintf("%s/icons/", PLUGINPATH); - epgImagePathDefault = cString::sprintf("%s/epgImages/", PLUGINPATH); - logoExtension = "png"; } @@ -28,13 +24,7 @@ bool cImageLoader::LoadLogo(const char *logo, int width=-1, int height=-1) { return false; std::string logoLower = logo; toLowerCase(logoLower); - bool success = false; - if( logoPathSet ) { - success = LoadImage(logoLower.c_str(), logoPath, logoExtension); - } - if( !success ) { - success = LoadImage(logoLower.c_str(), logoPathDefault, logoExtension); - } + bool success = LoadImage(logoLower.c_str(), Config.logoPath, logoExtension); if( !success ) return false; @@ -57,22 +47,8 @@ int cImageLoader::Width(void) { bool cImageLoader::LoadIcon(const char *cIcon, int size) { if (size==0) return false; - bool success = false; - if (iconPathSet) { - cString iconThemePath = cString::sprintf("%s%s/", *iconPath, Setup.OSDTheme); - success = LoadImage(cString(cIcon), iconThemePath, "png"); - if (!success) { - success = LoadImage(cString(cIcon), iconPath, "png"); - } - } - if (!success) { - cString iconThemePath = cString::sprintf("%s%s/", *iconPathDefault, Setup.OSDTheme); - printf("%s\n", *iconThemePath); - success = LoadImage(cString(cIcon), iconThemePath, "png"); - if (!success) { - success = LoadImage(cString(cIcon), iconPathDefault, "png"); - } - } + cString iconThemePath = cString::sprintf("%s%s/", *Config.iconPath, Setup.OSDTheme); + bool success = LoadImage(cString(cIcon), iconThemePath, "png"); if (!success) return false; buffer.sample(Geometry(size, size)); @@ -83,21 +59,8 @@ bool cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool prese try { if ((width == 0)||(height==0)) return false; - bool success = false; - if (iconPathSet) { - cString iconThemePath = cString::sprintf("%s%s/", *iconPath, Setup.OSDTheme); - success = LoadImage(cString(cIcon), iconThemePath, "png"); - if (!success) { - success = LoadImage(cString(cIcon), iconPath, "png"); - } - } - if (!success) { - cString iconThemePath = cString::sprintf("%s%s/", *iconPathDefault, Setup.OSDTheme); - success = LoadImage(cString(cIcon), iconThemePath, "png"); - if (!success) { - success = LoadImage(cString(cIcon), iconPathDefault, "png"); - } - } + cString iconThemePath = cString::sprintf("%s%s/", *Config.iconPath, Setup.OSDTheme); + bool success = LoadImage(cString(cIcon), iconThemePath, "png"); if (!success) return false; if (preserveAspect) { @@ -113,106 +76,6 @@ bool cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool prese } } -bool cImageLoader::LoadEPGImage(int eventID) { - int width = epgImageWidth; - int height = epgImageHeight; - if ((width == 0)||(height==0)) - return false; - bool success = false; - if (epgImagePathSet) { - success = LoadImage(cString::sprintf("%d", eventID), epgImagePath, "jpg"); - } - if (!success) { - success = LoadImage(cString::sprintf("%d", eventID), epgImagePathDefault, "jpg"); - } - if (!success) - return false; - if (height != 0 || width != 0) { - buffer.sample( Geometry(width, height)); - } - return true; -} - -bool cImageLoader::LoadAdditionalEPGImage(cString name) { - int width = epgImageWidthLarge; - int height = epgImageHeightLarge; - if ((width == 0)||(height==0)) - return false; - bool success = false; - if (epgImagePathSet) { - success = LoadImage(name, epgImagePath, "jpg"); - } - if (!success) { - success = LoadImage(name, epgImagePathDefault, "jpg"); - } - if (!success) - return false; - if (height != 0 || width != 0) { - buffer.sample( Geometry(width, height)); - } - return true; -} - -bool cImageLoader::LoadRecordingImage(cString Path) { - int width = epgImageWidth; - int height = epgImageHeight; - if ((width == 0)||(height==0)) - return false; - cString recImage(""); - if (FirstImageInFolder(Path, "jpg", &recImage)) { - recImage = cString::sprintf("/%s", *recImage); - if (!LoadImage(*recImage, Path, "jpg")) - return false; - buffer.sample( Geometry(width, height)); - return true; - } - return false; -} - -bool cImageLoader::LoadAdditionalRecordingImage(cString path, cString name) { - int width = epgImageWidthLarge; - int height = epgImageHeightLarge; - if ((width == 0)||(height==0)) - return false; - if (LoadImage(name, path, "jpg")) { - buffer.sample( Geometry(width, height)); - return true; - } - return false; -} - -void cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height, bool mirror) { - Color Back = Argb2Color(back); - Color Blend = Argb2Color(blend); - Image tmp(Geometry(width, height), Blend); - double arguments[9] = {0.0,(double)height,0.0,-1*(double)width,0.0,0.0,1.5*(double)width,0.0,1.0}; - tmp.sparseColor(MatteChannel, BarycentricColorInterpolate, 9, arguments); - Image tmp2(Geometry(width, height), Back); - tmp.composite(tmp2, 0, 0, OverlayCompositeOp); - if (mirror) - tmp.flop(); - buffer = tmp; -} - -void cImageLoader::DrawBackground2(tColor back, tColor blend, int width, int height) { - Color Back = Argb2Color(back); - Color Blend = Argb2Color(blend); - Image tmp(Geometry(width, height), Blend); - double arguments[9] = {0.0,(double)height,0.0,-0.5*(double)width,0.0,0.0,0.75*(double)width,0.0,1.0}; - tmp.sparseColor(MatteChannel, BarycentricColorInterpolate, 9, arguments); - Image tmp2(Geometry(width, height), Back); - tmp.composite(tmp2, 0, 0, OverlayCompositeOp); - buffer = tmp; -} - -void cImageLoader::Colorize(tColor col) -{ - // opacity - // 0 = opaque - // QuantumRange = trans - buffer.colorize(QuantumRange / 2, Argb2Color(col) ); -} - cImage cImageLoader::GetImage() { int w, h; w = buffer.columns(); @@ -261,21 +124,3 @@ bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) } return true; } - -bool cImageLoader::FirstImageInFolder(cString Path, cString Extension, cString *recImage) { - DIR *folder; - struct dirent *file; - folder = opendir(Path); - while ( (file = readdir(folder)) ) { - if (endswith(file->d_name, *Extension)) { - std::string fileName = file->d_name; - if (fileName.length() > 4) - fileName = fileName.substr(0, fileName.length() - 4); - else - return false; - *recImage = fileName.c_str(); - return true; - } - } - return false; -} diff --git a/imageloader.h b/imageloader.h index 83d4b27..eef7697 100644 --- a/imageloader.h +++ b/imageloader.h @@ -4,11 +4,10 @@ #include <vdr/osd.h> #include <vdr/skins.h> -#include <vdr/plugin.h> #include <Magick++.h> -#define PLUGINPATH (cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)) +#include "flat.h" using namespace Magick; @@ -20,27 +19,17 @@ public: bool LoadLogo(const char *logo, int width, int height); bool LoadIcon(const char *cIcon, int size); bool LoadIcon(const char *cIcon, int width, int height, bool preserveAspect = true); - bool LoadEPGImage(int eventID); - bool LoadAdditionalEPGImage(cString name); - bool LoadRecordingImage(cString Path); - bool LoadAdditionalRecordingImage(cString path, cString name); - void DrawBackground(tColor back, tColor blend, int width, int height, bool mirror = false); - void DrawBackground2(tColor back, tColor blend, int width, int height); - void Colorize(tColor col); + int Height(void); int Width(void); - private: int epgImageWidthLarge, epgImageHeightLarge; int epgImageWidth, epgImageHeight; int logoWidth, logoHeight; cString logoExtension; - cString logoPath, logoPathDefault, iconPath, iconPathDefault, epgImagePath, epgImagePathDefault; - bool logoPathSet, iconPathSet, epgImagePathSet; Image buffer; Color Argb2Color(tColor col); void toLowerCase(std::string &str); bool LoadImage(cString FileName, cString Path, cString Extension); - bool FirstImageInFolder(cString Path, cString Extension, cString *recImage); }; @@ -51,15 +51,31 @@ cPluginFlat::~cPluginFlat() { } const char *cPluginFlat::CommandLineHelp(void) { - return ""; + return " -l <LOGOPATH>, --logopath=<LOGOPATH> Set directory where Channel Logos are stored.\n"; } bool cPluginFlat::ProcessArgs(int argc, char *argv[]) { // Implement command line argument processing here if applicable. + static const struct option long_options[] = { + { "logopath", required_argument, NULL, 'l' }, + { NULL } + }; + + int c; + while ((c = getopt_long(argc, argv, "l:", long_options, NULL)) != -1) { + switch (c) { + case 'l': + Config.SetLogoPath(cString(optarg)); + break; + default: + return false; + } + } return true; } bool cPluginFlat::Initialize(void) { + Config.Init(); return true; } diff --git a/themes/flat-white.theme b/themes/flat-white.theme index 1899b89..e98da10 100644 --- a/themes/flat-white.theme +++ b/themes/flat-white.theme @@ -1,57 +1,57 @@ Description = white -clrTopBarBg = 90CCCCCC +clrTopBarBg = BBCCCCCC clrTopBarFont = FF222222 clrTopBarTimeFont = FF222222 clrTopBarDateFont = FF505050 -clrButtonBg = 90CCCCCC +clrButtonBg = BBCCCCCC clrButtonFont = FF222222 clrButtonRed = FFBB0000 clrButtonGreen = FF00BB00 clrButtonYellow = FFBBBB00 clrButtonBlue = FF0000BB -clrMessageBg = 90CCCCCC +clrMessageBg = BBCCCCCC clrMessageFont = FF222222 clrMessageStatus = FF0000FF clrMessageInfo = FF009900 clrMessageWarning = FFBBBB00 clrMessageError = FFBB0000 -clrChannelBg = 90CCCCCC +clrChannelBg = BBCCCCCC clrChannelFontTitle = FF206277 clrChannelFontEpg = FF222222 clrChannelFontEpgFollow = FF505050 clrChannelProgressFg = FF222222 clrChannelProgressBarFg = FF222222 -clrChannelProgressBg = 90CCCCCC -clrItemBg = 90808080 +clrChannelProgressBg = BBCCCCCC +clrItemBg = BB808080 clrItemFont = FF222222 -clrItemCurrentBg = 903090B0 +clrItemCurrentBg = BB3090B0 clrItemCurrentFont = FF222222 -clrItemSelableBg = 90CCCCCC +clrItemSelableBg = BBCCCCCC clrItemSelableFont = FF222222 clrScrollbarFg = FF222222 -clrScrollbarBg = 90CCCCCC +clrScrollbarBg = BBCCCCCC clrScrollbarBarFg = FF222222 -clrMenuEventBg = 90CCCCCC +clrMenuEventBg = BBCCCCCC clrMenuEventFontTitle = FF206277 clrMenuEventFontInfo = FF222222 -clrMenuRecBg = 90CCCCCC +clrMenuRecBg = BBCCCCCC clrMenuRecFontTitle = FF206277 clrMenuRecFontInfo = FF222222 -clrMenuTextBg = 90CCCCCC +clrMenuTextBg = BBCCCCCC clrMenuTextFont = FF222222 -clrReplayBg = 90CCCCCC +clrReplayBg = BBCCCCCC clrReplayFont = FF222222 clrReplayProgressFg = FF222222 clrReplayProgressBarFg = FF222222 -clrReplayProgressBg = 90CCCCCC +clrReplayProgressBg = BBCCCCCC clrReplayMarkFg = FF222222 clrReplayMarkCurrentFg = FF3090B0 -clrTrackItemBg = 90CCCCCC +clrTrackItemBg = BBCCCCCC clrTrackItemFont = FF222222 -clrTrackItemCurrentBg = 906AB0C0 +clrTrackItemCurrentBg = BB6AB0C0 clrTrackItemCurrentFont = FF222222 -clrVolumeBg = 90CCCCCC +clrVolumeBg = BBCCCCCC clrVolumeFont = FF222222 clrVolumeProgressFg = FF222222 clrVolumeProgressBarFg = FF222222 -clrVolumeProgressBg = 90CCCCCC +clrVolumeProgressBg = BBCCCCCC |
