当前位置: 首页>>代码示例>>C++>>正文


C++ BPath::Append方法代码示例

本文整理汇总了C++中BPath::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ BPath::Append方法的具体用法?C++ BPath::Append怎么用?C++ BPath::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BPath的用法示例。


在下文中一共展示了BPath::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AttachedToWindow


//.........这里部分代码省略.........
		if ( fThisArchive->FindBool( "AutoHide", &autohide ) != B_OK )
			autohide = false;
		((TPanelWindow*)Window())->SetAutoHide( autohide );

		int32 delay;
		if ( fThisArchive->FindInt32( "HideEffectDelay", &delay ) != B_OK )
			delay = kWindowHidderAnimationStaleSpeed;
		((TPanelWindow*)Window())->SetHideEffectDelay( delay );

		if ( fThisArchive->FindBool( "AlwaysOnTop", &fAlwaysOnTop ) != B_OK )
			fAlwaysOnTop = true;

		if ( fThisArchive->FindBool( "HideStandardDeskbar", &fHideStandardDeskbar ) != B_OK )
			fHideStandardDeskbar = false;

		if ( fHideStandardDeskbar )
		{
			BMessage msg(B_SET_PROPERTY);
			msg.AddBool( "data", true );
			msg.AddSpecifier( "Hidden" );
			msg.AddSpecifier( "Window", "Deskbar" );
			be_app->PostMessage(&msg);
		}

		for ( int i=0; ; i++ )
		{
			BMessage inner;
			if ( fThisArchive->FindMessage( "tabs", i, &inner ) != B_OK )
				break;
			inner.AddPointer( "parent", this );
			BArchivable *archive = instantiate_dock_object( &inner );
			if ( archive )
			{
				TInnerPanel *panel = dynamic_cast<TInnerPanel*>(archive);
				if ( panel )
				{
					AddPanel( panel );
					bool _isr;
					if ( inner.FindBool( "IsRunningAppPanel", &_isr ) == B_OK && _isr )
						fRunningAppPanel = cast_as( panel, TApplicationPanel );
				}
			}
		}

		delete fThisArchive;
		fThisArchive = 0;
	}
	else
	{
		// <options>
		fUseTransparentMenus = false;
		fLocation = kLocationBottom;
		fColor2 = (rgb_color){229,235,231,255};
		fColor3 = (rgb_color){218,218,205,255};
		fDrawOuterFrame = true;
		fUseWindowShapping = false;
		fHideStandardDeskbar = false;
		fAlwaysOnTop = false;
		// </options>
	}

	if ( fAlwaysOnTop )
		Window()->SetFeel( B_FLOATING_ALL_WINDOW_FEEL );
	else
		Window()->SetFeel( B_NORMAL_WINDOW_FEEL );

	if ( fPanels.CountItems() == 0 )
	{
		TShortcutPanel *cpanel = new TShortcutPanel(this);
		AddPanel( cpanel );

		cpanel->AddItem( new TTrashIcon() );
		cpanel->AddItem( new TWorkspacesIcon() );
		cpanel->AddItem( new TClockIcon() );

		BEntry entry( "/boot/beos/system/Tracker" );
		entry_ref ref;
		entry.GetRef( &ref );
		AddShortcut( cpanel, ref );

		BPath path;
		if ( find_directory( B_USER_CONFIG_DIRECTORY, &path ) == B_OK )
		{
			path.Append( "be" );
			BEntry entry2( path.Path() );
			entry2.GetRef( &ref );
			AddShortcut( cpanel, ref );
		}

		cpanel = new TShortcutPanel(this);
		AddPanel( cpanel );
		AddShortcut( cpanel, "application/x-vnd.Be-NPOS" );
		AddShortcut( cpanel, "application/x-vnd.Sugoi-BeShare" );

		fRunningAppPanel = new TApplicationPanel(this);
		AddPanel( fRunningAppPanel );
	}

//	AddPanel( new TReplicantShelfPanel(this) );
}
开发者ID:HaikuArchives,项目名称:DockBert,代码行数:101,代码来源:PanelWindowView.cpp

示例2: if

BLanguage::BLanguage(const char *language)
	:
	fName(NULL),
	fCode(NULL),
	fFamily(NULL),
	fDirection(B_LEFT_TO_RIGHT)
{
	for (int32 i = B_NUM_LANGUAGE_STRINGS;i-- > 0;)
		fStrings[i] = NULL;

	if (language == NULL) {
		Default();
		return;
	}

	char name[B_FILE_NAME_LENGTH];
	sprintf(name, "locale/languages/%s.language", language);

	BPath path;
	if (find_directory(B_BEOS_ETC_DIRECTORY, &path) < B_OK) {
		Default();
		return;
	}

	path.Append(name);

	FILE *file = fopen(path.Path(), "r");
	if (file == NULL) {
		Default();
		return;
	}

	int32 count = -2;
	while (fgets(name, B_FILE_NAME_LENGTH, file) != NULL) {
		if (count == -2) {
			char *family = strchr(name, ',');
			if (family == NULL)
				break;
			*family++ = '\0';

			// set the direction of writing			
			char *direction = strchr(family, ',');
			if (direction != NULL) {
				*direction++ = '\0';
				direction = TrimCopy(direction);

				if (!strcasecmp(direction, "ltr"))
					fDirection = B_LEFT_TO_RIGHT;
				else if (!strcasecmp(direction, "rtl"))
					fDirection = B_RIGHT_TO_LEFT;
				else if (!strcasecmp(direction, "ttb"))
					fDirection = B_TOP_TO_BOTTOM;

				free(direction);
			}

			fName = strdup(language);
			fCode = TrimCopy(name);
			fFamily = TrimCopy(family);
			count++;
		} else if (count == -1) {
			if (!strcmp(name,"--\n"))
				count++;
		} else if (count < B_NUM_LANGUAGE_STRINGS) {
			char *string = TrimCopy(name);
			if (string == NULL)
				continue;

			fStrings[count++] = string; 
		}
	}

	if (count < 0)
		Default();

	fclose(file);
}
开发者ID:HaikuArchives,项目名称:OpenTracker,代码行数:77,代码来源:Language.cpp

