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 MessageReceived(BMessage* message); 49 virtual bool QuitRequested(); 50 51 BMenu* GetSourceMenu() { return fSrcMenu; }; 52 BMenu* GetTargetMenu() { return fDestMenu; }; 53 private: 54 void _ShowOptionalPackages(); 55 void _LaunchDriveSetup(); 56 void _DisableInterface(bool disable); 57 void _ScanPartitions(); 58 void _UpdateControls(); 59 void _PublishPackages(); 60 void _SetStatusMessage(const char* text); 61 62 void _SetCopyEngineCancelSemaphore(sem_id id, 63 bool alreadyLocked = false); 64 void _QuitCopyEngine(bool askUser); 65 66 static int _ComparePackages(const void* firstArg, 67 const void* secondArg); 68 69 BTextView* fStatusView; 70 BMenu* fSrcMenu; 71 BMenu* fDestMenu; 72 BMenuField* fSrcMenuField; 73 BMenuField* fDestMenuField; 74 75 PaneSwitch* fPackagesSwitch; 76 PackagesView* fPackagesView; 77 BStringView* fSizeView; 78 79 BStatusBar* fProgressBar; 80 81 BLayoutItem* fPkgSwitchLayoutItem; 82 BLayoutItem* fPackagesLayoutItem; 83 BLayoutItem* fSizeViewLayoutItem; 84 BLayoutItem* fProgressLayoutItem; 85 86 BButton* fBeginButton; 87 BButton* fSetupButton; 88 BButton* fMakeBootableButton; 89 90 bool fEncouragedToSetupPartitions; 91 92 bool fDriveSetupLaunched; 93 InstallStatus fInstallStatus; 94 95 WorkerThread* fWorkerThread; 96 BString fLastStatus; 97 sem_id fCopyEngineCancelSemaphore; 98 }; 99 100 #endif // INSTALLER_WINDOW_H 101