/* * Copyright 2009, Stephan Aßmus . * Copyright 2005, Jérôme DUVAL. * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef WORKER_THREAD_H #define WORKER_THREAD_H #include #include #include #include #include #include class BList; class BMenu; class ProgressReporter; class WorkerThread : public BLooper { public: WorkerThread(const BMessenger& owner); virtual void MessageReceived(BMessage* message); void ScanDisksPartitions(BMenu* srcMenu, BMenu* dstMenu); void SetPackagesList(BList* list); void SetSpaceRequired(off_t bytes) { fSpaceRequired = bytes; }; bool Cancel(); void SetLock(sem_id cancelSemaphore) { fCancelSemaphore = cancelSemaphore; } void StartInstall(partition_id sourcePartitionID, partition_id targetPartitionID); void WriteBootSector(BMenu* dstMenu); private: status_t _WriteBootSector(BPath& path); status_t _LaunchFinishScript(BPath& path); status_t _PerformInstall(partition_id sourcePartitionID, partition_id targetPartitionID); status_t _PrepareCleanInstall( const BPath& targetDirectory) const; status_t _InstallationError(status_t error); status_t _MirrorIndices(const BPath& srcDirectory, const BPath& targetDirectory) const; status_t _CreateDefaultIndices( const BPath& targetDirectory) const; status_t _ProcessZipPackages(const char* sourcePath, const char* targetPath, ProgressReporter* reporter, BList& unzipEngines); void _SetStatusMessage(const char* status); private: class EntryFilter; private: BMessenger fOwner; BDiskDeviceRoster fDDRoster; BList* fPackages; off_t fSpaceRequired; sem_id fCancelSemaphore; }; #endif // WORKER_THREAD_H