本文整理汇总了C++中B_TRANSLATE_COMMENT函数的典型用法代码示例。如果您正苦于以下问题:C++ B_TRANSLATE_COMMENT函数的具体用法?C++ B_TRANSLATE_COMMENT怎么用?C++ B_TRANSLATE_COMMENT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了B_TRANSLATE_COMMENT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
// get the string for a modifier key
const char*
ModifierKeysWindow::_KeyToString(int32 key)
{
switch (key) {
case MENU_ITEM_SHIFT:
return B_TRANSLATE_COMMENT("Shift key",
"Label of key above Ctrl, usually Shift");
case MENU_ITEM_CONTROL:
return B_TRANSLATE_COMMENT("Ctrl key",
"Label of key farthest from the spacebar, usually Ctrl"
"e.g. Strg for German keyboard");
case MENU_ITEM_OPTION:
return B_TRANSLATE_COMMENT("Win/Cmd key",
"Label of the \"Windows\" key (PC)/Command key (Mac)");
case MENU_ITEM_COMMAND:
return B_TRANSLATE_COMMENT("Alt/Opt key",
"Label of Alt key (PC)/Option key (Mac)");
case MENU_ITEM_DISABLED:
return B_TRANSLATE_COMMENT("Disabled", "Do nothing");
}
return "";
}
示例2: fBaselineOffset
DriveItem::DriveItem(const BDiskDevice& device, const BootMenuList& menus)
:
fBaselineOffset(0),
fSizeWidth(0)
{
device.GetPath(&fPath);
if (device.Name() != NULL && device.Name()[0])
fName = device.Name();
else if (strstr(fPath.Path(), "usb") != NULL)
fName = B_TRANSLATE_COMMENT("USB Drive", "Default disk name");
else
fName = B_TRANSLATE_COMMENT("Hard Drive", "Default disk name");
fIcon = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1),
B_RGBA32);
if (device.GetIcon(fIcon, B_LARGE_ICON) != B_OK)
memset(fIcon->Bits(), 0, fIcon->BitsLength());
fDrive = new BootDrive(fPath.Path());
fIsInstalled = fDrive->InstalledMenu(menus) != NULL;
fCanBeInstalled = fDrive->CanMenuBeInstalled(menus);
char buffer[256];
fSize = string_for_size(device.Size(), buffer, sizeof(buffer));
}
示例3: B_TRANSLATE_COMMENT
void
InfoWin::_UpdateDuration()
{
if (!fController->HasFile()) {
fDurationInfo->SetText("-");
return;
}
BString info;
bigtime_t d = fController->TimeDuration() / 1000;
bigtime_t v = d / (3600 * 1000);
d = d % (3600 * 1000);
bool hours = v > 0;
if (hours)
info << v << ":";
v = d / (60 * 1000);
d = d % (60 * 1000);
info << v << ":";
v = d / 1000;
if (v < 10)
info << '0';
info << v;
if (hours)
info << " " << B_TRANSLATE_COMMENT("h", "Hours");
else
info << " " << B_TRANSLATE_COMMENT("min", "Minutes");
fDurationInfo->SetText(info.String());
}
示例4: B_TRANSLATE_COMMENT
bool
BootManagerController::_RestoreMBR()
{
BString disk;
BString path;
fSettings.FindString("disk", &disk);
fSettings.FindString("file", &path);
BString message;
message << B_TRANSLATE_COMMENT("About to restore the Master Boot Record "
"(MBR) of %disk from %file. Do you wish to continue?",
"Don't translate the place holders: %disk and %file");
message.ReplaceFirst("%disk", disk);
message.ReplaceFirst("%file", path);
BAlert* alert = new BAlert("confirm", message.String(),
B_TRANSLATE_COMMENT("Restore MBR", "Button"),
B_TRANSLATE_COMMENT("Back", "Button"),
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 1)
return false;
BFile file(path.String(), B_READ_ONLY);
fRestoreMBRStatus = fBootMenu->RestoreMasterBootRecord(&fSettings, &file);
return true;
}
示例5: rect
void
FileSelectionPage::_BuildUI(const char* description)
{
BRect rect(Bounds());
fDescription = CreateDescription(rect, "description", description);
MakeHeading(fDescription);
AddChild(fDescription);
BString file;
fSettings->FindString("file", &file);
fSelect = new BButton(rect, "select",
B_TRANSLATE_COMMENT("Select", "Button"),
new BMessage(kMsgOpenFilePanel),
B_FOLLOW_RIGHT);
fSelect->ResizeToPreferred();
float selectLeft = rect.right - fSelect->Bounds().Width();
rect.right = selectLeft - kFileButtonDistance;
fFile = new BTextControl(rect, "file",
B_TRANSLATE_COMMENT("File:", "Text control label"),
file.String(), new BMessage());
fFile->SetDivider(be_plain_font->StringWidth(fFile->Label()) + 5);
AddChild(fFile);
fSelect->MoveTo(selectLeft, 0);
AddChild(fSelect);
_Layout();
}
示例6: rect
void
DefaultPartitionPage::_BuildUI()
{
const float kTextDistance = be_control_look->DefaultItemSpacing();
BRect rect(Bounds());
BString text;
text << B_TRANSLATE_COMMENT("Default Partition", "Title") << "\n"
<< B_TRANSLATE("Please specify a default partition and a timeout.\n"
"The boot menu will load the default partition after "
"the timeout unless you select another partition. You "
"can also have the boot menu wait indefinitely for you "
"to select a partition.\n"
"Keep the 'ALT' key pressed to disable the timeout at boot time.");
fDescription = CreateDescription(rect, "description", text);
MakeHeading(fDescription);
AddChild(fDescription);
LayoutDescriptionVertically(fDescription);
rect.top = fDescription->Frame().bottom + kTextDistance;
BPopUpMenu* popUpMenu = _CreatePopUpMenu();
fDefaultPartition = new BMenuField(rect, "partitions",
B_TRANSLATE_COMMENT("Default Partition:", "Menu field label"),
popUpMenu);
float divider = be_plain_font->StringWidth(fDefaultPartition->Label()) + 3;
fDefaultPartition->SetDivider(divider);
AddChild(fDefaultPartition);
fDefaultPartition->ResizeToPreferred();
// timeout slider
rect.top = fDefaultPartition->Frame().bottom + kTextDistance;
int32 timeout;
fSettings->FindInt32("timeout", &timeout);
BString timeoutLabel;
_GetTimeoutLabel(timeout, timeoutLabel);
int32 sliderValue = get_index_for_timeout(timeout);
fTimeoutSlider = new BSlider(rect, "timeout", timeoutLabel.String(),
new BMessage(kMsgTimeout), 0, kNumberOfTimeoutOptions-1,
B_BLOCK_THUMB,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
fTimeoutSlider->SetModificationMessage(new BMessage(kMsgTimeout));
fTimeoutSlider->SetValue(sliderValue);
fTimeoutSlider->SetLimitLabels(B_TRANSLATE("Immediately"),
B_TRANSLATE("Never"));
fTimeoutSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fTimeoutSlider->SetHashMarkCount(kNumberOfTimeoutOptions);
fTimeoutSlider->ResizeToPreferred();
AddChild(fTimeoutSlider);
_Layout();
}
示例7: B_TRANSLATE_COMMENT
/*static*/ void
ShortcutsSpec::_InitModifierNames()
{
sShiftName = B_TRANSLATE_COMMENT("Shift",
"Name for modifier on keyboard");
sControlName = B_TRANSLATE_COMMENT("Control",
"Name for modifier on keyboard");
sOptionName = B_TRANSLATE_COMMENT("Option",
"Name for modifier on keyboard");
sCommandName = B_TRANSLATE_COMMENT("Alt",
"Name for modifier on keyboard");
}
示例8: frame
WizardPageView*
BootManagerController::CreatePage(int32 state, WizardView* wizard)
{
WizardPageView* page = NULL;
BRect frame(0, 0, 300, 250);
switch (state) {
case kStateEntry:
fSettings.ReplaceBool("install", true);
page = new DrivesPage(wizard, fBootMenus, &fSettings, "drives");
break;
case kStateErrorEntry:
page = _CreateErrorEntryPage();
wizard->SetPreviousButtonHidden(true);
wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button"));
break;
case kStateSaveMBR:
page = _CreateSaveMBRPage(frame);
wizard->SetPreviousButtonHidden(false);
break;
case kStateMBRSaved:
page = _CreateMBRSavedPage();
break;
case kStatePartitions:
page = new PartitionsPage(&fSettings, "partitions");
wizard->SetPreviousButtonHidden(false);
break;
case kStateDefaultPartitions:
page = new DefaultPartitionPage(&fSettings, frame, "default");
break;
case kStateInstallSummary:
page = _CreateInstallSummaryPage();
break;
case kStateInstalled:
page = _CreateInstalledPage();
wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button"));
break;
case kStateUninstall:
page = _CreateUninstallPage(frame);
wizard->SetPreviousButtonHidden(false);
break;
case kStateUninstalled:
// TODO prevent overwriting MBR after clicking "Previous"
page = _CreateUninstalledPage();
wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button"));
break;
}
return page;
}
示例9: BAlert
bool
BootManagerController::_WriteBootMenu()
{
BAlert* alert = new BAlert("confirm", B_TRANSLATE("About to write the "
"boot menu to disk. Are you sure you want to continue?"),
B_TRANSLATE_COMMENT("Write boot menu", "Button"),
B_TRANSLATE_COMMENT("Back", "Button"), NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
if (alert->Go() == 1)
return false;
fWriteBootMenuStatus = fBootMenu->Install(*fBootDrive, fSettings);
return true;
}
示例10: B_TRANSLATE_COMMENT
void
PartitionsPage::_BuildUI()
{
BString text;
text << B_TRANSLATE_COMMENT("Partitions", "Title") << "\n"
<< B_TRANSLATE("The following partitions were detected. Please "
"check the box next to the partitions to be included "
"in the boot menu. You can also set the names of the "
"partitions as you would like them to appear in the "
"boot menu.");
fDescription = CreateDescription("description", text);
MakeHeading(fDescription);
fPartitions = new BGridView("partitions", 0,
be_control_look->DefaultItemSpacing() / 3);
BLayoutBuilder::Grid<>(fPartitions)
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.SetColumnWeight(0, 0)
.SetColumnWeight(1, 1)
.SetColumnWeight(2, 0.5)
.SetColumnWeight(3, 0.5);
_FillPartitionsView(fPartitions);
BScrollView* scrollView = new BScrollView("scrollView", fPartitions, 0,
false, true);
SetLayout(new BGroupLayout(B_VERTICAL));
BLayoutBuilder::Group<>((BGroupLayout*)GetLayout())
.Add(fDescription)
.Add(scrollView);
}
示例11: toolTip
bool
ClipView::GetToolTipAt(BPoint point, BToolTip** _tip)
{
ClipItem* item = static_cast<ClipItem*>(this->ItemAt(this->IndexOf(point)));
if (item == NULL)
return false;
BString dateString = "";
bigtime_t added = item->GetTimeAdded();
if (BDateFormat().Format(dateString, added,
B_MEDIUM_DATE_FORMAT) != B_OK)
return false;
BString timeString = "";
added = item->GetTimeAdded();
if (BTimeFormat().Format(timeString, added,
B_SHORT_TIME_FORMAT) != B_OK)
return false;
BString toolTip(B_TRANSLATE_COMMENT("Added:\n%time%\n%date%",
"Tooltip, don't change the variables %time% and %date%."));
toolTip.ReplaceAll("%time%", timeString.String());
toolTip.ReplaceAll("%date%", dateString.String());
SetToolTip(toolTip.String());
*_tip = ToolTip();
return true;
}
示例12: WizardPageView
DrivesPage::DrivesPage(WizardView* wizardView, const BootMenuList& menus,
BMessage* settings, const char* name)
:
WizardPageView(settings, name),
fWizardView(wizardView),
fHasInstallableItems(false)
{
BString text;
text << B_TRANSLATE_COMMENT("Drives", "Title") << "\n"
<< B_TRANSLATE("Please select the drive you want the boot manager to "
"be installed to or uninstalled from.");
BTextView* description = CreateDescription("description", text);
MakeHeading(description);
fDrivesView = new BListView("drives", B_SINGLE_SELECTION_LIST,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE);
fDrivesView->SetSelectionMessage(new BMessage(kMsgSelectionChanged));
BScrollView* scrollView = new BScrollView("scrollView", fDrivesView, 0,
false, true);
SetLayout(new BGroupLayout(B_VERTICAL));
BLayoutBuilder::Group<>((BGroupLayout*)GetLayout())
.Add(description, 0.5)
.Add(scrollView, 1);
_UpdateWizardButtons(NULL);
_FillDrivesView(menus);
}
示例13: while
void
DiskProbe::RefsReceived(BMessage* message)
{
bool traverseLinks = (modifiers() & B_SHIFT_KEY) == 0;
int32 index = 0;
entry_ref ref;
while (message->FindRef("refs", index++, &ref) == B_OK) {
const char* attribute = NULL;
if (message->FindString("attributes", index - 1, &attribute) == B_OK)
traverseLinks = false;
BEntry entry;
status_t status = entry.SetTo(&ref, traverseLinks);
if (status == B_OK)
status = Probe(entry, attribute);
if (status != B_OK) {
char buffer[1024];
snprintf(buffer, sizeof(buffer),
B_TRANSLATE_COMMENT("Could not open \"%s\":\n"
"%s", "Opening of entry reference buffer for a DiskProbe "
"request Alert message. The name of entry reference and "
"error message is shown."),
ref.name, strerror(status));
BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
buffer, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
}
}
}
示例14: BPopUpMenu
BMenuField*
ModifierKeysWindow::_CreateCommandMenuField()
{
fCommandMenu = new BPopUpMenu(
B_TRANSLATE_NOCOLLECT(_KeyToString(MENU_ITEM_COMMAND)), true, true);
for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_DISABLED; key++) {
if (key == MENU_ITEM_SEPERATOR) {
// add separator item
BSeparatorItem* separator = new BSeparatorItem;
fCommandMenu->AddItem(separator, MENU_ITEM_SEPERATOR);
continue;
}
BMessage* message = new BMessage(kMsgUpdateModifier);
message->AddInt32(_KeyToString(MENU_ITEM_COMMAND), key);
BMenuItem* item = new BMenuItem(
B_TRANSLATE_NOCOLLECT(_KeyToString(key)), message);
fCommandMenu->AddItem(item, key);
}
fCommandMenu->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
B_ALIGN_VERTICAL_UNSET));
return new BMenuField(B_TRANSLATE_COMMENT("Command:",
"Command key role name"), fCommandMenu);
}
示例15: BPopUpMenu
BPopUpMenu*
DefaultPartitionPage::_CreatePopUpMenu()
{
int32 defaultPartitionIndex;
fSettings->FindInt32("defaultPartition", &defaultPartitionIndex);
BMenuItem* selectedItem = NULL;
int32 selectedItemIndex = 0;
BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE_COMMENT("Partitions",
"Pop up menu title"));
BMessage message;
for (int32 i = 0; fSettings->FindMessage("partition", i, &message) == B_OK;
i++) {
bool show;
if (message.FindBool("show", &show) != B_OK || !show)
continue;
BString name;
message.FindString("name", &name);
BMessage* msg = new BMessage(kMsgPartition);
msg->AddInt32("index", i);
BMenuItem* item = new BMenuItem(name.String(), msg);
menu->AddItem(item);
if (defaultPartitionIndex == i || selectedItem == NULL) {
selectedItem = item;
selectedItemIndex = i;
}
}
fSettings->ReplaceInt32("defaultPartition", selectedItemIndex);
selectedItem->SetMarked(true);
return menu;
}