bool Dialog::yesno(const String& heading, const String& line1, const String& line2, const String& line3, const String& nolabel, const String& yeslabel, int autoclose) { DelayedCallGuard dcguard(languageHook); CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog == NULL) throw WindowException("Error: Window is NULL, this is not possible :-)"); // get lines, last 4 lines are optional. if (!heading.empty()) pDialog->SetHeading(CVariant{heading}); if (!line1.empty()) pDialog->SetLine(0, CVariant{line1}); if (!line2.empty()) pDialog->SetLine(1, CVariant{line2}); if (!line3.empty()) pDialog->SetLine(2, CVariant{line3}); if (!nolabel.empty()) pDialog->SetChoice(0, CVariant{nolabel}); if (!yeslabel.empty()) pDialog->SetChoice(1, CVariant{yeslabel}); if (autoclose > 0) pDialog->SetAutoClose(autoclose); pDialog->Open(); return pDialog->IsConfirmed(); }
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; }
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) { 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 CGUIWindowPVRBase::ActionDeleteRecording(CFileItem *item) { bool bReturn = false; if (!item->IsPVRRecording() && !item->m_bIsFolder) return bReturn; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(122); // Confirm delete pDialog->SetLine(0, item->m_bIsFolder ? 19113 : 19112); // Are you sure? pDialog->SetLine(1, ""); pDialog->SetLine(2, item->GetLabel()); pDialog->SetChoice(1, 117); // Delete /* prompt for the user's confirmation */ pDialog->DoModal(); if (!pDialog->IsConfirmed()) return bReturn; /* delete the recording */ if (g_PVRRecordings->Delete(*item)) { g_PVRManager.TriggerRecordingsUpdate(); bReturn = true; } return bReturn; }
bool Dialog::yesno(const String& heading, const String& line1, const String& line2, const String& line3, const String& nolabel, const String& yeslabel) throw (WindowException) { DelayedCallGuard dcguard(languageHook); const int window = WINDOW_DIALOG_YES_NO; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(window); if (pDialog == NULL) throw WindowException("Error: Window is NULL, this is not possible :-)"); // get lines, last 4 lines are optional. if (!heading.empty()) pDialog->SetHeading(heading); if (!line1.empty()) pDialog->SetLine(0, line1); if (!line2.empty()) pDialog->SetLine(1, line2); if (!line3.empty()) pDialog->SetLine(2, line3); if (!nolabel.empty()) pDialog->SetChoice(0,nolabel); if (!yeslabel.empty()) pDialog->SetChoice(1,yeslabel); //send message and wait for user input XBMCWaitForThreadMessage(TMSG_DIALOG_DOMODAL, window, ACTIVE_WINDOW); return pDialog->IsConfirmed(); }
bool CGUIWindowPVRChannels::OnContextButtonUpdateEpg(CFileItem *item, CONTEXT_BUTTON button) { bool bReturn = false; if (button == CONTEXT_BUTTON_UPDATE_EPG) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); pDialog->SetHeading(CVariant{19251}); pDialog->SetLine(0, CVariant{g_localizeStrings.Get(19252)}); pDialog->SetLine(1, CVariant{channel->ChannelName()}); pDialog->SetLine(2, CVariant{""}); pDialog->Open(); if (!pDialog->IsConfirmed()) return bReturn; bReturn = UpdateEpgForChannel(item); std::string strMessage = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(bReturn ? 19253 : 19254).c_str(), channel->ChannelName().c_str()); CGUIDialogKaiToast::QueueNotification(bReturn ? CGUIDialogKaiToast::Info : CGUIDialogKaiToast::Error, g_localizeStrings.Get(19166), strMessage); } return bReturn; }
bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_CALIBRATE_SWAP_ARROWS: { NextControl(); return true; } break; case ACTION_CALIBRATE_RESET: { CGUIDialogYesNo* pDialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(CVariant{20325}); std::string strText = StringUtils::Format(g_localizeStrings.Get(20326).c_str(), CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(m_Res[m_iCurRes]).strMode.c_str()); pDialog->SetLine(0, CVariant{std::move(strText)}); pDialog->SetLine(1, CVariant{20327}); pDialog->SetChoice(0, CVariant{222}); pDialog->SetChoice(1, CVariant{186}); pDialog->Open(); if (pDialog->IsConfirmed()) { CServiceBroker::GetWinSystem()->GetGfxContext().ResetScreenParameters(m_Res[m_iCurRes]); ResetControls(); } return true; } break; case ACTION_CHANGE_RESOLUTION: // choose the next resolution in our list { m_iCurRes = (m_iCurRes+1) % m_Res.size(); CServiceBroker::GetWinSystem()->GetGfxContext().SetVideoResolution(m_Res[m_iCurRes], false); ResetControls(); return true; } break; // ignore all gesture meta actions case ACTION_GESTURE_BEGIN: case ACTION_GESTURE_END: case ACTION_GESTURE_ABORT: case ACTION_GESTURE_NOTIFY: case ACTION_GESTURE_PAN: case ACTION_GESTURE_ROTATE: case ACTION_GESTURE_ZOOM: return true; } // if we see a mouse move event without dx and dy (amount2 and amount3) these // are the focus actions which are generated on touch events and those should // be eaten/ignored here. Else we will switch to the screencalibration controls // which are at that x/y value on each touch/tap/swipe which makes the whole window // unusable for touch screens if (action.GetID() == ACTION_MOUSE_MOVE && action.GetAmount(2) == 0 && action.GetAmount(3) == 0) return true; return CGUIWindow::OnAction(action); // base class to handle basic movement etc. }
bool CGUIWindowPVRChannels::OnContextButtonHide(CFileItem *item, CONTEXT_BUTTON button) { bool bReturn = false; if (button == CONTEXT_BUTTON_HIDE) { CPVRChannel *channel = item->GetPVRChannelInfoTag(); if (!channel || channel->IsRadio() != m_bRadio) return bReturn; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(19039); pDialog->SetLine(0, ""); pDialog->SetLine(1, channel->ChannelName()); pDialog->SetLine(2, ""); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return bReturn; g_PVRManager.GetPlayingGroup(m_bRadio)->RemoveFromGroup(*channel); UpdateData(); bReturn = true; } return bReturn; }
bool CGUIWindowFileManager::DeleteItem(const CFileItem *pItem) { if (!pItem) return false; CLog::Log(LOGDEBUG,"FileManager::DeleteItem: %s",pItem->GetLabel().c_str()); // prompt user for confirmation of file/folder deletion CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)m_gWindowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(122); pDialog->SetLine(0, 125); pDialog->SetLine(1, CUtil::GetFileName(pItem->m_strPath)); pDialog->SetLine(2, ""); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return false; } // Create a temporary item list containing the file/folder for deletion CFileItemPtr pItemTemp(new CFileItem(*pItem)); pItemTemp->Select(true); CFileItemList items; items.Add(pItemTemp); // grab the real filemanager window, set up the progress bar, // and process the delete action CGUIWindowFileManager *pFileManager = (CGUIWindowFileManager *)m_gWindowManager.GetWindow(WINDOW_FILES); if (pFileManager) { pFileManager->m_dlgProgress = (CGUIDialogProgress *)m_gWindowManager.GetWindow(WINDOW_DIALOG_PROGRESS); pFileManager->ResetProgressBar(false); pFileManager->DoProcess(ACTION_DELETE, items, ""); if (pFileManager->m_dlgProgress) pFileManager->m_dlgProgress->Close(); } return true; }
bool CGUIWindowPVRCommon::ActionDeleteTimer(CFileItem *item) { bool bReturn = false; /* check if the timer tag is valid */ CPVRTimerInfoTag *timerTag = item->GetPVRTimerInfoTag(); if (!timerTag || timerTag->ClientIndex() < 0) return bReturn; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return false; pDialog->SetHeading(122); pDialog->SetLine(0, 19040); pDialog->SetLine(1, ""); pDialog->SetLine(2, timerTag->Title()); pDialog->DoModal(); /* prompt for the user's confirmation */ if (!pDialog->IsConfirmed()) return bReturn; /* delete the timer */ if (CPVRManager::GetTimers()->DeleteTimer(*item)) { UpdateData(); bReturn = true; } return bReturn; }
bool CFileUtils::DeleteItem(const CFileItemPtr &item, bool force) { if (!item || item->IsParentFolder()) return false; CGUIDialogYesNo* pDialog = g_windowManager.GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO); if (!force && pDialog) { pDialog->SetHeading(CVariant{122}); pDialog->SetLine(0, CVariant{125}); pDialog->SetLine(1, CVariant{CURL(item->GetPath()).GetWithoutUserDetails()}); pDialog->SetLine(2, CVariant{""}); pDialog->Open(); if (!pDialog->IsConfirmed()) return false; } // Create a temporary item list containing the file/folder for deletion CFileItemPtr pItemTemp(new CFileItem(*item)); pItemTemp->Select(true); CFileItemList items; items.Add(pItemTemp); // grab the real filemanager window, set up the progress bar, // and process the delete action CFileOperationJob op(CFileOperationJob::ActionDelete, items, ""); return op.DoWork(); }
bool CGUIDialogPVRGuideInfo::ActionCancelTimer(CFileItemPtr timer) { bool bReturn = false; if (!timer || !timer->HasPVRTimerInfoTag()) { return bReturn; } // prompt user for confirmation of timer deletion CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(265); pDialog->SetLine(0, ""); pDialog->SetLine(1, timer->GetPVRTimerInfoTag()->m_strTitle); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { Close(); bReturn = CPVRTimers::DeleteTimer(*timer); } } return bReturn; }
bool CGUIWindowPVRCommon::StartRecordFile(CFileItem *item) { if (!item->HasEPGInfoTag()) return false; CEpgInfoTag *tag = item->GetEPGInfoTag(); if (!tag || !tag->HasPVRChannel()) return false; CPVRTimerInfoTag *timer = g_PVRTimers->GetMatch(item); if (timer) { CGUIDialogOK::ShowAndGetInput(19033,19034,0,0); return false; } CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return false; pDialog->SetHeading(264); pDialog->SetLine(0, tag->PVRChannelName()); pDialog->SetLine(1, ""); pDialog->SetLine(2, tag->Title()); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return false; CPVRTimerInfoTag *newtimer = CPVRTimerInfoTag::CreateFromEpg(*tag); CFileItem *newTimerItem = new CFileItem(*newtimer); return g_PVRTimers->AddTimer(*newTimerItem); }
bool CGUIWindowPVRCommon::ActionDeleteRecording(CFileItem *item) { bool bReturn = false; /* check if the recording tag is valid */ CPVRRecording *recTag = (CPVRRecording *) item->GetPVRRecordingInfoTag(); if (!recTag || recTag->m_strRecordingId.IsEmpty()) return bReturn; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(122); pDialog->SetLine(0, 19043); pDialog->SetLine(1, ""); pDialog->SetLine(2, recTag->m_strTitle); pDialog->DoModal(); /* prompt for the user's confirmation */ if (!pDialog->IsConfirmed()) return bReturn; /* delete the recording */ if (g_PVRRecordings->DeleteRecording(*item)) { g_PVRManager.TriggerRecordingsUpdate(); bReturn = true; } return bReturn; }
bool CGUIWindowPVRCommon::ActionDeleteChannel(CFileItem *item) { CPVRChannel *channel = item->GetPVRChannelInfoTag(); /* check if the channel tag is valid */ if (!channel || channel->ChannelNumber() <= 0) return false; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) return false; pDialog->SetHeading(19039); pDialog->SetLine(0, ""); pDialog->SetLine(1, channel->ChannelName()); pDialog->SetLine(2, ""); pDialog->DoModal(); /* prompt for the user's confirmation */ if (!pDialog->IsConfirmed()) return false; g_PVRChannelGroups->GetGroupAll(channel->IsRadio())->RemoveFromGroup(*channel); UpdateData(); return true; }
bool CGUIWindowPVRBase::ActionDeleteChannel(CFileItem *item) { CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); /* check if the channel tag is valid */ if (!channel || channel->ChannelNumber() <= 0) return false; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return false; pDialog->SetHeading(CVariant{19039}); pDialog->SetLine(0, CVariant{""}); pDialog->SetLine(1, CVariant{channel->ChannelName()}); pDialog->SetLine(2, CVariant{""}); pDialog->Open(); /* prompt for the user's confirmation */ if (!pDialog->IsConfirmed()) return false; g_PVRChannelGroups->GetGroupAll(channel->IsRadio())->RemoveFromGroup(channel); Refresh(true); return true; }
bool CGUIWindowPVRTimers::OnContextButtonDelete(CFileItem *item, CONTEXT_BUTTON button) { bool bReturn = false; if (button == CONTEXT_BUTTON_DELETE) { bReturn = true; if (!item->HasPVRTimerInfoTag()) return bReturn; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(122); pDialog->SetLine(0, 19040); pDialog->SetLine(1, ""); pDialog->SetLine(2, item->GetPVRTimerInfoTag()->m_strTitle); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return bReturn; g_PVRTimers->DeleteTimer(*item); } return bReturn; }
bool CGUIDialogPVRGroupManager::ActionButtonDeleteGroup(CGUIMessage &message) { bool bReturn = false; unsigned int iControl = message.GetSenderId(); if (iControl == BUTTON_DELGROUP) { if (!m_selectedGroup) return bReturn; CGUIDialogYesNo* pDialog = g_windowManager.GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(CVariant{117}); pDialog->SetLine(0, CVariant{""}); pDialog->SetLine(1, CVariant{m_selectedGroup->GroupName()}); pDialog->SetLine(2, CVariant{""}); pDialog->Open(); if (pDialog->IsConfirmed()) { if (static_cast<CPVRChannelGroups*>(CServiceBroker::GetPVRManager().ChannelGroups()->Get(m_bIsRadio))->DeleteGroup(*m_selectedGroup)) Update(); } bReturn = true; } return bReturn; }
bool CGUIDialogPVRGroupManager::ActionButtonDeleteGroup(CGUIMessage &message) { bool bReturn = false; unsigned int iControl = message.GetSenderId(); if (iControl == BUTTON_DELGROUP) { if (!m_selectedGroup) return bReturn; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(117); pDialog->SetLine(0, ""); pDialog->SetLine(1, m_selectedGroup->GroupName()); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { if (((CPVRChannelGroups *) g_PVRChannelGroups->Get(m_bIsRadio))->DeleteGroup(*m_selectedGroup)) Update(); } bReturn = true; } return bReturn; }
bool CGUIDialogPVRGuideInfo::ActionStartTimer(const CEpgInfoTag *tag) { bool bReturn = false; // prompt user for confirmation of channel record CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(264); pDialog->SetLine(0, ""); pDialog->SetLine(1, tag->Title()); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { Close(); CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*tag); bReturn = CPVRTimers::AddTimer(*newTimer); delete newTimer; } } return bReturn; }
bool CFileUtils::DeleteItem(const CFileItemPtr &item, bool force) { if (!item || item->IsParentFolder()) return false; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!force && pDialog) { pDialog->SetHeading(122); pDialog->SetLine(0, 125); pDialog->SetLine(1, URIUtils::GetFileName(item->GetPath())); pDialog->SetLine(2, ""); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return false; } // Create a temporary item list containing the file/folder for deletion CFileItemPtr pItemTemp(new CFileItem(*item)); pItemTemp->Select(true); CFileItemList items; items.Add(pItemTemp); // grab the real filemanager window, set up the progress bar, // and process the delete action CFileOperationJob op(CFileOperationJob::ActionDelete, items, ""); return op.DoWork(); }
bool CGUIDialogPVRChannelManager::OnClickButtonDeleteChannel(CGUIMessage &message) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (!pItem) return false; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return true; pDialog->SetHeading(19211); pDialog->SetLine(0, ""); pDialog->SetLine(1, 750); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { if (pItem->GetProperty("Virtual").asBoolean()) { pItem->GetPVRChannelInfoTag()->SetVirtual(true); m_channelItems->Remove(m_iSelected); m_viewControl.SetItems(*m_channelItems); Renumber(); return true; } CGUIDialogOK::ShowAndGetInput(19033,19038,0,0); } return true; }
bool CGUIWindowPVRCommon::ActionDeleteRecording(CFileItem *item) { bool bReturn = false; /* check if the recording tag is valid */ CPVRRecordingInfoTag *recTag = (CPVRRecordingInfoTag *) item->GetPVRRecordingInfoTag(); if (!recTag || recTag->ClientIndex() < 0) return bReturn; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(122); pDialog->SetLine(0, 19043); pDialog->SetLine(1, ""); pDialog->SetLine(2, recTag->Title()); pDialog->DoModal(); /* prompt for the user's confirmation */ if (!pDialog->IsConfirmed()) return bReturn; /* delete the recording */ if (CPVRRecordings::DeleteRecording(*item)) { CPVRManager::GetRecordings()->Update(true); UpdateData(); bReturn = true; } return bReturn; }
bool CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant line0, CVariant line1, CVariant line2, bool &bCanceled, CVariant noLabel, CVariant yesLabel, unsigned int autoCloseTime) { CGUIDialogYesNo *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetLine(0, line0); dialog->SetLine(1, line1); dialog->SetLine(2, line2); if (autoCloseTime) dialog->SetAutoClose(autoCloseTime); dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106); dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107); dialog->SetChoice(2, ""); dialog->m_bCanceled = false; dialog->Open(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }
bool CGUIDialogYesNo::ShowAndGetInput(const CStdString& heading, const CStdString& line0, const CStdString& line1, const CStdString& line2, bool& bCanceled, const CStdString& noLabel, const CStdString& yesLabel) { CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetLine(0, line0); dialog->SetLine(1, line1); dialog->SetLine(2, line2); dialog->m_bCanceled = false; if (!noLabel.IsEmpty()) dialog->SetChoice(0,noLabel); else dialog->SetChoice(0,106); if (!yesLabel.IsEmpty()) dialog->SetChoice(1,yesLabel); else dialog->SetChoice(1,107); dialog->DoModal(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }
bool CGUIDialogPVRChannelManager::OnClickButtonRadioTV(CGUIMessage &message) { if (m_bContainsChanges) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return true; pDialog->SetHeading(20052); pDialog->SetLine(0, ""); pDialog->SetLine(1, 19212); pDialog->SetLine(2, 20103); pDialog->DoModal(); if (pDialog->IsConfirmed()) SaveList(); } m_iSelected = 0; m_bMovingMode = false; m_bAllowNewChannel = false; m_bContainsChanges = false; m_bIsRadio = !m_bIsRadio; SetProperty("IsRadio", m_bIsRadio ? "true" : ""); Update(); SetData(m_iSelected); return true; }
bool CPVRChannels::HideChannel(CPVRChannel *channel, bool bShowDialog /* = true */) { if (!channel) return false; /* check if there are active timers on this channel if we are hiding it */ if (!channel->IsHidden() && PVRTimers.ChannelHasTimers(*channel)) { if (bShowDialog) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return false; pDialog->SetHeading(19098); pDialog->SetLine(0, 19099); pDialog->SetLine(1, ""); pDialog->SetLine(2, 19100); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return false; } /* delete the timers */ PVRTimers.DeleteTimersOnChannel(*channel, true); } /* check if this channel is currently playing if we are hiding it */ if (!channel->IsHidden() && (g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) && (g_PVRManager.GetCurrentPlayingItem()->GetPVRChannelInfoTag() == channel)) { CGUIDialogOK::ShowAndGetInput(19098,19101,0,19102); return false; } /* switch the hidden flag */ channel->SetHidden(!channel->IsHidden()); /* update the hidden channel counter */ if (channel->IsHidden()) ++m_iHiddenChannels; else --m_iHiddenChannels; /* update the database entry */ channel->Persist(); /* move the channel to the end of the list */ MoveChannel(channel->ChannelNumber(), size()); return true; }
void CAutorun::ExecuteXBE(const CStdString &xbeFile) { #ifdef HAS_XBOX_HARDWARE int iRegion; if (g_guiSettings.GetBool("myprograms.gameautoregion")) { CXBE xbe; iRegion = xbe.ExtractGameRegion(xbeFile); if (iRegion < 1 || iRegion > 7) iRegion = 0; iRegion = xbe.FilterRegion(iRegion); } else iRegion = 0; #ifdef HAS_TRAINER CProgramDatabase database; database.Open(); DWORD dwTitleId = CUtil::GetXbeID(xbeFile); CStdString strTrainer = database.GetActiveTrainer(dwTitleId); if (strTrainer != "") { bool bContinue=false; if (CKaiClient::GetInstance()->IsEngineConnected()) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)m_gWindowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(714); pDialog->SetLine(0,"Use trainer or KAI?"); pDialog->SetLine(1, "Yes for trainer"); pDialog->SetLine(2, "No for KAI"); pDialog->DoModal(); if (pDialog->IsConfirmed()) { while (CKaiClient::GetInstance()->GetCurrentVector().size() > 1) CKaiClient::GetInstance()->ExitVector(); } else bContinue = true; } if (!bContinue) { CTrainer trainer; if (trainer.Load(strTrainer)) { database.GetTrainerOptions(strTrainer,dwTitleId,trainer.GetOptions(),trainer.GetNumberOfOptions()); CUtil::InstallTrainer(trainer); } } } database.Close(); #endif CUtil::RunXBE(xbeFile.c_str(), NULL,F_VIDEO(iRegion)); #endif }
bool CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant line0, CVariant line1, CVariant line2, bool &bCanceled, CVariant noLabel, CVariant yesLabel, unsigned int autoCloseTime /* = 0 */) { CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetLine(0, line0); dialog->SetLine(1, line1); dialog->SetLine(2, line2); if (autoCloseTime) dialog->SetAutoClose(autoCloseTime); dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106); dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107); dialog->m_bCanceled = false; dialog->DoModal(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }