本文整理汇总了C++中BDirectory::GetAttrInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ BDirectory::GetAttrInfo方法的具体用法?C++ BDirectory::GetAttrInfo怎么用?C++ BDirectory::GetAttrInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BDirectory
的用法示例。
在下文中一共展示了BDirectory::GetAttrInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: errorMessage
void
TTracker::InstallTemporaryBackgroundImages()
{
// make the large Haiku Logo the default background
BPath path;
status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
if (status < B_OK) {
// TODO: this error shouldn't be shown to the regular user
BString errorMessage(B_TRANSLATE("At %func \nfind_directory() "
"failed. \nReason: %error"));
errorMessage.ReplaceFirst("%func", __PRETTY_FUNCTION__);
errorMessage.ReplaceFirst("%error", strerror(status));
BAlert* alert = new BAlert("AlertError", errorMessage.String(),
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return;
}
path.Append("artwork");
BString defaultBackgroundImage("/HAIKU logo - white on blue - big.png");
BDirectory dir;
if (FSGetBootDeskDir(&dir) == B_OK) {
// install a default background if there is no background defined yet
attr_info info;
if (dir.GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) {
BScreen screen(B_MAIN_SCREEN_ID);
BPoint logoPos;
logoPos.x
= floorf((screen.Frame().Width() - 605) * (sqrtf(5) - 1) / 2);
logoPos.y = floorf((screen.Frame().Height() - 190) * 0.9);
BMessage message;
AddTemporaryBackgroundImages(&message,
(BString(path.Path()) << defaultBackgroundImage).String(),
BackgroundImage::kAtOffset, logoPos, 0xffffffff, false);
::InstallTemporaryBackgroundImages(&dir, &message);
}
}
}
示例2: defaultBackgroundImage
void
TTracker::InstallTemporaryBackgroundImages()
{
// make the large Haiku Logo the default background
BPath path;
status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
if (status < B_OK) {
BString errorMessage;
errorMessage << "At " << __PRETTY_FUNCTION__ << "\n";
errorMessage << "find_directory() failed. \nReason: ";
errorMessage << strerror(status);
(new BAlert("AlertError", errorMessage.String(), "OK", NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
return;
}
path.Append("artwork");
BString defaultBackgroundImage("/HAIKU logo - white on blue - big.png");
BDirectory dir;
if (FSGetBootDeskDir(&dir) == B_OK) {
// install a default background if there is no background defined yet
attr_info info;
if (dir.GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) {
BScreen screen(B_MAIN_SCREEN_ID);
BPoint logoPos;
logoPos.x
= floorf((screen.Frame().Width() - 605) * (sqrtf(5) - 1) / 2);
logoPos.y = floorf((screen.Frame().Height() - 190) * 0.9);
BMessage message;
AddTemporaryBackgroundImages(&message,
(BString(path.Path()) << defaultBackgroundImage).String(),
BackgroundImage::kAtOffset, logoPos, 0xffffffff, false);
::InstallTemporaryBackgroundImages(&dir, &message);
}
}
}
示例3: entry
void
TTracker::ReadyToRun()
{
gStatusWindow = new BStatusWindow();
InitMimeTypes();
InstallDefaultTemplates();
InstallIndices();
HideVarDir();
fTrashWatcher = new BTrashWatcher();
fTrashWatcher->Run();
fClipboardRefsWatcher = new BClipboardRefsWatcher();
fClipboardRefsWatcher->Run();
fAutoMounter = new AutoMounter();
fAutoMounter->Run();
fTaskLoop = new StandAloneTaskLoop(true);
bool openDisksWindow = false;
// open desktop window
BContainerWindow *deskWindow = NULL;
BVolume bootVol;
BVolumeRoster().GetBootVolume(&bootVol);
BDirectory deskDir;
if (FSGetDeskDir(&deskDir, bootVol.Device()) == B_OK) {
// create desktop
BEntry entry;
deskDir.GetEntry(&entry);
Model *model = new Model(&entry);
if (model->InitCheck() == B_OK) {
AutoLock<WindowList> lock(&fWindowList);
deskWindow = new BDeskWindow(&fWindowList);
AutoLock<BWindow> windowLock(deskWindow);
deskWindow->CreatePoseView(model);
deskWindow->Init();
} else
delete model;
// open previously open windows
attr_info attrInfo;
if (!BootedInSafeMode()
&& deskDir.GetAttrInfo(kAttrOpenWindows, &attrInfo) == B_OK) {
char *buffer = (char *)malloc((size_t)attrInfo.size);
BMessage message;
if (deskDir.ReadAttr(kAttrOpenWindows, B_MESSAGE_TYPE, 0, buffer, (size_t)attrInfo.size)
== attrInfo.size
&& message.Unflatten(buffer) == B_OK) {
node_ref nodeRef;
deskDir.GetNodeRef(&nodeRef);
int32 stateMessageCounter = 0;
const char *path;
for (int32 outer = 0;message.FindString("paths", outer, &path) == B_OK;outer++) {
int8 flags = 0;
for (int32 inner = 0;message.FindInt8(path, inner, &flags) == B_OK;inner++) {
BEntry entry(path, true);
if (entry.InitCheck() == B_OK) {
Model *model = new Model(&entry);
if (model->InitCheck() == B_OK && model->IsContainer()) {
BMessage state;
bool restoreStateFromMessage = false;
if ((flags & kOpenWindowHasState) != 0
&& message.FindMessage("window state", stateMessageCounter++, &state) == B_OK)
restoreStateFromMessage = true;
if (restoreStateFromMessage)
OpenContainerWindow(model, 0, kOpen,
kRestoreWorkspace | (flags & kOpenWindowMinimized ? kIsHidden : 0U),
false, &state);
else
OpenContainerWindow(model, 0, kOpen,
kRestoreWorkspace | (flags & kOpenWindowMinimized ? kIsHidden : 0U));
} else
delete model;
}
}
}
if (message.HasBool("open_disks_window"))
openDisksWindow = true;
}
free(buffer);
}
}
// create model for root of everything
if (deskWindow) {
BEntry entry("/");
Model model(&entry);
if (model.InitCheck() == B_OK) {
if (TrackerSettings().ShowDisksIcon()) {
// add the root icon to desktop window
BMessage message;
message.what = B_NODE_MONITOR;
//.........这里部分代码省略.........
示例4: defaultFolderPath
void
TTracker::InstallTemporaryBackgroundImages()
{
BPath path;
FSFindTrackerSettingsDir(&path, false);
BString defaultFolderPath(path.Path());
defaultFolderPath << '/' << kDefaultFolderTemplate << '/';
BNode node;
if (BContainerWindow::DefaultStateSourceNode(kDefaultFolderTemplate, &node, true))
InstallTemporaryBackgroundImagesIfNeeded(&node,
(BString(defaultFolderPath) << "backgroundTexture.tga").String(),
BackgroundImage::kTiled,
BPoint(0, 0), 0xffffffff, false);
BDirectory dir;
if (FSGetBootDeskDir(&dir) == B_OK) {
attr_info info;
if (dir.GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) {
BMessage message;
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bgdefault.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0xffffffff, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg1.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000001, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg2.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000002, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg3.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000004, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg4.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000008, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg5.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000010, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg6.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000020, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg7.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000040, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg8.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000080, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg9.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000100, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg10.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000200, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg11.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000400, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg12.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000800, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg12.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00001000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg13.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00002000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg14.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00002000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg15.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00004000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg16.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00008000, true);
::InstallTemporaryBackgroundImages(&dir, &message);
}
}
}