int CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant text, CVariant noLabel, CVariant yesLabel, CVariant customLabel, unsigned int autoCloseTime) { CGUIDialogYesNo *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetText(text); if (autoCloseTime) dialog->SetAutoClose(autoCloseTime); dialog->m_bCanceled = false; dialog->m_bCustom = false; dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106); dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107); dialog->SetChoice(2, customLabel); // Button only visible when label is not empty dialog->Open(); if (dialog->m_bCanceled) return -1; else if (dialog->m_bCustom) return 2; else if (dialog->IsConfirmed()) return 1; else return 0; }
bool CGUIDialogPVRChannelManager::OnContextButton(int itemNumber, CONTEXT_BUTTON button) { /* Check file item is in list range and get his pointer */ if (itemNumber < 0 || itemNumber >= (int)m_channelItems->Size()) return false; CFileItemPtr pItem = m_channelItems->Get(itemNumber); if (!pItem) return false; if (button == CONTEXT_BUTTON_MOVE) { m_bMovingMode = true; pItem->Select(true); } else if (button == CONTEXT_BUTTON_SETTINGS) { PVR_ERROR ret = CServiceBroker::GetPVRManager().Clients()->OpenDialogChannelSettings(pItem->GetPVRChannelInfoTag()); if (ret == PVR_ERROR_NOT_IMPLEMENTED) CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." else if (ret != PVR_ERROR_NO_ERROR) CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." } else if (button == CONTEXT_BUTTON_DELETE) { CGUIDialogYesNo* pDialog = g_windowManager.GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO); if (!pDialog) return true; pDialog->SetHeading(CVariant{19211}); // Delete channel pDialog->SetText(CVariant{750}); // Are you sure? pDialog->Open(); if (pDialog->IsConfirmed()) { CPVRChannelPtr channel = pItem->GetPVRChannelInfoTag(); PVR_ERROR ret = CServiceBroker::GetPVRManager().Clients()->DeleteChannel(channel); if (ret == PVR_ERROR_NO_ERROR) { CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAll(channel->IsRadio())->RemoveFromGroup(channel); m_channelItems->Remove(m_iSelected); m_viewControl.SetItems(*m_channelItems); Renumber(); } else if (ret == PVR_ERROR_NOT_IMPLEMENTED) CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." else CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." } } else if (button == CONTEXT_BUTTON_EDIT_SOURCE) { std::string strURL = pItem->GetProperty("StreamURL").asString(); if (CGUIKeyboardFactory::ShowAndGetInput(strURL, CVariant{g_localizeStrings.Get(19214)}, false)) pItem->SetProperty("StreamURL", strURL); } return true; }
bool CGUIDialogPVRChannelManager::OnContextButton(int itemNumber, CONTEXT_BUTTON button) { /* Check file item is in list range and get his pointer */ if (itemNumber < 0 || itemNumber >= (int)m_channelItems->Size()) return false; CFileItemPtr pItem = m_channelItems->Get(itemNumber); if (!pItem) return false; if (button == CONTEXT_BUTTON_MOVE) { m_bMovingMode = true; pItem->Select(true); } else if (button == CONTEXT_BUTTON_SETTINGS) { if (!g_PVRClients->OpenDialogChannelSettings(pItem->GetPVRChannelInfoTag())) CGUIDialogOK::ShowAndGetInput(2103, 0, 16029, 0); // Add-on error;Check the log file for details. } else if (button == CONTEXT_BUTTON_DELETE) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return true; pDialog->SetHeading(19211); // Delete channel pDialog->SetText(750); // Are you sure? pDialog->DoModal(); if (pDialog->IsConfirmed()) { CPVRChannelPtr channel = pItem->GetPVRChannelInfoTag(); if (g_PVRClients->DeleteChannel(channel)) { g_PVRChannelGroups->GetGroupAll(channel->IsRadio())->RemoveFromGroup(channel); m_channelItems->Remove(m_iSelected); m_viewControl.SetItems(*m_channelItems); Renumber(); } else CGUIDialogOK::ShowAndGetInput(2103, 0, 16029, 0); // Add-on error;Check the log file for details. } } else if (button == CONTEXT_BUTTON_EDIT_SOURCE) { std::string strURL = pItem->GetProperty("StreamURL").asString(); if (CGUIKeyboardFactory::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false)) pItem->SetProperty("StreamURL", strURL); } return true; }
bool CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant text, bool &bCanceled, CVariant noLabel /* = "" */, CVariant yesLabel /* = "" */, unsigned int autoCloseTime) { CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetText(text); if (autoCloseTime) dialog->SetAutoClose(autoCloseTime); dialog->m_bCanceled = false; dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106); dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107); dialog->Open(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }
bool CGUIDialogYesNo::ShowAndGetInput(const std::string& heading, const std::string& text, bool& bCanceled, const std::string& noLabel, const std::string& yesLabel) { CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetText(text); dialog->m_bCanceled = false; if (!noLabel.empty()) dialog->SetChoice(0,noLabel); else dialog->SetChoice(0,106); if (!yesLabel.empty()) dialog->SetChoice(1,yesLabel); else dialog->SetChoice(1,107); dialog->DoModal(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }