void
DataTranslationsWindow::_ShowInfoView()
{
	if (fConfigView) {
		fRightBox->RemoveChild(fConfigView);
		delete fConfigView;
		fConfigView = NULL;
	}

	BTextView* view = new BTextView("info text");
	view->MakeEditable(false);
	view->MakeSelectable(false);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	view->SetText(B_TRANSLATE(
		"Use this control panel to set default values for translators, "
		"to be used when no other settings are specified by an application."));

	BGroupView* group = new BGroupView(B_VERTICAL);
	group->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	group->AddChild(view);
	float spacing = be_control_look->DefaultItemSpacing();
	group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
	fRightBox->AddChild(group);
	fConfigView = group;
}
void
ConfigWindow::MakeHowToView()
{
	BResources *resources = BApplication::AppResources();
	if (resources)
	{
		size_t length;
		char *buffer = (char *)resources->FindResource('ICON',101,&length);
		if (buffer)
		{
			BBitmap *bitmap = new BBitmap(BRect(0,0,63,63),B_CMAP8);
			if (bitmap && bitmap->InitCheck() == B_OK)
			{
				// copy and enlarge a 32x32 8-bit bitmap
				char *bits = (char *)bitmap->Bits();
				for (int32 i = 0,j = -64;i < length;i++)
				{
					if ((i % 32) == 0)
						j += 64;

					char *b = bits + (i << 1) + j;
					b[0] = b[1] = b[64] = b[65] = buffer[i];
				}
				fConfigView->AddChild(new BitmapView(bitmap));
			}
			else
				delete bitmap;
		}
	}

	BRect rect = fConfigView->Bounds();
	BTextView *text = new BTextView(rect,NULL,rect,B_FOLLOW_NONE,B_WILL_DRAW);
	text->SetViewColor(fConfigView->Parent()->ViewColor());
	text->SetAlignment(B_ALIGN_CENTER);
	text->SetText(
		MDR_DIALECT_CHOICE ("\n\nCreate a new account using the \"Add\" button.\n\n"
		"Delete accounts (or only the inbound/outbound) by using the \"Remove\" button on the selected item.\n\n"
		"Select an item in the list to edit its configuration.",
		"\n\nアカウントの新規作成は\"追加\"ボタンを\n使います。"
		"\n\nアカウント自体またはアカウントの\n送受信設定を削除するには\n項目を選択して\"削除\"ボタンを使います。"
		"\n\nアカウント内容の変更は、\nマウスで項目をクリックしてください。"));
	rect = text->Bounds();
	text->ResizeTo(rect.Width(),text->TextHeight(0,42));
	text->SetTextRect(rect);

	text->MakeEditable(false);
	text->MakeSelectable(false);

	fConfigView->AddChild(text);
	
	static_cast<CenterContainer *>(fConfigView)->Layout();
}
Example #3
0
void
ConfigWindow::_MakeHowToView()
{
	app_info info;
	if (be_app->GetAppInfo(&info) == B_OK) {
		BFile appFile(&info.ref, B_READ_ONLY);
		BAppFileInfo appFileInfo(&appFile);
		if (appFileInfo.InitCheck() == B_OK) {
			BBitmap *bitmap = new (nothrow) BBitmap(BRect(0, 0, 63, 63),
				B_RGBA32);
			if (appFileInfo.GetIcon(bitmap, B_LARGE_ICON) == B_OK) {
				fConfigView->AddChild(new BitmapView(bitmap));
			} else
				delete bitmap;
		}
	}

	BRect rect = fConfigView->Bounds();
	BTextView *text = new BTextView(rect, NULL, rect, B_FOLLOW_NONE,
		B_WILL_DRAW);
	text->SetViewColor(fConfigView->Parent()->ViewColor());
	text->SetAlignment(B_ALIGN_CENTER);
	text->SetText(B_TRANSLATE(
		"\n\nCreate a new account with the Add button.\n\n"
		"Remove an account with the Remove button on the selected item.\n\n"
		"Select an item in the list to change its settings."));
	rect = text->Bounds();
	text->ResizeTo(rect.Width(), text->TextHeight(0, 42));
	text->SetTextRect(rect);

	text->MakeEditable(false);
	text->MakeSelectable(false);

	fConfigView->AddChild(text);

	fConfigView->Layout();
}
Example #4
0
void
ConfigWindow::MakeHowToView()
{
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
    BResources *resources = BApplication::AppResources();
    if (resources) {
        size_t length;
        char *buffer = (char *)resources->FindResource(B_LARGE_ICON_TYPE, 101,
                       &length);
        if (buffer) {
            BBitmap *bitmap = new (nothrow) BBitmap(BRect(0, 0, 63, 63),
                                                    B_CMAP8);
            if (bitmap && bitmap->InitCheck() == B_OK) {
                // copy and enlarge a 32x32 8-bit bitmap
                char *bits = (char *)bitmap->Bits();
                for (int32 i = 0, j = -64; i < (int32)length; i++) {
                    if ((i % 32) == 0)
                        j += 64;

                    char *b = bits + (i << 1) + j;
                    b[0] = b[1] = b[64] = b[65] = buffer[i];
                }
                fConfigView->AddChild(new BitmapView(bitmap));
            } else
                delete bitmap;
        }
    }
#else
    app_info info;
    if (be_app->GetAppInfo(&info) == B_OK) {
        BFile appFile(&info.ref, B_READ_ONLY);
        BAppFileInfo appFileInfo(&appFile);
        if (appFileInfo.InitCheck() == B_OK) {
            BBitmap *bitmap = new (nothrow) BBitmap(BRect(0, 0, 63, 63),
                                                    B_RGBA32);
            if (appFileInfo.GetIcon(bitmap, B_LARGE_ICON) == B_OK) {
                fConfigView->AddChild(new BitmapView(bitmap));
            } else
                delete bitmap;
        }
    }
#endif // HAIKU_TARGET_PLATFORM_HAIKU

    BRect rect = fConfigView->Bounds();
    BTextView *text = new BTextView(rect, NULL, rect, B_FOLLOW_NONE,
                                    B_WILL_DRAW);
    text->SetViewColor(fConfigView->Parent()->ViewColor());
    text->SetAlignment(B_ALIGN_CENTER);
    text->SetText(B_TRANSLATE(
                      "\n\nCreate a new account with the Add button.\n\n"
                      "Remove an account with the Remove button on the selected item.\n\n"
                      "Select an item in the list to change its settings."));
    rect = text->Bounds();
    text->ResizeTo(rect.Width(), text->TextHeight(0, 42));
    text->SetTextRect(rect);

    text->MakeEditable(false);
    text->MakeSelectable(false);

    fConfigView->AddChild(text);

    static_cast<CenterContainer *>(fConfigView)->Layout();
}
Example #5
0
FadeView::FadeView(const char* name, ScreenSaverSettings& settings)
	:
	BView(name, B_WILL_DRAW),
	fSettings(settings)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	font_height fontHeight;
	be_plain_font->GetHeight(&fontHeight);
	float textHeight = ceilf(fontHeight.ascent + fontHeight.descent);

	fEnableCheckBox = new BCheckBox("EnableCheckBox",
		B_TRANSLATE("Enable screensaver"),
		new BMessage(kMsgEnableScreenSaverBox));

	BBox* box = new BBox("EnableScreenSaverBox");
	box->SetLabel(fEnableCheckBox);

	// Start Screensaver
	BStringView* startScreenSaver = new BStringView("startScreenSaver",
		B_TRANSLATE("Start screensaver"));
	startScreenSaver->SetAlignment(B_ALIGN_RIGHT);

	fRunSlider = new TimeSlider("RunSlider", kMsgRunSliderChanged,
		kMsgRunSliderUpdate);

	// Turn Off
	rgb_color textColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
		B_DISABLED_LABEL_TINT);
	fTurnOffNotSupported = new BTextView("not_supported", be_plain_font,
		&textColor, B_WILL_DRAW);
	fTurnOffNotSupported->SetExplicitMinSize(BSize(B_SIZE_UNSET,
		3 + textHeight * 3));
	fTurnOffNotSupported->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fTurnOffNotSupported->MakeEditable(false);
	fTurnOffNotSupported->MakeSelectable(false);
	fTurnOffNotSupported->SetText(
		B_TRANSLATE("Display Power Management Signaling not available"));

	fTurnOffCheckBox = new BCheckBox("TurnOffScreenCheckBox",
		B_TRANSLATE("Turn off screen"), new BMessage(kMsgTurnOffCheckBox));
	fTurnOffCheckBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	fTurnOffSlider = new TimeSlider("TurnOffSlider", kMsgTurnOffSliderChanged,
		kMsgTurnOffSliderUpdate);

	// Password
	fPasswordCheckBox = new BCheckBox("PasswordCheckbox",
		B_TRANSLATE("Password lock"), new BMessage(kMsgPasswordCheckBox));
	fPasswordCheckBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	fPasswordSlider = new TimeSlider("PasswordSlider",
		kMsgPasswordSliderChanged, kMsgPasswordSliderUpdate);

	fPasswordButton = new BButton("PasswordButton",
		B_TRANSLATE("Password" B_UTF8_ELLIPSIS),
		new BMessage(kMsgChangePassword));

	// Bottom
	float monitorHeight = 10 + textHeight * 3;
	float aspectRatio = 4.0f / 3.0f;
	float monitorWidth = monitorHeight * aspectRatio;
	BRect monitorRect = BRect(0, 0, monitorWidth, monitorHeight);

	fFadeNow = new ScreenCornerSelector(monitorRect, "FadeNow",
		new BMessage(kMsgFadeCornerChanged), B_FOLLOW_NONE);
	BTextView* fadeNowText = new BTextView("FadeNowText", B_WILL_DRAW);
	fadeNowText->SetExplicitMinSize(BSize(B_SIZE_UNSET,
		4 + textHeight * 4));
	fadeNowText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fadeNowText->MakeEditable(false);
	fadeNowText->MakeSelectable(false);
	fadeNowText->SetText(B_TRANSLATE("Fade now when mouse is here"));

	fFadeNever = new ScreenCornerSelector(monitorRect, "FadeNever",
		new BMessage(kMsgNeverFadeCornerChanged), B_FOLLOW_NONE);
	BTextView* fadeNeverText = new BTextView("FadeNeverText", B_WILL_DRAW);
	fadeNeverText->SetExplicitMinSize(BSize(B_SIZE_UNSET,
		4 + textHeight * 4));
	fadeNeverText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fadeNeverText->MakeEditable(false);
	fadeNeverText->MakeSelectable(false);
	fadeNeverText->SetText(B_TRANSLATE("Don't fade when mouse is here"));

	box->AddChild(BLayoutBuilder::Group<>(B_VERTICAL)
		.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING)
		.AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
			.Add(startScreenSaver, 0, 0)
			.Add(fRunSlider, 1, 0)
			.Add(fTurnOffCheckBox, 0, 1)
			.Add(BLayoutBuilder::Group<>(B_VERTICAL)
				.Add(fTurnOffNotSupported)
				.Add(fTurnOffSlider)
				.View(), 1, 1)
			.Add(fPasswordCheckBox, 0, 2)
			.Add(fPasswordSlider, 1, 2)
			.End()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(fPasswordButton)
			.End()
		.AddGlue()
		.AddGroup(B_HORIZONTAL)
			.Add(fFadeNow)
			.AddGroup(B_VERTICAL, 0)
				.Add(fadeNowText)
				.AddGlue()
				.End()
			.Add(fFadeNever)
			.AddGroup(B_VERTICAL, 0)
				.Add(fadeNeverText)
				.AddGlue()
				.End()
			.End()
		.AddGlue()
		.View());

	BLayoutBuilder::Group<>(this, B_HORIZONTAL)
		.SetInsets(B_USE_SMALL_SPACING)
		.Add(box)
		.End();
}
Example #6
0
void
PackageView::_InitView()
{
	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

	float fontHeight = be_plain_font->Size();
	rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);

	BTextView* packageDescriptionView = new DescriptionTextView(
		"package description", fontHeight * 13);
	packageDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	packageDescriptionView->SetText(fInfo.GetDescription());
	packageDescriptionView->MakeEditable(false);
	packageDescriptionView->MakeSelectable(false);
	packageDescriptionView->SetFontAndColor(be_plain_font, B_FONT_ALL,
		&textColor);

	BScrollView* descriptionScrollView = new BScrollView(
		"package description scroll view", packageDescriptionView,
		0, false, true, B_NO_BORDER);

	// Install type menu field
	fInstallTypes = new BPopUpMenu(B_TRANSLATE("none"));
	BMenuField* installType = new BMenuField("install_type",
		B_TRANSLATE("Installation type:"), fInstallTypes);

	// Install type description text view
	fInstallTypeDescriptionView = new DescriptionTextView(
		"install type description", fontHeight * 4);
	fInstallTypeDescriptionView->MakeEditable(false);
	fInstallTypeDescriptionView->MakeSelectable(false);
	fInstallTypeDescriptionView->SetInsets(8, 0, 0, 0);
		// Left inset needs to match BMenuField text offset
	fInstallTypeDescriptionView->SetText(
		B_TRANSLATE("No installation type selected"));
	fInstallTypeDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	BFont font(be_plain_font);
	font.SetSize(ceilf(font.Size() * 0.85));
	fInstallTypeDescriptionView->SetFontAndColor(&font, B_FONT_ALL,
		&textColor);

	BScrollView* installTypeScrollView = new BScrollView(
		"install type description scroll view", fInstallTypeDescriptionView,
		 0, false, true, B_NO_BORDER);

	// Destination menu field
	fDestination = new BPopUpMenu(B_TRANSLATE("none"));
	fDestField = new BMenuField("install_to", B_TRANSLATE("Install to:"),
		fDestination);

	fBeginButton = new BButton("begin_button", B_TRANSLATE("Begin"),
		new BMessage(P_MSG_INSTALL));

	BLayoutItem* typeLabelItem = installType->CreateLabelLayoutItem();
	BLayoutItem* typeMenuItem = installType->CreateMenuBarLayoutItem();

	BLayoutItem* destFieldLabelItem = fDestField->CreateLabelLayoutItem();
	BLayoutItem* destFieldMenuItem = fDestField->CreateMenuBarLayoutItem();

	float forcedMinWidth = be_plain_font->StringWidth("XXX") * 5;
	destFieldMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
	typeMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));

	BAlignment labelAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
	typeLabelItem->SetExplicitAlignment(labelAlignment);
	destFieldLabelItem->SetExplicitAlignment(labelAlignment);

	// Build the layout
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.Add(descriptionScrollView)
		.AddGrid(B_USE_SMALL_SPACING, B_USE_DEFAULT_SPACING)
			.Add(typeLabelItem, 0, 0)
			.Add(typeMenuItem, 1, 0)
			.Add(installTypeScrollView, 1, 1)
			.Add(destFieldLabelItem, 0, 2)
			.Add(destFieldMenuItem, 1, 2)
		.End()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(fBeginButton)
		.End()
		.SetInsets(B_USE_DEFAULT_SPACING)
	;

	fBeginButton->MakeDefault(true);
}
Example #7
0
	KeyRequestView()
		:
		BView("KeyRequestView", B_WILL_DRAW),
		fPassword(NULL)
	{
		SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

		BGroupLayout* rootLayout = new(std::nothrow) BGroupLayout(B_VERTICAL);
		if (rootLayout == NULL)
			return;

		SetLayout(rootLayout);

		BGridView* controls = new(std::nothrow) BGridView();
		if (controls == NULL)
			return;

		BGridLayout* layout = controls->GridLayout();

		float inset = ceilf(be_plain_font->Size() * 0.7);
		rootLayout->SetInsets(inset, inset, inset, inset);
		rootLayout->SetSpacing(inset);
		layout->SetSpacing(inset, inset);

		BStringView* label = new(std::nothrow) BStringView("keyringLabel",
			B_TRANSLATE("Keyring:"));
		if (label == NULL)
			return;

		int32 row = 0;
		layout->AddView(label, 0, row);

		fKeyringName = new(std::nothrow) BStringView("keyringName", "");
		if (fKeyringName == NULL)
			return;

		layout->AddView(fKeyringName, 1, row++);

		fPassword = new(std::nothrow) BTextControl(B_TRANSLATE("Password:"******"", NULL);
		if (fPassword == NULL)
			return;

		BLayoutItem* layoutItem = fPassword->CreateTextViewLayoutItem();
		layoutItem->SetExplicitMinSize(BSize(fPassword->StringWidth(
				"0123456789012345678901234567890123456789") + inset,
			B_SIZE_UNSET));

		layout->AddItem(fPassword->CreateLabelLayoutItem(), 0, row);
		layout->AddItem(layoutItem, 1, row++);

		BGroupView* buttons = new(std::nothrow) BGroupView(B_HORIZONTAL);
		if (buttons == NULL)
			return;

		fCancelButton = new(std::nothrow) BButton(B_TRANSLATE("Cancel"),
			new BMessage(kMessageCancel));
		buttons->GroupLayout()->AddView(fCancelButton);

		buttons->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

		fUnlockButton = new(std::nothrow) BButton(B_TRANSLATE("Unlock"),
			new BMessage(kMessageUnlock));
		buttons->GroupLayout()->AddView(fUnlockButton);

		BTextView* message = new(std::nothrow) BTextView("message");
		message->SetText(B_TRANSLATE("An application wants to access the "
			"keyring below, but it is locked with a passphrase. Please enter "
			"the passphrase to unlock the keyring.\n"
			"If you unlock the keyring, it stays unlocked until the system is "
			"shut down or the keyring is manually locked again.\n"
			"If you cancel this dialog the keyring will remain locked."));
		message->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
		rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
		message->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
		message->MakeEditable(false);
		message->MakeSelectable(false);
		message->SetWordWrap(true);

		rootLayout->AddView(message);
		rootLayout->AddView(controls);
		rootLayout->AddView(buttons);
	}
Example #8
0
void
InstallerApp::ReadyToRun()
{
	BString infoText;
	infoText << B_TRANSLATE(
		"Welcome to the Haiku Installer!\n\n");
	infoText << B_TRANSLATE(
		"IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n");
	infoText << B_TRANSLATE(
		"This is alpha-quality software! It means there is a high risk of "
		"losing important data. Make frequent backups! You have been "
		"warned.\n\n\n");
	infoText << B_TRANSLATE(
		"1)   If you are installing Haiku onto real hardware (not inside an "
		"emulator) it is recommended that you have already prepared a hard "
		"disk partition. The Installer and the DriveSetup tool offer to "
		"initialize existing partitions with the Haiku native file system, "
		"but the options to change the actual partition layout may not have "
		"been tested on a sufficiently great variety of computer "
		"configurations so we do not recommend using it.\n");
	infoText << B_TRANSLATE(
		"If you have not created a partition yet, simply reboot, create the "
		"partition using whatever tool you feel most comfortable with, and "
		"reboot into Haiku to continue with the installation. You could for "
		"example use the GParted Live-CD, it can also resize existing "
		"partitions to make room.\n\n\n");
	infoText << B_TRANSLATE(
		"2)   The Installer will make the Haiku partition itself bootable, "
		"but takes no steps to integrate Haiku into an existing boot menu. "
		"If you have GRUB already installed, you can add Haiku to its boot "
		"menu. Depending on what version of GRUB you use, this is done "
		"differently.\n\n\n");
	infoText << B_TRANSLATE(
		"2.1) GRUB 1\n");
	infoText << B_TRANSLATE(
		"Configure your /boot/grub/menu.lst by launching your favorite "
		"editor from a Terminal like this:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo <your favorite text editor> /boot/grub/menu.lst\n\n");
	infoText << B_TRANSLATE(
		"You'll note that GRUB uses a different naming strategy for hard "
		"drives than Linux.\n\n");
	infoText << B_TRANSLATE(
		"With GRUB it's: (hdN,n)\n\n");
	infoText << B_TRANSLATE(
		"All hard disks start with \"hd\".\n");
	infoText << B_TRANSLATE(
		"\"N\" is the hard disk number, starting with \"0\".\n");
	infoText << B_TRANSLATE(
		"\"n\" is the partition number, also starting with \"0\".\n");
	infoText << B_TRANSLATE(
		"The first logical partition always has the number \"4\", regardless "
		"of the number of primary partitions.\n\n");
	infoText << B_TRANSLATE(
		"So behind the other menu entries towards the bottom of the file, add "
		"something similar to these lines:\n\n");
	infoText << B_TRANSLATE(
		"\t# Haiku on /dev/sda7\n");
	infoText << B_TRANSLATE(
		"\ttitle\t\t\t\tHaiku\n");
	infoText << B_TRANSLATE(
		"\trootnoverify\t\t(hd0,6)\n");
	infoText << B_TRANSLATE(
		"\tchainloader\t\t+1\n\n");
	infoText << B_TRANSLATE(
		"You can see the correct partition in GParted for example.\n\n\n");
	infoText << B_TRANSLATE(
		"2.2) GRUB 2\n");
	infoText << B_TRANSLATE(
		"Newer versions of GRUB use an extra configuration file to add "
		"custom entries to the boot menu. To add them to the top, you have "
		"to create/edit a file by launching your favorite editor from a "
		"Terminal like this:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo <your favorite text editor> /etc/grub.d/40_custom\n\n");
	infoText << B_TRANSLATE(
		"NOTE: While the naming strategy for hard disks is still as described "
		"under 2.1) the naming scheme for partitions has changed.\n\n");
	infoText << B_TRANSLATE(		
		"GRUB's naming scheme is still: (hdN,n)\n\n");
	infoText << B_TRANSLATE(
		"All hard disks start with \"hd\".\n");
	infoText << B_TRANSLATE(
		"\"N\" is the hard disk number, starting with \"0\".\n");
	infoText << B_TRANSLATE(
		"\"n\" is the partition number, which for GRUB 2 starts with \"1\"\n");
	infoText << B_TRANSLATE(
		"With GRUB 2 the first logical partition always has the number \"5\", "
		"regardless of the number of primary partitions.\n\n");
	infoText << B_TRANSLATE(
		"So below the heading that must not be edited, add something similar "
		"to these lines:\n\n");
	infoText << B_TRANSLATE(
		"\t# Haiku on /dev/sda7\n");
	infoText << B_TRANSLATE(
		"\tmenuentry \"Haiku Alpha\" {\n");
	infoText << B_TRANSLATE(
		"\t\tset root=(hd0,7)\n");
	infoText << B_TRANSLATE(
		"\t\tchainloader +1\n");
	infoText << B_TRANSLATE(
		"\t}\n\n");
	infoText << B_TRANSLATE(
		"Additionally you have to edit another file to actually display the "
		"boot menu:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo <your favorite text editor> /etc/default/grub\n\n");
	infoText << B_TRANSLATE(
		"Here you have to comment out the line \"GRUB_HIDDEN_TIMEOUT=0\" by "
		"putting a \"#\" in front of it in order to actually display the "
		"boot menu.\n\n");
	infoText << B_TRANSLATE(
		"Finally, you have to update the boot menu by entering:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo update-grub\n\n\n");
	infoText << B_TRANSLATE(
		"3)   When you successfully boot into Haiku for the first time, make "
		"sure to read our \"Welcome\" documentation, there is a link on the "
		"Desktop.\n\n");
	infoText << B_TRANSLATE(
		"Have fun and thanks a lot for trying out Haiku! We hope you like it!");

#if 1
	// Show the EULA first.
	BTextView* textView = new BTextView("eula", be_plain_font, NULL,
		B_WILL_DRAW);
	textView->SetInsets(10, 10, 10, 10);
	textView->MakeEditable(false);
	textView->MakeSelectable(false);
	textView->SetText(infoText);

	BScrollView* scrollView = new BScrollView("eulaScroll",
		textView, B_WILL_DRAW, false, true);

	BButton* cancelButton = new BButton(B_TRANSLATE("Quit"),
		new BMessage(B_QUIT_REQUESTED));
	cancelButton->SetTarget(this);

	BButton* continueButton = new BButton(B_TRANSLATE("Continue"),
		new BMessage(kMsgAgree));
	continueButton->SetTarget(this);
	continueButton->MakeDefault(true);

	BRect eulaFrame = BRect(0, 0, 600, 450);
	fEULAWindow = new BWindow(eulaFrame, B_TRANSLATE("README"),
		B_MODAL_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
			| B_AUTO_UPDATE_SIZE_LIMITS);

	BLayoutBuilder::Group<>(fEULAWindow, B_VERTICAL, 10)
		.SetInsets(10)
		.Add(scrollView)
		.AddGroup(B_HORIZONTAL, 10)
			.AddGlue()
			.Add(cancelButton)
			.Add(continueButton);

	fEULAWindow->CenterOnScreen();
	fEULAWindow->Show();
#else
	// Show the installer window without EULA.
	new InstallerWindow();
#endif
}
Example #9
0
EULAWindow::EULAWindow()
	:
	BWindow(BRect(0, 0, 600, 450), B_TRANSLATE("README"),
		B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE
		| B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	BString infoText;
	infoText << B_TRANSLATE(
		"Welcome to the Haiku Installer!\n\n");
	infoText << B_TRANSLATE(
		"IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n");
	infoText << B_TRANSLATE(
		"This is beta-quality software! It means there is a risk of "
		"losing important data. Make frequent backups! You have been "
		"warned.\n\n\n");
	infoText << B_TRANSLATE(
		"1)   If you are installing Haiku onto real hardware (not inside an "
		"emulator), you may want to prepare a hard disk partition from "
		"another OS (you could, for example, use a GParted Live-CD, which "
		"can also resize existing partitions to make room).\n"
		"You can also set up partitions by launching DriveSetup from "
		"Installer, but you won't be able to resize existing partitions with "
		"it. While DriveSetup has been quite thoroughly tested over the "
		"years, it's recommended to have up-to-date backups of the other "
		"partitions on your system. Just in case" B_UTF8_ELLIPSIS);
	infoText << "\n\n\n";
	infoText << B_TRANSLATE(
		"2)   The Installer will make the Haiku partition itself bootable, "
		"but takes no steps to integrate Haiku into an existing boot menu. "
		"If you have GRUB already installed, you can add Haiku to it.\n"
		"For details, please consult the guide on booting Haiku on our "
		"website at https://www.haiku-os.org/guides/booting.\n"
		"Or you can set up a boot menu from Installer's \"Tools\" menu, see "
		"the Userguide's topic on the application \"BootManager\".\n\n\n");
	infoText << B_TRANSLATE(
		"3)   When you successfully boot into Haiku for the first time, make "
		"sure to read our \"Welcome\" and \"Userguide\" documentation. There "
		"are links on the Desktop and in WebPositive's bookmarks.\n\n");
	infoText << B_TRANSLATE(
		"Have fun and thanks for trying out Haiku!");

	BTextView* textView = new BTextView("eula", be_plain_font, NULL, B_WILL_DRAW);
	textView->SetInsets(10, 10, 10, 10);
	textView->MakeEditable(false);
	textView->MakeSelectable(false);
	textView->SetText(infoText);

	BScrollView* scrollView = new BScrollView("eulaScroll",
		textView, B_WILL_DRAW, false, true);

	BButton* cancelButton = new BButton(B_TRANSLATE("Quit"),
		new BMessage(B_QUIT_REQUESTED));
	cancelButton->SetTarget(be_app);

	BButton* continueButton = new BButton(B_TRANSLATE("Continue"),
		new BMessage(kMsgAgree));
	continueButton->SetTarget(be_app);
	continueButton->MakeDefault(true);

	if (!be_roster->IsRunning(kTrackerSignature))
		SetWorkspaces(B_ALL_WORKSPACES);

	BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
		.SetInsets(B_USE_WINDOW_SPACING)
		.Add(scrollView)
		.AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
			.AddGlue()
			.Add(cancelButton)
			.Add(continueButton);

	CenterOnScreen();
	Show();
}
Example #10
0
bool AuthenticationPanel::getAuthentication(const BString& text,
    const BString& previousUser, const BString& previousPass,
	bool previousRememberCredentials, bool badPassword,
	BString& user, BString&  pass, bool* rememberCredentials)
{
	// Configure panel and layout controls.
	rgb_color infoColor = ui_color(B_PANEL_TEXT_COLOR);
	BRect textBounds(0, 0, 250, 200);
	BTextView* textView = new BTextView(textBounds, "text", textBounds,
	    be_plain_font, &infoColor, B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT);
	textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	textView->SetText(text.String());
	textView->MakeEditable(false);
	textView->MakeSelectable(false);

    m_usernameTextControl->SetText(previousUser.String());
	m_passwordTextControl->TextView()->HideTyping(true);
	// Ignore the previous password, if it didn't work.
	if (!badPassword)
	    m_passwordTextControl->SetText(previousPass.String());
	m_hidePasswordCheckBox->SetValue(B_CONTROL_ON);
	m_rememberCredentialsCheckBox->SetValue(previousRememberCredentials);

	// create layout
	SetLayout(new BGroupLayout(B_VERTICAL, 0.0));
	float spacing = be_control_look->DefaultItemSpacing();
	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0.0)
	    .Add(BGridLayoutBuilder(0, spacing)
	        .Add(textView, 0, 0, 2)
	        .Add(m_usernameTextControl->CreateLabelLayoutItem(), 0, 1)
	        .Add(m_usernameTextControl->CreateTextViewLayoutItem(), 1, 1)
	        .Add(m_passwordTextControl->CreateLabelLayoutItem(), 0, 2)
	        .Add(m_passwordTextControl->CreateTextViewLayoutItem(), 1, 2)
	        .Add(BSpaceLayoutItem::CreateGlue(), 0, 3)
	        .Add(m_hidePasswordCheckBox, 1, 3)
	        .Add(m_rememberCredentialsCheckBox, 0, 4, 2)
	        .SetInsets(spacing, spacing, spacing, spacing)
	    )
	    .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
	    .Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
	        .AddGlue()
	        .Add(m_cancelButton)
	        .Add(m_okButton)
	        .SetInsets(spacing, spacing, spacing, spacing)
	    )
	);

	float textHeight = textView->LineHeight(0) * textView->CountLines();
	textView->SetExplicitMinSize(BSize(B_SIZE_UNSET, textHeight));

	SetDefaultButton(m_okButton);
	if (badPassword && previousUser.Length())
	    m_passwordTextControl->MakeFocus(true);
	else
	    m_usernameTextControl->MakeFocus(true);

    if (m_parentWindowFrame.IsValid())
        CenterIn(m_parentWindowFrame);
    else
        CenterOnScreen();

	// Start AuthenticationPanel window thread
	Show();

	// Let the window jitter, if the previous password was invalid
	if (badPassword)
		PostMessage(kMsgJitter);

	// Block calling thread
	// Get the originating window, if it exists, to let it redraw itself.
	BWindow* window = dynamic_cast<BWindow*>(BLooper::LooperForThread(find_thread(NULL)));
	if (window) {
		status_t err;
		for (;;) {
			do {
				err = acquire_sem_etc(m_exitSemaphore, 1, B_RELATIVE_TIMEOUT, 10000);
				// We've (probably) had our time slice taken away from us
			} while (err == B_INTERRUPTED);

			if (err != B_TIMED_OUT) {
				// Semaphore was finally released or nuked.
				break;
			}
			window->UpdateIfNeeded();
		}
	} else {
		// No window to update, so just hang out until we're done.
		while (acquire_sem(m_exitSemaphore) == B_INTERRUPTED) {
		}
	}

	// AuthenticationPanel wants to quit.
	Lock();

	user = m_usernameTextControl->Text();
	pass = m_passwordTextControl->Text();
	if (rememberCredentials)
        *rememberCredentials = m_rememberCredentialsCheckBox->Value() == B_CONTROL_ON;

    bool canceled = m_cancelled;
	Quit();
	// AuthenticationPanel object is TOAST here.
	return !canceled;
}
Example #11
0
AntialiasingSettingsView::AntialiasingSettingsView(const char* name)
	: BView(name, 0)
{
	// collect the current system settings
	if (get_subpixel_antialiasing(&fCurrentSubpixelAntialiasing) != B_OK)
		fCurrentSubpixelAntialiasing = false;
	fSavedSubpixelAntialiasing = fCurrentSubpixelAntialiasing;

	if (get_hinting_mode(&fCurrentHinting) != B_OK)
		fCurrentHinting = HINTING_MODE_ON;
	fSavedHinting = fCurrentHinting;

	if (get_average_weight(&fCurrentAverageWeight) != B_OK)
		fCurrentAverageWeight = 100;
	fSavedAverageWeight = fCurrentAverageWeight;

	// create the controls

	// antialiasing menu
	_BuildAntialiasingMenu();
	fAntialiasingMenuField = new BMenuField("antialiasing",
		B_TRANSLATE("Antialiasing type:"), fAntialiasingMenu, NULL);

	// "average weight" in subpixel filtering
	fAverageWeightControl = new BSlider("averageWeightControl",
		B_TRANSLATE("Reduce colored edges filter strength:"),
		new BMessage(kMsgSetAverageWeight), 0, 255, B_HORIZONTAL);
	fAverageWeightControl->SetLimitLabels(B_TRANSLATE("Off"),
		B_TRANSLATE("Strong"));
	fAverageWeightControl->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fAverageWeightControl->SetHashMarkCount(255 / 15);
	fAverageWeightControl->SetEnabled(false);

	// hinting menu
	_BuildHintingMenu();
	fHintingMenuField = new BMenuField("hinting", B_TRANSLATE("Glyph hinting:"),
		fHintingMenu, NULL);

#ifdef DISABLE_HINTING_CONTROL
	fHintingMenuField->SetEnabled(false);
#endif

#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
	// subpixelAntialiasingDisabledLabel
	BFont infoFont(*be_plain_font);
	infoFont.SetFace(B_ITALIC_FACE);
	rgb_color infoColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
		B_DARKEN_4_TINT);
	// TODO: Replace with layout friendly constructor once available.
	BRect textBounds = Bounds();
	BTextView* subpixelAntialiasingDisabledLabel = new BTextView(
		textBounds, "unavailable label", textBounds, &infoFont, &infoColor,
		B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT);
	subpixelAntialiasingDisabledLabel->SetText(B_TRANSLATE(
		"Subpixel based anti-aliasing in combination with glyph hinting is not "
		"available in this build of Haiku to avoid possible patent issues. To "
		"enable this feature, you have to build Haiku yourself and enable "
		"certain options in the libfreetype configuration header."));
	subpixelAntialiasingDisabledLabel->SetViewColor(
		ui_color(B_PANEL_BACKGROUND_COLOR));
	subpixelAntialiasingDisabledLabel->MakeEditable(false);
	subpixelAntialiasingDisabledLabel->MakeSelectable(false);
