blob: 3a0eb529e006fc1b02f3eb7c7d8990416cfb114f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* Copyright (C) 2017-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "DialogGameOSD.h"
#include "DialogGameOSDHelp.h"
#include "ServiceBroker.h"
#include "games/GameServices.h"
#include "games/GameSettings.h"
#include "guilib/WindowIDs.h"
#include "input/actions/Action.h"
#include "input/actions/ActionIDs.h"
using namespace KODI;
using namespace GAME;
CDialogGameOSD::CDialogGameOSD()
: CGUIDialog(WINDOW_DIALOG_GAME_OSD, "GameOSD.xml"), m_helpDialog(new CDialogGameOSDHelp(*this))
{
// Initialize CGUIWindow
m_loadType = KEEP_IN_MEMORY;
}
bool CDialogGameOSD::OnAction(const CAction& action)
{
switch (action.GetID())
{
case ACTION_PARENT_DIR:
case ACTION_PREVIOUS_MENU:
case ACTION_NAV_BACK:
case ACTION_SHOW_OSD:
case ACTION_PLAYER_PLAY:
{
// Disable OSD help if visible
if (m_helpDialog->IsVisible() && CServiceBroker::IsServiceManagerUp())
{
GAME::CGameSettings& gameSettings = CServiceBroker::GetGameServices().GameSettings();
if (gameSettings.ShowOSDHelp())
{
gameSettings.SetShowOSDHelp(false);
return true;
}
}
break;
}
default:
break;
}
return CGUIDialog::OnAction(action);
}
void CDialogGameOSD::OnInitWindow()
{
// Init parent class
CGUIDialog::OnInitWindow();
// Init help dialog
m_helpDialog->OnInitWindow();
}
void CDialogGameOSD::OnDeinitWindow(int nextWindowID)
{
CGUIDialog::OnDeinitWindow(nextWindowID);
if (CServiceBroker::IsServiceManagerUp())
{
GAME::CGameSettings& gameSettings = CServiceBroker::GetGameServices().GameSettings();
gameSettings.SetShowOSDHelp(false);
}
}
bool CDialogGameOSD::PlayInBackground(int dialogId)
{
return dialogId == WINDOW_DIALOG_GAME_VOLUME;
}
|