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


C++ BEntry::InitCheck方法代码示例

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


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

示例1: BEntry

bool
exists(BPath *path)
{
  BEntry entry = BEntry(path->Path());
  return (entry.InitCheck() == B_OK) && entry.Exists();
}
开发者ID:astrieanna,项目名称:haiku-dropbox-client,代码行数:6,代码来源:HaikuDropbox.cpp

示例2: BWindow

HelloWindow::HelloWindow(BRect theframe)
				: BWindow(theframe, "DynaMate",  B_TITLED_WINDOW, B_NOT_RESIZABLE)
{
/// /// /// /// SOUND /// /// /// /// LÄGG TILL FELKOLLAR !!
	error=0;
	snd = new SoundStuff;

	app_info ai;	
	if (be_app->GetAppInfo(&ai)){ error = B_ERROR; fputs("DynaMate: Error getting AppInfo.\n",stderr); return;}

	entry_ref mref, sref, eref;
	BEntry *ment, *sent, *eent;
	
	BDirectory dir;
	BEntry *exeEnt;
	
	exeEnt = new BEntry(&(ai.ref));
	if (exeEnt->InitCheck())	{ error = B_ERROR; fputs("DynaMate: Error converting ref to Entry.\n",stderr); return;}
	if (exeEnt->GetParent(&dir)){ error = B_ERROR; fputs("DynaMate: Error getting parent.\n",stderr); return;}
	
	ment = new BEntry(&dir, "sfx/move");
	if (ment->InitCheck())		{ error = B_ERROR; fputs("DynaMate: Problems with file 'sfx/move'.\n",stderr); return;}

	sent = new BEntry(&dir, "sfx/stop");
	if (sent->InitCheck())		{ error = B_ERROR; fputs("DynaMate: Problems with file 'sfx/stop'.\n",stderr); return;}

	eent = new BEntry(&dir, "sfx/explosion");
	if (eent->InitCheck())		{ error = B_ERROR; fputs("DynaMate: Problems with file 'sfx/explosion'.\n",stderr); return;}

	if (ment->GetRef(&mref))	{ error = B_ERROR; fputs("DynaMate: Error converting ref to Entry.(mref)\n",stderr); return;}
	if (sent->GetRef(&sref))	{ error = B_ERROR; fputs("DynaMate: Error converting ref to Entry.(sref)\n",stderr); return;}
	if (eent->GetRef(&eref))	{ error = B_ERROR; fputs("DynaMate: Error converting ref to Entry.(eref)\n",stderr); return;}

	delete ment;
	delete sent;
	delete eent;
	delete exeEnt;

	snd->moveblip = new BSound(&mref,true);
	snd->stopblip = new BSound(&sref,true);
	snd->explblip = new BSound(&eref,true);

	if (snd->moveblip->InitCheck()) { error = B_ERROR; fputs("DynaMate: Problems with file 'sfx/move'.\n",stderr); return;}
	if (snd->stopblip->InitCheck()) { error = B_ERROR; fputs("DynaMate: Problems with file 'sfx/stop'.\n",stderr); return;}
	if (snd->explblip->InitCheck()) { error = B_ERROR; fputs("DynaMate: Problems with file 'sfx/explosion'.\n",stderr); return;}

/// /// /// /// /// /// /// /// ///

	frame=theframe;
	totalmoves=0;
	stonesleft=65535;
	SIZE=16;
	file = NULL;		
// reservera banan
	level=(uint8 *)malloc(256+1);		// 256==en piece 1==rekordet
	
// Starta en view	
	frame.OffsetTo(B_ORIGIN);

	gameView = NULL;
	titleView = NULL;
	LaunchTitle();
}
开发者ID:HaikuArchives,项目名称:Dynamate,代码行数:63,代码来源:DmWindow.cpp

示例3: info

