move video and music thumbloaders to their own .cpp/h files
[vuplus_xbmc] / xbmc / ThumbLoader.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2012 Team XBMC
4  *      http://www.xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "BackgroundInfoLoader.h"
23 #include "utils/StdString.h"
24
25 class CThumbLoader : public CBackgroundInfoLoader
26 {
27 public:
28   CThumbLoader(int nThreads=-1);
29   virtual ~CThumbLoader();
30
31   virtual void Initialize() { };
32
33   /*! \brief helper function to fill the art for a library item
34    \param item a CFileItem
35    \return true if we fill art, false otherwise
36    */
37   virtual bool FillLibraryArt(CFileItem &item) { return false; }
38
39   /*! \brief Checks whether the given item has an image listed in the texture database
40    \param item CFileItem to check
41    \param type the type of image to retrieve
42    \return the image associated with this item
43    */
44   static CStdString GetCachedImage(const CFileItem &item, const CStdString &type);
45
46   /*! \brief Associate an image with the given item in the texture database
47    \param item CFileItem to associate the image with
48    \param type the type of image
49    \param image the URL of the image
50    */
51   static void SetCachedImage(const CFileItem &item, const CStdString &type, const CStdString &image);
52 };
53
54 class CProgramThumbLoader : public CThumbLoader
55 {
56 public:
57   CProgramThumbLoader();
58   virtual ~CProgramThumbLoader();
59   virtual bool LoadItem(CFileItem* pItem);
60
61   /*! \brief Fill the thumb of a programs item
62    First uses a cached thumb from a previous run, then checks for a local thumb
63    and caches it for the next run
64    \param item the CFileItem object to fill
65    \return true if we fill the thumb, false otherwise
66    \sa GetLocalThumb
67    */
68   static bool FillThumb(CFileItem &item);
69
70   /*! \brief Get a local thumb for a programs item
71    Shortcuts are checked, then we check for a file or folder thumb
72    \param item the CFileItem object to check
73    \return the local thumb (if it exists)
74    \sa FillThumb
75    */
76   static CStdString GetLocalThumb(const CFileItem &item);
77 };