Debian Codegraph @

xbmc/guilib/guiinfo/GamesGUIInfo.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #include "guilib/guiinfo/GamesGUIInfo.h"
10
11 #include "FileItem.h"
12 #include "Util.h"
13 #include "cores/RetroPlayer/RetroPlayerUtils.h"
14 #include "games/tags/GameInfoTag.h"
15 #include "guilib/guiinfo/GUIInfo.h"
16 #include "guilib/guiinfo/GUIInfoLabels.h"
17 #include "settings/MediaSettings.h"
18 #include "utils/StringUtils.h"
19 #include "utils/Variant.h"
20 #include "utils/log.h"
21
22 using namespace KODI::GUILIB::GUIINFO;
23 using namespace KODI::GAME;
24 using namespace KODI::RETRO;
25
26 //! @todo Savestates were removed from v18
27 //#define FILEITEM_PROPERTY_SAVESTATE_DURATION "duration"
28
29 bool CGamesGUIInfo::InitCurrentItem(CFileItem *item)
30 {
31 if (item && item->IsGame())
32 {
33 CLog::Log(LOGDEBUG, "CGamesGUIInfo::InitCurrentItem({})", item->GetPath());
34
35 item->LoadGameTag();
36 CGameInfoTag* tag = item->GetGameInfoTag(); // creates item if not yet set, so no nullptr checks needed
37
38 if (tag->GetTitle().empty())
39 {
40 // No title in tag, show filename only
41 tag->SetTitle(CUtil::GetTitleFromPath(item->GetPath()));
42 }
43 return true;
44 }
45 return false;
46 }
47
48 bool CGamesGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const
49 {
50 switch (info.m_info)
51 {
52 ///////////////////////////////////////////////////////////////////////////////////////////////
53 // RETROPLAYER_*
54 ///////////////////////////////////////////////////////////////////////////////////////////////
55 case RETROPLAYER_VIDEO_FILTER:
56 {
57 value = CMediaSettings::GetInstance().GetCurrentGameSettings().VideoFilter();
58 return true;
59 }
60 case RETROPLAYER_STRETCH_MODE:
61 {
62 STRETCHMODE stretchMode = CMediaSettings::GetInstance().GetCurrentGameSettings().StretchMode();
63 value = CRetroPlayerUtils::StretchModeToIdentifier(stretchMode);
64 return true;
65 }
66 case RETROPLAYER_VIDEO_ROTATION:
67 {
68 const unsigned int rotationDegCCW = CMediaSettings::GetInstance().GetCurrentGameSettings().RotationDegCCW();
69 value = std::to_string(rotationDegCCW);
70 return true;
71 }
72 default:
73 break;
74 }
75
76 return false;
77 }
78
79 bool CGamesGUIInfo::GetInt(int& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const
80 {
81 return false;
82 }
83
84 bool CGamesGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const
85 {
86 return false;
87 }