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.
9 #include "GUIDialogVideoOSD.h"
11 #include "GUIUserMessages.h"
12 #include "ServiceBroker.h"
13 #include "application/Application.h"
14 #include "guilib/GUIComponent.h"
15 #include "guilib/GUIWindowManager.h"
16 #include "guilib/WindowIDs.h"
17 #include "input/InputManager.h"
18 #include "input/actions/Action.h"
19 #include "input/actions/ActionIDs.h"
20 #include "input/mouse/MouseEvent.h"
21 #include "settings/Settings.h"
22 #include "settings/SettingsComponent.h"
27 CGUIDialogVideoOSD::CGUIDialogVideoOSD(void)
28 : CGUIDialog(WINDOW_DIALOG_VIDEO_OSD
, "VideoOSD.xml")
30 m_loadType
= KEEP_IN_MEMORY
;
33 CGUIDialogVideoOSD::~CGUIDialogVideoOSD(void) = default;
35 void CGUIDialogVideoOSD::FrameMove()
39 // check for movement of mouse or a submenu open
40 if (CServiceBroker::GetInputManager().IsMouseActive()
41 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS
)
42 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_SUBTITLE_OSD_SETTINGS
)
43 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_VIDEO_OSD_SETTINGS
)
44 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_CMS_OSD_SETTINGS
)
45 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_VIDEO_BOOKMARKS
)
46 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_PVR_OSD_CHANNELS
)
47 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_PVR_CHANNEL_GUIDE
)
48 || CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_OSD_TELETEXT
))
49 // extend show time by original value
50 SetAutoClose(m_showDuration
);
52 CGUIDialog::FrameMove();
55 bool CGUIDialogVideoOSD::OnAction(const CAction
&action
)
57 if (action
.GetID() == ACTION_SHOW_OSD
)
63 return CGUIDialog::OnAction(action
);
66 EVENT_RESULT
CGUIDialogVideoOSD::OnMouseEvent(const CPoint
& point
, const MOUSE::CMouseEvent
& event
)
68 if (event
.m_id
== ACTION_MOUSE_WHEEL_UP
)
70 return g_application
.OnAction(CAction(ACTION_ANALOG_SEEK_FORWARD
, 0.5f
)) ? EVENT_RESULT_HANDLED
: EVENT_RESULT_UNHANDLED
;
72 if (event
.m_id
== ACTION_MOUSE_WHEEL_DOWN
)
74 return g_application
.OnAction(CAction(ACTION_ANALOG_SEEK_BACK
, 0.5f
)) ? EVENT_RESULT_HANDLED
: EVENT_RESULT_UNHANDLED
;
77 return CGUIDialog::OnMouseEvent(point
, event
);
80 bool CGUIDialogVideoOSD::OnMessage(CGUIMessage
& message
)
82 switch ( message
.GetMessage() )
84 case GUI_MSG_VIDEO_MENU_STARTED
:
86 // We have gone to the DVD menu, so close the OSD.
90 case GUI_MSG_WINDOW_DEINIT
: // fired when OSD is hidden
92 // Remove our subdialogs if visible
93 CGUIDialog
*pDialog
= CServiceBroker::GetGUI()->GetWindowManager().GetDialog(WINDOW_DIALOG_AUDIO_OSD_SETTINGS
);
94 if (pDialog
&& pDialog
->IsDialogRunning())
96 pDialog
= CServiceBroker::GetGUI()->GetWindowManager().GetDialog(WINDOW_DIALOG_SUBTITLE_OSD_SETTINGS
);
97 if (pDialog
&& pDialog
->IsDialogRunning())
102 return CGUIDialog::OnMessage(message
);