Debian Codegraph @

xbmc/games/controllers/guicontrols/GUIScalarFeatureButton.cpp

raw
1 /*
2 * Copyright (C) 2016-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 "GUIScalarFeatureButton.h"
10
11 #include "guilib/LocalizeStrings.h"
12
13 #include <string>
14
15 using namespace KODI;
16 using namespace GAME;
17
18 CGUIScalarFeatureButton::CGUIScalarFeatureButton(const CGUIButtonControl& buttonTemplate,
19 IConfigurationWizard* wizard,
20 const CPhysicalFeature& feature,
21 unsigned int index)
22 : CGUIFeatureButton(buttonTemplate, wizard, feature, index)
23 {
24 Reset();
25 }
26
27 bool CGUIScalarFeatureButton::PromptForInput(CEvent& waitEvent)
28 {
29 bool bInterrupted = false;
30
31 switch (m_state)
32 {
33 case STATE::NEED_INPUT:
34 {
35 const std::string& strPrompt = g_localizeStrings.Get(35090); // "Press %s"
36 const std::string& strWarn = g_localizeStrings.Get(35091); // "Press %s (%d)"
37
38 bInterrupted = DoPrompt(strPrompt, strWarn, m_feature.Label(), waitEvent);
39
40 m_state = GetNextState(m_state);
41
42 break;
43 }
44 default:
45 break;
46 }
47
48 return bInterrupted;
49 }
50
51 bool CGUIScalarFeatureButton::IsFinished(void) const
52 {
53 return m_state >= STATE::FINISHED;
54 }
55
56 void CGUIScalarFeatureButton::Reset(void)
57 {
58 m_state = STATE::NEED_INPUT;
59 }