示例3: BMessage

KeymapWindow::KeymapWindow()
	:
	BWindow(BRect(80, 50, 880, 380), TR("Keymap"), B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	SetLayout(new BGroupLayout(B_VERTICAL));

	fKeyboardLayoutView = new KeyboardLayoutView("layout");
	fKeyboardLayoutView->SetKeymap(&fCurrentMap);

	fTextControl = new BTextControl(TR("Sample and clipboard:"), "", NULL);

	fSwitchShortcutsButton = new BButton("switch", "",
		new BMessage(kMsgSwitchShortcuts));

	fRevertButton = new BButton("revertButton", TR("Revert"),
		new BMessage(kMsgRevertKeymap));

	// controls pane
	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.Add(_CreateMenu())
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
			.Add(_CreateMapLists(), 0.25)
			.Add(BGroupLayoutBuilder(B_VERTICAL, 10)
				.Add(fKeyboardLayoutView)
				//.Add(new BStringView("text label", "Sample and clipboard:"))
				.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
					.Add(_CreateDeadKeyMenuField(), 0.0)
					.AddGlue()
					.Add(fSwitchShortcutsButton))
				.Add(fTextControl)
				.AddGlue(0.0)
				.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
					.AddGlue(0.0)
					.Add(fRevertButton)))
			.SetInsets(10, 10, 10, 10)));

	fKeyboardLayoutView->SetTarget(fTextControl->TextView());
	fTextControl->MakeFocus();

	// Make sure the user keymap directory exists
	BPath path;
	find_directory(B_USER_SETTINGS_DIRECTORY, &path);
	path.Append("Keymap");

	entry_ref ref;
	get_ref_for_path(path.Path(), &ref);

	BDirectory userKeymapsDir(&ref);
	if (userKeymapsDir.InitCheck() != B_OK)
		create_directory(path.Path(), S_IRWXU | S_IRWXG | S_IRWXO);

	BMessenger messenger(this);
	fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, &ref,
		B_FILE_NODE, false, NULL);
	fSavePanel = new BFilePanel(B_SAVE_PANEL, &messenger, &ref,
		B_FILE_NODE, false, NULL);

	BRect windowFrame;
	BString keyboardLayout;
	_LoadSettings(windowFrame, keyboardLayout);
	_SetKeyboardLayout(keyboardLayout.String());

	ResizeTo(windowFrame.Width(), windowFrame.Height());
	MoveTo(windowFrame.LeftTop());

	// TODO: this might be a bug in the interface kit, but scrolling to
	// selection does not correctly work unless the window is shown.
	Show();
	Lock();

	// Try and find the current map name in the two list views (if the name
	// was read at all)
	_SelectCurrentMap();

	KeymapListItem* current
		= static_cast<KeymapListItem*>(fUserListView->FirstItem());

	fCurrentMap.Load(current->EntryRef());
	fPreviousMap = fCurrentMap;
	fAppliedMap = fCurrentMap;
	fCurrentMap.SetTarget(this, new BMessage(kMsgKeymapUpdated));

	_UpdateButtons();

	_UpdateDeadKeyMenu();
	_UpdateSwitchShortcutButton();

	Unlock();
}
开发者ID:mmanley,项目名称:Antares,代码行数:90,代码来源:KeymapWindow.cpp

示例4: listener

int
command_create(int argc, const char* const* argv)
{
	const char* changeToDirectory = NULL;
	bool quiet = false;
	bool verbose = false;

	while (true) {
		static struct option sLongOptions[] = {
			{ "help", no_argument, 0, 'h' },
			{ "quiet", no_argument, 0, 'q' },
			{ "verbose", no_argument, 0, 'v' },
			{ 0, 0, 0, 0 }
		};

		opterr = 0; // don't print errors
		int c = getopt_long(argc, (char**)argv, "+C:hqv", sLongOptions, NULL);
		if (c == -1)
			break;

		switch (c) {
			case 'C':
				changeToDirectory = optarg;
				break;

			case 'h':
				print_usage_and_exit(false);
				break;

			case 'q':
				quiet = true;
				break;

			case 'v':
				verbose = true;
				break;

			default:
				print_usage_and_exit(true);
				break;
		}
	}

	// The remaining arguments are the repository info file plus one or more
	// package files, i.e. at least two more arguments.
	if (optind + 2 > argc)
		print_usage_and_exit(true);

	const char* repositoryInfoFileName = argv[optind++];
	const char* const* packageFileNames = argv + optind;

	RepositoryWriterListener listener(verbose, quiet);

	BEntry repositoryInfoEntry(repositoryInfoFileName);
	if (!repositoryInfoEntry.Exists()) {
		listener.PrintError(
			"Error: given repository-info file '%s' doesn't exist!\n",
			repositoryInfoFileName);
		return 1;
	}

	// determine path for 'repo' file from given info file
	BEntry repositoryParentEntry;
	repositoryInfoEntry.GetParent(&repositoryParentEntry);
	BPath repositoryPath;
	if (repositoryParentEntry.GetPath(&repositoryPath) != B_OK) {
		listener.PrintError(
			"Error: can't determine path of given repository-info file!\n");
		return 1;
	}
	repositoryPath.Append("repo");

	// create repository
	BRepositoryInfo repositoryInfo(repositoryInfoEntry);
	status_t result = repositoryInfo.InitCheck();
	if (result != B_OK) {
		listener.PrintError(
			"Error: can't parse given repository-info file : %s\n",
			strerror(result));
		return 1;
	}
	BRepositoryWriter repositoryWriter(&listener, &repositoryInfo);
	if ((result = repositoryWriter.Init(repositoryPath.Path())) != B_OK) {
		listener.PrintError("Error: can't initialize repository-writer : %s\n",
			strerror(result));
		return 1;
	}

	// change directory, if requested
	if (changeToDirectory != NULL) {
		if (chdir(changeToDirectory) != 0) {
			listener.PrintError(
				"Error: Failed to change the current working directory to "
				"\"%s\": %s\n", changeToDirectory, strerror(errno));
			return 1;
		}
	}

	// add all given package files
	for (int i = 0; i < argc - optind; ++i) {
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:command_create.cpp

示例5: leaf

status_t
WinampSkinThemesAddon::SetSPSkin(BString *from)
{
	status_t err;
	BPath p;
	err = SPSkinPath(&p);
	if (err < B_OK)
		return err;
	p.Append(from->String());
	err = p.InitCheck();
	if (err < B_OK)
		return err;

	/* update the prefs file */
	BPath SPSPath;
	BMessage settings;
	
	if (!from)
		return EINVAL;
	if (from->Length() >= B_PATH_NAME_LENGTH)
		return B_NAME_TOO_LONG;
	
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &SPSPath) < B_OK)
		return B_ERROR;
	BString leaf(SP_SETTINGS_NAME);
	BString user(getenv("USER"));
	user.RemoveFirst("USER=");
	leaf.IReplaceFirst("$USER", user.String());
	SPSPath.Append(leaf.String());
	PRINT(("SPP %s\n", SPSPath.Path()));
	BFile SPSettings(SPSPath.Path(), B_READ_WRITE);
	PRINT(("SP:BFile\n"));
	if (SPSettings.InitCheck() < B_OK)
		return SPSettings.InitCheck();
	PRINT(("SP:BFile::InitCheck\n"));
	//SPSettings.WriteAt(0x8LL, from->String(), from->Length()+1);
	if (settings.Unflatten(&SPSettings) < B_OK)
		return EIO;
	PRINT(("SP:Unflatten\n"));
	settings.ReplaceString("skinname", p.Path());
	PRINT(("SP:Replace\n"));
	SPSettings.Seek(0LL, SEEK_SET);
	if (settings.Flatten(&SPSettings) < B_OK)
		return EIO;
	PRINT(("SP:Flatten\n"));
	
	/* then tell the app */
	/* first make sure the native BeOS is shown (the 'sk!n' message toggles, wonder Why TF...) */
	bool beosIfaceHidden;
	BMessenger msgr(SP_APP_SIG);
	
	BMessage command(B_GET_PROPERTY);
	BMessage answer;
	command.AddSpecifier("Hidden");
	command.AddSpecifier("Window", 0L); // TitleSpectrumAnalyzer does change the title from "SoundPlay"!
	err = msgr.SendMessage(&command, &answer,(bigtime_t)2E6,(bigtime_t)2E6);
	if(B_OK == err) {
		if (answer.FindBool("result", &beosIfaceHidden) != B_OK)
			beosIfaceHidden = false;
	} else {
		PRINT(("WinampSkinThemesAddon: couldn't talk to SoundPlay: error 0x%08lx\n", err));
		return EIO;
	}	

	BMessage msg('sk!n');
	msg.AddString("path", p.Path());
	msg.PrintToStream();
	if (!beosIfaceHidden) { // native GUI is active
		// -> sending the message to the App will make ituse the skin for all tracks
		PRINT(("SP:Sending to app\n"));
		msgr.SendMessage(&msg, (BHandler *)NULL, 500000);
	} else { // native GUI is hidden (= winamp GUI used)
		int32 wincnt;
		command.MakeEmpty();
		command.what = B_COUNT_PROPERTIES;
		answer.MakeEmpty();
		command.AddSpecifier("Window");
		err = msgr.SendMessage(&command, &answer,(bigtime_t)2E6,(bigtime_t)2E6);
		if(B_OK == err) {
			if (answer.FindInt32("result", &wincnt) != B_OK)
				wincnt = 1;
		} else {
			PRINT(("WinampSkinThemesAddon: couldn't talk to SoundPlay: (2) error 0x%08lx\n", err));
			return EIO;
		}
		// send to all windows but first one.
		for (int32 i = 1; i < wincnt; i++) {
			BMessage wmsg(msg);
			PRINT(("SP:Sending to window %ld\n", i));
			wmsg.AddSpecifier("Window", i);
			wmsg.PrintToStream();
			msgr.SendMessage(&wmsg, (BHandler *)NULL, 500000);
		}
	}
	return B_OK;
}
开发者ID:luciang,项目名称:haiku,代码行数:96,代码来源:WinampSkinAddon.cpp

示例6: new

// fill out the icons with the stop and warn symbols from app_server
void
ConflictView::_FillIcons()
{
	// return if the icons have already been filled out
	if (fStopIcon != NULL && fStopIcon->InitCheck() == B_OK
		&& fWarnIcon != NULL && fWarnIcon->InitCheck() == B_OK) {
		return;
	}

	BPath path;
	status_t status = find_directory(B_BEOS_SERVERS_DIRECTORY, &path);
	if (status < B_OK) {
		FTRACE((stderr,
			"_FillIcons() - find_directory failed: %s\n",
			strerror(status)));
		return;
	}

	path.Append("app_server");
	BFile file;
	status = file.SetTo(path.Path(), B_READ_ONLY);
	if (status < B_OK) {
		FTRACE((stderr,
			"_FillIcons() - BFile init failed: %s\n",
			strerror(status)));
		return;
	}

	BResources resources;
	status = resources.SetTo(&file);
	if (status < B_OK) {
		FTRACE((stderr,
			"_FillIcons() - BResources init failed: %s\n",
			strerror(status)));
		return;
	}

	size_t size = 0;

	if (fStopIcon == NULL) {
		// Allocate the fStopIcon bitmap
		fStopIcon = new (std::nothrow) BBitmap(BRect(0, 0, 15, 15), 0,
			B_RGBA32);
		if (fStopIcon->InitCheck() != B_OK) {
			FTRACE((stderr, "_FillIcons() - No memory for stop bitmap\n"));
			delete fStopIcon;
			fStopIcon = NULL;
			return;
		}

		// load stop icon bitmap from app_server
		const uint8* stopVector
			= (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE, "stop",
				&size);
		if (stopVector == NULL
			|| BIconUtils::GetVectorIcon(stopVector, size, fStopIcon)
				!= B_OK) {
			delete fStopIcon;
			fStopIcon = NULL;
		}
	}

	if (fWarnIcon == NULL) {
		// Allocate the fWarnIcon bitmap
		fWarnIcon = new (std::nothrow) BBitmap(BRect(0, 0, 15, 15), 0,
			B_RGBA32);
		if (fWarnIcon->InitCheck() != B_OK) {
			FTRACE((stderr, "_FillIcons() - No memory for warn bitmap\n"));
			delete fWarnIcon;
			fWarnIcon = NULL;
			return;
		}

		// load warn icon bitmap from app_server
		const uint8* warnVector
			= (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE, "warn",
				&size);
		if (warnVector == NULL
			|| BIconUtils::GetVectorIcon(warnVector, size, fWarnIcon)
				!= B_OK) {
			delete fWarnIcon;
			fWarnIcon = NULL;
		}
	}
}
开发者ID:tqh,项目名称:haiku_efi_old,代码行数:86,代码来源:ModifierKeysWindow.cpp

示例7: BFile

status_t
PoorManWindow::ReadSettings()
{
	BPath p;
	BFile f;
	BMessage m;
	
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &p) != B_OK)
		return B_ERROR;
	p.Append(STR_SETTINGS_FILE_NAME);
	
	f.SetTo(p.Path(), B_READ_ONLY);
	if (f.InitCheck() != B_OK)
		return B_ERROR;
	
	if (m.Unflatten(&f) != B_OK)
		return B_ERROR;
	
	if (MSG_PREF_FILE != m.what)
		return B_ERROR;
	
	//site tab
	if (m.FindString("fWebDirectory", &fWebDirectory) != B_OK)
		fWebDirectory.SetTo(STR_DEFAULT_WEB_DIRECTORY);
	if (m.FindString("fIndexFileName", &fIndexFileName) != B_OK)
		fIndexFileName.SetTo("index.html");
	if (m.FindBool("fDirListFlag", &fDirListFlag) != B_OK)
		fDirListFlag = false;
	
	//logging tab
	if (m.FindBool("fLogConsoleFlag", &fLogConsoleFlag) != B_OK)
		fLogConsoleFlag = true;
	if (m.FindBool("fLogFileFlag", &fLogFileFlag) != B_OK)
		fLogFileFlag = false;
	if (m.FindString("fLogPath", &fLogPath) != B_OK)
		fLogPath.SetTo("");
	
	//advance tab
	if (m.FindInt16("fMaxConnections", &fMaxConnections) != B_OK)
		fMaxConnections = (int16)32;
	
	//windows' position and size
	if (m.FindRect("frame", &fFrame) != B_OK)
		fFrame.Set(82.0f, 30.0f, 400.0f, 350.0f);
	if (m.FindRect("fSetwindowFrame", &fSetwindowFrame) != B_OK)
		fSetwindowFrame.Set(112.0f, 60.0f, 492.0f, 340.0f);
	if (m.FindBool("fIsZoomed", &fIsZoomed) != B_OK)
		fIsZoomed = true;
	if (m.FindFloat("fLastWidth", &fLastWidth) != B_OK)
		fLastWidth = 318.0f;
	if (m.FindFloat("fLastHeight", &fLastHeight) != B_OK)
		fLastHeight = 320.0f;
	
	fIsZoomed?ResizeTo(fLastWidth, fLastHeight):ResizeTo(318, 53);
	MoveTo(fFrame.left, fFrame.top);
	
	fLogFile = new BFile(fLogPath.String(), B_CREATE_FILE | B_WRITE_ONLY
		| B_OPEN_AT_END);
	if (fLogFile->InitCheck() != B_OK) {
		fLogFileFlag = false;
		//log it to console, "log to file unavailable."
		return B_OK;
	}
	
	SetDirLabel(fWebDirectory.String());
	
	return B_OK;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:68,代码来源:PoorManWindow.cpp

示例8: name

BString
Project::FindLibrary(const char *libname)
{
	BString outpath;
	
	if (!libname)
		return outpath;
	
	// Take some reasonable care that we're actually dealing with a library or something
	// like one
	BString name(libname);
	if (name.FindLast(".so") == B_ERROR && name.FindLast(".a") == B_ERROR &&
		name.FindLast(".o") == B_ERROR)
		return outpath;
	
	BString alertmsg;
	alertmsg << libname << " couldn't be found in the same place as it was under "
		<< sPlatformArray[fPlatform] << ". ";
	
	BPath tempPath;
	
	find_directory(B_USER_LIB_DIRECTORY,&tempPath);
	tempPath.Append(libname);
	if (BEntry(tempPath.Path()).Exists())
	{
		alertmsg << "Replacing it with " << tempPath.Path();
		if (!gBuildMode)
			ShowAlert(alertmsg.String(),"OK");
		
		outpath = tempPath.Path();
		return outpath;
	}
	
	find_directory(B_USER_LIB_DIRECTORY,&tempPath);
	tempPath.Append(libname);
	if (BEntry(tempPath.Path()).Exists())
	{
		alertmsg << "Replacing it with " << tempPath.Path();
		if (!gBuildMode)
			ShowAlert(alertmsg.String(),"OK");
		
		outpath = tempPath.Path();
		return outpath;
	}
	
	find_directory(B_USER_DEVELOP_DIRECTORY,&tempPath);
	tempPath.Append("lib/x86/");
	tempPath.Append(libname);
	if (BEntry(tempPath.Path()).Exists())
	{
		alertmsg << "Replacing it with " << tempPath.Path();
		if (!gBuildMode)
			ShowAlert(alertmsg.String(),"OK");
		
		outpath = tempPath.Path();
		return outpath;
	}
	
	find_directory(B_BEOS_LIB_DIRECTORY,&tempPath);
	tempPath.Append(libname);
	if (BEntry(tempPath.Path()).Exists())
	{
		alertmsg << "Replacing it with " << tempPath.Path();
		if (!gBuildMode)
			ShowAlert(alertmsg.String(),"OK");
		
		outpath = tempPath.Path();
		return outpath;
	}
	
	return outpath;
}
开发者ID:passick,项目名称:Paladin,代码行数:72,代码来源:Project.cpp

示例9: entry


//.........这里部分代码省略.........
				AddFile(srcfile, srcgroup);
			}
			else if (entry == "DEPENDENCY")
			{
				if (srcfile)
					srcfile->fDependencies = value;
			}
			else if (entry == "LOCALINCLUDE")
			{
				ProjectPath include(fPath.GetFolder(), value.String());
				AddLocalInclude(include.Absolute().String());
			}
			else if (entry == "SYSTEMINCLUDE")
				AddSystemInclude(value.String());
			else if (entry == "LIBRARY")
			{
				if (actualPlatform == fPlatform)
					AddLibrary(value.String());
				else
					ImportLibrary(value.String(),actualPlatform);
			}
			else if (entry == "GROUP")
				srcgroup = AddGroup(value.String());
			else if (entry == "EXPANDGROUP")
			{
				if (srcgroup)
					srcgroup->expanded = value == "yes" ? true : false;
			}
			else if (entry == "TARGETNAME")
				fTargetName = value;
			else if (entry == "CCDEBUG")
				fDebug = value == "yes" ? true : false;
			else if (entry == "CCPROFILE")
				fProfile = value == "yes" ? true : false;
			else if (entry == "CCOPSIZE")
				fOpSize = value == "yes" ? true : false;
			else if (entry == "CCOPLEVEL")
				fOpLevel = atoi(value.String());
			else if (entry == "CCTARGETTYPE")
				fTargetType = atoi(value.String());
			else if (entry == "CCEXTRA")
				fExtraCompilerOptions = value;
			else if (entry == "LDEXTRA")
				fExtraLinkerOptions = value;
			else if (entry == "RUNARGS")
				fRunArgs = value;
			else if (entry == "SCM")
			{
				if (value.ICompare("hg") == 0)
					fSCMType = SCM_HG;
				else if (value.ICompare("git") == 0)
					fSCMType = SCM_GIT;
				else if (value.ICompare("svn") == 0)
					fSCMType = SCM_SVN;
				else
					fSCMType = SCM_NONE;
			}
			else if (entry == "PLATFORM")
			{
				if (value.ICompare("Haiku") == 0)
					fPlatform = PLATFORM_HAIKU;
				else if (value.ICompare("HaikuGCC4") == 0)
					fPlatform = PLATFORM_HAIKU_GCC4;
				else if (value.ICompare("Zeta") == 0)
					fPlatform = PLATFORM_ZETA;
				else
					fPlatform = PLATFORM_R5;
			}
				
		}
		
		line = file.ReadLine();
	}
	
	// Fix one of my pet peeves when changing platforms: having to add libsupc++.so whenever
	// I change to Haiku GCC4 or GCC4hybrid from any other platform
	if (actualPlatform == PLATFORM_HAIKU_GCC4 && actualPlatform != fPlatform)
	{
		BPath libpath;
		find_directory(B_USER_DEVELOP_DIRECTORY,&libpath);
		libpath.Append("lib/x86/libsupc++.so");
		AddLibrary(libpath.Path());
	}
	
	fObjectPath = fPath.GetFolder();
	
	BString objfolder("(Objects.");
	objfolder << GetName() << ")";
	fObjectPath.Append(objfolder.String());
	
	UpdateBuildInfo();
	
	// We now set the platform to whatever we're building on. fPlatform is only used
	// in the project loading code to be able to help cover over issues with changing platforms.
	// Most of the time this is just the differences in libraries, but there may be other
	// unforeseen issues that will come to light in the future.
	fPlatform = actualPlatform;
	
	return B_OK;
}
开发者ID:passick,项目名称:Paladin,代码行数:101,代码来源:Project.cpp

示例10: dir

/***********************************************************
 * FilterMail
 ***********************************************************/