void
Model::FinishSettingUpType()
{
    char mimeString[B_MIME_TYPE_LENGTH];
    BEntry entry;

    // while we are reading the node, do a little
    // snooping to see if it even makes sense to look for a node-based
    // icon
    // This serves as a hint to the icon cache, allowing it to not hit the
    // disk again for models that do not have an icon defined by the node
    if (IsNodeOpen()
            && fBaseType != kLinkNode
            && !CheckNodeIconHintPrivate(fNode, dynamic_cast<TTracker *>(be_app) == NULL)
            && !HasVectorIconHint(fNode)) {
        // when checking for the node icon hint, if we are libtracker, only check
        // for small icons - checking for the large icons is a little more
        // work for the filesystem and this will speed up the test.
        // This makes node icons only work if there is a small and a large node
        // icon on a file - for libtracker that is not a problem though
        fIconFrom = kUnknownNotFromNode;
    }

    if (fBaseType != kDirectoryNode
            && fBaseType != kVolumeNode
            && fBaseType != kLinkNode
            && IsNodeOpen()) {
        BNodeInfo info(fNode);

        // check if a specific mime type is set
        if (info.GetType(mimeString) == B_OK) {
            // node has a specific mime type
            fMimeType = mimeString;
            if (strcmp(mimeString, B_QUERY_MIMETYPE) == 0)
                fBaseType = kQueryNode;
            else if (strcmp(mimeString, B_QUERY_TEMPLATE_MIMETYPE) == 0)
                fBaseType = kQueryTemplateNode;

            if (info.GetPreferredApp(mimeString) == B_OK) {
                if (fPreferredAppName)
                    DeletePreferredAppVolumeNameLinkTo();

                if (mimeString[0])
                    fPreferredAppName = strdup(mimeString);
            }
        }
    }

    switch (fBaseType) {
    case kDirectoryNode:
        entry.SetTo(&fEntryRef);
        if (entry.InitCheck() == B_OK) {
            if (FSIsTrashDir(&entry))
                fBaseType = kTrashNode;
            else if (FSIsDeskDir(&entry))
                fBaseType = kDesktopNode;
        }

        fMimeType = B_DIR_MIMETYPE;	// should use a shared string here
        if (IsNodeOpen()) {
            BNodeInfo info(fNode);
            if (info.GetType(mimeString) == B_OK)
                fMimeType = mimeString;

            if (fIconFrom == kUnknownNotFromNode
                    && WellKnowEntryList::Match(NodeRef()) > (directory_which)-1)
                // one of home, beos, system, boot, etc.
                fIconFrom = kTrackerSupplied;
        }
        break;

    case kVolumeNode:
    {
        if (NodeRef()->node == fEntryRef.directory
                && NodeRef()->device == fEntryRef.device) {
            // promote from volume to file system root
            fBaseType = kRootNode;
            fMimeType = B_ROOT_MIMETYPE;
            break;
        }

        // volumes have to have a B_VOLUME_MIMETYPE type
        fMimeType = B_VOLUME_MIMETYPE;
        if (fIconFrom == kUnknownNotFromNode) {
            if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1)
                fIconFrom = kTrackerSupplied;
            else
                fIconFrom = kVolume;
        }

        char name[B_FILE_NAME_LENGTH];
        BVolume	volume(NodeRef()->device);
        if (volume.InitCheck() == B_OK && volume.GetName(name) == B_OK) {
            if (fVolumeName)
                DeletePreferredAppVolumeNameLinkTo();

            fVolumeName = strdup(name);
        }
#if DEBUG
        else
//.........这里部分代码省略.........
开发者ID:mmadia,项目名称:haiku-1,代码行数:101,代码来源:Model.cpp

示例4: path

void
HWindow::SetupMenuField()
{
	BMenuField* menufield = dynamic_cast<BMenuField*>(FindView("filemenu"));
	if (menufield == NULL)
		return;
	BMenu* menu = menufield->Menu();
	int32 count = fEventList->CountRows();
	for (int32 i = 0; i < count; i++) {
		HEventRow* row = (HEventRow*)fEventList->RowAt(i);
		if (row == NULL)
			continue;

		BPath path(row->Path());
		if (path.InitCheck() != B_OK)
			continue;
		if (menu->FindItem(path.Leaf()))
			continue;

		BMessage* msg = new BMessage(M_ITEM_MESSAGE);
		entry_ref ref;
		::get_ref_for_path(path.Path(), &ref);
		msg->AddRef("refs", &ref);
		menu->AddItem(new BMenuItem(path.Leaf(), msg), 0);
	}

	BPath path;
	BDirectory dir;
	BEntry entry;
	BPath item_path;

	status_t err = find_directory(B_BEOS_SOUNDS_DIRECTORY, &path);
	if (err == B_OK)
		err = dir.SetTo(path.Path());
	while (err == B_OK) {
		err = dir.GetNextEntry(&entry, true);
		if (entry.InitCheck() != B_NO_ERROR)
			break;

		entry.GetPath(&item_path);

		if (menu->FindItem(item_path.Leaf()))
			continue;

		BMessage* msg = new BMessage(M_ITEM_MESSAGE);
		entry_ref ref;
		::get_ref_for_path(item_path.Path(), &ref);
		msg->AddRef("refs", &ref);
		menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0);
	}

	err = find_directory(B_USER_SOUNDS_DIRECTORY, &path);
	if (err == B_OK)
		err = dir.SetTo(path.Path());
	while (err == B_OK) {
		err = dir.GetNextEntry(&entry, true);
		if (entry.InitCheck() != B_NO_ERROR)
			break;

		entry.GetPath(&item_path);

		if (menu->FindItem(item_path.Leaf()))
			continue;

		BMessage* msg = new BMessage(M_ITEM_MESSAGE);
		entry_ref ref;

		::get_ref_for_path(item_path.Path(), &ref);
		msg->AddRef("refs", &ref);
		menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0);
	}

	err = find_directory(B_COMMON_SOUNDS_DIRECTORY, &path);
	if (err == B_OK)
		err = dir.SetTo(path.Path());
	while (err == B_OK) {
		err = dir.GetNextEntry(&entry, true);
		if (entry.InitCheck() != B_NO_ERROR)
			break;

		entry.GetPath(&item_path);

		if (menu->FindItem(item_path.Leaf()))
			continue;

		BMessage* msg = new BMessage(M_ITEM_MESSAGE);
		entry_ref ref;

		::get_ref_for_path(item_path.Path(), &ref);
		msg->AddRef("refs", &ref);
		menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0);
	}

}
开发者ID:royalharsh,项目名称:haiku,代码行数:94,代码来源:HWindow.cpp

示例5: MessageReceived

void ProtocolWindow::MessageReceived(BMessage *msg) {
	switch(msg->what) {
		case LOG_CLEAR: {
			Clear();
			break;
		}
		
		case ENABLE_LOG_FILE_MSG: {
			enablefileloggingMI->SetMarked(!enablefileloggingMI->IsMarked());
			//filelogging=enablefileloggingMI->IsMarked();
			setlognameMI->SetEnabled(enablefileloggingMI->IsMarked());
			if ((enablefileloggingMI->IsMarked()) && (strcmp(GetLogFileName(), "")==0)) {
				// does not break. but goes on to the next "case" statement!
			} else
				break;
		}
		
		case SETLOGFILE_MSG: {
			BEntry	*entry;
			BString	folder, filename;
			
			folder=GetLogFileName();
			if (folder.Length()>0) {
				folder.Remove(folder.FindLast('/')+1, (folder.Length()-folder.FindLast('/'))-1);
				filename=GetLogFileName();
				filename.RemoveFirst(folder.String());
			}
			FileDialog::fSourceWindow=this;
			entry=FileDialog::SaveDialog(_T("Log file"), folder.String(), filename.String()); // "TMI_LOG_FILE"
			
			if (entry->InitCheck()==B_OK) {
				BPath	path;
				entry->GetPath(&path);
				SetLogFileName(path.Path());
				path.Unset();
				// set MIME type to text/plain
				BNodeInfo	*info=new BNodeInfo(logfileF);
				info->SetType("text/plain");
				delete info;			
			}
			delete entry;
//			logfileFP=new BFilePanel(B_SAVE_PANEL,new BMessenger(this), (const entry_ref *)NULL, 0UL, false,NULL, NULL, false, true);
//			logfileFP->Window()->SetTitle(_T("Log file")); // "TMI_LOG_FILE"
//			logfileFP->Show();
			break;
		}
		
		case B_CANCEL: {
//			delete logfileFP;
			break;
		}
		
		case LOGSETTINGS_MSG: {
			LogSettingsWindow	*settings=new LogSettingsWindow(BRect(0,0,300,250),
					_T("Log settings")); // "L:Log Settings"
			settings->Show();
			break;
		}
		
		case B_SAVE_REQUESTED: {
//			entry_ref	ref;
//			BString		str;
//			BEntry		entry;
//			BPath		path;
//			
//			if (msg->FindRef("directory", &ref)==B_OK)
//				if (msg->FindString("name", &str)==B_OK) {
//					entry.SetTo(&ref);
//					entry.GetPath(&path);
//					if (path.Path()[strlen(path.Path())-1]!='/')
//						str.Prepend("/");
//					str.Prepend(path.Path());
//					SetLogFileName(str.String());
//					path.Unset();
//					entry.Unset();
//					
//					// set MIME type to text/plain
//					BNodeInfo	*info=new BNodeInfo(logfileF);
//					info->SetType("text/plain");
//					delete info;
//					
//					
//				}
			break;
		}
	
		default: {
			BWindow::MessageReceived(msg);
			break;
		}
	}
}
开发者ID:carriercomm,项目名称:Helios,代码行数:92,代码来源:ProtocolWindow.cpp

