Moved the "Write boot sector" and "Set up boot menu" functionality into a new

Tools menu. Fixes #5820.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36484 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-04-26 11:37:32 +00:00
parent 43c4e12359
commit c89c29e76c
2 changed files with 41 additions and 31 deletions
+38 -29
View File
@@ -15,6 +15,7 @@
#include <Box.h> #include <Box.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h> #include <Catalog.h>
#include <ControlLook.h>
#include <Directory.h> #include <Directory.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <GridLayoutBuilder.h> #include <GridLayoutBuilder.h>
@@ -213,23 +214,31 @@ InstallerWindow::InstallerWindow()
TR("Set up partitions" B_UTF8_ELLIPSIS), TR("Set up partitions" B_UTF8_ELLIPSIS),
new BMessage(LAUNCH_DRIVE_SETUP)); new BMessage(LAUNCH_DRIVE_SETUP));
fLaunchBootmanButton = new BButton("bootman_button", fLaunchBootmanItem = new BMenuItem(TR("Set up boot menu"),
TR("Set up boot menu"), new BMessage(LAUNCH_BOOTMAN)); new BMessage(LAUNCH_BOOTMAN));
fLaunchBootmanButton->SetEnabled(false); fLaunchBootmanItem->SetEnabled(false);
fMakeBootableButton = new BButton("makebootable_button", fMakeBootableItem = new BMenuItem(TR("Write boot sector"),
TR("Write boot sector"), new BMessage(MSG_WRITE_BOOT_SECTOR)); new BMessage(MSG_WRITE_BOOT_SECTOR));
fMakeBootableButton->SetEnabled(false); fMakeBootableItem->SetEnabled(false);
BMenuBar* mainMenu = new BMenuBar("main menu");
BMenu* toolsMenu = new BMenu(TR("Tools"));
toolsMenu->AddItem(fLaunchBootmanItem);
toolsMenu->AddItem(fMakeBootableItem);
mainMenu->AddItem(toolsMenu);
float spacing = be_control_look->DefaultItemSpacing();
SetLayout(new BGroupLayout(B_HORIZONTAL)); SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL) AddChild(BGroupLayoutBuilder(B_VERTICAL)
.Add(mainMenu)
.Add(BGroupLayoutBuilder(B_HORIZONTAL) .Add(BGroupLayoutBuilder(B_HORIZONTAL)
.Add(logoView) .Add(logoView)
.Add(fStatusView) .Add(fStatusView)
) )
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER)) .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
.Add(BGroupLayoutBuilder(B_VERTICAL, 10) .Add(BGroupLayoutBuilder(B_VERTICAL, spacing)
.Add(BGridLayoutBuilder(0, 10) .Add(BGridLayoutBuilder(0, spacing)
.Add(fSrcMenuField->CreateLabelLayoutItem(), 0, 0) .Add(fSrcMenuField->CreateLabelLayoutItem(), 0, 0)
.Add(fSrcMenuField->CreateMenuBarLayoutItem(), 1, 0) .Add(fSrcMenuField->CreateMenuBarLayoutItem(), 1, 0)
.Add(fDestMenuField->CreateLabelLayoutItem(), 0, 1) .Add(fDestMenuField->CreateLabelLayoutItem(), 0, 1)
@@ -243,14 +252,12 @@ InstallerWindow::InstallerWindow()
.Add(fSizeView, 0, 6, 2) .Add(fSizeView, 0, 6, 2)
) )
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
.Add(fLaunchDriveSetupButton) .Add(fLaunchDriveSetupButton)
.Add(fLaunchBootmanButton)
.Add(fMakeBootableButton)
.AddGlue() .AddGlue()
.Add(fBeginButton) .Add(fBeginButton)
) )
.SetInsets(10, 10, 10, 10) .SetInsets(spacing, spacing, spacing, spacing)
) )
); );
@@ -271,17 +278,17 @@ InstallerWindow::InstallerWindow()
"Partitions can be initialized with the\n" "Partitions can be initialized with the\n"
"Be File System needed for a Haiku boot\n" "Be File System needed for a Haiku boot\n"
"partition.")); "partition."));
fLaunchBootmanButton->SetToolTip( // fLaunchBootmanItem->SetToolTip(
TR("Install or uninstall the Haiku boot menu, which allows to " // TR("Install or uninstall the Haiku boot menu, which allows to "
"choose an operating system to boot when the computer starts.\n" // "choose an operating system to boot when the computer starts.\n"
"If this computer already has a boot manager such as GRUB installed, " // "If this computer already has a boot manager such as GRUB installed, "
"it is better to add Haiku to that menu than to overwrite it.")); // "it is better to add Haiku to that menu than to overwrite it."));
fMakeBootableButton->SetToolTip( // fMakeBootableItem->SetToolTip(
TR("Writes the Haiku boot code to the partition start\n" // TR("Writes the Haiku boot code to the partition start\n"
"sector. This step is automatically performed by\n" // "sector. This step is automatically performed by\n"
"the installation, but you can manually make a\n" // "the installation, but you can manually make a\n"
"partition bootable in case you do not need to\n" // "partition bootable in case you do not need to\n"
"perform an installation.")); // "perform an installation."));
// finish creating window // finish creating window
if (!be_roster->IsRunning(kDeskbarSignature)) if (!be_roster->IsRunning(kDeskbarSignature))
@@ -298,7 +305,7 @@ InstallerWindow::InstallerWindow()
if (Lock()) { if (Lock()) {
fLaunchDriveSetupButton->SetEnabled(!fDriveSetupLaunched); fLaunchDriveSetupButton->SetEnabled(!fDriveSetupLaunched);
fLaunchBootmanButton->SetEnabled(!fBootmanLaunched); fLaunchBootmanItem->SetEnabled(!fBootmanLaunched);
Unlock(); Unlock();
} }
@@ -648,8 +655,8 @@ void
InstallerWindow::_DisableInterface(bool disable) InstallerWindow::_DisableInterface(bool disable)
{ {
fLaunchDriveSetupButton->SetEnabled(!disable); fLaunchDriveSetupButton->SetEnabled(!disable);
fLaunchBootmanButton->SetEnabled(!disable); fLaunchBootmanItem->SetEnabled(!disable);
fMakeBootableButton->SetEnabled(!disable); fMakeBootableItem->SetEnabled(!disable);
fSrcMenuField->SetEnabled(!disable); fSrcMenuField->SetEnabled(!disable);
fDestMenuField->SetEnabled(!disable); fDestMenuField->SetEnabled(!disable);
} }
@@ -747,9 +754,11 @@ InstallerWindow::_UpdateControls()
label = buffer; label = buffer;
} else } else
label = TR("Write boot sector"); label = TR("Write boot sector");
fMakeBootableButton->SetEnabled(dstItem != NULL); fMakeBootableItem->SetEnabled(dstItem != NULL);
fMakeBootableButton->SetLabel(label.String()); fMakeBootableItem->SetLabel(label.String());
fLaunchBootmanButton->SetEnabled(dstItem != NULL); // TODO: Once bootman support writing to specific disks, enable this, since
// we would pass it the disk which contains the target partition.
// fLaunchBootmanItem->SetEnabled(dstItem != NULL);
if (!fEncouragedToSetupPartitions && !foundOneSuitableTarget) { if (!fEncouragedToSetupPartitions && !foundOneSuitableTarget) {
// Focus the users attention on the DriveSetup button // Focus the users attention on the DriveSetup button
+3 -2
View File
@@ -18,6 +18,7 @@ class BButton;
class BLayoutItem; class BLayoutItem;
class BMenu; class BMenu;
class BMenuField; class BMenuField;
class BMenuItem;
class BStatusBar; class BStatusBar;
class BStringView; class BStringView;
class BTextView; class BTextView;
@@ -86,8 +87,8 @@ private:
BButton* fBeginButton; BButton* fBeginButton;
BButton* fLaunchDriveSetupButton; BButton* fLaunchDriveSetupButton;
BButton* fLaunchBootmanButton; BMenuItem* fLaunchBootmanItem;
BButton* fMakeBootableButton; BMenuItem* fMakeBootableItem;
bool fEncouragedToSetupPartitions; bool fEncouragedToSetupPartitions;