Ticket #4425: InstallerExhance.diff
File InstallerExhance.diff, 7.0 KB (added by , 14 years ago) |
---|
-
InstallerWindow.cpp
48 48 #define TR_CONTEXT "InstallerWindow" 49 49 50 50 #define DRIVESETUP_SIG "application/x-vnd.Haiku-DriveSetup" 51 #define BOOTMAN_SIG "application/x-vnd.Haiku-Bootman" 51 52 52 53 const uint32 BEGIN_MESSAGE = 'iBGN'; 53 54 const uint32 SHOW_BOTTOM_MESSAGE = 'iSBT'; … … 213 214 TR("Write boot sector"), new BMessage(MSG_WRITE_BOOT_SECTOR)); 214 215 fMakeBootableButton->SetEnabled(false); 215 216 217 fBootmanButton = new BButton("bootman_button", 218 TR("Setup Boot Menu"), new BMessage(MSG_WRITE_BOOTMAN)); 219 fBootmanButton->SetEnabled(false); 220 216 221 SetLayout(new BGroupLayout(B_HORIZONTAL)); 217 222 AddChild(BGroupLayoutBuilder(B_VERTICAL) 218 223 .Add(BGroupLayoutBuilder(B_HORIZONTAL) … … 238 243 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) 239 244 .Add(fSetupButton) 240 245 .Add(fMakeBootableButton) 246 .Add(fBootmanButton) 241 247 .AddGlue() 242 248 .Add(fBeginButton) 243 249 ) … … 268 274 "the installation, but you can manually make a\n" 269 275 "partition bootable in case you do not need to\n" 270 276 "perform an installation.")); 271 277 fBootmanButton->SetToolTip( 278 TR("Install/Uninstall our Boot Menu, which allow you to choose\n" 279 "operating system to boot when computer starts up\n" 280 "If you have another Boot manager such as LILO or GRUB\n" 281 "You do not need to perform this one\n")); 272 282 // finish creating window 273 283 if (!be_roster->IsRunning(kDeskbarSignature)) 274 284 SetFlags(Flags() | B_NOT_MINIMIZABLE); … … 276 286 CenterOnScreen(); 277 287 Show(); 278 288 279 fDriveSetupLaunched = be_roster->IsRunning(DRIVESETUP_SIG);280 289 281 290 if (Lock()) { 282 fSetupButton->SetEnabled(!fDriveSetupLaunched );291 fSetupButton->SetEnabled(!fDriveSetupLaunched || !fDriveSetupLaunched); 283 292 Unlock(); 284 293 } 285 294 … … 466 475 case B_SOME_APP_LAUNCHED: 467 476 case B_SOME_APP_QUIT: 468 477 { 469 const char *signature; 470 if (msg->FindString("be:signature", &signature) == B_OK 471 && strcasecmp(signature, DRIVESETUP_SIG) == 0) { 472 fDriveSetupLaunched = msg->what == B_SOME_APP_LAUNCHED; 473 fBeginButton->SetEnabled(!fDriveSetupLaunched); 474 _DisableInterface(fDriveSetupLaunched); 475 if (fDriveSetupLaunched) 476 _SetStatusMessage(TR("Running DriveSetup" B_UTF8_ELLIPSIS 478 479 if (fDriveSetupLaunched) { 480 fDriveSetupLaunched = msg->what == B_SOME_APP_LAUNCHED; 481 fBeginButton->SetEnabled(!fDriveSetupLaunched); 482 _DisableInterface(fDriveSetupLaunched); 483 _SetStatusMessage(TR("Running DriveSetup" B_UTF8_ELLIPSIS 477 484 "\n\nClose DriveSetup to continue with the " 478 485 "installation.")); 479 else486 } else 480 487 _ScanPartitions(); 488 489 if (fBootmanLaunched) { 490 fBootmanLaunched = msg->what == B_SOME_APP_LAUNCHED; 491 fBeginButton->SetEnabled(!fBootmanLaunched); 492 _DisableInterface(fBootmanLaunched); 493 _SetStatusMessage(TR("Running Boot Manager" B_UTF8_ELLIPSIS 494 "\n\nClose Boot Manager to continue with the " 495 "installation.")); 496 } 481 497 } 482 498 break; 483 }499 484 500 case MSG_WRITE_BOOT_SECTOR: 485 501 fWorkerThread->WriteBootSector(fDestMenu); 486 502 break; 487 503 504 case MSG_WRITE_BOOTMAN: 505 { 506 _LaunchBootman(); 507 } 508 break; 488 509 default: 489 510 BWindow::MessageReceived(msg); 490 511 break; … … 502 523 return false; 503 524 } 504 525 526 if (fBootmanLaunched) { 527 (new BAlert("bootman", 528 TR("Please close the Boot Manager window before closing the " 529 "Installer window."), TR("OK")))->Go(); 530 return false; 531 } 532 505 533 if (fInstallStatus != kFinished && (Flags() & B_NOT_MINIMIZABLE) != 0) { 506 534 // This means Deskbar is not running, i.e. Installer is the only 507 535 // thing on the screen and we will reboot the machine once it quits. … … 536 564 void 537 565 InstallerWindow::_LaunchDriveSetup() 538 566 { 539 if (be_roster->Launch(DRIVESETUP_SIG) != B_OK) { 567 if (be_roster->Launch(DRIVESETUP_SIG) == B_OK) { 568 569 fDriveSetupLaunched = be_roster->IsRunning(DRIVESETUP_SIG); 570 571 } else { 572 540 573 // Try really hard to launch it. It's very likely that this fails, 541 574 // when we run from the CD and there is only an incomplete mime 542 575 // database for example... … … 552 585 "application to configure disk partitions, could not be " 553 586 "launched."), TR("OK")); 554 587 alert->Go(); 588 } 589 fDriveSetupLaunched = be_roster->IsRunning(&ref); 590 } 591 } 592 593 void 594 InstallerWindow::_LaunchBootman() 595 { 596 if (be_roster->Launch(BOOTMAN_SIG) == B_OK) { 597 598 fBootmanLaunched = be_roster->IsRunning(BOOTMAN_SIG); 599 600 } else { 601 // Try really hard to launch it. It's very likely that this fails, 602 // when we run from the CD and there is only an incomplete mime 603 // database for example... 604 BPath path; 605 if (find_directory(B_BEOS_SYSTEM_DIRECTORY, &path) != B_OK 606 || path.Append("bin/bootman") != B_OK) { 607 path.SetTo("/boot/system/bin/bootman"); 555 608 } 609 BEntry entry(path.Path()); 610 entry_ref ref; 611 if (entry.GetRef(&ref) != B_OK || be_roster->Launch(&ref) != B_OK) { 612 BAlert* alert = new BAlert("error", TR("Boot Manager, the " 613 "application to Setup Boot Menu, could not be " 614 "launched."), TR("OK")); 615 alert->Go(); 616 } 617 fBootmanLaunched = be_roster->IsRunning(&ref); 556 618 } 557 619 } 558 620 559 560 621 void 561 622 InstallerWindow::_DisableInterface(bool disable) 562 623 { 563 624 fSetupButton->SetEnabled(!disable); 564 625 fMakeBootableButton->SetEnabled(!disable); 626 fBootmanButton->SetEnabled(!disable); 565 627 fSrcMenuField->SetEnabled(!disable); 566 628 fDestMenuField->SetEnabled(!disable); 567 629 } … … 651 713 fBeginButton->SetLabel(TR("Begin")); 652 714 fBeginButton->SetEnabled(srcItem && dstItem); 653 715 654 // adjust "Write Boot Sector " button716 // adjust "Write Boot Sector and Setup Boot Menu" button 655 717 if (dstItem) { 656 718 char buffer[256]; 657 719 snprintf(buffer, sizeof(buffer), TR("Write boot sector to '%s'"), … … 661 723 label = TR("Write boot sector"); 662 724 fMakeBootableButton->SetEnabled(dstItem); 663 725 fMakeBootableButton->SetLabel(label.String()); 664 726 fBootmanButton->SetEnabled(dstItem); 727 665 728 if (!fEncouragedToSetupPartitions && !foundOneSuitableTarget) { 666 729 // Focus the users attention on the DriveSetup button 667 730 fEncouragedToSetupPartitions = true; -
InstallerWindow.h
35 35 const uint32 MSG_INSTALL_FINISHED = 'iIFN'; 36 36 const uint32 MSG_RESET = 'iRSI'; 37 37 const uint32 MSG_WRITE_BOOT_SECTOR = 'iWBS'; 38 const uint32 MSG_WRITE_BOOTMAN = 'iWBM'; 38 39 39 40 const char PACKAGES_DIRECTORY[] = "_packages_"; 40 41 const char VAR_DIRECTORY[] = "var"; … … 53 54 private: 54 55 void _ShowOptionalPackages(); 55 56 void _LaunchDriveSetup(); 57 void _LaunchBootman(); 56 58 void _DisableInterface(bool disable); 57 59 void _ScanPartitions(); 58 60 void _UpdateControls(); … … 86 88 BButton* fBeginButton; 87 89 BButton* fSetupButton; 88 90 BButton* fMakeBootableButton; 89 91 BButton* fBootmanButton; 90 92 bool fEncouragedToSetupPartitions; 91 93 92 94 bool fDriveSetupLaunched; 95 bool fBootmanLaunched; 96 93 97 InstallStatus fInstallStatus; 94 98 95 99 WorkerThread* fWorkerThread;