示例6: if

// DispatchMessage
void	TexWin::DispatchMessage(BMessage *mess, BHandler *target)
{
	BFile *file; BEntry *entry;
	BDirectory *dir; char filename[B_FILE_NAME_LENGTH];
	BAlert *al; char ch[256]; int32 i;
	char *data;
	entry_ref ref;
	switch(mess->what) {
	case B_PASTE :
		savedoc = false;
	case B_CUT :
	case B_COPY :
	case B_UNDO :
	case B_SELECT_ALL :
		BWindow::DispatchMessage(mess, view);
		break;
	case TEX_FULL_ANALYSE :
		view->Analyse(true);
		break;
	case TEX_SAVE :
		if (newdoc) {
			BMessage *messa = new BMessage(TEX_SAVE_AS);
			messa->AddPointer("window", (void *)this);
			be_app->PostMessage(messa); break;}
		else if (savedoc) break;
		else {
			file = new BFile (&fileref, B_READ_WRITE | B_ERASE_FILE);
			if (file->InitCheck()<0) {
				sprintf(ch, "An error as occured during saving %s.", Title());
				al = new BAlert("alert",ch,"Ok");
				al->Go();
			}
			else {
				file->Write(view->Text(), view->TextLength());
				savedoc = true;
				if (file->SetSize(view->TextLength())<0) {
					sprintf(ch, "An error as occured during saving %s.", Title());
					al = new BAlert("alert",ch,"Ok");
					al->Go();
				}
				if (file->WriteAttr("BEOS:TYPE",'MIMS',0,"text/plain\0",11)<0) {
					sprintf(ch, "An error as occured during saving %s.", Title());
					al = new BAlert("alert",ch,"Ok");
					al->Go();
				}
				else if (file->WriteAttr("BEOS:PREF_APP",'MIMS',0,"application/x-vnd.shin-TexEdit\0",31)<0) {
						sprintf(ch, "An error as occured during saving %s.", Title());
						al = new BAlert("alert",ch,"Ok");
						al->Go();
				}
				if (isQuitting)
					if (be_app->CountWindows()<4)
						be_app->PostMessage(B_QUIT_REQUESTED);
					else
						Quit();
			}
			delete file;
			break;
		}	
	case B_SAVE_REQUESTED :
		char ch[256];
		sprintf(ch, "An error as occured during saving %s.", mess->FindString("name"));
		SetTitle(mess->FindString("name"));
		mess->FindRef("directory", &ref);
		dir = new BDirectory(&ref);
		entry = new BEntry(dir, mess->FindString("name"));
		file = new BFile (entry, B_READ_WRITE | B_ERASE_FILE | B_CREATE_FILE);
		if (entry->InitCheck() < 0) {
			al = new BAlert("alert", ch,"Ok");
			al->Go();
		} else if (file->InitCheck() < 0) {
			al = new BAlert("alert", ch,"Ok");
			al->Go();
		} else {
			file->Write(view->Text(), view->TextLength());
			newdoc = false; savedoc = true;
			entry->GetRef(&fileref);
			if (file->WriteAttr("BEOS:TYPE",'MIMS',0,"text/plain\0",11)<0) {
					sprintf(ch, "An error as occured during saving %s.", Title());
					al = new BAlert("alert",ch,"Ok");
					al->Go();
				}
				else if (file->WriteAttr("BEOS:PREF_APP",'MIMS',0,"application/x-vnd.shin-TexEdit\0",31)<0) {
						sprintf(ch, "An error as occured during saving %s.", Title());
						al = new BAlert("alert",ch,"Ok");
						al->Go();
				}
			if (isQuitting) be_app->PostMessage(B_QUIT_REQUESTED);
		}
		delete entry; delete file; delete dir;
		break;
	case B_REFS_RECEIVED :
		int32 j;
		i = 0;
		mess->FindRef("refs", &fileref);
		entry = new BEntry(&fileref);
		if (entry->InitCheck() < 0) {
			al = new BAlert("alert","An error as occured : cannot use BEntry.","Ok");
			al->Go();
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:TeXEdit,代码行数:101,代码来源:TexWin.c

示例7: resources

void
DecorInfo::_Init(bool isUpdate)
{
	if (!isUpdate && InitCheck() != B_NO_INIT) {
		// TODO: remove after validation
		fprintf(stderr, "DecorInfo::_Init()\tImproper init state\n");
		return;
	}

	BEntry entry;

	if (fPath == "Default") {
		if (isUpdate) {
			// should never happen
			fprintf(stderr, "DecorInfo::_Init(true)\tBUG BUG updating default"
				"decorator!?!?!\n");
			return;
		}

		fAuthors = "DarkWyrm, Stephan Aßmus, Clemens Zeidler, Ingo Weinhold";
		fLongDescription = fShortDescription;
		fLicenseURL = "http://";
		fLicenseName = "MIT";
		fSupportURL = "http://www.haiku-os.org/";
		fVersion = 0.5;
		fInitStatus = B_OK;

		fName = gSystemCatalog.GetString(B_TRANSLATE_MARK("Default"),
			B_TRANSLATION_CONTEXT);
		fShortDescription = gSystemCatalog.GetString(B_TRANSLATE_MARK(
				"Default Haiku window decorator."),
			B_TRANSLATION_CONTEXT);

		// The following is to get the modification time of the app_server
		// and, thusly, the Default decorator...
		// If you can make it more simple, please do!
		BPath path;
		find_directory(B_SYSTEM_SERVERS_DIRECTORY, &path);
		path.Append("app_server");
		entry.SetTo(path.Path(), true);
		if (!entry.Exists()) {
			fprintf(stderr, "Server MIA the world has become its slave! "
				"Call the CIA!\n");
			return;
		}

		entry.GetModificationTime(&fModificationTime);
		return;
	}

	// Is a file system object...

	entry.SetTo(&fRef, true);	// follow link
	if (entry.InitCheck() != B_OK) {
		fInitStatus = entry.InitCheck();
		return;
	}

	if (!entry.Exists()) {
		if (isUpdate) {
			fprintf(stderr, "DecorInfo::_Init()\tERROR: decorator deleted"
					" after CheckForChanges() found it!\n");
			fprintf(stderr, "DecorInfo::_Init()\tERROR: DecorInfo will "
					"Unset\n");
			Unset();
		}
		return;
	}

	// update fRef to match file system object
	entry.GetRef(&fRef);
	entry.GetModificationTime(&fModificationTime);

	BResources resources(&fRef);
	if (resources.InitCheck() != B_OK) {
		fprintf(stderr, "DecorInfo::_Init()\t BResource InitCheck() failure\n");
		return;
	}

	size_t infoSize = 0;
	const void* infoData = resources.LoadResource(B_MESSAGE_TYPE,
		"be:decor:info", &infoSize);
	BMessage infoMessage;

	if (infoData == NULL || infoSize == 0
		|| infoMessage.Unflatten((const char*)infoData) != B_OK) {
		fprintf(stderr, "DecorInfo::_init()\tNo extended information found for"
			" \"%s\"\n", fRef.name);
	} else {
		infoMessage.FindString("name", &fName);
		infoMessage.FindString("authors", &fAuthors);
		infoMessage.FindString("short_descr", &fShortDescription);
		infoMessage.FindString("long_descr", &fLongDescription);
		infoMessage.FindString("lic_url", &fLicenseURL);
		infoMessage.FindString("lic_name", &fLicenseName);
		infoMessage.FindString("support_url", &fSupportURL);
		infoMessage.FindFloat ("version", &fVersion);
	}

	fInitStatus = B_OK;
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:DecorInfo.cpp

示例8: LoadPlugins

void ImmersiveVideoWindow::LoadPlugins(void) {
	image_id		addonId;
   	status_t 		err = B_NO_ERROR; 
	ImmersiveVideoPlugin* aktPlugin=NULL;
	ImmersiveVideoPlugin* (*NewImmersiveVideoPlugin)(image_id);
	app_info		info;
	BFile			*file;
	BPath			path;
	BPath			*configPath = new BPath();
	BPath			*pluginPath	= new BPath();
	BEntry			*entry	=new BEntry();

	find_directory(B_COMMON_SETTINGS_DIRECTORY,pluginPath,false,NULL);
	pluginPath->Append("Immersive Video/plugins");
	/*pfad von der Anwendung besorgen, von der aus ein 
	ImmersiveVideoWindow aufgerufen wurde*/	
/*	be_app->GetAppInfo(&info); 
    BEntry entry(&info.ref); 
    entry.GetPath(&path); 
    path.GetParent(&path);
    //in das Unterverzeichniss "Plugins wechseln"
	path.Append("plugins");*/
	BDirectory dir(pluginPath->Path());
	printf("Laden der Plugins..\n");
	/*config Pfad holen*/
	find_directory(B_COMMON_SETTINGS_DIRECTORY,configPath,false,NULL);
	configPath->Append("Immersive Video/config");
	BDirectory configDir(configPath->Path());
	/*alle Dateien in diesem Verzeichniss durchlaufen 
	und jede Datei überprüfen ob sie ein gültiges Plugin ist.
	?muss ich vorher testen ob der Pfadgültig ist ?*/
	while( err == B_NO_ERROR )
	{
		// nächsten Verweis auf eine Datei auslesen
		err = dir.GetNextEntry(entry, TRUE );			
		//testen ob es ein gültiger Verweis ist
		if( entry->InitCheck() != B_NO_ERROR )
		{
			break;
		}
		//einen Pfad(+Dateiname) von dem aktuellen Verweis erstellen lassen ->Path
		if( entry->GetPath(&path) != B_NO_ERROR )
		{
			//printf( "entry.GetPath failed\n" );
		}
		else
		{
			//Versuch die über path angegebene Datei als Addon zu laden
			addonId = load_add_on( path.Path() );
			if( addonId < 0 )
			{
				//Wenns schief ging, kein Poblem, dann wars irgendeine andere Datei
				//printf( "load_add_on( %s ) failed\n", path.Path() );
				
			}
			else
			{
				//wenns geklappt hatt dann kleine Naricht auf stdout
				printf( "\t%s\t\tloaded\n", path.Leaf());
				/*überprüfen ob es ein Addon war, welches unsere Schnittstelle entspricht
				Schnittstelle heist hier NewImmersiveVideoPlugin und es muss mit dem Protypen
				(void **)NewImmersiveVideoPlugin gekennzeichnet*/
				if( get_image_symbol( addonId, 
									"NewImmersiveVideoPlugin", 
									B_SYMBOL_TYPE_TEXT, 
									(void **)&NewImmersiveVideoPlugin) )
				{
					// wenn wir ein ungülitges Plugin geladen hatten, wieder wegwerfen ;-)
					//printf( "get_image_symbol( NewImmersiveVideoPlugin ) failed\n" );
					unload_add_on(addonId );
				}
				else
				{
					//ansonsten von dem geleadenen Plugin mit der addonID ein gültiges Objekt erzeugen
					aktPlugin = (*NewImmersiveVideoPlugin)( addonId );
					if( !aktPlugin )
					{
						printf( "failed to create a new plugin\n" );
					}
					else
					{
						file=new BFile(&configDir,aktPlugin->GetName(),B_READ_ONLY);
						if (file->InitCheck()==B_OK)
						{
							//BMessage laden welches alle Einstellungen enhält
							BMessage *archive=new BMessage();
							archive->Unflatten(file);
							//daraus das Plugin alles bauen lassen, was es benötigt
							aktPlugin->Init(archive);
							delete archive;
							archive=NULL;
						}
						else
						{
							//wenn keine Configdatei gefunden wurde, wird das Plugin "pur" initialisiert
							aktPlugin->Init();
						}
				//		pluginWindow = new PluginWin(this,aktPlugin);
						//aktuelles Plugin der Liste (in diesm Fall der Grafischen Liste) als Eintrag hinzufügen
						listView->AddItem(new PluginItem(aktPlugin));
//.........这里部分代码省略.........
开发者ID:Paradoxianer,项目名称:ImmersiveVideo,代码行数:101,代码来源:ImmersiveVideoWindow.cpp

示例9: tmp

void
MediaConverterApp::_RunConvert()
{
	bigtime_t start = 0;
	bigtime_t end = 0;
	int32 audioQuality = 75;
	int32 videoQuality = 75;

	if (fWin->Lock()) {
		char *a;
		start = strtoimax(fWin->StartDuration(), &a, 0) * 1000;
		end = strtoimax(fWin->EndDuration(), &a, 0) * 1000;
		audioQuality = fWin->AudioQuality();
		videoQuality = fWin->VideoQuality();
		fWin->Unlock();
	}

	int32 srcIndex = 0;

	BMediaFile *inFile(NULL), *outFile(NULL);
	BEntry outEntry;
	entry_ref inRef;
	entry_ref outRef;
	BPath path;
	BString name;

	while (!fCancel) {
		if (fWin->Lock()) {
			status_t r = fWin->GetSourceFileAt(srcIndex, &inFile, &inRef);
			if (r == B_OK) {
				media_codec_info* audioCodec;
				media_codec_info* videoCodec;
				media_file_format* fileFormat;
				fWin->GetSelectedFormatInfo(&fileFormat, &audioCodec, &videoCodec);
				BDirectory directory = fWin->OutputDirectory();
				fWin->Unlock();
				outEntry = _CreateOutputFile(directory, &inRef, fileFormat);

				// display file name

				outEntry.GetPath(&path);
				name.SetTo(path.Leaf());

				if (outEntry.InitCheck() == B_OK) {
					entry_ref outRef;
					outEntry.GetRef(&outRef);
					outFile = new BMediaFile(&outRef, fileFormat);

					BString tmp(
						B_TRANSLATE("Output file '%filename' created"));
					tmp.ReplaceAll("%filename", name);
					name = tmp;
				} else {
					BString tmp(B_TRANSLATE("Error creating '%filename'"));
					tmp.ReplaceAll("%filename", name);
					name = tmp;
				}

				if (fWin->Lock()) {
					fWin->SetFileMessage(name.String());
					fWin->Unlock();
				}

				if (outFile != NULL) {
					r = _ConvertFile(inFile, outFile, audioCodec, videoCodec,
						audioQuality, videoQuality, start, end);

					// set mime
					update_mime_info(path.Path(), false, false, false);

					fWin->Lock();
					if (r == B_OK) {
						fWin->RemoveSourceFile(srcIndex);
					} else {
						srcIndex++;
						BString error(
							B_TRANSLATE("Error converting '%filename'"));
  						error.ReplaceAll("%filename", inRef.name);
						fWin->SetStatusMessage(error.String());
					}
					fWin->Unlock();
				}


			} else {
				fWin->Unlock();
				break;
			}
		} else {
			break;
		}
	}

	BMessenger(this).SendMessage(CONVERSION_DONE_MESSAGE);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:95,代码来源:MediaConverterApp.cpp

示例10: CopyDirectory

void GenesisCopyWindow::CopyDirectory(const char *dirname, const char *destination, const char *destdirname)
////////////////////////////////////////////////////////////////////////
{
	BEntry srcentry(dirname);
	BEntry dstentry;
	char name[B_FILE_NAME_LENGTH];
	BString fulldestdir;
	
	if (srcentry.InitCheck()!=B_OK)
		return;
		
	if (!srcentry.Exists())
		return;
		
	srcentry.GetName(name);	
	
	fulldestdir.SetTo(destination);
	if (destdirname)
		fulldestdir << "/" << destdirname;
	else
		fulldestdir << "/" << name;

	dstentry.SetTo(fulldestdir.String());
	
	if (dstentry.InitCheck()!=B_OK)
		return;
		
	if (!dstentry.Exists())
	{
		if (create_directory(fulldestdir.String(), 0777)!=B_OK)		// TODO: jo a 0777?
			return;
	}

	BDirectory dir;
	
	dir.SetTo(dirname);
	if (dir.InitCheck()==B_OK)
	{
		BEntry entry;
		
		if (dir.GetEntry(&entry)==B_OK)
		{	
			while (dir.GetNextEntry(&entry)==B_OK)			
			{
				entry.GetName(name);
								
				if (entry.IsDirectory())
				{
					BString fullname;
					
					fullname.SetTo(dirname);
					fullname << "/" << name;
					CopyDirectory(fullname.String(), fulldestdir.String());
				}
				else if (entry.IsSymLink())
				{
					BString fullname;
					
					fullname.SetTo(dirname);
					fullname << "/" << name;
					CopyLink(fullname.String(), fulldestdir.String());
				}
				else 
				{
					BString fullname;
					
					fullname.SetTo(dirname);
					fullname << "/" << name;
					CopyFile(fullname.String(), fulldestdir.String());
				}
			}
		}
	}

	// Copy attributes...
	CopyAttr(dirname, fulldestdir.String());
}
开发者ID:PZsolt27,项目名称:GenesisCommander,代码行数:77,代码来源:GenesisCopyWindow.cpp


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