1 /* 2 * Copyright 2009, 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 #include <String.h> 10 #include <Window.h> 11 12 namespace BPrivate { 13 class PaneSwitch; 14 }; 15 using namespace BPrivate; 16 17 class BButton; 18 class BLayoutItem; 19 class BMenu; 20 class BMenuField; 21 class BStatusBar; 22 class BStringView; 23 class BTextView; 24 class PackagesView; 25 class WorkerThread; 26 27 enum InstallStatus { 28 kReadyForInstall, 29 kInstalling, 30 kFinished, 31 kCancelled 32 }; 33 34 const uint32 MSG_STATUS_MESSAGE = 'iSTM'; 35 const uint32 MSG_INSTALL_FINISHED = 'iIFN'; 36 const uint32 MSG_RESET = 'iRSI'; 37 const uint32 MSG_WRITE_BOOT_SECTOR = 'iWBS'; 38 39 const char PACKAGES_DIRECTORY[] = "_packages_"; 40 const char VAR_DIRECTORY[] = "var"; 41 42 43 class InstallerWindow : public BWindow { 44 public: 45 InstallerWindow(); 46 virtual ~InstallerWindow(); 47 48 virtual void FrameResized(float width, float height); 49 virtual void MessageReceived(BMessage* message); 50 virtual bool QuitRequested(); 51 52 BMenu* GetSourceMenu() { return fSrcMenu; }; 53 BMenu* GetTargetMenu() { return fDestMenu; }; 54 private: 55 void _ShowOptionalPackages(); 56 void _LaunchDriveSetup(); 57 void _DisableInterface(bool disable); 58 void _ScanPartitions(); 59 void _UpdateControls(); 60 void _PublishPackages(); 61 void _SetStatusMessage(const char* text); 62 63 void _SetCopyEngineCancelSemaphore(sem_id id, 64 bool alreadyLocked = false); 65 void _QuitCopyEngine(bool askUser); 66 67 static int _ComparePackages(const void* firstArg, 68 const void* secondArg); 69 70 BTextView* fStatusView; 71 BMenu* fSrcMenu; 72 BMenu* fDestMenu; 73 BMenuField* fSrcMenuField; 74 BMenuField* fDestMenuField; 75 76 PaneSwitch* fPackagesSwitch; 77 PackagesView* fPackagesView; 78 BStringView* fSizeView; 79 80 BStatusBar* fProgressBar; 81 82 BLayoutItem* fPkgSwitchLayoutItem; 83 BLayoutItem* fPackagesLayoutItem; 84 BLayoutItem* fSizeViewLayoutItem; 85 BLayoutItem* fProgressLayoutItem; 86 87 BButton* fBeginButton; 88 BButton* fSetupButton; 89 BButton* fMakeBootableButton; 90 91 bool fNeedsToCenterOnScreen; 92 bool fEncouragedToSetupPartitions; 93 94 bool fDriveSetupLaunched; 95 InstallStatus fInstallStatus; 96 97 WorkerThread* fWorkerThread; 98 BString fLastStatus; 99 sem_id fCopyEngineCancelSemaphore; 100 }; 101 102 #endif // INSTALLER_WINDOW_H 103