/* * Image plugin to VDR (C++) * * (C) 2004-2006 Andreas Brachold * based on (C) 2003 Kai Tobias Burwieck * * based on MP3/MPlayer plugin to VDR (C++) * (C) 2001,2002 Stefan Huelswitt * * * This code is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Or, point your browser to http://www.gnu.org/copyleft/gpl.html */ #include #include #include #include #include #include "setup-image.h" cImageSetup ImageSetup; const int cImageSetup::m_cSSMin = 2; const int cImageSetup::m_cSSMax = 300; // --- cImageSetup ----------------------------------------------------------- cImageSetup::cImageSetup(void) { m_bSlideShow = 1; m_nSSsec = 10; m_bAutoRepeat = 1; PictureSize = 2; AutoMusic = 0; OffsetLeft = 0; OffsetTop = 0; max_osdwidth = 1920; max_osdheight = 1080; Effect = 0; strncpy(MusicDir, "/media/server/nfs/data/mp3", sizeof(MusicDir)); MuteAudio = 1; rotate = 0; save = 0; makebackup = 1; oldrotate = 0; } #define ParseInteger(szTitle,nValue,nMin,nMax) \ if(!strcasecmp(szName, szTitle)) \ { \ nValue = atoi(szValue); \ if(nValue < nMin) nValue = nMin; \ if(nValue > nMax) nValue = nMax; \ } bool cImageSetup::SetupParse(const char *szName, const char *szValue) { ParseInteger("SlideShow", m_bSlideShow,0,1) else ParseInteger("SSsec", m_nSSsec,m_cSSMin,m_cSSMax) else ParseInteger("AutoRepeat", m_bAutoRepeat,0,1) else if(!strcasecmp(szName,"Resolution")) ImageSetup.PictureSize = atoi(szValue); else if(!strcasecmp(szName,"OffsetLeft")) ImageSetup.OffsetLeft = atoi(szValue); else if(!strcasecmp(szName,"OffsetTop")) ImageSetup.OffsetTop = atoi(szValue); else if(!strcasecmp(szName,"Max_OSDWidth")) ImageSetup.max_osdwidth = atoi(szValue); else if(!strcasecmp(szName,"Max_OSDHeight")) ImageSetup.max_osdheight = atoi(szValue); else if(!strcasecmp(szName,"Effect")) ImageSetup.Effect = atoi(szValue); // else if(!strcasecmp(szName,"AutoMusic")) ImageSetup.AutoMusic = atoi(szValue); else if(!strcasecmp(szName,"MusicDir")) strn0cpy(ImageSetup.MusicDir, szValue, sizeof(ImageSetup.MusicDir)); else if(!strcasecmp(szName,"MuteAudio")) ImageSetup.MuteAudio = atoi(szValue); else if(!strcasecmp(szName,"MakeBackup")) ImageSetup.makebackup = atoi(szValue); else return false; return true; } // --- cMenuSetupImage -------------------------------------------------------- void cMenuSetupImage::Store(void) { ImageSetup = m_tmpSetup; SetupStore("SlideShow", ImageSetup.m_bSlideShow); SetupStore("SSsec", ImageSetup.m_nSSsec); SetupStore("AutoRepeat", ImageSetup.m_bAutoRepeat); SetupStore("Resolution", ImageSetup.PictureSize); SetupStore("OffsetLeft", ImageSetup.OffsetLeft); SetupStore("OffsetTop", ImageSetup.OffsetTop); SetupStore("Max_OSDWidth", ImageSetup.max_osdwidth); SetupStore("Max_OSDHeight", ImageSetup.max_osdheight); SetupStore("Effect", ImageSetup.Effect); // SetupStore("AutoMusic", ImageSetup.AutoMusic); SetupStore("MusicDir", ImageSetup.MusicDir); SetupStore("MuteAudio", ImageSetup.MuteAudio); SetupStore("MakeBackup", ImageSetup.makebackup); } cMenuSetupImage::cMenuSetupImage(void) : m_tmpSetup(ImageSetup) { static const char allowed[] = { "1234567890abcdefghijklmnopqrstuvwxyz-_@/" }; SetSection(tr("Image")); Add(new cMenuEditBoolItem(tr("Slide show"), &m_tmpSetup.m_bSlideShow, tr("no"), tr("yes"))); Add(new cMenuEditIntItem (tr("Slide duration (sec)"), &m_tmpSetup.m_nSSsec, cImageSetup::m_cSSMin, cImageSetup::m_cSSMax)); Add(new cMenuEditBoolItem(tr("Repeat slide show"), &m_tmpSetup.m_bAutoRepeat, tr("no"), tr("yes"))); picturesize[0]=tr("640x480"); picturesize[1]=tr("768x576"); picturesize[2]=tr("1280x720"); picturesize[3]=tr("1920x1080"); picturesize[4]=tr("Own resolution"); Add(new cMenuEditStraItem(tr("Resolution") , &m_tmpSetup.PictureSize , 5 , picturesize)); Add(new cMenuEditIntItem(tr("Offset left") , &m_tmpSetup.OffsetLeft , 0 , 960)); Add(new cMenuEditIntItem(tr("Offset top") , &m_tmpSetup.OffsetTop , 0 , 540)); Add(new cMenuEditIntItem(tr("Width for own resoltion") , &m_tmpSetup.max_osdwidth , 120 , 1920)); Add(new cMenuEditIntItem(tr("Height for own resolution") , &m_tmpSetup.max_osdheight, 120 , 1200)); effect[0]=tr("None"); effect[1]=tr("Fadein/-out"); effect[2]=tr("Crossfade"); Add(new cMenuEditStraItem(tr("Effect") , &m_tmpSetup.Effect , 3 , effect)); // Add(new cMenuEditBoolItem(tr("Play music in background") , &m_tmpSetup.AutoMusic , tr("no") , tr("yes"))); Add(new cMenuEditStrItem(tr("Path to music library") , m_tmpSetup.MusicDir , 255 , allowed)); Add(new cMenuEditBoolItem(tr("Mute Audio before") , &m_tmpSetup.MuteAudio , tr("no") , tr("yes"))); Add(new cMenuEditBoolItem(tr("Make backup before saving image") , &m_tmpSetup.makebackup , tr("no") , tr("yes"))); }