void CPVRActionListener::OnSettingAction(const CSetting *setting) { if (setting == nullptr) return; const std::string &settingId = setting->GetId(); if (settingId == CSettings::SETTING_PVRMANAGER_RESETDB) { CServiceBroker::GetPVRManager().GUIActions()->ResetPVRDatabase(false); } else if (settingId == CSettings::SETTING_EPG_RESETEPG) { CServiceBroker::GetPVRManager().GUIActions()->ResetPVRDatabase(true); } else if (settingId == CSettings::SETTING_PVRMANAGER_CHANNELMANAGER) { if (CServiceBroker::GetPVRManager().IsStarted()) { CGUIDialog *dialog = g_windowManager.GetDialog(WINDOW_DIALOG_PVR_CHANNEL_MANAGER); if (dialog) dialog->Open(); } } else if (settingId == CSettings::SETTING_PVRMANAGER_GROUPMANAGER) { if (CServiceBroker::GetPVRManager().IsStarted()) { CGUIDialog *dialog = g_windowManager.GetDialog(WINDOW_DIALOG_PVR_GROUP_MANAGER); if (dialog) dialog->Open(); } } else if (settingId == CSettings::SETTING_PVRMANAGER_CHANNELSCAN) { CServiceBroker::GetPVRManager().GUIActions()->StartChannelScan(); } else if (settingId == CSettings::SETTING_PVRMENU_SEARCHICONS) { CServiceBroker::GetPVRManager().TriggerSearchMissingChannelIcons(); } else if (settingId == CSettings::SETTING_PVRCLIENT_MENUHOOK) { CServiceBroker::GetPVRManager().GUIActions()->ProcessMenuHooks(CFileItemPtr()); } }
void CGameWindowFullScreen::TriggerOSD() { CGUIDialog *pOSD = GetOSD(); if (pOSD != nullptr) { if (!pOSD->IsDialogRunning()) pOSD->Open(); } }
void CGameWindowFullScreen::ToggleOSD() { CGUIDialog *pOSD = GetOSD(); if (pOSD != nullptr) { if (pOSD->IsDialogRunning()) pOSD->Close(); else pOSD->Open(); } MarkDirtyRegion(); }
EVENT_RESULT CGUIWindowVisualisation::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_RIGHT_CLICK) { // no control found to absorb this click - go back to GUI OnAction(CAction(ACTION_SHOW_GUI)); return EVENT_RESULT_HANDLED; } if (event.m_id == ACTION_GESTURE_NOTIFY) return EVENT_RESULT_UNHANDLED; if (event.m_id != ACTION_MOUSE_MOVE || event.m_offsetX || event.m_offsetY) { // some other mouse action has occurred - bring up the OSD CGUIDialog *pOSD = CServiceBroker::GetGUI()->GetWindowManager().GetDialog(WINDOW_DIALOG_MUSIC_OSD); if (pOSD) { pOSD->SetAutoClose(3000); pOSD->Open(); } return EVENT_RESULT_HANDLED; } return EVENT_RESULT_UNHANDLED; }
void CGUIWindowManager::OnApplicationMessage(ThreadMessage* pMsg) { switch (pMsg->dwMessage) { case TMSG_GUI_DIALOG_OPEN: { if (pMsg->lpVoid) static_cast<CGUIDialog*>(pMsg->lpVoid)->Open(pMsg->strParam); else { CGUIDialog* pDialog = static_cast<CGUIDialog*>(GetWindow(pMsg->param1)); if (pDialog) pDialog->Open(pMsg->strParam); } } break; case TMSG_GUI_WINDOW_CLOSE: { CGUIWindow *window = static_cast<CGUIWindow *>(pMsg->lpVoid); if (window) window->Close((pMsg->param1 & 0x1) ? true : false, pMsg->param1, (pMsg->param1 & 0x2) ? true : false); } break; case TMSG_GUI_ACTIVATE_WINDOW: { ActivateWindow(pMsg->param1, pMsg->params, pMsg->param2 > 0); } break; case TMSG_GUI_ADDON_DIALOG: { if (pMsg->lpVoid) { // TODO: This is ugly - really these python dialogs should just be normal XBMC dialogs static_cast<ADDON::CGUIAddonWindowDialog *>(pMsg->lpVoid)->Show_Internal(pMsg->param2 > 0); } } break; #ifdef HAS_PYTHON case TMSG_GUI_PYTHON_DIALOG: { // This hack is not much better but at least I don't need to make ApplicationMessenger // know about Addon (Python) specific classes. CAction caction(pMsg->param1); static_cast<CGUIWindow*>(pMsg->lpVoid)->OnAction(caction); } break; #endif case TMSG_GUI_ACTION: { if (pMsg->lpVoid) { CAction *action = static_cast<CAction *>(pMsg->lpVoid); if (pMsg->param1 == WINDOW_INVALID) g_application.OnAction(*action); else { CGUIWindow *pWindow = GetWindow(pMsg->param1); if (pWindow) pWindow->OnAction(*action); else CLog::Log(LOGWARNING, "Failed to get window with ID %i to send an action to", pMsg->param1); } delete action; } } break; case TMSG_GUI_MESSAGE: if (pMsg->lpVoid) { CGUIMessage *message = static_cast<CGUIMessage *>(pMsg->lpVoid); SendMessage(*message, pMsg->param1); delete message; } break; case TMSG_GUI_DIALOG_YESNO: if (!pMsg->lpVoid && pMsg->param1 < 0 && pMsg->param2 < 0) return; auto dialog = static_cast<CGUIDialogYesNo*>(GetWindow(WINDOW_DIALOG_YES_NO)); if (!dialog) return; if (pMsg->lpVoid) pMsg->SetResult(dialog->ShowAndGetInput(*static_cast<HELPERS::DialogYesNoMessage*>(pMsg->lpVoid))); else { HELPERS::DialogYesNoMessage options; options.heading = pMsg->param1; options.text = pMsg->param2; pMsg->SetResult(dialog->ShowAndGetInput(options)); } break; } }
void CGUIWindowManager::OnApplicationMessage(ThreadMessage* pMsg) { switch (pMsg->dwMessage) { case TMSG_GUI_DIALOG_OPEN: { if (pMsg->lpVoid) static_cast<CGUIDialog*>(pMsg->lpVoid)->Open(); else { CGUIDialog* pDialog = static_cast<CGUIDialog*>(GetWindow(pMsg->param1)); if (pDialog) pDialog->Open(); } } break; case TMSG_GUI_WINDOW_CLOSE: { CGUIWindow *window = static_cast<CGUIWindow *>(pMsg->lpVoid); if (window) window->Close(pMsg->param1 & 0x1 ? true : false, pMsg->param1, pMsg->param1 & 0x2 ? true : false); } break; case TMSG_GUI_ACTIVATE_WINDOW: { ActivateWindow(pMsg->param1, pMsg->params, pMsg->param2 > 0); } break; case TMSG_GUI_ADDON_DIALOG: { if (pMsg->lpVoid) { // TODO: This is ugly - really these python dialogs should just be normal XBMC dialogs static_cast<ADDON::CGUIAddonWindowDialog *>(pMsg->lpVoid)->Show_Internal(pMsg->param2 > 0); } } break; #ifdef HAS_PYTHON case TMSG_GUI_PYTHON_DIALOG: { // This hack is not much better but at least I don't need to make ApplicationMessenger // know about Addon (Python) specific classes. CAction caction(pMsg->param1); static_cast<CGUIWindow*>(pMsg->lpVoid)->OnAction(caction); } break; #endif case TMSG_GUI_ACTION: { if (pMsg->lpVoid) { CAction *action = static_cast<CAction *>(pMsg->lpVoid); if (pMsg->param1 == WINDOW_INVALID) g_application.OnAction(*action); else { CGUIWindow *pWindow = GetWindow(pMsg->param1); if (pWindow) pWindow->OnAction(*action); else CLog::Log(LOGWARNING, "Failed to get window with ID %i to send an action to", pMsg->param1); } delete action; } } break; case TMSG_GUI_MESSAGE: { if (pMsg->lpVoid) { CGUIMessage *message = static_cast<CGUIMessage *>(pMsg->lpVoid); SendMessage(*message, pMsg->param1); delete message; } } break; } }