* Adopted naming scheme for private methods
* Sorted methods to reflect order in .cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30376 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -344,11 +344,11 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
case RESET_INSTALL:
|
case RESET_INSTALL:
|
||||||
fInstallStatus = kReadyForInstall;
|
fInstallStatus = kReadyForInstall;
|
||||||
fBeginButton->SetEnabled(true);
|
fBeginButton->SetEnabled(true);
|
||||||
DisableInterface(false);
|
_DisableInterface(false);
|
||||||
fBeginButton->SetLabel("Begin");
|
fBeginButton->SetLabel("Begin");
|
||||||
break;
|
break;
|
||||||
case START_SCAN:
|
case START_SCAN:
|
||||||
StartScan();
|
_ScanPartitions();
|
||||||
break;
|
break;
|
||||||
case BEGIN_MESSAGE:
|
case BEGIN_MESSAGE:
|
||||||
switch (fInstallStatus) {
|
switch (fInstallStatus) {
|
||||||
@@ -362,13 +362,13 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
fInstallStatus = kInstalling;
|
fInstallStatus = kInstalling;
|
||||||
BMessenger(fCopyEngine).SendMessage(ENGINE_START);
|
BMessenger(fCopyEngine).SendMessage(ENGINE_START);
|
||||||
fBeginButton->SetLabel("Stop");
|
fBeginButton->SetLabel("Stop");
|
||||||
DisableInterface(true);
|
_DisableInterface(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kInstalling:
|
case kInstalling:
|
||||||
if (fCopyEngine->Cancel()) {
|
if (fCopyEngine->Cancel()) {
|
||||||
fInstallStatus = kCancelled;
|
fInstallStatus = kCancelled;
|
||||||
SetStatusMessage("Installation cancelled.");
|
_SetStatusMessage("Installation cancelled.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kFinished:
|
case kFinished:
|
||||||
@@ -379,23 +379,23 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SHOW_BOTTOM_MESSAGE:
|
case SHOW_BOTTOM_MESSAGE:
|
||||||
ShowBottom();
|
_ShowOptionalPackages();
|
||||||
break;
|
break;
|
||||||
case SRC_PARTITION:
|
case SRC_PARTITION:
|
||||||
if (fLastSrcItem == fSrcMenu->FindMarked())
|
if (fLastSrcItem == fSrcMenu->FindMarked())
|
||||||
break;
|
break;
|
||||||
fLastSrcItem = fSrcMenu->FindMarked();
|
fLastSrcItem = fSrcMenu->FindMarked();
|
||||||
PublishPackages();
|
_PublishPackages();
|
||||||
AdjustMenus();
|
_UpdateMenus();
|
||||||
break;
|
break;
|
||||||
case TARGET_PARTITION:
|
case TARGET_PARTITION:
|
||||||
if (fLastTargetItem == fDestMenu->FindMarked())
|
if (fLastTargetItem == fDestMenu->FindMarked())
|
||||||
break;
|
break;
|
||||||
fLastTargetItem = fDestMenu->FindMarked();
|
fLastTargetItem = fDestMenu->FindMarked();
|
||||||
AdjustMenus();
|
_UpdateMenus();
|
||||||
break;
|
break;
|
||||||
case SETUP_MESSAGE:
|
case SETUP_MESSAGE:
|
||||||
LaunchDriveSetup();
|
_LaunchDriveSetup();
|
||||||
break;
|
break;
|
||||||
case PACKAGE_CHECKBOX: {
|
case PACKAGE_CHECKBOX: {
|
||||||
char buffer[15];
|
char buffer[15];
|
||||||
@@ -411,16 +411,16 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
const char *status;
|
const char *status;
|
||||||
if (msg->FindString("status", &status) == B_OK) {
|
if (msg->FindString("status", &status) == B_OK) {
|
||||||
fLastStatus = fStatusView->Text();
|
fLastStatus = fStatusView->Text();
|
||||||
SetStatusMessage(status);
|
_SetStatusMessage(status);
|
||||||
} else
|
} else
|
||||||
SetStatusMessage(fLastStatus.String());
|
_SetStatusMessage(fLastStatus.String());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INSTALL_FINISHED:
|
case INSTALL_FINISHED:
|
||||||
fBeginButton->SetLabel("Quit");
|
fBeginButton->SetLabel("Quit");
|
||||||
SetStatusMessage("Installation completed.");
|
_SetStatusMessage("Installation completed.");
|
||||||
fInstallStatus = kFinished;
|
fInstallStatus = kFinished;
|
||||||
DisableInterface(false);
|
_DisableInterface(false);
|
||||||
break;
|
break;
|
||||||
case B_SOME_APP_LAUNCHED:
|
case B_SOME_APP_LAUNCHED:
|
||||||
case B_SOME_APP_QUIT:
|
case B_SOME_APP_QUIT:
|
||||||
@@ -430,13 +430,13 @@ InstallerWindow::MessageReceived(BMessage *msg)
|
|||||||
&& strcasecmp(signature, DRIVESETUP_SIG) == 0) {
|
&& strcasecmp(signature, DRIVESETUP_SIG) == 0) {
|
||||||
fDriveSetupLaunched = msg->what == B_SOME_APP_LAUNCHED;
|
fDriveSetupLaunched = msg->what == B_SOME_APP_LAUNCHED;
|
||||||
fBeginButton->SetEnabled(!fDriveSetupLaunched);
|
fBeginButton->SetEnabled(!fDriveSetupLaunched);
|
||||||
DisableInterface(fDriveSetupLaunched);
|
_DisableInterface(fDriveSetupLaunched);
|
||||||
if (fDriveSetupLaunched)
|
if (fDriveSetupLaunched)
|
||||||
SetStatusMessage("Running DriveSetup" B_UTF8_ELLIPSIS
|
_SetStatusMessage("Running DriveSetup" B_UTF8_ELLIPSIS
|
||||||
"\nClose DriveSetup to continue with the\n"
|
"\nClose DriveSetup to continue with the\n"
|
||||||
"installation.");
|
"installation.");
|
||||||
else
|
else
|
||||||
StartScan();
|
_ScanPartitions();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -462,8 +462,11 @@ InstallerWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallerWindow::ShowBottom()
|
InstallerWindow::_ShowOptionalPackages()
|
||||||
{
|
{
|
||||||
if (fPackagesLayoutItem && fSizeViewLayoutItem) {
|
if (fPackagesLayoutItem && fSizeViewLayoutItem) {
|
||||||
fPackagesLayoutItem->SetVisible(fDrawButton->Value());
|
fPackagesLayoutItem->SetVisible(fDrawButton->Value());
|
||||||
@@ -473,7 +476,7 @@ InstallerWindow::ShowBottom()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallerWindow::LaunchDriveSetup()
|
InstallerWindow::_LaunchDriveSetup()
|
||||||
{
|
{
|
||||||
if (be_roster->Launch(DRIVESETUP_SIG) != B_OK) {
|
if (be_roster->Launch(DRIVESETUP_SIG) != B_OK) {
|
||||||
// Try really hard to launch it. It's very likely that this fails,
|
// Try really hard to launch it. It's very likely that this fails,
|
||||||
@@ -497,7 +500,7 @@ InstallerWindow::LaunchDriveSetup()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallerWindow::DisableInterface(bool disable)
|
InstallerWindow::_DisableInterface(bool disable)
|
||||||
{
|
{
|
||||||
fSetupButton->SetEnabled(!disable);
|
fSetupButton->SetEnabled(!disable);
|
||||||
fSrcMenuField->SetEnabled(!disable);
|
fSrcMenuField->SetEnabled(!disable);
|
||||||
@@ -506,9 +509,9 @@ InstallerWindow::DisableInterface(bool disable)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallerWindow::StartScan()
|
InstallerWindow::_ScanPartitions()
|
||||||
{
|
{
|
||||||
SetStatusMessage("Scanning for disks" B_UTF8_ELLIPSIS);
|
_SetStatusMessage("Scanning for disks" B_UTF8_ELLIPSIS);
|
||||||
|
|
||||||
BMenuItem *item;
|
BMenuItem *item;
|
||||||
while ((item = fSrcMenu->RemoveItem((int32)0)))
|
while ((item = fSrcMenu->RemoveItem((int32)0)))
|
||||||
@@ -519,16 +522,16 @@ InstallerWindow::StartScan()
|
|||||||
fCopyEngine->ScanDisksPartitions(fSrcMenu, fDestMenu);
|
fCopyEngine->ScanDisksPartitions(fSrcMenu, fDestMenu);
|
||||||
|
|
||||||
if (fSrcMenu->ItemAt(0)) {
|
if (fSrcMenu->ItemAt(0)) {
|
||||||
PublishPackages();
|
_PublishPackages();
|
||||||
}
|
}
|
||||||
AdjustMenus();
|
_UpdateMenus();
|
||||||
SetStatusMessage("Choose the disk you want to install onto from the "
|
_SetStatusMessage("Choose the disk you want to install onto from the "
|
||||||
"pop-up menu. Then click \"Begin\".");
|
"pop-up menu. Then click \"Begin\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallerWindow::AdjustMenus()
|
InstallerWindow::_UpdateMenus()
|
||||||
{
|
{
|
||||||
PartitionMenuItem *item1 = (PartitionMenuItem *)fSrcMenu->FindMarked();
|
PartitionMenuItem *item1 = (PartitionMenuItem *)fSrcMenu->FindMarked();
|
||||||
BString label;
|
BString label;
|
||||||
@@ -557,14 +560,14 @@ InstallerWindow::AdjustMenus()
|
|||||||
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'",
|
||||||
item1 ? item1->Name() : "null", item2 ? item2->Name() : "null");
|
item1 ? item1->Name() : "null", item2 ? item2->Name() : "null");
|
||||||
SetStatusMessage(message);
|
_SetStatusMessage(message);
|
||||||
if (item1 && item2)
|
if (item1 && item2)
|
||||||
fBeginButton->SetEnabled(true);
|
fBeginButton->SetEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallerWindow::PublishPackages()
|
InstallerWindow::_PublishPackages()
|
||||||
{
|
{
|
||||||
fPackagesView->Clean();
|
fPackagesView->Clean();
|
||||||
PartitionMenuItem *item = (PartitionMenuItem *)fSrcMenu->FindMarked();
|
PartitionMenuItem *item = (PartitionMenuItem *)fSrcMenu->FindMarked();
|
||||||
@@ -601,15 +604,25 @@ InstallerWindow::PublishPackages()
|
|||||||
packages.AddItem(package);
|
packages.AddItem(package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
packages.SortItems(ComparePackages);
|
packages.SortItems(_ComparePackages);
|
||||||
|
|
||||||
fPackagesView->AddPackages(packages, new BMessage(PACKAGE_CHECKBOX));
|
fPackagesView->AddPackages(packages, new BMessage(PACKAGE_CHECKBOX));
|
||||||
PostMessage(PACKAGE_CHECKBOX);
|
PostMessage(PACKAGE_CHECKBOX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
InstallerWindow::_SetStatusMessage(const char *text)
|
||||||
|
{
|
||||||
|
fStatusView->SetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
InstallerWindow::ComparePackages(const void *firstArg, const void *secondArg)
|
InstallerWindow::_ComparePackages(const void *firstArg, const void *secondArg)
|
||||||
{
|
{
|
||||||
const Group *group1 = *static_cast<const Group * const *>(firstArg);
|
const Group *group1 = *static_cast<const Group * const *>(firstArg);
|
||||||
const Group *group2 = *static_cast<const Group * const *>(secondArg);
|
const Group *group2 = *static_cast<const Group * const *>(secondArg);
|
||||||
@@ -626,9 +639,3 @@ InstallerWindow::ComparePackages(const void *firstArg, const void *secondArg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
InstallerWindow::SetStatusMessage(const char *text)
|
|
||||||
{
|
|
||||||
fStatusView->SetText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,15 @@ public:
|
|||||||
BMenu* GetSourceMenu() { return fSrcMenu; };
|
BMenu* GetSourceMenu() { return fSrcMenu; };
|
||||||
BMenu* GetTargetMenu() { return fDestMenu; };
|
BMenu* GetTargetMenu() { return fDestMenu; };
|
||||||
private:
|
private:
|
||||||
void DisableInterface(bool disable);
|
void _ShowOptionalPackages();
|
||||||
void LaunchDriveSetup();
|
void _LaunchDriveSetup();
|
||||||
void PublishPackages();
|
void _DisableInterface(bool disable);
|
||||||
void ShowBottom();
|
void _ScanPartitions();
|
||||||
void StartScan();
|
void _UpdateMenus();
|
||||||
void AdjustMenus();
|
void _PublishPackages();
|
||||||
void SetStatusMessage(const char* text);
|
void _SetStatusMessage(const char* text);
|
||||||
static int ComparePackages(const void* firstArg,
|
|
||||||
|
static int _ComparePackages(const void* firstArg,
|
||||||
const void* secondArg);
|
const void* secondArg);
|
||||||
|
|
||||||
BButton* fBeginButton;
|
BButton* fBeginButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user