本文整理汇总了C++中CDateTime::GetAsSystemTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::GetAsSystemTime方法的具体用法?C++ CDateTime::GetAsSystemTime怎么用?C++ CDateTime::GetAsSystemTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::GetAsSystemTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetMode
void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const std::string &initial)
{
m_mode = mode;
m_block = 0;
m_lastblock = 0;
if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS || m_mode == INPUT_DATE)
{
CDateTime dateTime;
if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS)
{
// check if we have a pure number
if (initial.find_first_not_of("0123456789") == std::string::npos)
{
long seconds = strtol(initial.c_str(), nullptr, 10);
dateTime = seconds;
}
else
{
std::string tmp = initial;
// if we are handling seconds and if the string only contains
// "mm:ss" we need to add dummy "hh:" to get "hh:mm:ss"
if (m_mode == INPUT_TIME_SECONDS && tmp.length() <= 5)
tmp = "00:" + tmp;
dateTime.SetFromDBTime(tmp);
}
}
else if (m_mode == INPUT_DATE)
{
std::string tmp = initial;
StringUtils::Replace(tmp, '/', '.');
dateTime.SetFromDBDate(tmp);
}
if (!dateTime.IsValid())
return;
dateTime.GetAsSystemTime(m_datetime);
m_lastblock = (m_mode == INPUT_DATE) ? 2 : 1;
}
else if (m_mode == INPUT_IP_ADDRESS)
{
m_lastblock = 3;
auto blocks = StringUtils::Split(initial, '.');
if (blocks.size() != 4)
return;
for (size_t i = 0; i < blocks.size(); ++i)
{
if (blocks[i].length() > 3)
return;
m_ip[i] = static_cast<uint8_t>(atoi(blocks[i].c_str()));
}
}
else if (m_mode == INPUT_NUMBER || m_mode == INPUT_PASSWORD)
m_number = initial;
}
示例2: OnClick
void CGUIEditControl::OnClick()
{
// we received a click - it's not from the keyboard, so pop up the virtual keyboard, unless
// that is where we reside!
if (GetParentID() == WINDOW_DIALOG_KEYBOARD)
return;
CStdString utf8;
g_charsetConverter.wToUTF8(m_text2, utf8);
bool textChanged = false;
CStdString heading = g_localizeStrings.Get(m_inputHeading ? m_inputHeading : 16028);
switch (m_inputType)
{
case INPUT_TYPE_NUMBER:
textChanged = CGUIDialogNumeric::ShowAndGetNumber(utf8, heading);
break;
case INPUT_TYPE_SECONDS:
textChanged = CGUIDialogNumeric::ShowAndGetSeconds(utf8, g_localizeStrings.Get(21420));
break;
case INPUT_TYPE_DATE:
{
CDateTime dateTime;
dateTime.SetFromDBDate(utf8);
if (dateTime < CDateTime(2000,1, 1, 0, 0, 0))
dateTime = CDateTime(2000, 1, 1, 0, 0, 0);
SYSTEMTIME date;
dateTime.GetAsSystemTime(date);
if (CGUIDialogNumeric::ShowAndGetDate(date, g_localizeStrings.Get(21420)))
{
dateTime = CDateTime(date);
utf8 = dateTime.GetAsDBDate();
textChanged = true;
}
break;
}
case INPUT_TYPE_IPADDRESS:
textChanged = CGUIDialogNumeric::ShowAndGetIPAddress(utf8, heading);
break;
case INPUT_TYPE_SEARCH:
textChanged = CGUIDialogKeyboard::ShowAndGetFilter(utf8, true);
break;
case INPUT_TYPE_FILTER:
textChanged = CGUIDialogKeyboard::ShowAndGetFilter(utf8, false);
break;
case INPUT_TYPE_TEXT:
default:
textChanged = CGUIDialogKeyboard::ShowAndGetInput(utf8, heading, true, m_inputType == INPUT_TYPE_PASSWORD);
break;
}
if (textChanged)
{
g_charsetConverter.utf8ToW(utf8, m_text2, false);
m_cursorPos = m_text2.size();
UpdateText();
m_cursorPos = m_text2.size();
}
}
示例3: SetMode
void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const CStdString &initial)
{
m_mode = mode;
m_block = 0;
m_lastblock = 0;
if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS || m_mode == INPUT_DATE)
{
CDateTime dateTime;
if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS)
{
// check if we have a pure number
if (initial.find_first_not_of("0123456789") == std::string::npos)
{
long seconds = strtol(initial.c_str(), NULL, 10);
dateTime = seconds;
}
else
{
CStdString tmp = initial;
// if we are handling seconds and if the string only contains
// "mm:ss" we need to add dummy "hh:" to get "hh:mm:ss"
if (m_mode == INPUT_TIME_SECONDS && tmp.size() <= 5)
tmp = "00:" + tmp;
dateTime.SetFromDBTime(tmp);
}
}
else if (m_mode == INPUT_DATE)
{
CStdString tmp = initial;
StringUtils::Replace(tmp, '/', '.');
dateTime.SetFromDBDate(tmp);
}
if (!dateTime.IsValid())
return;
dateTime.GetAsSystemTime(m_datetime);
m_lastblock = (m_mode == INPUT_DATE) ? 2 : 1;
}
else
SetMode(mode, (void*)&initial);
}
示例4: OnClick
void CGUIEditControl::OnClick()
{
// we received a click - it's not from the keyboard, so pop up the virtual keyboard, unless
// that is where we reside!
if (GetParentID() == WINDOW_DIALOG_KEYBOARD)
return;
std::string utf8;
g_charsetConverter.wToUTF8(m_text2, utf8);
bool textChanged = false;
std::string heading = g_localizeStrings.Get(m_inputHeading ? m_inputHeading : 16028);
switch (m_inputType)
{
case INPUT_TYPE_READONLY:
textChanged = false;
break;
case INPUT_TYPE_NUMBER:
textChanged = CGUIDialogNumeric::ShowAndGetNumber(utf8, heading);
break;
case INPUT_TYPE_SECONDS:
textChanged = CGUIDialogNumeric::ShowAndGetSeconds(utf8, g_localizeStrings.Get(21420));
break;
case INPUT_TYPE_TIME:
{
CDateTime dateTime;
dateTime.SetFromDBTime(utf8);
SYSTEMTIME time;
dateTime.GetAsSystemTime(time);
if (CGUIDialogNumeric::ShowAndGetTime(time, !heading.empty() ? heading : g_localizeStrings.Get(21420)))
{
dateTime = CDateTime(time);
utf8 = dateTime.GetAsLocalizedTime("", false);
textChanged = true;
}
break;
}
case INPUT_TYPE_DATE:
{
CDateTime dateTime;
dateTime.SetFromDBDate(utf8);
if (dateTime < CDateTime(2000,1, 1, 0, 0, 0))
dateTime = CDateTime(2000, 1, 1, 0, 0, 0);
SYSTEMTIME date;
dateTime.GetAsSystemTime(date);
if (CGUIDialogNumeric::ShowAndGetDate(date, !heading.empty() ? heading : g_localizeStrings.Get(21420)))
{
dateTime = CDateTime(date);
utf8 = dateTime.GetAsDBDate();
textChanged = true;
}
break;
}
case INPUT_TYPE_IPADDRESS:
textChanged = CGUIDialogNumeric::ShowAndGetIPAddress(utf8, heading);
break;
case INPUT_TYPE_SEARCH:
textChanged = CGUIKeyboardFactory::ShowAndGetFilter(utf8, true);
break;
case INPUT_TYPE_FILTER:
textChanged = CGUIKeyboardFactory::ShowAndGetFilter(utf8, false);
break;
case INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW:
textChanged = CGUIDialogNumeric::ShowAndVerifyNewPassword(utf8);
break;
case INPUT_TYPE_PASSWORD_MD5:
utf8 = ""; // TODO: Ideally we'd send this to the keyboard and tell the keyboard we have this type of input
// fallthrough
case INPUT_TYPE_TEXT:
default:
textChanged = CGUIKeyboardFactory::ShowAndGetInput(utf8, heading, true, m_inputType == INPUT_TYPE_PASSWORD || m_inputType == INPUT_TYPE_PASSWORD_MD5);
break;
}
if (textChanged)
{
ClearMD5();
m_edit.clear();
g_charsetConverter.utf8ToW(utf8, m_text2);
m_cursorPos = m_text2.size();
UpdateText();
m_cursorPos = m_text2.size();
}
}
示例5: OnSearch
void CGUIDialogPVRGuideSearch::OnSearch()
{
CGUISpinControlEx *pSpin;
CGUIEditControl *pEdit;
CGUIRadioButtonControl *pRadioButton;
CDateTime dateTime;
if (!m_searchfilter)
return;
pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_SEARCH);
if (pEdit) m_searchfilter->m_strSearchTerm = pEdit->GetLabel2();
pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_INC_DESC);
if (pRadioButton) m_searchfilter->m_bSearchInDescription = pRadioButton->IsSelected();
pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_CASE_SENS);
if (pRadioButton) m_searchfilter->m_bIsCaseSensitive = pRadioButton->IsSelected();
pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_FTA_ONLY);
if (pRadioButton) m_searchfilter->m_bFTAOnly = pRadioButton->IsSelected();
pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_UNK_GENRE);
if (pRadioButton) m_searchfilter->m_bIncludeUnknownGenres = pRadioButton->IsSelected();
pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_REC);
if (pRadioButton) m_searchfilter->m_bIgnorePresentRecordings = pRadioButton->IsSelected();
pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_TMR);
if (pRadioButton) m_searchfilter->m_bIgnorePresentTimers = pRadioButton->IsSelected();
pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_SPIN_NO_REPEATS);
if (pRadioButton) m_searchfilter->m_bPreventRepeats = pRadioButton->IsSelected();
pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GENRE);
if (pSpin) m_searchfilter->m_iGenreType = pSpin->GetValue();
pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MIN_DURATION);
if (pSpin) m_searchfilter->m_iMinimumDuration = pSpin->GetValue();
pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MAX_DURATION);
if (pSpin) m_searchfilter->m_iMaximumDuration = pSpin->GetValue();
pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_CHANNELS);
if (pSpin) m_searchfilter->m_iChannelNumber = pSpin->GetValue();
pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GROUPS);
if (pSpin) m_searchfilter->m_iChannelGroup = pSpin->GetValue();
pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_TIME);
if (pEdit)
{
dateTime.SetFromDBTime(pEdit->GetLabel2());
dateTime.GetAsSystemTime(m_searchfilter->m_startTime);
}
pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_TIME);
if (pEdit)
{
dateTime.SetFromDBTime(pEdit->GetLabel2());
dateTime.GetAsSystemTime(m_searchfilter->m_endTime);
}
pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_DATE);
if (pEdit)
{
dateTime.SetFromDBDate(pEdit->GetLabel2());
dateTime.GetAsSystemTime(m_searchfilter->m_startDate);
}
pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_DATE);
if (pEdit)
{
dateTime.SetFromDBDate(pEdit->GetLabel2());
dateTime.GetAsSystemTime(m_searchfilter->m_endDate);
}
m_bConfirmed = true;
}
示例6: ShowVirtualKeyboard
//.........这里部分代码省略.........
{
if (type == "video")
strMask = g_advancedSettings.m_videoExtensions;
else if (type == "audio")
strMask = g_advancedSettings.GetMusicExtensions();
else if (type == "executable")
#if defined(_WIN32_WINNT)
strMask = ".exe|.bat|.cmd|.py";
#else
strMask = "";
#endif
}
// get any options
bool bUseThumbs = false;
bool bUseFileDirectories = false;
if (option)
{
vector<string> options = StringUtils::Split(option, '|');
bUseThumbs = find(options.begin(), options.end(), "usethumbs") != options.end();
bUseFileDirectories = find(options.begin(), options.end(), "treatasfolder") != options.end();
}
if (CGUIDialogFileBrowser::ShowAndGetFile(localShares, strMask, label, value, bUseThumbs, bUseFileDirectories))
((CGUIButtonControl*) control)->SetLabel2(value);
}
}
else if (type == "date")
{
CDateTime date;
if (!value.empty())
date.SetFromDBDate(value);
SYSTEMTIME timedate;
date.GetAsSystemTime(timedate);
if(CGUIDialogNumeric::ShowAndGetDate(timedate, label))
{
date = timedate;
value = date.GetAsDBDate();
((CGUIButtonControl*) control)->SetLabel2(value);
}
}
else if (type == "time")
{
SYSTEMTIME timedate;
if (value.size() >= 5)
{
// assumes HH:MM
timedate.wHour = atoi(value.substr(0, 2).c_str());
timedate.wMinute = atoi(value.substr(3, 2).c_str());
}
if (CGUIDialogNumeric::ShowAndGetTime(timedate, label))
{
value = StringUtils::Format("%02d:%02d", timedate.wHour, timedate.wMinute);
((CGUIButtonControl*) control)->SetLabel2(value);
}
}
else if (type == "addon")
{
const char *strType = setting->Attribute("addontype");
if (strType)
{
vector<string> addonTypes = StringUtils::Split(strType, ',');
vector<ADDON::TYPE> types;
for (vector<string>::iterator i = addonTypes.begin(); i != addonTypes.end(); ++i)
{
StringUtils::Trim(*i);