* Changed some kind of broken translation strings (like replacements with a
fixed order). * Style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40111 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2009, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2008-2010, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -7,6 +7,7 @@
|
||||
* Axel Dörfler <[email protected]>
|
||||
*/
|
||||
|
||||
|
||||
#include "BootManagerWindow.h"
|
||||
|
||||
#include <Alert.h>
|
||||
@@ -20,21 +21,21 @@
|
||||
#define B_TRANSLATE_CONTEXT "BootManager"
|
||||
|
||||
|
||||
static const char* kSignature = "application/x-vnd.Haiku-bootman";
|
||||
static const char* kSignature = "application/x-vnd.Haiku-BootManager";
|
||||
|
||||
|
||||
class BootManager : public BApplication {
|
||||
public:
|
||||
BootManager();
|
||||
BootManager();
|
||||
|
||||
virtual void ReadyToRun();
|
||||
|
||||
virtual void AboutRequested();
|
||||
virtual void ReadyToRun();
|
||||
virtual void AboutRequested();
|
||||
};
|
||||
|
||||
|
||||
BootManager::BootManager()
|
||||
: BApplication(kSignature)
|
||||
:
|
||||
BApplication(kSignature)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ BootManager::BootManager()
|
||||
void
|
||||
BootManager::ReadyToRun()
|
||||
{
|
||||
BootManagerWindow * window = new BootManagerWindow();
|
||||
BootManagerWindow* window = new BootManagerWindow();
|
||||
window->Show();
|
||||
}
|
||||
|
||||
@@ -51,16 +52,15 @@ void
|
||||
BootManager::AboutRequested()
|
||||
{
|
||||
BString aboutText;
|
||||
const char* title = B_TRANSLATE_COMMENT("Haiku Boot Manager",
|
||||
"About text title");
|
||||
aboutText <<
|
||||
title << "\n\n" <<
|
||||
B_TRANSLATE("written by") << "\n"
|
||||
"\tDavid Dengg\n"
|
||||
"\tMichael Pfeiffer\n"
|
||||
"\n" <<
|
||||
B_TRANSLATE_COMMENT("Copyright %year, Haiku Inc.\n",
|
||||
"Leave %year untranslated");
|
||||
const char* title = B_TRANSLATE_COMMENT("BootManager", "Application name");
|
||||
aboutText << title << "\n\n"
|
||||
<< B_TRANSLATE("written by")
|
||||
<< "\n"
|
||||
"\tDavid Dengg\n"
|
||||
"\tMichael Pfeiffer\n"
|
||||
"\n"
|
||||
<< B_TRANSLATE_COMMENT("Copyright %year, Haiku Inc.\n",
|
||||
"Leave %year untranslated");
|
||||
aboutText.ReplaceLast("%year", "2008-2010");
|
||||
BAlert *alert = new BAlert("about",
|
||||
aboutText.String(), B_TRANSLATE("OK"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 20082009, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2008-2010, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -9,23 +9,6 @@
|
||||
|
||||
#include "BootManagerController.h"
|
||||
|
||||
#include "WizardView.h"
|
||||
|
||||
#include "EntryPage.h"
|
||||
#include "PartitionsPage.h"
|
||||
#include "DefaultPartitionPage.h"
|
||||
#include "DescriptionPage.h"
|
||||
#include "FileSelectionPage.h"
|
||||
#include "LegacyBootDrive.h"
|
||||
|
||||
|
||||
#define USE_TEST_BOOT_DRIVE 0
|
||||
|
||||
#if USE_TEST_BOOT_DRIVE
|
||||
#include "TestBootDrive.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Application.h>
|
||||
#include <Catalog.h>
|
||||
@@ -35,6 +18,21 @@
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
|
||||
#include "DefaultPartitionPage.h"
|
||||
#include "DescriptionPage.h"
|
||||
#include "EntryPage.h"
|
||||
#include "FileSelectionPage.h"
|
||||
#include "LegacyBootDrive.h"
|
||||
#include "PartitionsPage.h"
|
||||
#include "WizardView.h"
|
||||
|
||||
|
||||
#define USE_TEST_BOOT_DRIVE 0
|
||||
|
||||
#if USE_TEST_BOOT_DRIVE
|
||||
# include "TestBootDrive.h"
|
||||
#endif
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "BootManagerController"
|
||||
@@ -90,19 +88,19 @@ BootManagerController::NextState(int32 state)
|
||||
{
|
||||
switch (state) {
|
||||
case kStateEntry:
|
||||
{
|
||||
bool install;
|
||||
fSettings.FindBool("install", &install);
|
||||
if (install) {
|
||||
if (fBootDrive->IsBootMenuInstalled(&fSettings))
|
||||
return kStatePartitions;
|
||||
else
|
||||
return kStateSaveMBR;
|
||||
}
|
||||
else
|
||||
return kStateUninstall;
|
||||
{
|
||||
bool install;
|
||||
fSettings.FindBool("install", &install);
|
||||
if (install) {
|
||||
if (fBootDrive->IsBootMenuInstalled(&fSettings))
|
||||
return kStatePartitions;
|
||||
|
||||
return kStateSaveMBR;
|
||||
}
|
||||
|
||||
return kStateUninstall;
|
||||
}
|
||||
|
||||
case kStateErrorEntry:
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
break;
|
||||
@@ -150,7 +148,8 @@ bool
|
||||
BootManagerController::_HasSelectedPartitions()
|
||||
{
|
||||
BMessage message;
|
||||
for (int32 i = 0; fSettings.FindMessage("partition", i, &message) == B_OK; i ++) {
|
||||
for (int32 i = 0; fSettings.FindMessage("partition", i, &message) == B_OK;
|
||||
i++) {
|
||||
bool show;
|
||||
if (message.FindBool("show", &show) == B_OK && show)
|
||||
return true;
|
||||
@@ -168,16 +167,17 @@ BootManagerController::_HasSelectedPartitions()
|
||||
bool
|
||||
BootManagerController::_WriteBootMenu()
|
||||
{
|
||||
BAlert* alert = new BAlert("confirm", B_TRANSLATE("About to write the "
|
||||
BAlert* alert = new BAlert("confirm", B_TRANSLATE("About to write the "
|
||||
"boot menu to disk. Are you sure you want to continue?"),
|
||||
B_TRANSLATE_COMMENT("Write boot menu", "Button"),
|
||||
B_TRANSLATE_COMMENT("Back", "Button"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||
B_TRANSLATE_COMMENT("Write boot menu", "Button"),
|
||||
B_TRANSLATE_COMMENT("Back", "Button"), NULL, B_WIDTH_AS_USUAL,
|
||||
B_WARNING_ALERT);
|
||||
|
||||
if (alert->Go() == 1)
|
||||
return false;
|
||||
if (alert->Go() == 1)
|
||||
return false;
|
||||
|
||||
fWriteBootMenuStatus = fBootDrive->WriteBootMenu(&fSettings);
|
||||
return true;
|
||||
fWriteBootMenuStatus = fBootDrive->WriteBootMenu(&fSettings);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -279,19 +279,19 @@ BootManagerController::_CreateErrorEntryPage(BRect frame)
|
||||
{
|
||||
BString description;
|
||||
|
||||
if (fReadPartitionsStatus == kErrorBootSectorTooSmall)
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Partition table not compatible", "Title") <<
|
||||
"\n\n" <<
|
||||
B_TRANSLATE("The partition table of the first hard disk is not "
|
||||
"compatible with Boot Manager.\n"
|
||||
"Boot Manager needs 2 KB available space before the first "
|
||||
"partition.");
|
||||
else
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Error reading partition table", "Title") <<
|
||||
"\n\n" <<
|
||||
B_TRANSLATE("Boot Manager is unable to read the partition table!");
|
||||
if (fReadPartitionsStatus == kErrorBootSectorTooSmall) {
|
||||
description << B_TRANSLATE_COMMENT("Partition table not compatible",
|
||||
"Title") << "\n\n"
|
||||
<< B_TRANSLATE("The partition table of the first hard disk is not "
|
||||
"compatible with Boot Manager.\n"
|
||||
"Boot Manager needs 2 KB available space before the first "
|
||||
"partition.");
|
||||
} else {
|
||||
description << B_TRANSLATE_COMMENT("Error reading partition table",
|
||||
"Title") << "\n\n"
|
||||
<< B_TRANSLATE("Boot Manager is unable to read the partition "
|
||||
"table!");
|
||||
}
|
||||
|
||||
return new DescriptionPage(frame, "errorEntry", description.String(), true);
|
||||
}
|
||||
@@ -304,15 +304,15 @@ BootManagerController::_CreateSaveMBRPage(BRect frame)
|
||||
BString disk;
|
||||
fSettings.FindString("disk", &disk);
|
||||
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Backup Master Boot Record", "Title") << "\n\n" <<
|
||||
B_TRANSLATE("The Master Boot Record (MBR) of the boot device:\n"
|
||||
"\t%s\n"
|
||||
"will now be saved to disk. Please select a file to "
|
||||
"save the MBR into.\n\n"
|
||||
"If something goes wrong with the installation or if "
|
||||
"you later wish to remove the boot menu, simply run the "
|
||||
"bootman program and choose the 'Uninstall' option.");
|
||||
description << B_TRANSLATE_COMMENT("Backup Master Boot Record", "Title")
|
||||
<< "\n\n" << B_TRANSLATE("The Master Boot Record (MBR) of the boot "
|
||||
"device:\n"
|
||||
"\t%s\n"
|
||||
"will now be saved to disk. Please select a file to "
|
||||
"save the MBR into.\n\n"
|
||||
"If something goes wrong with the installation or if "
|
||||
"you later wish to remove the boot menu, simply run the "
|
||||
"bootman program and choose the 'Uninstall' option.");
|
||||
description.ReplaceFirst("%s", disk);
|
||||
|
||||
return new FileSelectionPage(&fSettings, frame, "saveMBR",
|
||||
@@ -329,17 +329,15 @@ BootManagerController::_CreateMBRSavedPage(BRect frame)
|
||||
fSettings.FindString("file", &file);
|
||||
|
||||
if (fSaveMBRStatus == B_OK) {
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Old Master Boot Record saved", "Title") <<
|
||||
"\n\n" <<
|
||||
B_TRANSLATE("The old Master Boot Record was successfully saved to "
|
||||
"%s.") << "\n";
|
||||
description << B_TRANSLATE_COMMENT("Old Master Boot Record saved",
|
||||
"Title") << "\n\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\n" <<
|
||||
B_TRANSLATE("The old Master Boot Record could not be saved to %s") <<
|
||||
"\n";
|
||||
description << B_TRANSLATE_COMMENT("Old Master Boot Record Saved "
|
||||
"failure", "Title") << "\n\n"
|
||||
<< B_TRANSLATE("The old Master Boot Record could not be saved "
|
||||
"to %s") << "\n";
|
||||
}
|
||||
description.ReplaceFirst("%s", file);
|
||||
|
||||
@@ -354,16 +352,15 @@ BootManagerController::_CreateInstallSummaryPage(BRect frame)
|
||||
BString disk;
|
||||
fSettings.FindString("disk", &disk);
|
||||
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Summary", "Title") << "\n\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 << B_TRANSLATE_COMMENT("Summary", "Title") << "\n\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 ++) {
|
||||
|
||||
for (int32 i = 0; fSettings.FindMessage("partition", i, &message) == B_OK;
|
||||
i++) {
|
||||
bool show;
|
||||
if (message.FindBool("show", &show) != B_OK || !show)
|
||||
continue;
|
||||
@@ -390,14 +387,14 @@ BootManagerController::_CreateInstalledPage(BRect frame)
|
||||
BString description;
|
||||
|
||||
if (fWriteBootMenuStatus == B_OK) {
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Installation of boot menu completed", "Title") << "\n\n" <<
|
||||
B_TRANSLATE("The boot manager has been successfully installed "
|
||||
description << B_TRANSLATE_COMMENT("Installation of boot menu "
|
||||
"completed", "Title") << "\n\n"
|
||||
<< B_TRANSLATE("The boot manager has been successfully installed "
|
||||
"on your system.");
|
||||
} else {
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Installation of boot menu failed", "Title") << "\n\n" <<
|
||||
B_TRANSLATE("An error occurred writing the boot menu. "
|
||||
description << B_TRANSLATE_COMMENT("Installation of boot menu failed",
|
||||
"Title") << "\n\n"
|
||||
<< B_TRANSLATE("An error occurred writing the boot menu. "
|
||||
"The Master Boot Record might be destroyed, "
|
||||
"you should restore the MBR now!");
|
||||
}
|
||||
@@ -410,11 +407,10 @@ WizardPageView*
|
||||
BootManagerController::_CreateUninstallPage(BRect frame)
|
||||
{
|
||||
BString description;
|
||||
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Uninstall boot manager", "Title") << "\n\n" <<
|
||||
B_TRANSLATE("Please locate the Master Boot Record (MBR) save file to "
|
||||
"restore from. This is the file that was created when the "
|
||||
description << B_TRANSLATE_COMMENT("Uninstall boot manager", "Title")
|
||||
<< "\n\n"
|
||||
<< B_TRANSLATE("Please locate the Master Boot Record (MBR) save file "
|
||||
"to restore from. This is the file that was created when the "
|
||||
"boot manager was first installed.");
|
||||
|
||||
return new FileSelectionPage(&fSettings, frame, "restoreMBR",
|
||||
@@ -432,17 +428,16 @@ BootManagerController::_CreateUninstalledPage(BRect frame)
|
||||
fSettings.FindString("file", &file);
|
||||
|
||||
if (fRestoreMBRStatus == B_OK) {
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Uninstallation of boot menu completed", "Title") <<
|
||||
"\n\n" <<
|
||||
B_TRANSLATE("The Master Boot Record of the boot device "
|
||||
"(%s) has been successfully restored from %s.");
|
||||
description.ReplaceFirst("%s", disk);
|
||||
description.ReplaceLast("%s", file);
|
||||
description << B_TRANSLATE_COMMENT("Uninstallation of boot menu "
|
||||
"completed", "Title") << "\n\n"
|
||||
<< B_TRANSLATE("The Master Boot Record of the boot device "
|
||||
"(%DISK) has been successfully restored from %FILE.");
|
||||
description.ReplaceFirst("%DISK", disk);
|
||||
description.ReplaceFirst("%FILE", file);
|
||||
} else {
|
||||
description <<
|
||||
B_TRANSLATE_COMMENT("Uninstallation of boot menu failed", "Title") << "\n\n" <<
|
||||
B_TRANSLATE("The Master Boot Record could not be restored!");
|
||||
description << B_TRANSLATE_COMMENT("Uninstallation of boot menu "
|
||||
"failed", "Title") << "\n\n"
|
||||
<< B_TRANSLATE("The Master Boot Record could not be restored!");
|
||||
}
|
||||
|
||||
return new DescriptionPage(frame, "summary", description.String(), true);
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
/*
|
||||
* Copyright 2008, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2008-2010, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
*
|
||||
* Authors:
|
||||
* Michael Pfeiffer <[email protected]>
|
||||
*/
|
||||
#ifndef BOOT_MANAGER_CONTROLLER_H
|
||||
#define BOOT_MANAGER_CONTROLLER_H
|
||||
|
||||
|
||||
#include "WizardController.h"
|
||||
|
||||
#include <Message.h>
|
||||
|
||||
|
||||
class BootDrive;
|
||||
|
||||
class WizardView;
|
||||
class WizardPageView;
|
||||
class BRect;
|
||||
|
||||
/*
|
||||
Remainder of Settings Message Format:
|
||||
(See also BootDrive.h)
|
||||
|
||||
/* Remainder of Settings Message Format:
|
||||
(See also BootDrive.h)
|
||||
"install" bool (whether install or uninstall should be performed)
|
||||
"file" String (the file where the backup of the MBR is saved)
|
||||
"defaultPartition" int32 (index of default partition)
|
||||
"timeout" int32 (timeout in seconds, -1 for no timeout)
|
||||
*/
|
||||
*/
|
||||
|
||||
class BootManagerController : public WizardController
|
||||
{
|
||||
class BootManagerController : public WizardController {
|
||||
public:
|
||||
BootManagerController();
|
||||
virtual ~BootManagerController();
|
||||
BootManagerController();
|
||||
virtual ~BootManagerController();
|
||||
|
||||
protected:
|
||||
virtual int32 InitialState();
|
||||
virtual int32 NextState(int32 state);
|
||||
virtual WizardPageView* CreatePage(int32 state, WizardView* wizard);
|
||||
virtual int32 InitialState();
|
||||
virtual int32 NextState(int32 state);
|
||||
virtual WizardPageView* CreatePage(int32 state, WizardView* wizard);
|
||||
|
||||
private:
|
||||
|
||||
enum State {
|
||||
kStateEntry,
|
||||
kStateErrorEntry,
|
||||
|
||||
|
||||
// Install states
|
||||
kStateSaveMBR,
|
||||
kStateMBRSaved,
|
||||
@@ -51,32 +51,32 @@ private:
|
||||
kStateDefaultPartitions,
|
||||
kStateInstallSummary,
|
||||
kStateInstalled,
|
||||
|
||||
|
||||
// Uninstall states
|
||||
kStateUninstall,
|
||||
kStateUninstalled
|
||||
};
|
||||
|
||||
bool _HasSelectedPartitions();
|
||||
bool _WriteBootMenu();
|
||||
bool _SaveMBR();
|
||||
bool _RestoreMBR();
|
||||
|
||||
WizardPageView* _CreateErrorEntryPage(BRect frame);
|
||||
WizardPageView* _CreateSaveMBRPage(BRect frame);
|
||||
WizardPageView* _CreateMBRSavedPage(BRect frame);
|
||||
WizardPageView* _CreateInstallSummaryPage(BRect frame);
|
||||
WizardPageView* _CreateInstalledPage(BRect frame);
|
||||
WizardPageView* _CreateUninstallPage(BRect frame);
|
||||
WizardPageView* _CreateUninstalledPage(BRect frame);
|
||||
|
||||
BMessage fSettings;
|
||||
BootDrive* fBootDrive;
|
||||
|
||||
status_t fReadPartitionsStatus;
|
||||
status_t fWriteBootMenuStatus;
|
||||
status_t fSaveMBRStatus;
|
||||
status_t fRestoreMBRStatus;
|
||||
|
||||
bool _HasSelectedPartitions();
|
||||
bool _WriteBootMenu();
|
||||
bool _SaveMBR();
|
||||
bool _RestoreMBR();
|
||||
|
||||
WizardPageView* _CreateErrorEntryPage(BRect frame);
|
||||
WizardPageView* _CreateSaveMBRPage(BRect frame);
|
||||
WizardPageView* _CreateMBRSavedPage(BRect frame);
|
||||
WizardPageView* _CreateInstallSummaryPage(BRect frame);
|
||||
WizardPageView* _CreateInstalledPage(BRect frame);
|
||||
WizardPageView* _CreateUninstallPage(BRect frame);
|
||||
WizardPageView* _CreateUninstalledPage(BRect frame);
|
||||
|
||||
BMessage fSettings;
|
||||
BootDrive* fBootDrive;
|
||||
|
||||
status_t fReadPartitionsStatus;
|
||||
status_t fWriteBootMenuStatus;
|
||||
status_t fSaveMBRStatus;
|
||||
status_t fRestoreMBRStatus;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
BootManagerWindow::BootManagerWindow()
|
||||
:
|
||||
BWindow(BRect(100, 100, 500, 400), B_TRANSLATE_COMMENT("Boot Manager",
|
||||
BWindow(BRect(100, 100, 500, 400), B_TRANSLATE_COMMENT("BootManager",
|
||||
"Window Title"),
|
||||
B_TITLED_WINDOW,
|
||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2008, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2008-2010, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
*
|
||||
* Authors:
|
||||
* Michael Pfeiffer <[email protected]>
|
||||
*/
|
||||
@@ -13,21 +13,22 @@
|
||||
|
||||
#include "BootManagerController.h"
|
||||
|
||||
|
||||
class WizardView;
|
||||
|
||||
class BootManagerWindow : public BWindow
|
||||
{
|
||||
|
||||
class BootManagerWindow : public BWindow {
|
||||
public:
|
||||
BootManagerWindow();
|
||||
virtual ~BootManagerWindow();
|
||||
BootManagerWindow();
|
||||
virtual ~BootManagerWindow();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
private:
|
||||
|
||||
BootManagerController fController;
|
||||
WizardView* fWizardView;
|
||||
BootManagerController fController;
|
||||
WizardView* fWizardView;
|
||||
};
|
||||
|
||||
|
||||
#endif // BOOT_MANAGER_WINDOW_H
|
||||
|
||||
Reference in New Issue
Block a user