1 /* 2 * Copyright 2008-2011, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Pfeiffer <laplace@users.sourceforge.net> 7 */ 8 #ifndef BOOT_MANAGER_CONTROLLER_H 9 #define BOOT_MANAGER_CONTROLLER_H 10 11 12 #include "WizardController.h" 13 14 #include <Message.h> 15 16 #include "BootMenu.h" 17 18 19 class BootDrive; 20 class WizardView; 21 class WizardPageView; 22 23 24 /* Remainder of Settings Message Format: 25 (See also BootDrive.h) 26 "install" bool (whether install or uninstall should be performed) 27 "file" String (the file where the backup of the MBR is saved) 28 "defaultPartition" int32 (index of default partition) 29 "timeout" int32 (timeout in seconds, -1 for no timeout) 30 */ 31 32 class BootManagerController : public WizardController { 33 public: 34 BootManagerController(); 35 virtual ~BootManagerController(); 36 37 virtual void Previous(WizardView* wizard); 38 39 protected: 40 virtual int32 InitialState(); 41 virtual int32 NextState(int32 state); 42 virtual WizardPageView* CreatePage(int32 state, WizardView* wizard); 43 44 private: 45 enum State { 46 kStateEntry, 47 kStateErrorEntry, 48 49 // Install states 50 kStateSaveMBR, 51 kStateMBRSaved, 52 kStatePartitions, 53 kStateDefaultPartitions, 54 kStateInstallSummary, 55 kStateInstalled, 56 57 // Uninstall states 58 kStateUninstall, 59 kStateUninstalled 60 }; 61 62 bool _HasSelectedPartitions(); 63 bool _WriteBootMenu(); 64 bool _SaveMBR(); 65 bool _RestoreMBR(); 66 67 WizardPageView* _CreateErrorEntryPage(); 68 WizardPageView* _CreateSaveMBRPage(BRect frame); 69 WizardPageView* _CreateMBRSavedPage(); 70 WizardPageView* _CreateInstallSummaryPage(); 71 WizardPageView* _CreateInstalledPage(); 72 WizardPageView* _CreateUninstallPage(BRect frame); 73 WizardPageView* _CreateUninstalledPage(); 74 75 BMessage fSettings; 76 BootMenuList fBootMenus; 77 BootDrive* fBootDrive; 78 BootMenu* fBootMenu; 79 80 status_t fCollectPartitionsStatus; 81 status_t fWriteBootMenuStatus; 82 status_t fSaveMBRStatus; 83 status_t fRestoreMBRStatus; 84 }; 85 86 87 #endif // BOOT_MANAGER_CONTROLLER_H 88