BAboutMenuItem::BAboutMenuItem()
	:
	BMenuItem("", new BMessage(B_ABOUT_REQUESTED))
{
	app_info info;
	const char* name = NULL;
	if (be_app != NULL && be_app->GetAppInfo(&info) == B_OK)
		name = B_TRANSLATE_NOCOLLECT_SYSTEM_NAME(info.ref.name);

	// we need to translate some strings, and in order to do so, we need
	// to use the LocaleBackend to reach liblocale.so
	if (gLocaleBackend == NULL)
		LocaleBackend::LoadBackend();

	const char* string = B_TRANSLATE_MARK("About %app%");
	if (gLocaleBackend) {
		string = gLocaleBackend->GetString(string, "AboutMenuItem");
	}

	BString label = string;
	if (name != NULL)
		label.ReplaceFirst("%app%", name);
	else
		label.ReplaceFirst("%app%", "(NULL)");
	SetLabel(label.String());
}
Exemplo n.º 2
0
void
WorkspacesView::_AboutRequested()
{
	BString text = B_TRANSLATE("Workspaces\n"
		"written by %1, and %2.\n\n"
		"Copyright %3, Haiku.\n\n"
		"Send windows behind using the Option key. "
		"Move windows to front using the Control key.\n");
	text.ReplaceFirst("%1", "François Revol, Axel Dörfler");
	text.ReplaceFirst("%2", "Matt Madia");
	text.ReplaceFirst("%3", "2002-2008");
		
	BAlert *alert = new BAlert("about", text.String(), B_TRANSLATE("OK"));
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 10, &font);

	alert->Go();
}
Exemplo n.º 3
0
status_t MSNConnection::HandleADC(Command *command) {
	LOG(kProtocolName, liDebug, "C %lX: Processing ADC", this);
	
	BString listStr = command->Param(0);
	BString passport = command->Param(1, true);
	passport.ReplaceFirst("N=", "");
	BString display = "<unknown display name>";
	if ( command->Params() == 3 )
	{
		display = command->Param(2, true);
		display.ReplaceFirst("F=", "");
	}
	
	list_types listtype = ltReverseList;
	
	if (listStr == "RL") listtype = ltReverseList;
	if (listStr == "AL") listtype = ltAllowList;
	if (listStr == "FL") listtype = ltForwardList;
	if (listStr == "BL") listtype = ltBlockList;
	
	if ( listtype == ltReverseList )
	{
		BMessage requestAuth(msnAuthRequest);
		requestAuth.AddString("displayname", display);
		requestAuth.AddString("passport", passport);
		requestAuth.AddInt8("list", (int8)listtype);
		
		BMessenger(fManager).SendMessage(&requestAuth);
	}
	
	return B_OK;
};
void
_BZombieReplicantView_::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case B_ABOUT_REQUESTED:
		{
			const char* addOn = NULL;
			BString error;
			if (fArchive->FindString("add_on", &addOn) == B_OK) {
				char description[B_MIME_TYPE_LENGTH] = "";
				BMimeType type(addOn);
				type.GetShortDescription(description);
				error = B_TRANSLATE("Cannot create the replicant for "
						"\"%description\".\n%error");
				error.ReplaceFirst("%description", description);
			} else
				error = B_TRANSLATE("Cannot locate the application for the "
					"replicant. No application signature supplied.\n%error");

			error.ReplaceFirst("%error", strerror(fError));

			BAlert* alert = new (std::nothrow) BAlert(B_TRANSLATE("Error"),
				error.String(), B_TRANSLATE("OK"), NULL, NULL,
				B_WIDTH_AS_USUAL, B_STOP_ALERT);
			if (alert != NULL)
				alert->Go();

			break;
		}
		default:
			BView::MessageReceived(msg);
	}
}
Exemplo n.º 5
0
/*!
	\brief Get the FontStyle object for the name given
	\param style Name of the style to be obtained
	\return The FontStyle object or NULL if none was found.

	The object returned belongs to the family and must not be deleted.
*/
FontStyle*
FontFamily::GetStyle(const char *name) const
{
    if (name == NULL || !name[0])
        return NULL;

    FontStyle* style = _FindStyle(name);
    if (style != NULL)
        return style;

    // try alternative names

    if (!strcmp(name, "Roman") || !strcmp(name, "Regular")
            || !strcmp(name, "Book")) {
        style = _FindStyle("Roman");
        if (style == NULL) {
            style = _FindStyle("Regular");
            if (style == NULL)
                style = _FindStyle("Book");
        }
        return style;
    }

    BString alternative = name;
    if (alternative.FindFirst("Italic") >= 0) {
        alternative.ReplaceFirst("Italic", "Oblique");
        return _FindStyle(alternative.String());
    }
    if (alternative.FindFirst("Oblique") >= 0) {
        alternative.ReplaceFirst("Oblique", "Italic");
        return _FindStyle(alternative.String());
    }

    return NULL;
}
Exemplo n.º 6
0
void
PulseApp::ShowAbout(bool asApplication)
{
	// static version to be used in replicant mode
	BString name;
	if (asApplication)
		name = B_TRANSLATE_SYSTEM_NAME("Pulse");
	else
		name = B_TRANSLATE("Pulse");

	BString message = B_TRANSLATE(
		"%s\n\nBy David Ramsey and Arve Hjønnevåg\n"
		"Revised by Daniel Switkin\n");
	message.ReplaceFirst("%s", name);
	BAlert *alert = new BAlert(B_TRANSLATE("Info"),
		message.String(), B_TRANSLATE("OK"));

	BTextView* view = alert->TextView();
	BFont font;
				
	view->SetStylable(true);			
	view->GetFont(&font);
	
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, name.Length(), &font);
	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	// Use the asynchronous version so we don't block the window's thread
	alert->Go(NULL);
}
void
DefaultPartitionPage::_GetTimeoutLabel(int32 timeout, BString& label)
{
	const char* text = B_TRANSLATE_NOCOLLECT(get_label_for_timeout(timeout));
	label = B_TRANSLATE("Timeout: %s");
	label.ReplaceFirst("%s", text);
}
Exemplo n.º 8
0
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;
}
Exemplo n.º 9
0
WizardPageView*
BootManagerController::_CreateInstallSummaryPage()
{
	BString description;
	BString disk;
	fSettings.FindString("disk", &disk);

	description << B_TRANSLATE_COMMENT("Summary", "Title") << "\n"
		<< B_TRANSLATE("About to write the following boot menu to the boot "
			"disk (%s). Please verify the information below before continuing.")
		<< "\n\n";
	description.ReplaceFirst("%s", disk);

	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;
		BString path;
		message.FindString("name", &name);
		message.FindString("path", &path);

		BString displayName;
		if (fBootMenu->GetDisplayText(name.String(), displayName) == B_OK)
			description << displayName << "\t(" << path << ")\n";
		else
			description << name << "\t(" << path << ")\n";
	}

	return new DescriptionPage("summary", description.String(), true);
}
Exemplo n.º 10
0
DefaultNotifier::DefaultNotifier(const char* accountName, bool inbound,
	ErrorLogWindow* errorWindow, uint32& showMode)
	:
	fAccountName(accountName),
	fIsInbound(inbound),
	fErrorWindow(errorWindow),
	fNotification(B_PROGRESS_NOTIFICATION),
	fShowMode(showMode),
	fTotalItems(0),
	fItemsDone(0),
	fTotalSize(0),
	fSizeDone(0)
{
	BString desc;
	if (fIsInbound == true)
		desc << B_TRANSLATE("Fetching mail for %name");
	else
		desc << B_TRANSLATE("Sending mail for %name");
    desc.ReplaceFirst("%name", fAccountName);

	BString identifier;
	identifier << accountName << inbound;
		// Two windows for each acocunt : one for sending and the other for
		// receiving mails
	fNotification.SetMessageID(identifier);
	fNotification.SetGroup(B_TRANSLATE("Mail Status"));
	fNotification.SetTitle(desc);

	app_info info;
	be_roster->GetAppInfo(B_MAIL_DAEMON_SIGNATURE, &info);
	BBitmap icon(BRect(0, 0, 32, 32), B_RGBA32);
	BNode node(&info.ref);
	BIconUtils::GetVectorIcon(&node, "BEOS:ICON", &icon);
	fNotification.SetIcon(&icon);
}
Exemplo n.º 11
0
entry_ref
MakeProjectFile(DPath folder, const char *name, const char *data, const char *type)
{
	entry_ref ref;
	
	DPath path(folder);
	path.Append(name);
	BEntry entry(path.GetFullPath());
	if (entry.Exists())
	{
		BString errstr = B_TRANSLATE("%filepath% already exists. Do you want to overwrite it?");
		errstr.ReplaceFirst("%filepath%", path.GetFullPath());
		int32 result = ShowAlert(errstr.String(),B_TRANSLATE("Overwrite"),B_TRANSLATE("Cancel"));
		if (result == 1)
			return ref;
	}
	
	BFile file(path.GetFullPath(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
	
	if (data && strlen(data) > 0)
		file.Write(data,strlen(data));
	
	BString fileType = (type && strlen(type) > 0) ? type : "text/x-source-code";
	file.WriteAttr("BEOS:TYPE",B_STRING_TYPE, 0, fileType.String(),
						fileType.Length() + 1);
	
	file.Unset();
	entry.GetRef(&ref);
	return ref;
}
Exemplo n.º 12
0
void
ShutdownProcess::_DisplayAbortingApp(team_id team)
{
	// find the app that cancelled the shutdown
	char appName[B_FILE_NAME_LENGTH];
	bool foundApp = false;
	{
		BAutolock _(fWorkerLock);

		RosterAppInfo* info = fUserApps.InfoFor(team);
		if (!info)
			info = fSystemApps.InfoFor(team);
		if (!info)
			fBackgroundApps.InfoFor(team);

		if (info) {
			foundApp = true;
			strcpy(appName, info->ref.name);
		}
	}

	if (!foundApp) {
		PRINT(("ShutdownProcess::_DisplayAbortingApp(): Didn't find the app "
			"that has cancelled the shutdown.\n"));
		return;
	}

	// compose the text to be displayed
	BString buffer = B_TRANSLATE("Application \"%appName%\" has aborted the "
		"shutdown process.");
	buffer.ReplaceFirst("%appName%", appName);

	// set up the window
	_SetShutdownWindowCurrentApp(team);
	_SetShutdownWindowText(buffer.String());
	_SetShutdownWindowWaitForAbortedOK();

	// schedule the timeout event
	_SetPhase(ABORTED_PHASE);
	_ScheduleTimeoutEvent(kDisplayAbortingAppTimeout);

	// wait for the timeout or the user to press the cancel button
	while (true) {
		uint32 event;
		team_id eventTeam;
		int32 phase;
		status_t error = _GetNextEvent(event, eventTeam, phase, true);
		if (error != B_OK)
			break;

		// stop waiting when the timeout occurs
		if (event == TIMEOUT_EVENT)
			break;

		// stop waiting when the user hit the cancel button
		if (event == ABORT_EVENT && phase == ABORTED_PHASE && eventTeam < 0)
			break;
	}
}
void
BStatusView::InitStatus(int32 totalItems, off_t totalSize,
	const entry_ref* destDir, bool showCount)
{
	Init();
	fTotalSize = totalSize;
	fShowCount = showCount;

	BEntry entry;
	char name[B_FILE_NAME_LENGTH];
	if (destDir && (entry.SetTo(destDir) == B_OK)) {
		entry.GetName(name);
		fDestDir = name;
	}

	BString buffer;
	if (totalItems > 0) {
		char totalStr[32];
		buffer.SetTo(B_TRANSLATE("of %items"));
		snprintf(totalStr, sizeof(totalStr), "%" B_PRId32, totalItems);
		buffer.ReplaceFirst("%items", totalStr);
	}

	switch (fType) {
		case kCopyState:
			fStatusBar->Reset(B_TRANSLATE("Copying: "), buffer.String());
			break;

		case kCreateLinkState:
			fStatusBar->Reset(B_TRANSLATE("Creating links: "),
				buffer.String());
			break;

		case kMoveState:
			fStatusBar->Reset(B_TRANSLATE("Moving: "), buffer.String());
			break;

		case kTrashState:
			fStatusBar->Reset(
				B_TRANSLATE("Emptying Trash" B_UTF8_ELLIPSIS " "),
				buffer.String());
			break;

		case kDeleteState:
			fStatusBar->Reset(B_TRANSLATE("Deleting: "), buffer.String());
			break;

		case kRestoreFromTrashState:
			fStatusBar->Reset(B_TRANSLATE("Restoring: "), buffer.String());
			break;

		default:
			break;
	}

	fStatusBar->SetMaxValue(1);
		// SetMaxValue has to be here because Reset changes it to 100
	Invalidate();
}
Exemplo n.º 14
0
void
dump_translation_formats(BString &bstr, const translation_format *pfmts,
	int32 nfmts)
{
	BString *str1 = NULL;
	for (int i = 0; i < nfmts; i++) {
		BString string = B_TRANSLATE("\nType: '%1' (%2)\n"
			"Group: '%3' (%4)\n"
			"Quality: %5\n"
			"Capability: %6\n"
			"MIME Type: %7\n"
			"Name: %8\n");
		string.ReplaceFirst("%1", char_format(pfmts[i].type));
		string.ReplaceFirst("%2", hex_format(pfmts[i].type));
		string.ReplaceFirst("%3", char_format(pfmts[i].group));
		string.ReplaceFirst("%4", hex_format(pfmts[i].group));
		char str2[127] = { 0 };
		sprintf(str2, "%f", pfmts[i].quality);
		string.ReplaceFirst("%5", str2 );
		str2[0] = '\0';
		sprintf(str2, "%f", pfmts[i].capability);
		string.ReplaceFirst("%6",  str2 );
		string.ReplaceFirst("%7", pfmts[i].MIME);
		string.ReplaceFirst("%8", pfmts[i].name);
		if (i == 0)
			str1 = new BString(string);
		else
			str1->Append(string);
	}
	bstr = str1->String();
}
Exemplo n.º 15
0
void
App::OpenPartner(entry_ref ref)
{
	entry_ref partnerRef = GetPartnerRef(ref);
	DPath refpath(BPath(&ref).Path());
	
	if (partnerRef.name)
	{
		OpenFile(partnerRef);
		return;
	}
	
	BString errmsg = B_TRANSLATE(
		"Couldn't find a partner file for %refname% in %reffolder%/.");
	errmsg.ReplaceFirst("%refname%", ref.name);
	errmsg.ReplaceFirst("%reffolder%", refpath.GetFolder());
	ShowAlert(errmsg.String());
}
Exemplo n.º 16
0
void WatchView::OnAboutRequested()
{
	BString text = B_TRANSLATE("WebWatch %1"
		"\nAn internet time clock for your Deskbar\n\n"
		"Created by Matthijs Hollemans\n"
		"[email protected]\n\n"
		"Thanks to Jason Parks for his help.\n");
	text.ReplaceFirst("%1", VERSION);
	(new BAlert(NULL, text.String(), B_TRANSLATE("OK")))->Go(NULL);
}
BString
BStatusView::_FullSpeedString()
{
	BString buffer;
	if (fBytesPerSecond != 0.0) {
		char sizeBuffer[128];
		buffer.SetTo(B_TRANSLATE(
			"%SizeProcessed of %TotalSize, %BytesPerSecond/s"));
		buffer.ReplaceFirst("%SizeProcessed",
			string_for_size((double)fSizeProcessed, sizeBuffer,
			sizeof(sizeBuffer)));
		buffer.ReplaceFirst("%TotalSize",
			string_for_size((double)fTotalSize, sizeBuffer,
			sizeof(sizeBuffer)));
		buffer.ReplaceFirst("%BytesPerSecond",
			string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer)));
	}
	return buffer;
}
Exemplo n.º 18
0
void
NetworkPrefsView::SetAlternateCount(uint32 altCount)
{
	BString text = B_TRANSLATE("Fallbacks: %1");
	BString value;
	value << altCount;
	text.ReplaceFirst("%1", value);
	fAlternates->SetText(text.String());
	fAlternates->ResizeToPreferred();
}
Exemplo n.º 19
0
void
PictureView::_BeginDrag(BPoint sourcePoint)
{
	BBitmap* bitmap = _CopyPicture(128);
	if (bitmap == NULL)
		return;

	// fill the drag message
	BMessage drag(B_SIMPLE_DATA);
	drag.AddInt32("be:actions", B_COPY_TARGET);
	drag.AddInt32("be:actions", B_TRASH_TARGET);

	// name the clip after person name, if any
	BString name = B_TRANSLATE("%name% picture");
	name.ReplaceFirst("%name%", Window() ? Window()->Title() :
		B_TRANSLATE("Unnamed person"));
	drag.AddString("be:clip_name", name.String());

	BTranslatorRoster* roster = BTranslatorRoster::Default();
	if (roster == NULL) {
		delete bitmap;
		return;
	}

	int32 infoCount;
	translator_info* info;
	BBitmapStream stream(bitmap);
	if (roster->GetTranslators(&stream, NULL, &info, &infoCount) == B_OK) {
		for (int32 i = 0; i < infoCount; i++) {
			const translation_format* formats;
			int32 count;
			roster->GetOutputFormats(info[i].translator, &formats, &count);
			for (int32 j = 0; j < count; j++) {
				if (strcmp(formats[j].MIME, "image/x-be-bitmap") != 0) {
					// needed to send data in message
					drag.AddString("be:types", formats[j].MIME);
					// needed to pass data via file
					drag.AddString("be:filetypes", formats[j].MIME);
					drag.AddString("be:type_descriptions", formats[j].name);
				}
			}
		}
	}
	stream.DetachBitmap(&bitmap);

	// we also support "Passing Data via File" protocol
	drag.AddString("be:types", B_FILE_MIME_TYPE);

	sourcePoint -= fPictureRect.LeftTop();

	SetMouseEventMask(B_POINTER_EVENTS);

	DragMessage(&drag, bitmap, B_OP_ALPHA, sourcePoint);
	bitmap = NULL;
}
BString
BStatusView::_FullTimeRemainingString(time_t now, time_t finishTime,
	const char* timeText)
{
	BDurationFormat formatter;
	BString buffer;
	BString finishStr;
	if (finishTime - now > 60 * 60) {
		buffer.SetTo(B_TRANSLATE("Finish: %time - Over %finishtime left"));
		formatter.Format(now * 1000000LL, finishTime * 1000000LL, &finishStr);
	} else {
		buffer.SetTo(B_TRANSLATE("Finish: %time - %finishtime left"));
		formatter.Format(now * 1000000LL, finishTime * 1000000LL, &finishStr);
	}

	buffer.ReplaceFirst("%time", timeText);
	buffer.ReplaceFirst("%finishtime", finishStr);

	return buffer;
}
BString
BStatusView::_ShortTimeRemainingString(const char* timeText)
{
	BString buffer;

	// complete string too wide, try with shorter version
	buffer.SetTo(B_TRANSLATE("Finish: %time"));
	buffer.ReplaceFirst("%time", timeText);

	return buffer;
}
BString
ApplicationTypeWindow::_Title(const BEntry& entry)
{
	char name[B_FILE_NAME_LENGTH];
	if (entry.GetName(name) != B_OK)
		strcpy(name, "\"-\"");

	BString title = B_TRANSLATE("%1 application type");
	title.ReplaceFirst("%1", name);
	return title;
}
BString
BStatusView::_ShortSpeedString()
{
	BString buffer;
	if (fBytesPerSecond != 0.0) {
		char sizeBuffer[128];
		buffer << B_TRANSLATE("%BytesPerSecond/s");
		buffer.ReplaceFirst("%BytesPerSecond",
			string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer)));
	}
	return buffer;
}
Exemplo n.º 24
0
void
NetworkStatusView::_AboutRequested()
{
	BString about = B_TRANSLATE(
		"NetworkStatus\n\twritten by %1 and Hugo Santos\n\t%2, Haiku, Inc.\n"
		);
	about.ReplaceFirst("%1", "Axel Dörfler");
		// Append a new developer here
	about.ReplaceFirst("%2", "Copyright 2007-2010");
		// Append a new year here
	BAlert* alert = new BAlert("about", about, B_TRANSLATE("OK"));
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 13, &font);

	alert->Go();
}
Exemplo n.º 25
0
status_t MSNConnection::HandleLST(Command *command) {
	LOG(kProtocolName, liDebug, "C %lX: Processing LST", this);
	
	BString passport = command->Param(0);
	passport.ReplaceFirst("N=", "");
	BString display = command->Param(1, true);
	display.ReplaceFirst("F=", "");
	
	BMessage contactInfo(msnContactInfo);
	contactInfo.AddString("passport", passport.String() );
	contactInfo.AddString("display", display.String() );
	
	if ( command->Params() == 4 )
	{ // this param might not be here if the contact is in no lists
		//	This is a bitmask. 1 = FL, 2 = AL, 4 = BL, 8 = RL
		int32 lists = atol(command->Param(3));
		
		LOG(kProtocolName, liDebug, "C %lX: %s (%s) is in list %i", this, passport.String(), display.String(), lists);
		
/*		if (lists == ltReverseList) {
			LOG(kProtocolName, liDebug, "C %lX: \"%s\" (%s) is only on our reverse list. Likely they "
				"added us while we were offline. Ask for authorisation", this, display.String(),
				passport.String());
			fManager->Handler()->AuthRequest(ltReverseList, passport.String(), display.String());
		}; */
		
		contactInfo.AddInt32("lists", lists);
	} else
	{
		LOG(kProtocolName, liDebug, "C %lX: %s (%s) is in no lists", this, passport.String(), display.String() );
		contactInfo.AddInt32("lists", 0);
	}
	
	fManMsgr.SendMessage( &contactInfo );
	
	return B_OK;
};
Exemplo n.º 26
0
void
Project::CompileFile(SourceFile *file)
{
	if (!file)
	{
		return;
	}
	
	BString compileString;
	if (Debug())
		compileString << "-g -O0 ";
	else
	{
		compileString << "-O" << (int)OpLevel() << " ";
		
		if (OpForSize())
			compileString << "-Os ";
	}
	
	if (Profiling())
		compileString << "-p ";
	
	if (fExtraCompilerOptions.CountChars() > 0)
		compileString << fExtraCompilerOptions << " ";
	
	compileString << "-I '" << fPath.GetFolder() << "' ";
	for (int32 i = 0; i < fLocalIncludeList.CountItems(); i++)
		compileString << "-I '" << fLocalIncludeList.ItemAt(i)->Absolute() << "' ";

	for (int32 i = 0; i < fSystemIncludeList.CountItems(); i++)
	{
		BString item = *fSystemIncludeList.ItemAt(i);
		
		if (item == ".")
			item = GetPath().GetFolder();
		else if (item.CountChars() >= 2 && item[0] == '.' && item[1] == '/')
			item.ReplaceFirst(".",GetPath().GetFolder());
		else if (item[0] != '/')
		{
			item.Prepend("/");
			item.Prepend(GetPath().GetFolder());
		}
		
		compileString << "-I '" << item.String() << "' ";
	}

	DPath projfolder(GetPath().GetFolder());
	file->Compile(fBuildInfo,compileString.String());
}
Exemplo n.º 27
0
void
App::GenerateMakefile(const entry_ref &ref)
{
	BPath path(&ref);
	Project *proj = new Project;
	
	if (proj->Load(path.Path()) != B_OK)
	{
		BMessage msg(M_BUILD_FAILURE);
		PostMessage(&msg);
		
		delete proj;
		return;
	}
	
	if (proj->IsReadOnly())
	{
		BString err = B_TRANSLATE(
			"%path% is on a read-only disk. Please copy the project to another disk "
			"or remount the disk with write support to be able to build it.\n");
		err.ReplaceFirst("%path%", path.Path());
		BMessage msg(M_BUILD_FAILURE);
		msg.AddString("errstr",err);
		PostMessage(&msg);
		
		delete proj;
		return;
	}
	
	gProjectList->Lock();
	gProjectList->AddItem(proj);
	gProjectList->Unlock();
	
	gCurrentProject = proj;
	DPath out(proj->GetPath().GetFolder());
	out.Append("Makefile");
	if (MakeMake(proj, out) == B_OK); {
		BEntry entry(out.GetFullPath());
		entry_ref new_ref;
		if (entry.InitCheck() == B_OK) {
			entry.GetRef(&new_ref);
			BMessage refMessage(B_REFS_RECEIVED);
			refMessage.AddRef("refs",&new_ref);
			be_app->PostMessage(&refMessage);
		}
	}
}
Exemplo n.º 28
0
PrefWindow::PrefWindow(const BMessenger& messenger)
	:
	BWindow(BRect(0, 0, 375, 185), "Terminal settings",
		B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
	fPreviousPref(new PrefHandler(PrefHandler::Default())),
	fSavePanel(NULL),
	fDirty(false),
	fTerminalMessenger(messenger)
{
	BString app = B_TRANSLATE_SYSTEM_NAME("Terminal");
	BString title = B_TRANSLATE_COMMENT("%app% settings", "window title");
	title.ReplaceFirst("%app%", app);
	SetTitle(title);

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.AddGroup(B_VERTICAL)
		.SetInsets(10, 10, 10, 10)
			.Add(fAppearanceView = new AppearancePrefView(
				B_TRANSLATE("Appearance"), fTerminalMessenger))
			.AddGroup(B_HORIZONTAL)
				.Add(fDefaultsButton = new BButton("defaultsbutton",
					B_TRANSLATE("Defaults"), new BMessage(MSG_DEFAULTS_PRESSED),
					B_WILL_DRAW))
				.Add(fRevertButton = new BButton("revertbutton",
					B_TRANSLATE("Revert"), new BMessage(MSG_REVERT_PRESSED),
					B_WILL_DRAW))
				.AddGlue()
				.Add(fSaveAsFileButton = new BButton("savebutton",
					B_TRANSLATE("Save to file" B_UTF8_ELLIPSIS),
					new BMessage(MSG_SAVEAS_PRESSED), B_WILL_DRAW))
			.End()
		.End();

	fRevertButton->SetEnabled(fDirty);

	AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	CenterOnScreen();
	Show();
}
Exemplo n.º 29
0
void
App::BuildProject(const entry_ref &ref)
{
	BPath path(&ref);
	Project *proj = new Project;
	
	if (proj->Load(path.Path()) != B_OK)
	{
		BMessage msg(M_BUILD_FAILURE);
		PostMessage(&msg);
		
		delete proj;
		return;
	}
	
	if (proj->IsReadOnly())
	{
		BString err = B_TRANSLATE(
			"%path% is on a read-only disk. Please copy the project to another disk "
			"or remount the disk with write support to be able to build it.\n");
		err.ReplaceFirst("%path", path.Path());
		BMessage msg(M_BUILD_FAILURE);
		msg.AddString("errstr",err);
		PostMessage(&msg);
		
		delete proj;
		return;
	}
	
	gProjectList->Lock();
	gProjectList->AddItem(proj);
	gProjectList->Unlock();
	
	gCurrentProject = proj;
	if (!fBuilder)
		fBuilder = new ProjectBuilder(BMessenger(this));
	
	if (fBuildCleanMode)
		proj->ForceRebuild();
	
	fBuilder->BuildProject(proj, POSTBUILD_NOTHING);
}
Exemplo n.º 30
0
WizardPageView*
BootManagerController::_CreateMBRSavedPage()
{
	BString description;
	BString file;
	fSettings.FindString("file", &file);

	if (fSaveMBRStatus == B_OK) {
		description << B_TRANSLATE_COMMENT("Old Master Boot Record saved",
				"Title") << "\n"
			<< B_TRANSLATE("The old Master Boot Record was successfully "
				"saved to %s.") << "\n";
	} else {
		description << B_TRANSLATE_COMMENT("Old Master Boot Record Saved "
				"failure", "Title") << "\n"
			<< B_TRANSLATE("The old Master Boot Record could not be saved "
				"to %s") << "\n";
	}
	description.ReplaceFirst("%s", file);

	return new DescriptionPage("summary", description.String(), true);
}