Debian Codegraph @

xbmc/games/dialogs/osd/DialogGameOSDHelp.cpp

raw
1 /*
2 * Copyright (C) 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 "DialogGameOSDHelp.h"
10
11 #include "DialogGameOSD.h"
12 #include "guilib/GUIMessage.h"
13 #include "guilib/LocalizeStrings.h"
14 #include "guilib/WindowIDs.h"
15 #include "utils/StringUtils.h"
16
17 using namespace KODI;
18 using namespace GAME;
19
20 namespace
21 {
22 constexpr char HELP_COMBO[] =
23 "[B]$FEATURE[select,game.controller.snes] + $FEATURE[x,game.controller.default][/B]";
24 }
25
26 const int CDialogGameOSDHelp::CONTROL_ID_HELP_TEXT = 1101;
27
28 CDialogGameOSDHelp::CDialogGameOSDHelp(CDialogGameOSD& dialog) : m_dialog(dialog)
29 {
30 }
31
32 void CDialogGameOSDHelp::OnInitWindow()
33 {
34 // Set help text
35 // "Press {0:s} to open the menu."
36 std::string helpText = StringUtils::Format(g_localizeStrings.Get(35235), HELP_COMBO);
37
38 CGUIMessage msg(GUI_MSG_LABEL_SET, WINDOW_DIALOG_GAME_OSD, CONTROL_ID_HELP_TEXT);
39 msg.SetLabel(helpText);
40 m_dialog.OnMessage(msg);
41 }
42
43 bool CDialogGameOSDHelp::IsVisible()
44 {
45 return IsVisible(CONTROL_ID_HELP_TEXT);
46 }
47
48 bool CDialogGameOSDHelp::IsVisible(int windowId)
49 {
50 CGUIControl* control = m_dialog.GetControl(windowId);
51 if (control != nullptr)
52 return control->IsVisible();
53
54 return false;
55 }