本文整理汇总了C++中CGUIDialogNumeric::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogNumeric::Open方法的具体用法?C++ CGUIDialogNumeric::Open怎么用?C++ CGUIDialogNumeric::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogNumeric
的用法示例。
在下文中一共展示了CGUIDialogNumeric::Open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowAndGetSeconds
bool CGUIDialogNumeric::ShowAndGetSeconds(std::string &timeString, const std::string &heading)
{
CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC);
if (!pDialog) return false;
int seconds = StringUtils::TimeStringToSeconds(timeString);
SYSTEMTIME time = {0};
time.wHour = seconds / 3600;
time.wMinute = (seconds - time.wHour * 3600) / 60;
time.wSecond = seconds - time.wHour * 3600 - time.wMinute * 60;
pDialog->SetMode(INPUT_TIME_SECONDS, (void *)&time);
pDialog->SetHeading(heading);
pDialog->Open();
if (!pDialog->IsConfirmed() || pDialog->IsCanceled())
return false;
pDialog->GetOutput(&time);
seconds = time.wHour * 3600 + time.wMinute * 60 + time.wSecond;
timeString = StringUtils::SecondsToTimeString(seconds);
return true;
}
示例2: ShowAndVerifyInput
// \brief Show numeric keypad and verify user input against strToVerify.
// \param strToVerify Value to compare against user input.
// \param dlgHeading String shown on dialog title.
// \param bVerifyInput If set as true we verify the users input versus strToVerify.
// \return true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
bool CGUIDialogNumeric::ShowAndVerifyInput(std::string& strToVerify, const std::string& dlgHeading, bool bVerifyInput)
{
// Prompt user for password input
CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC);
pDialog->SetHeading( dlgHeading );
std::string strInput;
if (!bVerifyInput)
strInput = strToVerify;
pDialog->SetMode(INPUT_PASSWORD, (void *)&strInput);
pDialog->Open();
pDialog->GetOutput(&strInput);
if (!pDialog->IsConfirmed() || pDialog->IsCanceled())
{
// user canceled out
strToVerify ="";
return false;
}
std::string md5pword2 = XBMC::XBMC_MD5::GetMD5(strInput);
if (!bVerifyInput)
{
strToVerify = md5pword2;
StringUtils::ToLower(strToVerify);
return true;
}
if (StringUtils::EqualsNoCase(strToVerify, md5pword2))
return true; // entered correct password
// incorrect password
return false;
}