[video] fix selection after changing video or extra art
[xbmc.git] / xbmc / ThumbLoader.h
blob7b163eaa43faaf2f1033be7f2b46a46fbe2e6ead
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "BackgroundInfoLoader.h"
13 #include <string>
15 class CTextureDatabase;
17 class CThumbLoader : public CBackgroundInfoLoader
19 public:
20 CThumbLoader();
21 ~CThumbLoader() override;
23 void OnLoaderStart() override;
24 void OnLoaderFinish() override;
26 /*! \brief helper function to fill the art for a library item
27 \param item a CFileItem
28 \return true if we fill art, false otherwise
30 virtual bool FillLibraryArt(CFileItem &item) { return false; }
32 /*! \brief Checks whether the given item has an image listed in the texture database
33 \param item CFileItem to check
34 \param type the type of image to retrieve
35 \return the image associated with this item
37 virtual std::string GetCachedImage(const CFileItem &item, const std::string &type);
39 /*! \brief Associate an image with the given item in the texture database
40 \param item CFileItem to associate the image with
41 \param type the type of image
42 \param image the URL of the image
44 virtual void SetCachedImage(const CFileItem &item, const std::string &type, const std::string &image);
46 protected:
47 CTextureDatabase *m_textureDatabase;
50 class CProgramThumbLoader : public CThumbLoader
52 public:
53 CProgramThumbLoader();
54 ~CProgramThumbLoader() override;
55 bool LoadItem(CFileItem* pItem) override;
56 bool LoadItemCached(CFileItem* pItem) override;
57 bool LoadItemLookup(CFileItem* pItem) override;
59 /*! \brief Fill the thumb of a programs item
60 First uses a cached thumb from a previous run, then checks for a local thumb
61 and caches it for the next run
62 \param item the CFileItem object to fill
63 \return true if we fill the thumb, false otherwise
64 \sa GetLocalThumb
66 virtual bool FillThumb(CFileItem &item);
68 /*! \brief Get a local thumb for a programs item
69 Shortcuts are checked, then we check for a file or folder thumb
70 \param item the CFileItem object to check
71 \return the local thumb (if it exists)
72 \sa FillThumb
74 static std::string GetLocalThumb(const CFileItem &item);