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 WORKER_THREAD_H 7 #define WORKER_THREAD_H 8 9 #include <DiskDevice.h> 10 #include <DiskDeviceRoster.h> 11 #include <Looper.h> 12 #include <Messenger.h> 13 #include <Partition.h> 14 #include <Volume.h> 15 16 class BList; 17 class BMenu; 18 class InstallerWindow; 19 class ProgressReporter; 20 21 class WorkerThread : public BLooper { 22 public: 23 WorkerThread(InstallerWindow* window); 24 25 virtual void MessageReceived(BMessage* message); 26 27 void ScanDisksPartitions(BMenu* srcMenu, 28 BMenu* dstMenu); 29 30 void SetPackagesList(BList* list); 31 void SetSpaceRequired(off_t bytes) 32 { fSpaceRequired = bytes; }; 33 34 bool Cancel(); 35 void SetLock(sem_id cancelSemaphore) 36 { fCancelSemaphore = cancelSemaphore; } 37 38 void StartInstall(); 39 void WriteBootSector(BMenu* dstMenu); 40 41 private: 42 void _LaunchInitScript(BPath& path); 43 void _LaunchFinishScript(BPath& path); 44 45 void _PerformInstall(BMenu* srcMenu, 46 BMenu* dstMenu); 47 status_t _ProcessZipPackages(const char* sourcePath, 48 const char* targetPath, 49 ProgressReporter* reporter, 50 BList& unzipEngines); 51 52 void _SetStatusMessage(const char* status); 53 54 InstallerWindow* fWindow; 55 BDiskDeviceRoster fDDRoster; 56 BList* fPackages; 57 off_t fSpaceRequired; 58 sem_id fCancelSemaphore; 59 }; 60 61 #endif // WORKER_THREAD_H 62