1 /* 2 * Copyright 2009-2010, Stephan Aßmus <superstippi@gmx.de> 3 * Copyright 2005, Jérôme DUVAL 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 #ifndef INSTALLER_WINDOW_H 7 #define INSTALLER_WINDOW_H 8 9 10 #include <String.h> 11 #include <Window.h> 12 13 14 namespace BPrivate { 15 class PaneSwitch; 16 }; 17 using namespace BPrivate; 18 19 class BButton; 20 class BLayoutItem; 21 class BMenu; 22 class BMenuField; 23 class BMenuItem; 24 class BStatusBar; 25 class BStringView; 26 class BTextView; 27 class PackagesView; 28 class WorkerThread; 29 30 enum InstallStatus { 31 kReadyForInstall, 32 kInstalling, 33 kFinished, 34 kCancelled 35 }; 36 37 const uint32 MSG_STATUS_MESSAGE = 'iSTM'; 38 const uint32 MSG_INSTALL_FINISHED = 'iIFN'; 39 const uint32 MSG_RESET = 'iRSI'; 40 const uint32 MSG_WRITE_BOOT_SECTOR = 'iWBS'; 41 42 const char PACKAGES_DIRECTORY[] = "_packages_"; 43 const char SOURCES_DIRECTORY[] = "_sources_"; 44 const char VAR_DIRECTORY[] = "var"; 45 46 47 class InstallerWindow : public BWindow { 48 public: 49 InstallerWindow(); 50 virtual ~InstallerWindow(); 51 52 virtual void MessageReceived(BMessage* message); 53 virtual bool QuitRequested(); 54 55 BMenu* GetSourceMenu() { return fSrcMenu; }; 56 BMenu* GetTargetMenu() { return fDestMenu; }; 57 private: 58 void _ShowOptionalPackages(); 59 void _LaunchDriveSetup(); 60 void _LaunchBootManager(); 61 void _DisableInterface(bool disable); 62 void _ScanPartitions(); 63 void _UpdateControls(); 64 void _PublishPackages(); 65 void _SetStatusMessage(const char* text); 66 67 void _SetCopyEngineCancelSemaphore(sem_id id, 68 bool alreadyLocked = false); 69 void _QuitCopyEngine(bool askUser); 70 71 static int _ComparePackages(const void* firstArg, 72 const void* secondArg); 73 74 BTextView* fStatusView; 75 BMenu* fSrcMenu; 76 BMenu* fDestMenu; 77 BMenuField* fSrcMenuField; 78 BMenuField* fDestMenuField; 79 80 PaneSwitch* fPackagesSwitch; 81 PackagesView* fPackagesView; 82 BStringView* fSizeView; 83 84 BStatusBar* fProgressBar; 85 86 BLayoutItem* fPkgSwitchLayoutItem; 87 BLayoutItem* fPackagesLayoutItem; 88 BLayoutItem* fSizeViewLayoutItem; 89 BLayoutItem* fProgressLayoutItem; 90 91 BButton* fBeginButton; 92 BButton* fLaunchDriveSetupButton; 93 BMenuItem* fLaunchBootManagerItem; 94 BMenuItem* fMakeBootableItem; 95 96 bool fEncouragedToSetupPartitions; 97 98 bool fDriveSetupLaunched; 99 bool fBootManagerLaunched; 100 InstallStatus fInstallStatus; 101 102 WorkerThread* fWorkerThread; 103 BString fLastStatus; 104 sem_id fCopyEngineCancelSemaphore; 105 }; 106 107 108 #endif // INSTALLER_WINDOW_H 109