Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] [PATCH] vdrc-0.0.8 for VDR-1.3.x
Hi,
This is a patch to make vdrc-0.0.8 work with newer vdr-1.3.x (tested
with 1.3.12).
The plugin seems to work, but I could not checked it against the
original version because of the lack of a vdr-1.2.x installation so I
don't know whether it is behaving like the original or not.
The changes are mainly OSD interface related, and I can not say that I
really understood what I was doing, so take this patch with a grain of salt.
Wolfgang
Index: filewnd.c
===================================================================
RCS file: /home/cvs/cvsroot/vdr/vdr/PLUGINS/src/vdrc/filewnd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- filewnd.c 13 Aug 2004 16:01:51 -0000 1.1.1.1
+++ filewnd.c 14 Aug 2004 08:31:05 -0000 1.3
@@ -23,7 +23,7 @@
free(m_sName);
}
-cFileWnd::cFileWnd(cOsdBase *osd, int x, int y, int width, int height, const char *folder)
+cFileWnd::cFileWnd(cOsd *osd, int x, int y, int width, int height, const char *folder)
{
pOSD = osd;
iX = x; // OSD x
@@ -187,22 +187,22 @@
m_iCurrentElem = iMaxElem - m_iTopElem;
}
-void cFileWnd::DrawText(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg)
+void cFileWnd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg)
{
if (x < iWidth && y < iHeight)
{
- pOSD->Text((iX + x) * charWidth + 2, (iY + y) * lineHeight, s, ColorFg, ColorBg);
+ pOSD->DrawText((iX + x) * charWidth + 2, (iY + y) * lineHeight, s, ColorFg, ColorBg, cFont::GetFont(fontOsd));
}
}
void cFileWnd::Draw()
{
// Clear Title
- pOSD->Fill(iX * charWidth, iY * lineHeight,
+ pOSD->DrawRectangle(iX * charWidth, iY * lineHeight,
(iX + iWidth) * charWidth, (iY + 1) * lineHeight,
clr_vdrc_bk);
//Clear Panel
- pOSD->Fill(iX * charWidth, (iY + 1) * lineHeight,
+ pOSD->DrawRectangle(iX * charWidth, (iY + 1) * lineHeight,
(iX + iWidth) * charWidth, (iY + iHeight) * lineHeight,
clr_vdrc_bk);
DrawTitle();
@@ -248,7 +248,7 @@
if (i == (m_iCurrentElem + m_iTopElem) && m_bActive)
{
- pOSD->Fill((iX + x) * charWidth, (iY + y) * lineHeight, (iX + iWidth) * charWidth - 2, (iY + y + 1) * lineHeight - 1, clrCyan);
+ pOSD->DrawRectangle((iX + x) * charWidth, (iY + y) * lineHeight, (iX + iWidth) * charWidth - 2, (iY + y + 1) * lineHeight - 1, clrCyan);
DrawText(x, y, s, clr_vdrc_item_sel, clr_vdrc_item_sel_bk);
}
else
@@ -313,7 +313,7 @@
// dsyslog("VDRC: ReadActiveDir");
for (int i = 0; i < (int) strlen(sFA); i++)
{
- asprintf(&sCMD, "find \"%s\" -follow -type %c -maxdepth 1 | sort -df", m_sFolder, sFA[i]);
+ asprintf(&sCMD, "find \"%s\" -follow -type %c -maxdepth 1 2>/dev/null | sort -df", m_sFolder, sFA[i]);
FILE *fl = popen(sCMD, "r");
if (fl)
Index: filewnd.h
===================================================================
RCS file: /home/cvs/cvsroot/vdr/vdr/PLUGINS/src/vdrc/filewnd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- filewnd.h 13 Aug 2004 16:01:51 -0000 1.1.1.1
+++ filewnd.h 14 Aug 2004 08:11:32 -0000 1.2
@@ -32,7 +32,7 @@
class cFileWnd
{
private:
- cOsdBase *pOSD;
+ cOsd *pOSD;
int iX;
int iY;
int iWidth;
@@ -45,10 +45,10 @@
protected:
void DrawDirItems();
void DrawTitle();
- void DrawText(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg);
+ void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg);
bool ReadActiveDir();
public:
- cFileWnd(cOsdBase *osd, int x, int y, int width, int height, const char *folder);
+ cFileWnd(cOsd *osd, int x, int y, int width, int height, const char *folder);
~cFileWnd(void);
void Draw();
void SetActive(bool bActive = true);
Index: functhread.c
===================================================================
RCS file: /home/cvs/cvsroot/vdr/vdr/PLUGINS/src/vdrc/functhread.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- functhread.c 13 Aug 2004 16:01:51 -0000 1.1.1.1
+++ functhread.c 14 Aug 2004 08:12:10 -0000 1.2
@@ -1,316 +1,316 @@
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <utime.h>
-#include <stdio.h>
-#include "functhread.h"
-
-cFuncThread::cFuncThread(cOsdBase *pStatusOSD, const char *sFromFile, const char *sToFile, int iFunction, int *piReturn)
-{
- m_sFromFile = strdup(sFromFile);
- m_sToFile = strdup(sToFile);
- m_iProgressBarVal = -1;
- m_iFunction = iFunction;
- m_piReturn = piReturn;
- SetReturn(-1);
- pOSD = pStatusOSD;
- Start();
-}
-
-void cFuncThread::SetReturn(int iValue)
-{
- if ( m_piReturn )
- *m_piReturn = iValue;
-}
-
-void cFuncThread::Action(void)
-{
- dsyslog("VDRC: function thread started (pid=%d)", getpid());
- switch(m_iFunction)
- {
- case func_copy_file:
- if ( Copy_File_File(m_sFromFile, m_sToFile) )
- SetReturn(0);
- break;
- case func_copy_dir:
- if ( Copy_Dir_Dir(m_sFromFile, m_sToFile) )
- SetReturn(0);
- break;
- case func_delete_dir:
- if ( Erase_Recursive(m_sFromFile) )
- SetReturn(0);
- break;
- }
- dsyslog("VDRC: end function thread");
-}
-
-cFuncThread::~cFuncThread()
-{
- Cancel(0);
- delete m_sFromFile;
- delete m_sToFile;
-}
-
-bool cFuncThread::Copy_File_File(char *sSrc, char *sDest)
-{
- bool bReturn = false;
- int fSource = 0;
- int fDest = 0;
- struct stat stFile;
-
- if ( (fSource = open(sSrc, O_RDONLY)) > 0) // | O_LINEAR)) > 0)
- {
- int iBufSize = 8192; // Buffer Size 8K
-
- uid_t uidSrc = (uid_t) -1;
- uid_t gidSrc = (gid_t) -1;
- int modeSrc = 0;
- struct utimbuf tmSrc;
-
- fstat(fSource, &stFile);
-
- // Get Data for CHOWN
- uidSrc = stFile.st_uid;
- gidSrc = stFile.st_gid;
-
- // Get Data for CHMOD
- modeSrc = stFile.st_mode;
-
- // Get Time Data
- tmSrc.actime = stFile.st_atime;
- tmSrc.modtime = stFile.st_mtime;
-
-// dsyslog("VDRC: File Size %d", (int) stFile.st_size);
- if ( (fDest = open(sDest, O_WRONLY | O_CREAT | O_TRUNC, 0600) ) > 0)
- {
- char *sBuf;
- int iReadBytes = 1;
- int iWriteBytes = 0;
- int iAllReadBytes = 0;
- int iFileSize;
-
- sBuf = (char *) malloc(iBufSize);
-
- iFileSize = stFile.st_size / 1024;
- ProgressBar(0, iFileSize);
-
- while (iReadBytes > 0)
- {
- iReadBytes = read(fSource, sBuf, iBufSize);
-
- if (iReadBytes > 0)
- {
- ProgressBar((iAllReadBytes / 1024), iFileSize);
- iWriteBytes = write(fDest, sBuf, iReadBytes);
-
- iAllReadBytes += iReadBytes;
- }
- }
-
- close(fDest);
-
- if ( chown(sDest, uidSrc, gidSrc) == 0 )
- if ( chmod(sDest, modeSrc) == 0 )
- utime(sDest, &tmSrc);
-
- free(sBuf);
-
- bReturn = true;
- }
-
- close(fSource);
- }
-
- return bReturn;
-}
-
-
-char *cFuncThread::MakeFileWithPath(char *sPath, char *sFile)
-{
- char *sRet = NULL;
-
- if (strlen(sPath) > 1)
- asprintf(&sRet, "%s/%s", sPath, sFile);
- else
- asprintf(&sRet, "%s%s", sPath, sFile);
-
- return sRet;
-}
-
-bool cFuncThread::Erase_Recursive(char* sPath)
-{
- bool bReturn = false;
- DIR *dDir;
- struct dirent *stDir;
-
- dDir = opendir(sPath);
-
- if (dDir)
- {
- bool bNoError = true;
-
- while ( (stDir = readdir(dDir)) && bNoError)
- {
- struct stat statFile;
-
- if ( strcmp(stDir->d_name, ".") == 0 ||
- strcmp(stDir->d_name, "..") == 0 )
- continue;
-
- char *sFullFile = MakeFileWithPath(sPath, stDir->d_name);
-
- bNoError = (lstat(sFullFile, &statFile) == 0);
-
- if (bNoError)
- {
- if ( S_ISDIR(statFile.st_mode) )
- bNoError = Erase_Recursive(sFullFile);
- else
- {
- bNoError = ( unlink(sFullFile) == 0 );
-// dsyslog("vdrc: delete rec file \"%s\"", sFullFile);
- }
- }
-
- if (sFullFile)
- free(sFullFile);
- }
-
- if (bNoError)
- {
- closedir(dDir);
- bNoError = (rmdir(sPath) == 0);
-// dsyslog("vdrc: delete rec dir \"%s\"", sPath);
- }
-
- if (bNoError)
- bReturn = true;
- }
-
- return bReturn;
-}
-
-bool cFuncThread::Copy_Dir_Dir(char *sSrc, char *sDest)
-{
- bool bReturn = false;
- struct stat stSrcFile;
- struct stat stDestFile;
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <utime.h>
+#include <stdio.h>
+#include "functhread.h"
+
+cFuncThread::cFuncThread(cOsd *pStatusOSD, const char *sFromFile, const char *sToFile, int iFunction, int *piReturn)
+{
+ m_sFromFile = strdup(sFromFile);
+ m_sToFile = strdup(sToFile);
+ m_iProgressBarVal = -1;
+ m_iFunction = iFunction;
+ m_piReturn = piReturn;
+ SetReturn(-1);
+ pOSD = pStatusOSD;
+ Start();
+}
+
+void cFuncThread::SetReturn(int iValue)
+{
+ if ( m_piReturn )
+ *m_piReturn = iValue;
+}
+
+void cFuncThread::Action(void)
+{
+ dsyslog("VDRC: function thread started (pid=%d)", getpid());
+ switch(m_iFunction)
+ {
+ case func_copy_file:
+ if ( Copy_File_File(m_sFromFile, m_sToFile) )
+ SetReturn(0);
+ break;
+ case func_copy_dir:
+ if ( Copy_Dir_Dir(m_sFromFile, m_sToFile) )
+ SetReturn(0);
+ break;
+ case func_delete_dir:
+ if ( Erase_Recursive(m_sFromFile) )
+ SetReturn(0);
+ break;
+ }
+ dsyslog("VDRC: end function thread");
+}
+
+cFuncThread::~cFuncThread()
+{
+ Cancel(0);
+ delete m_sFromFile;
+ delete m_sToFile;
+}
+
+bool cFuncThread::Copy_File_File(char *sSrc, char *sDest)
+{
+ bool bReturn = false;
+ int fSource = 0;
+ int fDest = 0;
+ struct stat stFile;
+
+ if ( (fSource = open(sSrc, O_RDONLY)) > 0) // | O_LINEAR)) > 0)
+ {
+ int iBufSize = 8192; // Buffer Size 8K
+
+ uid_t uidSrc = (uid_t) -1;
+ uid_t gidSrc = (gid_t) -1;
+ int modeSrc = 0;
+ struct utimbuf tmSrc;
+
+ fstat(fSource, &stFile);
+
+ // Get Data for CHOWN
+ uidSrc = stFile.st_uid;
+ gidSrc = stFile.st_gid;
+
+ // Get Data for CHMOD
+ modeSrc = stFile.st_mode;
+
+ // Get Time Data
+ tmSrc.actime = stFile.st_atime;
+ tmSrc.modtime = stFile.st_mtime;
+
+// dsyslog("VDRC: File Size %d", (int) stFile.st_size);
+ if ( (fDest = open(sDest, O_WRONLY | O_CREAT | O_TRUNC, 0600) ) > 0)
+ {
+ char *sBuf;
+ int iReadBytes = 1;
+ int iWriteBytes = 0;
+ int iAllReadBytes = 0;
+ int iFileSize;
+
+ sBuf = (char *) malloc(iBufSize);
+
+ iFileSize = stFile.st_size / 1024;
+ ProgressBar(0, iFileSize);
+
+ while (iReadBytes > 0)
+ {
+ iReadBytes = read(fSource, sBuf, iBufSize);
+
+ if (iReadBytes > 0)
+ {
+ ProgressBar((iAllReadBytes / 1024), iFileSize);
+ iWriteBytes = write(fDest, sBuf, iReadBytes);
+
+ iAllReadBytes += iReadBytes;
+ }
+ }
+
+ close(fDest);
+
+ if ( chown(sDest, uidSrc, gidSrc) == 0 )
+ if ( chmod(sDest, modeSrc) == 0 )
+ utime(sDest, &tmSrc);
+
+ free(sBuf);
+
+ bReturn = true;
+ }
+
+ close(fSource);
+ }
+
+ return bReturn;
+}
+
+
+char *cFuncThread::MakeFileWithPath(char *sPath, char *sFile)
+{
+ char *sRet = NULL;
+
+ if (strlen(sPath) > 1)
+ asprintf(&sRet, "%s/%s", sPath, sFile);
+ else
+ asprintf(&sRet, "%s%s", sPath, sFile);
+
+ return sRet;
+}
+
+bool cFuncThread::Erase_Recursive(char* sPath)
+{
+ bool bReturn = false;
+ DIR *dDir;
+ struct dirent *stDir;
+
+ dDir = opendir(sPath);
+
+ if (dDir)
+ {
+ bool bNoError = true;
+
+ while ( (stDir = readdir(dDir)) && bNoError)
+ {
+ struct stat statFile;
+
+ if ( strcmp(stDir->d_name, ".") == 0 ||
+ strcmp(stDir->d_name, "..") == 0 )
+ continue;
+
+ char *sFullFile = MakeFileWithPath(sPath, stDir->d_name);
+
+ bNoError = (lstat(sFullFile, &statFile) == 0);
+
+ if (bNoError)
+ {
+ if ( S_ISDIR(statFile.st_mode) )
+ bNoError = Erase_Recursive(sFullFile);
+ else
+ {
+ bNoError = ( unlink(sFullFile) == 0 );
+// dsyslog("vdrc: delete rec file \"%s\"", sFullFile);
+ }
+ }
+
+ if (sFullFile)
+ free(sFullFile);
+ }
+
+ if (bNoError)
+ {
+ closedir(dDir);
+ bNoError = (rmdir(sPath) == 0);
+// dsyslog("vdrc: delete rec dir \"%s\"", sPath);
+ }
+
+ if (bNoError)
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool cFuncThread::Copy_Dir_Dir(char *sSrc, char *sDest)
+{
+ bool bReturn = false;
+ struct stat stSrcFile;
+ struct stat stDestFile;
char *sD1;
char *sD2;
-
+
asprintf(&sD1, "%s/", sSrc);
asprintf(&sD2, "%s/", sDest);
if (strncasecmp(sD2, sD1, strlen(sD1)) != 0)
{
- if ( lstat(sSrc, &stSrcFile) == 0 && S_ISDIR(stSrcFile.st_mode) )
- {
- bool bNoError = true;
- bool bCreated = ( lstat(sDest, &stDestFile) == 0);
- struct utimbuf tmSrc;
-
- // Get Time Data
- tmSrc.actime = stSrcFile.st_atime;
- tmSrc.modtime = stSrcFile.st_mtime;
-
- if ( !bCreated || S_ISDIR(stDestFile.st_mode) )
- {
- DIR *dDir;
- struct dirent *stDir;
-
- if (!bCreated)
- {
-
- bNoError = ( mkdir(sDest, stSrcFile.st_mode) == 0 );
- if (bNoError)
- bNoError = ( chown(sDest, stSrcFile.st_uid, stSrcFile.st_gid) == 0 );
-
-// dsyslog("vdrc: copy rec make dir \"%s\"", sDest);
- }
-
-
- if (bNoError)
- {
- dDir = opendir(sSrc);
-
- if (dDir)
- {
- while ( (stDir = readdir(dDir)) && bNoError)
- {
- struct stat statFile;
-
- if ( strcmp(stDir->d_name, ".") == 0 ||
- strcmp(stDir->d_name, "..") == 0 )
- continue;
-
- char *sSrcFullFile = MakeFileWithPath(sSrc, stDir->d_name);
- char *sDestFullFile = MakeFileWithPath(sDest, stDir->d_name);
-
- bNoError = (lstat(sSrcFullFile, &statFile) == 0);
-
- if (bNoError)
- {
- if ( S_ISDIR(statFile.st_mode) )
- bNoError = Copy_Dir_Dir(sSrcFullFile, sDestFullFile);
- else
- {
- bNoError = Copy_File_File(sSrcFullFile, sDestFullFile);
-// dsyslog("vdrc: copy rec file \"%s\" to \"%s\"", sSrcFullFile, sDestFullFile);
- }
- }
-
- if (sSrcFullFile)
- free(sSrcFullFile);
- if (sDestFullFile)
- free(sDestFullFile);
- }
-
- closedir(dDir);
- }
- }
-
- bNoError = ( chmod(sDest, stSrcFile.st_mode) == 0 );
- if (bNoError)
- bNoError = ( utime(sDest, &tmSrc) == 0 );
-
- }
- else
+ if ( lstat(sSrc, &stSrcFile) == 0 && S_ISDIR(stSrcFile.st_mode) )
+ {
+ bool bNoError = true;
+ bool bCreated = ( lstat(sDest, &stDestFile) == 0);
+ struct utimbuf tmSrc;
+
+ // Get Time Data
+ tmSrc.actime = stSrcFile.st_atime;
+ tmSrc.modtime = stSrcFile.st_mtime;
+
+ if ( !bCreated || S_ISDIR(stDestFile.st_mode) )
+ {
+ DIR *dDir;
+ struct dirent *stDir;
+
+ if (!bCreated)
+ {
+
+ bNoError = ( mkdir(sDest, stSrcFile.st_mode) == 0 );
+ if (bNoError)
+ bNoError = ( chown(sDest, stSrcFile.st_uid, stSrcFile.st_gid) == 0 );
+
+// dsyslog("vdrc: copy rec make dir \"%s\"", sDest);
+ }
+
+
+ if (bNoError)
+ {
+ dDir = opendir(sSrc);
+
+ if (dDir)
+ {
+ while ( (stDir = readdir(dDir)) && bNoError)
+ {
+ struct stat statFile;
+
+ if ( strcmp(stDir->d_name, ".") == 0 ||
+ strcmp(stDir->d_name, "..") == 0 )
+ continue;
+
+ char *sSrcFullFile = MakeFileWithPath(sSrc, stDir->d_name);
+ char *sDestFullFile = MakeFileWithPath(sDest, stDir->d_name);
+
+ bNoError = (lstat(sSrcFullFile, &statFile) == 0);
+
+ if (bNoError)
+ {
+ if ( S_ISDIR(statFile.st_mode) )
+ bNoError = Copy_Dir_Dir(sSrcFullFile, sDestFullFile);
+ else
+ {
+ bNoError = Copy_File_File(sSrcFullFile, sDestFullFile);
+// dsyslog("vdrc: copy rec file \"%s\" to \"%s\"", sSrcFullFile, sDestFullFile);
+ }
+ }
+
+ if (sSrcFullFile)
+ free(sSrcFullFile);
+ if (sDestFullFile)
+ free(sDestFullFile);
+ }
+
+ closedir(dDir);
+ }
+ }
+
+ bNoError = ( chmod(sDest, stSrcFile.st_mode) == 0 );
+ if (bNoError)
+ bNoError = ( utime(sDest, &tmSrc) == 0 );
+
+ }
+ else
{
if (bCreated)
dsyslog("Error copy Dir on File");
- bNoError = false;
+ bNoError = false;
}
if (bNoError)
bReturn = true;
- }
-
}
+ }
+ }
else
dsyslog("Error copy Parent into Child");
free(sD1);
free(sD2);
- return bReturn;
-}
-
-void cFuncThread::ProgressBar(int Current, int Total)
-{
- if (Total > 0)
- {
- int Width = (Setup.OSDwidth * charWidth);
- int y = ((Setup.OSDheight - 1)* lineHeight);
- int y1 = ((Setup.OSDheight)* lineHeight);
- long p = Current * Width / Total;
-
- if (p != m_iProgressBarVal && (p % 16 == 0))
- {
- pOSD->Fill(m_iProgressBarVal + 0, y, p, y1, clr_vdrc_pbar);
- pOSD->Fill(p + 1, y, Width, y1, clr_vdrc_pbar_bk);
- pOSD->Flush();
-
- m_iProgressBarVal = p;
- }
- }
-}
+ return bReturn;
+}
+
+void cFuncThread::ProgressBar(int Current, int Total)
+{
+ if (Total > 0)
+ {
+ int Width = (Setup.OSDWidth * charWidth);
+ int y = ((Setup.OSDHeight - 1)* lineHeight);
+ int y1 = ((Setup.OSDHeight)* lineHeight);
+ long p = Current * Width / Total;
+
+ if (p != m_iProgressBarVal && (p % 16 == 0))
+ {
+ pOSD->DrawRectangle(m_iProgressBarVal + 0, y, p, y1, clr_vdrc_pbar);
+ pOSD->DrawRectangle(p + 1, y, Width, y1, clr_vdrc_pbar_bk);
+ pOSD->Flush();
+
+ m_iProgressBarVal = p;
+ }
+ }
+}
Index: functhread.h
===================================================================
RCS file: /home/cvs/cvsroot/vdr/vdr/PLUGINS/src/vdrc/functhread.h,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- functhread.h 13 Aug 2004 16:01:51 -0000 1.1.1.1
+++ functhread.h 14 Aug 2004 08:57:47 -0000 1.3
@@ -1,44 +1,44 @@
-/*
- * functhread.h: Functions Thread
- *
- */
-
-#ifndef _FUNCTHREAD__H
-#define _FUNCTHREAD__H
-
-#include <vdr/plugin.h>
-#include "global.h"
-
-class cFuncThread : public cThread
-{
-private:
- char *m_sFromFile;
- char *m_sToFile;
- int m_iProgressBarVal;
- int m_iFunction;
- int *m_piReturn;
- cOsdBase *pOSD; // OSD Object
-
-protected:
- virtual void Action(void);
- bool Copy_File_File(char *sSrc, char *sDest);
- bool Copy_Dir_Dir(char *sSrc, char *sDest)
;
- char *MakeFileWithPath(char *sPath, char *sFile);
- bool Erase_Recursive(char* sPath);
- void ProgressBar(int Current, int Total);
- void SetReturn(int iValue = -1);
-
-public:
- enum
- {
- func_copy_file,
- func_delete_file,
- func_copy_dir,
- func_delete_dir
- }
;
-
- cFuncThread(cOsdBase *pStatusOSD, const char *sFromFile, const char *sToFile, int iFunction, int *piReturn = NULL);
- virtual ~cFuncThread();
-};
-
-#endif //_FUNCTHREAD__H
\ No newline at end of file
+/*
+ * functhread.h: Functions Thread
+ *
+ */
+
+#ifndef _FUNCTHREAD__H
+#define _FUNCTHREAD__H
+
+#include <vdr/plugin.h>
+#include "global.h"
+
+class cFuncThread : public cThread
+{
+private:
+ char *m_sFromFile;
+ char *m_sToFile;
+ int m_iProgressBarVal;
+ int m_iFunction;
+ int *m_piReturn;
+ cOsd *pOSD; // OSD Object
+
+protected:
+ virtual void Action(void);
+ bool Copy_File_File(char *sSrc, char *sDest);
+ bool Copy_Dir_Dir(char *sSrc, char *sDest);
+ char *MakeFileWithPath(char *sPath, char *sFile);
+ bool Erase_Recursive(char* sPath);
+ void ProgressBar(int Current, int Total);
+ void SetReturn(int iValue = -1);
+
+public:
+ enum
+ {
+ func_copy_file,
+ func_delete_file,
+ func_copy_dir,
+ func_delete_dir
+ };
+
+ cFuncThread(cOsd *pStatusOSD, const char *sFromFile, const char *sToFile, int iFunction, int *piReturn = NULL);
+ virtual ~cFuncThread();
+};
+
+#endif //_FUNCTHREAD__H
Index: global.h
===================================================================
RCS file: /home/cvs/cvsroot/vdr/vdr/PLUGINS/src/vdrc/global.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- global.h 13 Aug 2004 16:01:51 -0000 1.1.1.1
+++ global.h 14 Aug 2004 08:13:11 -0000 1.2
@@ -16,7 +16,7 @@
#define clr_vdrc_pbar_bk clrWhite // Progress Bar Background Color
#define clr_vdrc_pbar clrGreen // Progress Bar Color
-#define clr_vdrc_bk clrBackground // VDRC Backgroung Color
+#define clr_vdrc_bk clrGray50 // VDRC Background Color
#define clr_vdrc_item_sel clrBlack // Selected Item Color
#define clr_vdrc_item_sel_bk clrCyan // Selected Item Bk Color
#define clr_vdrc_item_nsel clrWhite // Non-Selected Item Color
@@ -28,4 +28,7 @@
#define _DEF_MAX_WIN 2
+#define p2c(x) ((x) / charWidth)
+#define p2l(x) ((x) / lineHeight)
+
#endif //_GLOBAL__H
Index: mainwnd.c
===================================================================
RCS file: /home/cvs/cvsroot/vdr/vdr/PLUGINS/src/vdrc/mainwnd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- mainwnd.c 13 Aug 2004 16:01:51 -0000 1.1.1.1
+++ mainwnd.c 14 Aug 2004 08:18:01 -0000 1.2
@@ -55,28 +55,20 @@
int x = 0;
int y = 0;
- x = (720 - (Setup.OSDwidth + 1) * charWidth) / 2;
- y = (576 - Setup.OSDheight * lineHeight) / 2;
+ x = (720 - (Setup.OSDWidth + 1)) / 2;
+ y = (576 - Setup.OSDHeight) / 2;
// dsyslog("X <%d> Y <%d>", x, y);
- pOSD = cOsd::OpenRaw(x, y);
+ pOSD = cOsdProvider::NewOsd(x, y);
if (pOSD)
- {
- pOSD->Create(0, 0, (Setup.OSDwidth) * charWidth, lineHeight, 2);
- pOSD->Create(0, lineHeight, (Setup.OSDwidth) * charWidth, (Setup.OSDheight - 2) * lineHeight, 2);
- pOSD->Create(0, (Setup.OSDheight - 1) * lineHeight, (Setup.OSDwidth) * charWidth, lineHeight, 2);
-
- pOSD->AddColor(clrBackground);
- pOSD->AddColor(clrRed);
- pOSD->AddColor(clrGreen);
- pOSD->AddColor(clrBlue);
- pOSD->AddColor(clrTransparent);
- pOSD->AddColor(clrWhite);
- pOSD->AddColor(clrBlack);
- pOSD->AddColor(clrCyan);
-
- pOSD->Clear();
+ {
+ tArea Areas[] = { {0, 0, Setup.OSDWidth - 1, lineHeight - 1, 2 },
+ {0, lineHeight, Setup.OSDWidth - 1, Setup.OSDHeight - lineHeight - 1, 2 },
+ {0, Setup.OSDHeight - lineHeight, Setup.OSDWidth - 1, Setup.OSDHeight - 1, 2 }
+ };
+
+ pOSD->SetAreas(Areas, sizeof(Areas) / sizeof(tArea));
CreatePanels();
pPanelWnd[m_iCurrentPanel]->SetActive();
@@ -180,17 +172,17 @@
void cMainWnd::CreatePanels(void)
{
- int iPanelWidth = Setup.OSDwidth / _DEF_MAX_WIN;
+ int iPanelWidth = p2c (Setup.OSDWidth) / _DEF_MAX_WIN;
int iX = 0;
int i;
for (i = 0; i < _DEF_MAX_WIN - 1; i++)
{
- pPanelWnd[i] = new cFileWnd(pOSD, iX, 0, iPanelWidth, Setup.OSDheight - 1, m_sDefDir[i]);
+ pPanelWnd[i] = new cFileWnd(pOSD, iX, 0, iPanelWidth, p2l (Setup.OSDHeight) - 1, m_sDefDir[i]);
iX += iPanelWidth;
}
- pPanelWnd[_DEF_MAX_WIN - 1] = new cFileWnd(pOSD, iX, 0, Setup.OSDwidth - iX, Setup.OSDheight - 1, m_sDefDir[_DEF_MAX_WIN - 1]);
+ pPanelWnd[_DEF_MAX_WIN - 1] = new cFileWnd(pOSD, iX, 0, p2c (Setup.OSDWidth) - iX, p2l (Setup.OSDHeight) - 1, m_sDefDir[_DEF_MAX_WIN - 1]);
}
void cMainWnd::RedrawAll(int iPanelNr)
@@ -508,15 +500,15 @@
void cMainWnd::ShowStatusText(const char *s)
{
- pOSD->Fill(0, (Setup.OSDheight - 1) * lineHeight, (Setup.OSDwidth) * charWidth, Setup.OSDheight * lineHeight, clrGreen);
- pOSD->Text(5, (Setup.OSDheight - 1) * lineHeight, s, clrBlack, clrGreen);
+ pOSD->DrawRectangle(0, Setup.OSDHeight - lineHeight, Setup.OSDWidth - 1, Setup.OSDHeight - 1, clrGreen);
+ pOSD->DrawText(5, Setup.OSDHeight - lineHeight, s, clrBlack, clrGreen, cFont::GetFont(fontOsd));
pOSD->Flush();
}
void cMainWnd::ClearStatus(void)
{
- pOSD->Fill(0, (Setup.OSDheight - 1) * lineHeight, Setup.OSDwidth * charWidth, Setup.OSDheight * lineHeight - 1, clrBackground);
+ pOSD->DrawRectangle(0, Setup.OSDHeight - lineHeight, Setup.OSDWidth -1, Setup.OSDHeight - 1, clrGray50);
pOSD->Flush();
}
Index: mainwnd.h
===================================================================
RCS file: /home/cvs/cvsroot/vdr/vdr/PLUGINS/src/vdrc/mainwnd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- mainwnd.h 13 Aug 2004 16:01:51 -0000 1.1.1.1
+++ mainwnd.h 14 Aug 2004 08:18:31 -0000 1.2
@@ -7,6 +7,7 @@
#define _MAINWND__H
#include <vdr/plugin.h>
+#include <vdr/interface.h>
#include "filewnd.h"
#include "global.h"
#include "functhread.h"
@@ -14,7 +15,7 @@
class cMainWnd : public cOsdObject
{
private:
- cOsdBase *pOSD; // OSD Object
+ cOsd *pOSD; // OSD Object
cFileWnd *pPanelWnd[_DEF_MAX_WIN]; // Panels Object
int m_iCurrentPanel; // Active Panel
int m_iReturnWords;
Home |
Main Index |
Thread Index