* 'PNG ' -> B_PNG_FORMAT
* reformat long lines so that they don't exceed 80 chars git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22751 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ac1a8a0c8d
commit
ed7081f728
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
//#define COPY_TRACE
|
//#define COPY_TRACE
|
||||||
#ifdef COPY_TRACE
|
#ifdef COPY_TRACE
|
||||||
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
|
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
|
||||||
#define ERR2(x, y...) fprintf(stderr, "CopyEngine: "x" %s\n", y, strerror(err))
|
#define ERR2(x, y...) fprintf(stderr, "CopyEngine: "x" %s\n", y, strerror(err))
|
||||||
#define ERR(x) fprintf(stderr, "CopyEngine: "x" %s\n", strerror(err))
|
#define ERR(x) fprintf(stderr, "CopyEngine: "x" %s\n", strerror(err))
|
||||||
#else
|
#else
|
||||||
#define CALLED()
|
#define CALLED()
|
||||||
#define ERR(x)
|
#define ERR(x)
|
||||||
@ -49,7 +49,7 @@ class TargetVisitor : public BDiskDeviceVisitor
|
|||||||
virtual bool Visit(BDiskDevice *device);
|
virtual bool Visit(BDiskDevice *device);
|
||||||
virtual bool Visit(BPartition *partition, int32 level);
|
virtual bool Visit(BPartition *partition, int32 level);
|
||||||
private:
|
private:
|
||||||
void MakeLabel(BPartition *partition, char *label, char *menuLabel);
|
void _MakeLabel(BPartition *partition, char *label, char *menuLabel);
|
||||||
BMenu *fMenu;
|
BMenu *fMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,10 +71,13 @@ CopyEngine::MessageReceived(BMessage*msg)
|
|||||||
CALLED();
|
CALLED();
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case ENGINE_START:
|
case ENGINE_START:
|
||||||
status_t err = Start(fWindow->GetSourceMenu(), fWindow->GetTargetMenu());
|
{
|
||||||
|
status_t err = Start(fWindow->GetSourceMenu(),
|
||||||
|
fWindow->GetTargetMenu());
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
ERR("Start failed");
|
ERR("Start failed");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +142,8 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
|||||||
if (fDDRoster.GetPartitionWithID(targetItem->ID(), &device, &partition) == B_OK) {
|
if (fDDRoster.GetPartitionWithID(targetItem->ID(), &device, &partition) == B_OK) {
|
||||||
if (!partition->IsMounted()) {
|
if (!partition->IsMounted()) {
|
||||||
if ((err = partition->Mount()) < B_OK) {
|
if ((err = partition->Mount()) < B_OK) {
|
||||||
SetStatusMessage("The disk can't be mounted. Please choose a different disk.");
|
SetStatusMessage("The disk can't be mounted. Please choose a "
|
||||||
|
"different disk.");
|
||||||
ERR("BPartition::Mount");
|
ERR("BPartition::Mount");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -155,7 +159,8 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
|||||||
} else if (fDDRoster.GetDeviceWithID(targetItem->ID(), &device) == B_OK) {
|
} else if (fDDRoster.GetDeviceWithID(targetItem->ID(), &device) == B_OK) {
|
||||||
if (!device.IsMounted()) {
|
if (!device.IsMounted()) {
|
||||||
if ((err = device.Mount()) < B_OK) {
|
if ((err = device.Mount()) < B_OK) {
|
||||||
SetStatusMessage("The disk can't be mounted. Please choose a different disk.");
|
SetStatusMessage("The disk can't be mounted. Please choose a "
|
||||||
|
"different disk.");
|
||||||
ERR("BDiskDevice::Mount");
|
ERR("BDiskDevice::Mount");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -173,8 +178,9 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
|||||||
|
|
||||||
// check if target has enough space
|
// check if target has enough space
|
||||||
if ((fSpaceRequired > 0 && targetVolume.FreeBytes() < fSpaceRequired)
|
if ((fSpaceRequired > 0 && targetVolume.FreeBytes() < fSpaceRequired)
|
||||||
&& ((new BAlert("", "The destination disk may not have enough space. Try choosing a different disk or \
|
&& ((new BAlert("", "The destination disk may not have enough space. "
|
||||||
choose to not install optional items.", "Try installing anyway", "Cancel", 0,
|
"Try choosing a different disk or choose to not install optional "
|
||||||
|
"items.", "Try installing anyway", "Cancel", 0,
|
||||||
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) {
|
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) {
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@ -195,14 +201,16 @@ choose to not install optional items.", "Try installing anyway", "Cancel", 0,
|
|||||||
|
|
||||||
// check not installing on itself
|
// check not installing on itself
|
||||||
if (strcmp(srcDirectory.Path(), targetDirectory.Path()) == 0) {
|
if (strcmp(srcDirectory.Path(), targetDirectory.Path()) == 0) {
|
||||||
SetStatusMessage("You can't install the contents of a disk onto itself. Please choose a different disk.");
|
SetStatusMessage("You can't install the contents of a disk onto "
|
||||||
|
"itself. Please choose a different disk.");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check not installing on boot volume
|
// check not installing on boot volume
|
||||||
if ((strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0)
|
if ((strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0)
|
||||||
&& ((new BAlert("", "Are you sure you want to install onto the current boot disk? \
|
&& ((new BAlert("", "Are you sure you want to install onto the "
|
||||||
The installer will have to reboot your machine if you proceed.", "OK", "Cancel", 0,
|
"current boot disk? The installer will have to reboot your "
|
||||||
|
"machine if you proceed.", "OK", "Cancel", 0,
|
||||||
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) {
|
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) {
|
||||||
SetStatusMessage("Installation stopped.");
|
SetStatusMessage("Installation stopped.");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -255,7 +263,8 @@ CopyEngine::CopyFolder(BDirectory &srcDir, BDirectory &targetDir)
|
|||||||
}
|
}
|
||||||
err = FSCopyFolder(&entry, &targetDir, fControl, NULL, false, undo);
|
err = FSCopyFolder(&entry, &targetDir, fControl, NULL, false, undo);
|
||||||
} else {
|
} else {
|
||||||
err = FSCopyFile(&entry, &statbuf, &targetDir, fControl, NULL, false, undo);
|
err = FSCopyFile(&entry, &statbuf, &targetDir, fControl, NULL,
|
||||||
|
false, undo);
|
||||||
}
|
}
|
||||||
if (err != B_OK) {
|
if (err != B_OK) {
|
||||||
BPath path;
|
BPath path;
|
||||||
@ -290,6 +299,9 @@ CopyEngine::SetPackagesList(BList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
SourceVisitor::SourceVisitor(BMenu *menu)
|
SourceVisitor::SourceVisitor(BMenu *menu)
|
||||||
: fMenu(menu)
|
: fMenu(menu)
|
||||||
{
|
{
|
||||||
@ -298,12 +310,14 @@ SourceVisitor::SourceVisitor(BMenu *menu)
|
|||||||
bool
|
bool
|
||||||
SourceVisitor::Visit(BDiskDevice *device)
|
SourceVisitor::Visit(BDiskDevice *device)
|
||||||
{
|
{
|
||||||
if (!device->ContentType() || strcmp(device->ContentType(), kPartitionTypeBFS) != 0)
|
if (!device->ContentType()
|
||||||
|
|| strcmp(device->ContentType(), kPartitionTypeBFS) != 0)
|
||||||
return false;
|
return false;
|
||||||
BPath path;
|
BPath path;
|
||||||
if (device->GetPath(&path) == B_OK)
|
if (device->GetPath(&path) == B_OK)
|
||||||
printf("SourceVisitor::Visit(BDiskDevice *) : %s type:%s, contentType:%s\n",
|
printf("SourceVisitor::Visit(BDiskDevice *) : %s type:%s, "
|
||||||
path.Path(), device->Type(), device->ContentType());
|
"contentType:%s\n", path.Path(), device->Type(),
|
||||||
|
device->ContentType());
|
||||||
PartitionMenuItem *item = new PartitionMenuItem(NULL, device->ContentName(), NULL, new BMessage(SRC_PARTITION), device->ID());
|
PartitionMenuItem *item = new PartitionMenuItem(NULL, device->ContentName(), NULL, new BMessage(SRC_PARTITION), device->ID());
|
||||||
if (device->IsMounted()) {
|
if (device->IsMounted()) {
|
||||||
BPath mountPoint;
|
BPath mountPoint;
|
||||||
@ -319,13 +333,16 @@ SourceVisitor::Visit(BDiskDevice *device)
|
|||||||
bool
|
bool
|
||||||
SourceVisitor::Visit(BPartition *partition, int32 level)
|
SourceVisitor::Visit(BPartition *partition, int32 level)
|
||||||
{
|
{
|
||||||
if (!partition->ContentType() || strcmp(partition->ContentType(), kPartitionTypeBFS) != 0)
|
if (!partition->ContentType()
|
||||||
|
|| strcmp(partition->ContentType(), kPartitionTypeBFS) != 0)
|
||||||
return false;
|
return false;
|
||||||
BPath path;
|
BPath path;
|
||||||
if (partition->GetPath(&path) == B_OK)
|
if (partition->GetPath(&path) == B_OK)
|
||||||
printf("SourceVisitor::Visit(BPartition *) : %s\n", path.Path());
|
printf("SourceVisitor::Visit(BPartition *) : %s\n", path.Path());
|
||||||
printf("SourceVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
printf("SourceVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
||||||
PartitionMenuItem *item = new PartitionMenuItem(NULL, partition->ContentName(), NULL, new BMessage(SRC_PARTITION), partition->ID());
|
PartitionMenuItem *item = new PartitionMenuItem(NULL,
|
||||||
|
partition->ContentName(), NULL, new BMessage(SRC_PARTITION),
|
||||||
|
partition->ID());
|
||||||
if (partition->IsMounted()) {
|
if (partition->IsMounted()) {
|
||||||
BPath mountPoint;
|
BPath mountPoint;
|
||||||
partition->GetMountPoint(&mountPoint);
|
partition->GetMountPoint(&mountPoint);
|
||||||
@ -337,6 +354,9 @@ SourceVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
TargetVisitor::TargetVisitor(BMenu *menu)
|
TargetVisitor::TargetVisitor(BMenu *menu)
|
||||||
: fMenu(menu)
|
: fMenu(menu)
|
||||||
{
|
{
|
||||||
@ -352,8 +372,9 @@ TargetVisitor::Visit(BDiskDevice *device)
|
|||||||
if (device->GetPath(&path) == B_OK)
|
if (device->GetPath(&path) == B_OK)
|
||||||
printf("TargetVisitor::Visit(BDiskDevice *) : %s\n", path.Path());
|
printf("TargetVisitor::Visit(BDiskDevice *) : %s\n", path.Path());
|
||||||
char label[255], menuLabel[255];
|
char label[255], menuLabel[255];
|
||||||
MakeLabel(device, label, menuLabel);
|
_MakeLabel(device, label, menuLabel);
|
||||||
fMenu->AddItem(new PartitionMenuItem(device->ContentName(), label, menuLabel, new BMessage(TARGET_PARTITION), device->ID()));
|
fMenu->AddItem(new PartitionMenuItem(device->ContentName(), label,
|
||||||
|
menuLabel, new BMessage(TARGET_PARTITION), device->ID()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,14 +389,15 @@ TargetVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path());
|
printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path());
|
||||||
printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
||||||
char label[255], menuLabel[255];
|
char label[255], menuLabel[255];
|
||||||
MakeLabel(partition, label, menuLabel);
|
_MakeLabel(partition, label, menuLabel);
|
||||||
fMenu->AddItem(new PartitionMenuItem(partition->ContentName(), label, menuLabel, new BMessage(TARGET_PARTITION), partition->ID()));
|
fMenu->AddItem(new PartitionMenuItem(partition->ContentName(), label,
|
||||||
|
menuLabel, new BMessage(TARGET_PARTITION), partition->ID()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TargetVisitor::MakeLabel(BPartition *partition, char *label, char *menuLabel)
|
TargetVisitor::_MakeLabel(BPartition *partition, char *label, char *menuLabel)
|
||||||
{
|
{
|
||||||
char size[15];
|
char size[15];
|
||||||
SizeAsString(partition->ContentSize(), size);
|
SizeAsString(partition->ContentSize(), size);
|
||||||
@ -383,9 +405,10 @@ TargetVisitor::MakeLabel(BPartition *partition, char *label, char *menuLabel)
|
|||||||
if (partition->Parent())
|
if (partition->Parent())
|
||||||
partition->Parent()->GetPath(&path);
|
partition->Parent()->GetPath(&path);
|
||||||
|
|
||||||
sprintf(label, "%s - %s [%s] [%s partition:%li]", partition->ContentName(), size, partition->ContentType(),
|
sprintf(label, "%s - %s [%s] [%s partition:%li]", partition->ContentName(),
|
||||||
path.Path(), partition->ID());
|
size, partition->ContentType(), path.Path(), partition->ID());
|
||||||
sprintf(menuLabel, "%s - %s [%s]", partition->ContentName(), size, partition->ContentType());
|
sprintf(menuLabel, "%s - %s [%s]", partition->ContentName(), size,
|
||||||
|
partition->ContentType());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
#include <TranslatorFormats.h>
|
||||||
#include "InstallerWindow.h"
|
#include "InstallerWindow.h"
|
||||||
#include "PartitionMenuItem.h"
|
#include "PartitionMenuItem.h"
|
||||||
|
|
||||||
@ -38,9 +39,10 @@ class LogoView : public BBox {
|
|||||||
|
|
||||||
|
|
||||||
LogoView::LogoView(const BRect &r)
|
LogoView::LogoView(const BRect &r)
|
||||||
: BBox(r, "logoview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER)
|
: BBox(r, "logoview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW,
|
||||||
|
B_NO_BORDER)
|
||||||
{
|
{
|
||||||
fLogo = BTranslationUtils::GetBitmap('PNG ', "haikulogo.png");
|
fLogo = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "haikulogo.png");
|
||||||
if (fLogo) {
|
if (fLogo) {
|
||||||
fDrawPoint.x = (r.Width() - fLogo->Bounds().Width()) / 2;
|
fDrawPoint.x = (r.Width() - fLogo->Bounds().Width()) / 2;
|
||||||
fDrawPoint.y = 0;
|
fDrawPoint.y = 0;
|
||||||
@ -62,8 +64,12 @@ LogoView::Draw(BRect update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
InstallerWindow::InstallerWindow(BRect frame_rect)
|
InstallerWindow::InstallerWindow(BRect frame_rect)
|
||||||
: BWindow(frame_rect, "Installer", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
|
: BWindow(frame_rect, "Installer", B_TITLED_WINDOW,
|
||||||
|
B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
|
||||||
fDriveSetupLaunched(false),
|
fDriveSetupLaunched(false),
|
||||||
fLastSrcItem(NULL),
|
fLastSrcItem(NULL),
|
||||||
fLastTargetItem(NULL)
|
fLastTargetItem(NULL)
|
||||||
@ -73,7 +79,8 @@ InstallerWindow::InstallerWindow(BRect frame_rect)
|
|||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
bounds.bottom += 1;
|
bounds.bottom += 1;
|
||||||
bounds.right += 1;
|
bounds.right += 1;
|
||||||
fBackBox = new BBox(bounds, NULL, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
|
fBackBox = new BBox(bounds, NULL, B_FOLLOW_ALL,
|
||||||
|
B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
|
||||||
AddChild(fBackBox);
|
AddChild(fBackBox);
|
||||||
|
|
||||||
BRect logoRect = fBackBox->Bounds();
|
BRect logoRect = fBackBox->Bounds();
|
||||||
@ -84,7 +91,8 @@ InstallerWindow::InstallerWindow(BRect frame_rect)
|
|||||||
LogoView *logoView = new LogoView(logoRect);
|
LogoView *logoView = new LogoView(logoRect);
|
||||||
fBackBox->AddChild(logoView);
|
fBackBox->AddChild(logoView);
|
||||||
|
|
||||||
BRect statusRect(bounds.right - 222, logoRect.top + 2, bounds.right - 14, logoRect.bottom - B_H_SCROLL_BAR_HEIGHT + 4);
|
BRect statusRect(bounds.right - 222, logoRect.top + 2, bounds.right - 14,
|
||||||
|
logoRect.bottom - B_H_SCROLL_BAR_HEIGHT + 4);
|
||||||
BRect textRect(statusRect);
|
BRect textRect(statusRect);
|
||||||
textRect.OffsetTo(B_ORIGIN);
|
textRect.OffsetTo(B_ORIGIN);
|
||||||
textRect.InsetBy(2, 2);
|
textRect.InsetBy(2, 2);
|
||||||
@ -93,34 +101,42 @@ InstallerWindow::InstallerWindow(BRect frame_rect)
|
|||||||
fStatusView->MakeEditable(false);
|
fStatusView->MakeEditable(false);
|
||||||
fStatusView->MakeSelectable(false);
|
fStatusView->MakeSelectable(false);
|
||||||
|
|
||||||
BScrollView *scroll = new BScrollView("statusScroll", fStatusView, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS);
|
BScrollView *scroll = new BScrollView("statusScroll", fStatusView,
|
||||||
|
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS);
|
||||||
fBackBox->AddChild(scroll);
|
fBackBox->AddChild(scroll);
|
||||||
|
|
||||||
fBeginButton = new BButton(BRect(bounds.right - 90, bounds.bottom - 35, bounds.right - 11, bounds.bottom - 11),
|
fBeginButton = new BButton(BRect(bounds.right - 90, bounds.bottom - 35,
|
||||||
"begin_button", "Begin", new BMessage(BEGIN_MESSAGE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
bounds.right - 11, bounds.bottom - 11),
|
||||||
|
"begin_button", "Begin", new BMessage(BEGIN_MESSAGE),
|
||||||
|
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
fBeginButton->MakeDefault(true);
|
fBeginButton->MakeDefault(true);
|
||||||
fBackBox->AddChild(fBeginButton);
|
fBackBox->AddChild(fBeginButton);
|
||||||
|
|
||||||
fSetupButton = new BButton(BRect(bounds.left + 11, bounds.bottom - 35,
|
fSetupButton = new BButton(BRect(bounds.left + 11, bounds.bottom - 35,
|
||||||
bounds.left + be_plain_font->StringWidth("Setup partitions") + 36, bounds.bottom - 22),
|
bounds.left + be_plain_font->StringWidth("Setup partitions") + 36,
|
||||||
"setup_button", "Setup partitions" B_UTF8_ELLIPSIS, new BMessage(SETUP_MESSAGE), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
bounds.bottom - 22), "setup_button", "Setup partitions" B_UTF8_ELLIPSIS,
|
||||||
|
new BMessage(SETUP_MESSAGE), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
fBackBox->AddChild(fSetupButton);
|
fBackBox->AddChild(fSetupButton);
|
||||||
fSetupButton->Hide();
|
fSetupButton->Hide();
|
||||||
|
|
||||||
fPackagesView = new PackagesView(BRect(bounds.left + 12, bounds.top + 4, bounds.right - 15 - B_V_SCROLL_BAR_WIDTH, bounds.bottom - 61), "packages_view");
|
fPackagesView = new PackagesView(BRect(bounds.left + 12, bounds.top + 4,
|
||||||
fPackagesScrollView = new BScrollView("packagesScroll", fPackagesView, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW,
|
bounds.right - 15 - B_V_SCROLL_BAR_WIDTH, bounds.bottom - 61),
|
||||||
false, true);
|
"packages_view");
|
||||||
|
fPackagesScrollView = new BScrollView("packagesScroll", fPackagesView,
|
||||||
|
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW, false, true);
|
||||||
fBackBox->AddChild(fPackagesScrollView);
|
fBackBox->AddChild(fPackagesScrollView);
|
||||||
fPackagesScrollView->Hide();
|
fPackagesScrollView->Hide();
|
||||||
|
|
||||||
fDrawButton = new DrawButton(BRect(bounds.left + 12, bounds.bottom - 33, bounds.left + 120, bounds.bottom - 20),
|
fDrawButton = new DrawButton(BRect(bounds.left + 12, bounds.bottom - 33,
|
||||||
"options_button", "Fewer options", "More options", new BMessage(SHOW_BOTTOM_MESSAGE));
|
bounds.left + 120, bounds.bottom - 20), "options_button",
|
||||||
|
"Fewer options", "More options", new BMessage(SHOW_BOTTOM_MESSAGE));
|
||||||
fBackBox->AddChild(fDrawButton);
|
fBackBox->AddChild(fDrawButton);
|
||||||
|
|
||||||
fDestMenu = new BPopUpMenu("scanning" B_UTF8_ELLIPSIS, true, false);
|
fDestMenu = new BPopUpMenu("scanning" B_UTF8_ELLIPSIS, true, false);
|
||||||
fSrcMenu = new BPopUpMenu("scanning" B_UTF8_ELLIPSIS, true, false);
|
fSrcMenu = new BPopUpMenu("scanning" B_UTF8_ELLIPSIS, true, false);
|
||||||
|
|
||||||
BRect fieldRect(bounds.left + 50, bounds.top + 70, bounds.right - 13, bounds.top + 90);
|
BRect fieldRect(bounds.left + 50, bounds.top + 70, bounds.right - 13,
|
||||||
|
bounds.top + 90);
|
||||||
fSrcMenuField = new BMenuField(fieldRect, "srcMenuField",
|
fSrcMenuField = new BMenuField(fieldRect, "srcMenuField",
|
||||||
"Install from: ", fSrcMenu);
|
"Install from: ", fSrcMenu);
|
||||||
fSrcMenuField->SetDivider(bounds.right - 274);
|
fSrcMenuField->SetDivider(bounds.right - 274);
|
||||||
@ -138,8 +154,11 @@ InstallerWindow::InstallerWindow(BRect frame_rect)
|
|||||||
sizeRect.top = 105;
|
sizeRect.top = 105;
|
||||||
sizeRect.bottom = sizeRect.top + 15;
|
sizeRect.bottom = sizeRect.top + 15;
|
||||||
sizeRect.right -= 12;
|
sizeRect.right -= 12;
|
||||||
sizeRect.left = sizeRect.right - be_plain_font->StringWidth("Disk space required: 0.0 KB") - 40;
|
const char* requiredDiskSpaceString = "Disk space required: 0.0 KB";
|
||||||
fSizeView = new BStringView(sizeRect, "size_view", "Disk space required: 0.0 KB", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
sizeRect.left = sizeRect.right - be_plain_font->StringWidth(
|
||||||
|
requiredDiskSpaceString) - 40;
|
||||||
|
fSizeView = new BStringView(sizeRect, "size_view",
|
||||||
|
requiredDiskSpaceString, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
fSizeView->SetAlignment(B_ALIGN_RIGHT);
|
fSizeView->SetAlignment(B_ALIGN_RIGHT);
|
||||||
fBackBox->AddChild(fSizeView);
|
fBackBox->AddChild(fSizeView);
|
||||||
fSizeView->Hide();
|
fSizeView->Hide();
|
||||||
@ -224,7 +243,9 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
fDriveSetupLaunched = msg->what == B_SOME_APP_LAUNCHED;
|
fDriveSetupLaunched = msg->what == B_SOME_APP_LAUNCHED;
|
||||||
DisableInterface(fDriveSetupLaunched);
|
DisableInterface(fDriveSetupLaunched);
|
||||||
if (fDriveSetupLaunched)
|
if (fDriveSetupLaunched)
|
||||||
SetStatusMessage("Running DriveSetup" B_UTF8_ELLIPSIS "\nClose DriveSetup to continue with the\ninstallation.");
|
SetStatusMessage("Running DriveSetup" B_UTF8_ELLIPSIS
|
||||||
|
"\nClose DriveSetup to continue with the\n"
|
||||||
|
"installation.");
|
||||||
else
|
else
|
||||||
StartScan();
|
StartScan();
|
||||||
}
|
}
|
||||||
@ -241,7 +262,8 @@ InstallerWindow::QuitRequested()
|
|||||||
{
|
{
|
||||||
if (fDriveSetupLaunched) {
|
if (fDriveSetupLaunched) {
|
||||||
(new BAlert("driveSetup",
|
(new BAlert("driveSetup",
|
||||||
"Please close the DriveSetup window before closing the\nInstaller window.", "OK"))->Go();
|
"Please close the DriveSetup window before closing the\n"
|
||||||
|
"Installer window.", "OK"))->Go();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
@ -308,7 +330,8 @@ InstallerWindow::StartScan()
|
|||||||
PublishPackages();
|
PublishPackages();
|
||||||
}
|
}
|
||||||
AdjustMenus();
|
AdjustMenus();
|
||||||
SetStatusMessage("Choose the disk you want to install onto from the pop-up menu. Then click \"Begin\".");
|
SetStatusMessage("Choose the disk you want to install onto from the "
|
||||||
|
"pop-up menu. Then click \"Begin\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -321,8 +344,10 @@ InstallerWindow::AdjustMenus()
|
|||||||
} else {
|
} else {
|
||||||
if (fSrcMenu->CountItems() == 0)
|
if (fSrcMenu->CountItems() == 0)
|
||||||
fSrcMenuField->MenuItem()->SetLabel("<none>");
|
fSrcMenuField->MenuItem()->SetLabel("<none>");
|
||||||
else
|
else {
|
||||||
fSrcMenuField->MenuItem()->SetLabel(((PartitionMenuItem *)fSrcMenu->ItemAt(0))->MenuLabel());
|
fSrcMenuField->MenuItem()->SetLabel(
|
||||||
|
((PartitionMenuItem *)fSrcMenu->ItemAt(0))->MenuLabel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PartitionMenuItem *item2 = (PartitionMenuItem *)fDestMenu->FindMarked();
|
PartitionMenuItem *item2 = (PartitionMenuItem *)fDestMenu->FindMarked();
|
||||||
@ -331,8 +356,10 @@ InstallerWindow::AdjustMenus()
|
|||||||
} else {
|
} else {
|
||||||
if (fDestMenu->CountItems() == 0)
|
if (fDestMenu->CountItems() == 0)
|
||||||
fDestMenuField->MenuItem()->SetLabel("<none>");
|
fDestMenuField->MenuItem()->SetLabel("<none>");
|
||||||
else
|
else {
|
||||||
fDestMenuField->MenuItem()->SetLabel(((PartitionMenuItem *)fDestMenu->ItemAt(0))->MenuLabel());
|
fDestMenuField->MenuItem()->SetLabel(
|
||||||
|
((PartitionMenuItem *)fDestMenu->ItemAt(0))->MenuLabel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
char message[255];
|
char message[255];
|
||||||
sprintf(message, "Press the Begin button to install from '%s' onto '%s'",
|
sprintf(message, "Press the Begin button to install from '%s' onto '%s'",
|
||||||
|
Loading…
Reference in New Issue
Block a user