本文整理汇总了C++中InfoBoxData::SetValueFromVoltage方法的典型用法代码示例。如果您正苦于以下问题:C++ InfoBoxData::SetValueFromVoltage方法的具体用法?C++ InfoBoxData::SetValueFromVoltage怎么用?C++ InfoBoxData::SetValueFromVoltage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InfoBoxData
的用法示例。
在下文中一共展示了InfoBoxData::SetValueFromVoltage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
UpdateInfoBoxBattery(InfoBoxData &data)
{
#ifdef HAVE_BATTERY
bool DisplaySupplyVoltageAsValue=false;
switch (Power::External::Status) {
case Power::External::OFF:
if (CommonInterface::Basic().battery_level_available)
data.UnsafeFormatComment(_T("%s; %d%%"),
_("AC Off"),
(int)CommonInterface::Basic().battery_level);
else
data.SetComment(_("AC Off"));
break;
case Power::External::ON:
if (!CommonInterface::Basic().voltage_available)
data.SetComment(_("AC ON"));
else{
DisplaySupplyVoltageAsValue = true;
data.SetValueFromVoltage(CommonInterface::Basic().voltage);
}
break;
case Power::External::UNKNOWN:
default:
data.SetCommentInvalid();
}
#ifndef ANDROID
switch (Power::Battery::Status){
case Power::Battery::HIGH:
case Power::Battery::LOW:
case Power::Battery::CRITICAL:
case Power::Battery::CHARGING:
if (Power::Battery::RemainingPercentValid){
#endif
if (!DisplaySupplyVoltageAsValue)
data.SetValueFromPercent(Power::Battery::RemainingPercent);
else
data.SetCommentFromPercent(Power::Battery::RemainingPercent);
#ifndef ANDROID
}
else
if (!DisplaySupplyVoltageAsValue)
data.SetValueInvalid();
else
data.SetCommentInvalid();
break;
case Power::Battery::NOBATTERY:
case Power::Battery::UNKNOWN:
if (!DisplaySupplyVoltageAsValue)
data.SetValueInvalid();
else
data.SetCommentInvalid();
}
#endif
return;
#endif
if (CommonInterface::Basic().voltage_available) {
data.SetValueFromVoltage(CommonInterface::Basic().voltage);
return;
} else if (CommonInterface::Basic().battery_level_available) {
data.SetValueFromPercent(CommonInterface::Basic().battery_level);
return;
}
data.SetInvalid();
}