本文整理汇总了C++中CGUIDialogYesNo::SetChoice方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogYesNo::SetChoice方法的具体用法?C++ CGUIDialogYesNo::SetChoice怎么用?C++ CGUIDialogYesNo::SetChoice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogYesNo
的用法示例。
在下文中一共展示了CGUIDialogYesNo::SetChoice方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowAndGetInput
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;
}
示例2: yesno
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();
}
示例3: yesno
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();
}
示例4: ActionDeleteRecording
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;
}
示例5: ShowAndGetInput
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;
}
示例6: ShowAndGetInput
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;
}
示例7: ShowAndGetInput
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;
}
示例8: OnAction
bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
{
switch (action.wID)
{
case ACTION_PREVIOUS_MENU:
{
m_gWindowManager.PreviousWindow();
return true;
}
break;
case ACTION_CALIBRATE_SWAP_ARROWS:
{
NextControl();
return true;
}
break;
case ACTION_CALIBRATE_RESET:
{
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)m_gWindowManager.GetWindow(WINDOW_DIALOG_YES_NO);
pDialog->SetHeading(20325);
CStdString strText;
strText.Format(g_localizeStrings.Get(20326).c_str(), g_settings.m_ResInfo[m_Res[m_iCurRes]].strMode);
pDialog->SetLine(0, strText);
pDialog->SetLine(1, 20327);
pDialog->SetChoice(0, 222);
pDialog->SetChoice(1, 186);
pDialog->DoModal();
if (pDialog->IsConfirmed())
{
g_graphicsContext.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();
g_graphicsContext.SetVideoResolution(m_Res[m_iCurRes], TRUE);
ResetControls();
return true;
}
break;
}
return CGUIWindow::OnAction(action); // base class to handle basic movement etc.
}
示例9: ActionDeleteRecording
bool CGUIWindowPVRRecordings::ActionDeleteRecording(CFileItem *item)
{
bool bReturn = false;
if ((!item->IsPVRRecording() && !item->m_bIsFolder) || item->IsParentFolder())
return bReturn;
/* show a confirmation dialog */
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
if (!pDialog)
return bReturn;
int iLine0 = item->m_bIsFolder ? 19113 : item->GetPVRRecordingInfoTag()->IsDeleted() ? 19294 : 19112;
pDialog->SetHeading(CVariant{122}); // Confirm delete
pDialog->SetLine(0, CVariant{iLine0}); // Delete all recordings in this folder? / Delete this recording permanently? / Delete this recording?
pDialog->SetLine(1, CVariant{""});
pDialog->SetLine(2, CVariant{item->GetLabel()});
pDialog->SetChoice(1, CVariant{117}); // Delete
/* prompt for the user's confirmation */
pDialog->Open();
if (!pDialog->IsConfirmed())
return bReturn;
/* delete the recording */
if (g_PVRRecordings->Delete(*item))
{
g_PVRManager.TriggerRecordingsUpdate();
bReturn = true;
/* remove the item from the list immediately, otherwise the
item count further down may be wrong */
m_vecItems->Remove(item);
/* go to the parent folder if we're in a subdirectory and just deleted the last item */
CPVRRecordingsPath path(m_vecItems->GetPath());
if (path.IsValid() && !path.IsRecordingsRoot() && m_vecItems->GetObjectCount() == 0)
GoParentFolder();
}
return bReturn;
}
示例10: OnContextButtonDeleteAll
bool CGUIWindowPVRRecordings::OnContextButtonDeleteAll(CFileItem *item, CONTEXT_BUTTON button)
{
bool bReturn = false;
if (button != CONTEXT_BUTTON_DELETE_ALL || !item->IsDeletedPVRRecording())
return bReturn;
/* show a confirmation dialog */
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
if (!pDialog)
return bReturn;
pDialog->SetHeading(CVariant{19292}); // Delete all permanently
pDialog->SetLine(0, CVariant{19293}); // Delete all recordings permanently?
pDialog->SetLine(1, CVariant{""});
pDialog->SetLine(2, CVariant{""});
pDialog->SetChoice(1, CVariant{117}); // Delete
/* prompt for the user's confirmation */
pDialog->Open();
if (!pDialog->IsConfirmed())
return bReturn;
/* undelete the recording */
if (g_PVRRecordings->DeleteAllRecordingsFromTrash())
{
g_PVRManager.TriggerRecordingsUpdate();
bReturn = true;
/* remove the item from the list immediately, otherwise the
item count further down may be wrong */
m_vecItems->Clear();
/* go to the parent folder if we're in a subdirectory and just deleted the last item */
CPVRRecordingsPath path(m_vecItems->GetPath());
if (path.IsValid() && !path.IsRecordingsRoot() && m_vecItems->GetObjectCount() == 0)
GoParentFolder();
}
return bReturn;
}
示例11: ActionDeleteRecording
bool CGUIWindowPVRRecordings::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;
/* remove the item from the list immediately, otherwise the
item count further down may be wrong */
m_vecItems->Remove(item);
/* go to the parent folder if we're in a subdirectory and just deleted the last item */
if (m_vecItems->GetPath() != "pvr://recordings/" && m_vecItems->GetObjectCount() == 0)
GoParentFolder();
}
return bReturn;
}
示例12: OnInitWindow
void CGUIWindowBoxeeWizardResolution::OnInitWindow()
{
CGUIWindow::OnInitWindow();
delete m_xrandr;
m_xrandr = new CXRandR();
if (!m_wizardCompletedOnce)
{
CONTROL_DISABLE(CONTROL_NEXT);
}
if (m_afterResolutionChange)
{
CGUIListContainer *pList = (CGUIListContainer *)GetControl(CONTROL_SD_HD);
if (pList)
pList->SetSingleSelectedItem();
ShowResolutionsList(IsResolutionHD(m_newResolution), &m_newResolution);
CStdString origHz;
origHz.Format("%.2f", m_originalResolution.hz);
CStdString newHz;
newHz.Format("%.2f", m_newResolution.hz);
if (m_newResolution.name != m_originalResolution.name || origHz != newHz)
{
CGUIDialogYesNo *pDlgYesNo = (CGUIDialogYesNo*)m_gWindowManager.GetWindow(WINDOW_DIALOG_YES_NO);
pDlgYesNo->SetHeading("Resolution Change");
pDlgYesNo->SetLine(0, "Do you want to keep this resolution");
pDlgYesNo->SetLine(1, "(will revert automatically in 6 seconds)");
pDlgYesNo->SetLine(2, "");
pDlgYesNo->SetLine(3, "");
pDlgYesNo->SetChoice(0, "Revert");
pDlgYesNo->SetChoice(1, "Keep");
pDlgYesNo->SetDefaultChoice(0);
pDlgYesNo->SetAutoClose(6000);
pDlgYesNo->DoModal();
if (!pDlgYesNo->IsConfirmed())
{
m_afterResolutionChange = false;
// Set the requested resolution
g_graphicsContext.SetVideoResolution(m_originalResolutionId, TRUE);
// Reload the fonts to they will scale correctly
g_fontManager.ReloadTTFFonts();
// Close the dialog and restart it so it will re-set the size of the labels to
// fit for the new resolutions
Close();
m_gWindowManager.ActivateWindow(WINDOW_BOXEE_WIZARD_RESOLUTION);
}
else
{
int xbmcResolutionId = GetXBMCResolutionId();
if (xbmcResolutionId != -1)
{
g_guiSettings.SetInt("videoscreen.resolution", xbmcResolutionId);
g_guiSettings.SetInt("videoplayer.displayresolution", xbmcResolutionId);
g_guiSettings.SetInt("pictures.displayresolution", xbmcResolutionId);
g_settings.Save();
delete m_xrandr;
m_xrandr = new CXRandR();
}
m_wizardCompletedOnce = true;
CONTROL_ENABLE(CONTROL_NEXT);
SET_CONTROL_FOCUS(CONTROL_NEXT, 0);
}
}
else
{
m_wizardCompletedOnce = true;
CONTROL_ENABLE(CONTROL_NEXT);
SET_CONTROL_FOCUS(CONTROL_NEXT, 0);
}
}
else if (m_resolutionChangedOnce || m_wizardCompletedOnce)
{
XOutput output = GetCurrentOutput();
XMode currentResolution = m_xrandr->GetCurrentMode(output.name);
ShowResolutionsList(IsResolutionHD(currentResolution), ¤tResolution);
}
else
{
XOutput output = GetCurrentOutput();
XMode currentResolution = m_xrandr->GetCurrentMode(output.name);
CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), CONTROL_SD_HD, IsResolutionHD(currentResolution) ? VALUE_HD : VALUE_SD);
OnMessage(msg);
}
}