#endif // !FT_CONFIG_OPTION_SUBPIXEL_RENDERING

	SetLayout(new BGroupLayout(B_VERTICAL));

	// controls pane
	AddChild(BGridLayoutBuilder(10, 10)
		.Add(fHintingMenuField->CreateLabelLayoutItem(), 0, 0)
		.Add(fHintingMenuField->CreateMenuBarLayoutItem(), 1, 0)

		.Add(fAntialiasingMenuField->CreateLabelLayoutItem(), 0, 1)
		.Add(fAntialiasingMenuField->CreateMenuBarLayoutItem(), 1, 1)

		.Add(fAverageWeightControl, 0, 2, 2)

#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
		// hinting+subpixel unavailable info
		.Add(subpixelAntialiasingDisabledLabel, 0, 3, 2)
#else
		.Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2)
#endif

		.SetInsets(10, 10, 10, 10)
	);

	_SetCurrentAntialiasing();
	_SetCurrentHinting();
	_SetCurrentAverageWeight();
}
Example #12
0
status_t
PTextView::SetProperty(const char *name, PValue *value, const int32 &index)
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
		return B_READ_ONLY;
	
	BTextView *backend = (BTextView*)fView;
	
	BoolValue boolval;
	CharValue charval;
	ColorValue colorval;
	FloatValue floatval;
	IntValue intval;
	PointValue pointval;
	RectValue rectval;
	StringValue stringval;
	
	status_t status = prop->SetValue(value);
	if (status != B_OK)
		return status;

	if (backend->Window())
		backend->Window()->Lock();

	else if (str.ICompare("Selectable") == 0)
	{
		prop->GetValue(&boolval);
		backend->MakeSelectable(*boolval.value);
	}
	else if (str.ICompare("CurrentLine") == 0)
	{
		prop->GetValue(&intval);
		backend->GoToLine(*intval.value);
	}
	else if (str.ICompare("TabWidth") == 0)
	{
		prop->GetValue(&floatval);
		backend->SetTabWidth(*floatval.value);
	}
	else if (str.ICompare("TextRect") == 0)
	{
		prop->GetValue(&rectval);
		backend->SetTextRect(*rectval.value);
	}
	else if (str.ICompare("MaxBytes") == 0)
	{
		prop->GetValue(&intval);
		backend->SetMaxBytes(*intval.value);
	}
	else if (str.ICompare("UseWordWrap") == 0)
	{
		prop->GetValue(&boolval);
		backend->SetWordWrap(*boolval.value);
	}
	else if (str.ICompare("HideTyping") == 0)
	{
		prop->GetValue(&boolval);
		backend->HideTyping(*boolval.value);
	}
	else if (str.ICompare("Editable") == 0)
	{
		prop->GetValue(&boolval);
		backend->MakeEditable(*boolval.value);
	}
	else if (str.ICompare("ColorSpace") == 0)
	{
		prop->GetValue(&intval);
		backend->SetColorSpace((color_space)*intval.value);
	}
	else if (str.ICompare("Text") == 0)
	{
		prop->GetValue(&stringval);
		backend->SetText(*stringval.value);
	}
	else if (str.ICompare("Resizable") == 0)
	{
		prop->GetValue(&boolval);
		backend->MakeResizable(*boolval.value);
	}
	else if (str.ICompare("Alignment") == 0)
	{
		prop->GetValue(&intval);
		backend->SetAlignment((alignment)*intval.value);
	}
	else if (str.ICompare("Undoable") == 0)
	{
		prop->GetValue(&boolval);
		backend->SetDoesUndo(*boolval.value);
	}
	else if (str.ICompare("AutoIndent") == 0)
	{
		prop->GetValue(&boolval);
		backend->SetAutoindent(*boolval.value);
	}
	else if (str.ICompare("Stylable") == 0)
	{
		prop->GetValue(&boolval);
		backend->SetStylable(*boolval.value);
	}
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::SetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
Example #13
0
EULAWindow::EULAWindow()
	:
	BWindow(BRect(0, 0, 600, 450), B_TRANSLATE("README"),
		B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE
		| B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	BString infoText;
	infoText << B_TRANSLATE(
		"Welcome to the Haiku Installer!\n\n");
	infoText << B_TRANSLATE(
		"IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n");
	infoText << B_TRANSLATE(
		"This is alpha-quality software! It means there is a high risk of "
		"losing important data. Make frequent backups! You have been "
		"warned.\n\n\n");
	infoText << B_TRANSLATE(
		"1)   If you are installing Haiku onto real hardware (not inside an "
		"emulator) it is recommended that you have already prepared a hard "
		"disk partition. The Installer and the DriveSetup tool offer to "
		"initialize existing partitions with the Haiku native file system, "
		"but the options to change the actual partition layout may not have "
		"been tested on a sufficiently great variety of computer "
		"configurations so we do not recommend using it.\n");
	infoText << B_TRANSLATE(
		"If you have not created a partition yet, simply reboot, create the "
		"partition using whatever tool you feel most comfortable with, and "
		"reboot into Haiku to continue with the installation. You could for "
		"example use the GParted Live-CD, it can also resize existing "
		"partitions to make room.\n\n\n");
	infoText << B_TRANSLATE(
		"2)   The Installer will make the Haiku partition itself bootable, "
		"but takes no steps to integrate Haiku into an existing boot menu. "
		"If you have GRUB already installed, you can add Haiku to its boot "
		"menu. Depending on what version of GRUB you use, this is done "
		"differently.\n\n\n");
	infoText << B_TRANSLATE(
		"2.1) GRUB (since os-prober v1.44)\n");
	infoText << B_TRANSLATE(
		"Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku "
		"should be recognized out of the box. To add Haiku to the GRUB menu, "
		"open a Terminal and enter:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo update-grub\n\n\n");
	infoText << B_TRANSLATE(
		"2.2) GRUB 2\n");
	infoText << B_TRANSLATE(
		"If the os-prober approach doesn't work for you, GRUB 2 uses an extra "
		"configuration file to add custom entries to the boot menu. To add "
		"them to the top, you have to create/edit a file by launching your "
		"favorite editor from a Terminal like this:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo <your favorite text editor> /etc/grub.d/40_custom\n\n");
	infoText << B_TRANSLATE(
		"GRUB's naming scheme for partitions is: (hdN,n)\n\n");
	infoText << B_TRANSLATE(
		"All hard disks start with \"hd\".\n");
	infoText << B_TRANSLATE(
		"\"N\" is the hard disk number, starting with \"0\".\n");
	infoText << B_TRANSLATE(
		"\"n\" is the partition number, which for GRUB 2 starts with \"1\"\n");
	infoText << B_TRANSLATE(
		"With GRUB 2 the first logical partition always has the number \"5\", "
		"regardless of the number of primary partitions.\n\n");
	infoText << B_TRANSLATE(
		"So below the heading that must not be edited, add something similar "
		"to these lines:\n\n");
	infoText << B_TRANSLATE(
		"\t# Haiku on /dev/sda7\n");
	infoText << B_TRANSLATE(
		"\tmenuentry \"Haiku Alpha\" {\n");
	infoText << B_TRANSLATE(
		"\t\tset root=(hd0,7)\n");
	infoText << B_TRANSLATE(
		"\t\tchainloader +1\n");
	infoText << B_TRANSLATE(
		"\t}\n\n");
	infoText << B_TRANSLATE(
		"Additionally you have to edit another file to actually display the "
		"boot menu:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo <your favorite text editor> /etc/default/grub\n\n");
	infoText << B_TRANSLATE(
		"Here you have to comment out the line \"GRUB_HIDDEN_TIMEOUT=0\" by "
		"putting a \"#\" in front of it in order to actually display the "
		"boot menu.\n\n");
	infoText << B_TRANSLATE(
		"Finally, you have to update the boot menu by entering:\n\n");
	infoText << B_TRANSLATE(
		"\tsudo update-grub\n\n\n");
	infoText << B_TRANSLATE(
		"3)   When you successfully boot into Haiku for the first time, make "
		"sure to read our \"Welcome\" and \"Userguide\" documentation. There "
		"are links on the Desktop and in WebPositive's bookmarks.\n\n");
	infoText << B_TRANSLATE(
		"Have fun and thanks a lot for trying out Haiku! We hope you like it!");

	BTextView* textView = new BTextView("eula", be_plain_font, NULL, B_WILL_DRAW);
	textView->SetInsets(10, 10, 10, 10);
	textView->MakeEditable(false);
	textView->MakeSelectable(false);
	textView->SetText(infoText);

	BScrollView* scrollView = new BScrollView("eulaScroll",
		textView, B_WILL_DRAW, false, true);

	BButton* cancelButton = new BButton(B_TRANSLATE("Quit"),
		new BMessage(B_QUIT_REQUESTED));
	cancelButton->SetTarget(be_app);

	BButton* continueButton = new BButton(B_TRANSLATE("Continue"),
		new BMessage(kMsgAgree));
	continueButton->SetTarget(be_app);
	continueButton->MakeDefault(true);

	if (!be_roster->IsRunning(kTrackerSignature))
		SetWorkspaces(B_ALL_WORKSPACES);

	BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
		.SetInsets(B_USE_WINDOW_SPACING)
		.Add(scrollView)
		.AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING)
			.AddGlue()
			.Add(cancelButton)
			.Add(continueButton);

	CenterOnScreen();
	Show();
}
Example #14
0
void
TestPageView::AttachedToWindow()
{
	BTextView* statusView = new BTextView("statusView",
		be_plain_font, NULL, B_WILL_DRAW);

	statusView->SetInsets(10, 10, 10, 10);
	statusView->MakeEditable(false);
	statusView->MakeSelectable(false);

	const char* title = B_TRANSLATE("Test Page");
	BString text;
	text << title << "\n\n";
	text << B_TRANSLATE(
		"Printer: %printer_name%\n"
		"Driver:  %driver%\n");

	text.ReplaceFirst("%printer_name%", fPrinter->Name());
	text.ReplaceFirst("%driver%", fPrinter->Driver());
	if (strlen(fPrinter->Transport()) > 0) {
		text << B_TRANSLATE("Transport: %transport% %transport_address%");

		text.ReplaceFirst("%transport%", fPrinter->Transport());
		text.ReplaceFirst("%transport_address%", fPrinter->TransportAddress());
	}

	statusView->SetText(text.String());
	BFont font;
	statusView->SetStylable(true);
	statusView->GetFont(&font);
	font.SetFace(B_BOLD_FACE);
	font.SetSize(font.Size() * 1.7);
	statusView->SetFontAndColor(0, strlen(title), &font);

	BGridLayoutBuilder gradiants(2.0);
	gradiants.View()->SetViewColor(B_TRANSPARENT_COLOR);

	for (int i = 0; i < kNumColorGradients; ++i) {
		BStringView* label = new BStringView(kColorGradients[i].name,
			kColorGradients[i].name);
		// label->SetAlignment(B_ALIGN_RIGHT);
		gradiants.Add(label, 0, i);
		gradiants.Add(new ColorGradientView(kColorGradients[i].color), 1, i);
	}

	SetLayout(new BGroupLayout(B_HORIZONTAL));
	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
			.Add(statusView)
			.Add(new LeafView())
		)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
			.Add(gradiants, 0.60)
			.Add(new RadialLinesView(), 0.40)
		)
		.AddGlue()
		.End()
	);

	// set layout background color to transparent instead
	// of default UI panel color
	ChildAt(0)->SetViewColor(B_TRANSPARENT_COLOR);
}
Example #15
0
void
InstallerApp::ReadyToRun()
{
	const char* infoText = B_TRANSLATE(
		"Welcome to the Haiku Installer!\n\n"

		"IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n"

		"This is alpha-quality software! It means there is a high risk of "
		"losing important data. Make frequent backups! You have been "
		"warned.\n\n"

		"1)  If you are installing Haiku onto real hardware (not inside an "
		"emulator) it is recommended that you have already prepared a hard "
		"disk partition. The Installer and the DriveSetup tool offer to "
		"initialize existing partitions with the Haiku native file system, "
		"but the options to change the actual partition layout may not have "
		"been tested on a sufficiently great variety of computer "
		"installations so we do not recommend using it.\n"
		"If you have not created a partition yet, simply reboot, create the "
		"partition using whatever tool you feel most comfortable with, and "
		"reboot into Haiku to continue with the installation. You could for "
		"example use the GParted Live-CD, it can also resize existing "
		"partitions to make room.\n\n"

		"2)  The Installer will take no steps to integrate Haiku into an "
		"existing boot menu. The Haiku partition itself will be made "
		"bootable. If you have GRUB already installed, edit your "
		"/boot/grub/menu.lst by launching your favorite editor from a "
		"Terminal like this:\n\n"

		"\tsudo <your favorite text editor> /boot/grub/menu.lst\n\n"

		"You'll note that GRUB uses a different naming strategy for hard "
		"drives than Linux.\n\n"

		"With GRUB it's: (hdN,n)\n\n"

		"All harddisks start with \"hd\"\n"
		"\"N\" is the hard disk number, starting with \"0\".\n"
		"\"n\" is the partition number, also starting with \"0\".\n"
		"The first logical partition always has the number 4, regardless of "
		"the number of primary partitions.\n\n"

		"So behind the other menu entries towards the bottom of the file, add "
		"something similar to these lines:\n\n"

		"\t# Haiku on /dev/sda7\n"
		"\ttitle\t\t\t\tHaiku\n"
		"\trootnoverify\t\t(hd0,6)\n"
		"\tchainloader\t\t+1\n\n"

		"You can see the correct partition in GParted for example.\n\n"

		"3)  When you successfully boot into Haiku for the first time, make "
		"sure to read our \"Welcome\" documentation, there is a link on the "
		"Desktop.\n\n"

		"Have fun and thanks a lot for trying out Haiku! We hope you like it!"
	);

#if 1
	// Show the EULA first.
	BTextView* textView = new BTextView("eula", be_plain_font, NULL,
		B_WILL_DRAW);
	textView->SetInsets(10, 10, 10, 10);
	textView->MakeEditable(false);
	textView->MakeSelectable(false);
	textView->SetText(infoText);

	BScrollView* scrollView = new BScrollView("eulaScroll",
		textView, B_WILL_DRAW, false, true);

	BButton* cancelButton = new BButton(B_TRANSLATE("Quit"),
		new BMessage(B_QUIT_REQUESTED));
	cancelButton->SetTarget(this);

	BButton* continueButton = new BButton(B_TRANSLATE("Continue"),
		new BMessage(kMsgAgree));
	continueButton->SetTarget(this);
	continueButton->MakeDefault(true);

	BRect eulaFrame = BRect(0, 0, 600, 450);
	fEULAWindow = new BWindow(eulaFrame, B_TRANSLATE("README"),
		B_MODAL_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
			| B_AUTO_UPDATE_SIZE_LIMITS);

	fEULAWindow->SetLayout(new BGroupLayout(B_HORIZONTAL));
	fEULAWindow->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
		.Add(scrollView)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
			.AddGlue()
			.Add(cancelButton)
			.Add(continueButton)
		)
		.SetInsets(10, 10, 10, 10)
	);

	fEULAWindow->CenterOnScreen();
	fEULAWindow->Show();
#else
	// Show the installer window without EULA.
	new InstallerWindow();
#endif
}