void
HDaemonApp::FilterMail(const char* subject,
							const char* from,
							const char* to,
							const char* cc,
							const char* reply,
							BString &outpath)
{
	BPath	path;
	::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
	path.Append("Scooby");
	path.Append("Filters");
	::create_directory(path.Path(),0777);
	
	entry_ref ref;
	::get_ref_for_path(path.Path(),&ref);
	BDirectory dir( &ref );
   	//load all email
   	status_t err = B_NO_ERROR;
	dir.Rewind();
	BFile file;
	BMessage filter;
	int32 attr,op,action,op2;
	BString attr_value,action_value;
	char* key(NULL);
	bool hit = false,skip = false;
	type_code type;
	int32 count;
	
	while( err == B_OK )
	{
		if( (err = dir.GetNextRef( &ref )) == B_OK)
		{
			if( file.SetTo(&ref,B_READ_ONLY) != B_OK)
				continue;
			filter.Unflatten(&file);
			filter.GetInfo("attribute",&type,&count);
			filter.FindString("action_value",&action_value);
			filter.FindInt32("action",&action);	
			for(int32 i = 0;i < count;i++)
			{
				filter.FindInt32("attribute",i,&attr);
				filter.FindInt32("operation1",i,&op);
				filter.FindInt32("operation2",i,&op2);
				
				filter.FindString("attr_value",i,&attr_value);
				
				switch(attr)
				{
				case 0:
					key = ::strdup(subject);
					break;
				case 1:
					key = ::strdup(to);
					break;
				case 2:
					key = ::strdup(from);
					break;
				case 3:
					key = ::strdup(cc);
					break;
				case 4:
					key = ::strdup(reply);
					break;
				}
				
				if(!skip)
					hit = Filter(key,op,attr_value.String());
				else
					skip = false;
			
				free( key );
				key = NULL;
				// And condition
				if(op2 == 0 && !hit )
					break;
				// Or condition
				if(op2 == 1 && hit)
					skip=true;	
			}
			if(hit)
			{
				PRINT(("MATCH\n"));
				// action move
				//if(action == 0)
				//{	
					::find_directory(B_USER_DIRECTORY,&path);
					path.Append( "mail" );
					path.Append(action_value.String());
					PRINT(("%s\n",action_value.String()));
					if(!path.Path())
						goto no_hit;
					outpath = path.Path();
					return;
				//}
			}
		}
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:101,代码来源:HDaemonApp.cpp

示例11: header

/***********************************************************
 * SaveMails
 ***********************************************************/
void
HDaemonApp::SaveMail(const char* all_content,
						entry_ref* folder_ref,
						entry_ref *file_ref,
						bool *is_delete)
{
	fGotMails = true;
	if(!fHaveNewMails)
		fHaveNewMails = true;
	BString header(""),subject(""),to(""),date(""),cc(""),from("")
			,priority(""),reply(""),mime("");
	Encoding encode;
	
	bool is_multipart = false;
	int32 org_len = strlen(all_content);
	// Probably deleted with Spam filter
	if(org_len == 0)
	{
		*is_delete = false;
		return;
	}
	//
	int32 header_len = 0;
	for(int32 i = 0;i < org_len;i++)
	{
		if(strncasecmp(&all_content[i],"Subject:",8) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(subject,all_content,i+8);
		else if(strncasecmp(&all_content[i],"Date:",5) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(date,all_content,i+5);
		else if(strncasecmp(&all_content[i],"Cc:",3) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(cc,all_content,i+3);
		else if(strncasecmp(&all_content[i],"To:",3) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(to,all_content,i+3);
		else if(strncasecmp(&all_content[i],"From:",5) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(from,all_content,i+5);
		else if(strncasecmp(&all_content[i],"X-Priority:",11) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(priority,all_content,i+11);
		else if(strncasecmp(&all_content[i],"Mime-Version:",13) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(mime,all_content,i+13);
		else if(strncasecmp(&all_content[i],"Reply-To:",9) == 0 && all_content[i-1] == '\n')
			i = GetHeaderParam(reply,all_content,i+9);
		else if(all_content[i] == '\r'||all_content[i] == '\n')
		{
			if(all_content[i-2] == '\r'||all_content[i-1] == '\n')
			{
				header_len = i+2;
				break;
			}
		}
	}
	
	header.Append(all_content,header_len);
	
	if(subject.Length() == 0)
		subject = "Untitled";
	if(strstr(header.String(),"Content-Type: multipart"))
		is_multipart = true;
	
	//PRINT(("From:%s\n",from.String()));
	encode.Mime2UTF8(from);
	//PRINT(("Decoded From:%s\n",from.String()));
	encode.Mime2UTF8(to);
	encode.Mime2UTF8(cc);
	encode.Mime2UTF8(reply);
	// convert mime subject to UTF8
	encode.Mime2UTF8(subject);
	
	// Filter mails
	BString folder_path;
	FilterMail(subject.String(),
				from.String(),
				to.String(),
				cc.String(),
				reply.String(),
				folder_path);
	//PRINT(("path:%s\n",folder_path.String() ));
	
	// Save to disk
	BPath path = folder_path.String();
	::create_directory(path.Path(),0777);
	BDirectory destDir(path.Path());
	path.Append(subject.String());
	//PRINT(("path:%s\n",path.Path() ));
	// create the e-mail file
	BFile file;

	TrackerUtils().SmartCreateFile(&file,&destDir,path.Leaf(),"_");
	// write e-mail attributes
	file.Write(all_content,strlen(all_content));
	file.SetSize(strlen(all_content));
	
	file.WriteAttr(B_MAIL_ATTR_STATUS,B_STRING_TYPE,0,"New",4);
	file.WriteAttrString(B_MAIL_ATTR_PRIORITY,&priority);
	file.WriteAttrString(B_MAIL_ATTR_TO,&to);
	file.WriteAttrString(B_MAIL_ATTR_CC,&cc);
	file.WriteAttrString(B_MAIL_ATTR_FROM,&from);
	file.WriteAttrString(B_MAIL_ATTR_SUBJECT,&subject);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:101,代码来源:HDaemonApp.cpp

示例12: new

BBitmap*
BAlert::_InitIcon()
{
	// Save the desired alert type and set it to "empty" until
	// loading the icon was successful
	alert_type alertType = fMsgType;
	fMsgType = B_EMPTY_ALERT;

	// After a bit of a search, I found the icons in app_server. =P
	BBitmap* icon = NULL;
	BPath path;
	status_t status = find_directory(B_BEOS_SERVERS_DIRECTORY, &path);
	if (status < B_OK) {
		FTRACE((stderr, "BAlert::_InitIcon() - find_directory failed: %s\n",
			strerror(status)));
		return NULL;
	}

	path.Append("app_server");
	BFile file;
	status = file.SetTo(path.Path(), B_READ_ONLY);
	if (status < B_OK) {
		FTRACE((stderr, "BAlert::_InitIcon() - BFile init failed: %s\n",
			strerror(status)));
		return NULL;
	}

	BResources resources;
	status = resources.SetTo(&file);
	if (status < B_OK) {
		FTRACE((stderr, "BAlert::_InitIcon() - BResources init failed: %s\n",
			strerror(status)));
		return NULL;
	}

	// Which icon are we trying to load?
	const char* iconName = "";	// Don't want any seg faults
	switch (alertType) {
		case B_INFO_ALERT:
			iconName = "info";
			break;
		case B_IDEA_ALERT:
			iconName = "idea";
			break;
		case B_WARNING_ALERT:
			iconName = "warn";
			break;
		case B_STOP_ALERT:
			iconName = "stop";
			break;

		default:
			// Alert type is either invalid or B_EMPTY_ALERT;
			// either way, we're not going to load an icon
			return NULL;
	}

	int32 iconSize = 32 * icon_layout_scale();
	// Allocate the icon bitmap
	icon = new(std::nothrow) BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1),
		0, B_RGBA32);
	if (icon == NULL || icon->InitCheck() < B_OK) {
		FTRACE((stderr, "BAlert::_InitIcon() - No memory for bitmap\n"));
		delete icon;
		return NULL;
	}

	// Load the raw icon data
	size_t size = 0;
	const uint8* rawIcon;

#ifdef __ANTARES__
	// Try to load vector icon
	rawIcon = (const uint8*)resources.LoadResource(B_VECTOR_ICON_TYPE,
		iconName, &size);
	if (rawIcon != NULL
		&& BIconUtils::GetVectorIcon(rawIcon, size, icon) == B_OK) {
		// We have an icon, restore the saved alert type
		fMsgType = alertType;
		return icon;
	}
#endif

	// Fall back to bitmap icon
	rawIcon = (const uint8*)resources.LoadResource(B_LARGE_ICON_TYPE,
		iconName, &size);
	if (rawIcon == NULL) {
		FTRACE((stderr, "BAlert::_InitIcon() - Icon resource not found\n"));
		delete icon;
		return NULL;
	}

	// Handle color space conversion
#ifdef __ANTARES__
	if (icon->ColorSpace() != B_CMAP8) {
		BIconUtils::ConvertFromCMAP8(rawIcon, iconSize, iconSize,
			iconSize, icon);
	}
#else
	icon->SetBits(rawIcon, iconSize, 0, B_CMAP8);
//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:Alert.cpp

示例13: LoadOldSettings

status_t
TMailApp::LoadSettings()
{
	BMailSettings accountSettings;
	fDefaultAccount = accountSettings.DefaultOutboundAccount();

	BPath path;
	status_t status = GetSettingsPath(path);
	if (status != B_OK)
		return status;

	path.Append("BeMail Settings");

	BFile file;
	status = file.SetTo(path.Path(), B_READ_ONLY);
	if (status != B_OK)
		return LoadOldSettings();

	BMessage settings;
	status = settings.Unflatten(&file);
	if (status < B_OK || settings.what != 'BeMl') {
		// the current settings are corrupted, try old ones
		return LoadOldSettings();
	}

	BRect rect;
	if (settings.FindRect("MailWindowSize", &rect) == B_OK)
		fMailWindowFrame = rect;

	int32 int32Value;
//	if (settings.FindInt32("ExperienceLevel", &int32Value) == B_OK)
//		level = int32Value;

	const char *fontFamily;
	if (settings.FindString("FontFamily", &fontFamily) == B_OK) {
		const char *fontStyle;
		if (settings.FindString("FontStyle", &fontStyle) == B_OK) {
			float size;
			if (settings.FindFloat("FontSize", &size) == B_OK) {
				if (size >= 7)
					fContentFont.SetSize(size);

				if (fontFamily[0] && fontStyle[0]) {
					fContentFont.SetFamilyAndStyle(fontFamily[0] ? fontFamily : NULL,
						fontStyle[0] ? fontStyle : NULL);
				}
			}
		}
	}

	if (settings.FindRect("SignatureWindowSize", &rect) == B_OK)
		fSignatureWindowFrame = rect;

	bool boolValue;
	if (settings.FindBool("WordWrapMode", &boolValue) == B_OK)
		fWrapMode = boolValue;

	BPoint point;
	if (settings.FindPoint("PreferencesWindowLocation", &point) == B_OK)
		fPrefsWindowPos = point;

	if (settings.FindBool("AutoMarkRead", &boolValue) == B_OK)
		fAutoMarkRead = boolValue;

	const char *string;
	if (settings.FindString("SignatureText", &string) == B_OK) {
		free(fSignature);
		fSignature = strdup(string);
	}

	if (settings.FindInt32("CharacterSet", &int32Value) == B_OK)
		fMailCharacterSet = int32Value;
	if (fMailCharacterSet != B_MAIL_UTF8_CONVERSION
		&& fMailCharacterSet != B_MAIL_US_ASCII_CONVERSION
		&& BCharacterSetRoster::GetCharacterSetByConversionID(fMailCharacterSet) == NULL)
		fMailCharacterSet = B_MS_WINDOWS_CONVERSION;

	if (settings.FindString("FindString", &string) == B_OK)
		FindWindow::SetFindString(string);

	int8 int8Value;
	if (settings.FindInt8("ShowButtonBar", &int8Value) == B_OK)
		fShowToolBar = int8Value;

	if (settings.FindInt32("UseAccountFrom", &int32Value) == B_OK)
		fUseAccountFrom = int32Value;
	if (fUseAccountFrom < ACCOUNT_USE_DEFAULT
		|| fUseAccountFrom > ACCOUNT_FROM_MAIL)
		fUseAccountFrom = ACCOUNT_USE_DEFAULT;

	if (settings.FindBool("ColoredQuotes", &boolValue) == B_OK)
		fColoredQuotes = boolValue;

	if (settings.FindString("ReplyPreamble", &string) == B_OK) {
		free(fReplyPreamble);
		fReplyPreamble = strdup(string);
	}

	if (settings.FindBool("AttachAttributes", &boolValue) == B_OK)
		fAttachAttributes = boolValue;
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:MailApp.cpp

示例14: dc

PadBlocker::PadBlocker()
{
	_lastKeyUp = 0;
	_threshold = 300; //~one third of a second?

	#if Z_DEBUG
	BeDC dc("PadBlocker");
	#endif

	//load settings file

	BPath settingsPath;
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &settingsPath) == B_OK)
	{
		settingsPath.Append("PadBlocker_settings");
		BEntry settingsEntry(settingsPath.Path());
		
		//does the settings file exist?
		if (!settingsEntry.Exists())
		{
			#if Z_DEBUG
			dc.SendMessage("Settings file does not exist. Creating new one.");
			#endif

		
			BFile defaultSettingsFile(&settingsEntry, B_CREATE_FILE | B_READ_WRITE);

			if (defaultSettingsFile.IsWritable())
			{
				//write in default settings
				char buf[64];
				sprintf(buf, "%ld #delay in 1/1000 secs", (int32)_threshold);
				defaultSettingsFile.WriteAt(0, (void *)buf, strlen(buf));
				defaultSettingsFile.Unset();
			}
				
		}
		else
		{
			#if Z_DEBUG
			dc.SendMessage("Settings file Exists");
			#endif
		
			BFile settingsFile(&settingsEntry, B_READ_WRITE);
		
			if (settingsFile.IsReadable())
			{
				char buf[256];
				uint32 amt_read = settingsFile.ReadAt(0, (void *)buf, 256);
				buf[amt_read] = '\0';
				_threshold = atoi(buf);
			}
		}
	}
		
	_threshold *= 1000; //I'd rather keep the number in the file in thousandths
	
	#ifdef Z_DEBUG
	dc.SendInt(_threshold, "Touchpad threshold.");
	#endif
}
开发者ID:HaikuArchives,项目名称:PadBlocker,代码行数:61,代码来源:PadBlocker.cpp

示例15: BMessage

ConfigWindow::ConfigWindow()
	:
	BWindow(BRect(100, 100, 600, 540), B_TRANSLATE_SYSTEM_NAME("E-mail"),
		B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
	fLastSelectedAccount(NULL),
	fSaveSettings(false)
{
	BTabView* tabView = new BTabView("tab");
	tabView->SetBorder(B_NO_BORDER);

	// accounts listview

	BView* view = new BView("accounts", 0);
	tabView->AddTab(view);
	tabView->TabAt(0)->SetLabel(B_TRANSLATE("Accounts"));

	fAccountsListView = new AccountsListView(this);
	fAccountsListView->SetExplicitPreferredSize(BSize(
		fAccountsListView->StringWidth("W") * 22, B_SIZE_UNSET));

	BButton* addButton = new BButton(NULL, B_TRANSLATE("Add"),
		new BMessage(kMsgAddAccount));
	fRemoveButton = new BButton(NULL, B_TRANSLATE("Remove"),
		new BMessage(kMsgRemoveAccount));

	fConfigView = new BView(NULL, 0);
	fConfigView->SetLayout(new BGroupLayout(B_VERTICAL));
	fConfigView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
	fConfigView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

	BScrollView* scroller = new BScrollView(NULL, fAccountsListView, 0,
		false, true);

	BLayoutBuilder::Group<>(view, B_HORIZONTAL)
		.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
			B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL)
			.Add(scroller)
			.AddGroup(B_HORIZONTAL)
				.Add(addButton)
				.Add(fRemoveButton)
			.End()
		.End()
		.Add(fConfigView, 2.0f);

	_ReplaceConfigView(_BuildHowToView());

	// general settings

	view = new BView("general", 0);
	view->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
	tabView->AddTab(view);
	tabView->TabAt(1)->SetLabel(B_TRANSLATE("Settings"));

	fCheckMailCheckBox = new BCheckBox("check", B_TRANSLATE("Check every"),
		NULL);
	fIntervalControl = new BTextControl("time", B_TRANSLATE("minutes"), NULL,
		NULL);

	BPopUpMenu* statusPopUp = new BPopUpMenu(B_EMPTY_STRING);
	const char* statusModes[] = {
		B_TRANSLATE_COMMENT("Never", "show status window"),
		B_TRANSLATE("While sending"),
		B_TRANSLATE("While sending and receiving")};
	for (size_t i = 0; i < sizeof(statusModes) / sizeof(statusModes[0]); i++) {
		BMessage* msg = new BMessage(kMsgShowStatusWindowChanged);
		BMenuItem* item = new BMenuItem(statusModes[i], msg);
		statusPopUp->AddItem(item);
		msg->AddInt32("ShowStatusWindow", i);
	}

	fStatusModeField = new BMenuField("show status",
		B_TRANSLATE("Show notifications:"), statusPopUp);

	BMessage* msg = new BMessage(B_REFS_RECEIVED);
	BButton* editMenuButton = new BButton(B_EMPTY_STRING,
		B_TRANSLATE("Edit mailbox menu…"), msg);
	editMenuButton->SetTarget(BMessenger("application/x-vnd.Be-TRAK"));

	BPath path;
	find_directory(B_USER_SETTINGS_DIRECTORY, &path);
	path.Append("Mail/Menu Links");
	BEntry entry(path.Path());
	if (entry.InitCheck() == B_OK && entry.Exists()) {
		entry_ref ref;
		entry.GetRef(&ref);
		msg->AddRef("refs", &ref);
	} else
		editMenuButton->SetEnabled(false);

	BLayoutBuilder::Group<>(view, B_VERTICAL)
		.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
			B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING)
//		.AddGlue()
		.AddGroup(B_HORIZONTAL, 0.f)
			.AddGlue()
			.Add(fCheckMailCheckBox)
			.AddStrut(be_control_look->DefaultLabelSpacing())
			.Add(fIntervalControl->CreateTextViewLayoutItem())
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:ConfigWindow.cpp


注:本文中的BPath::Append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。