xref: /haiku/src/apps/installer/CopyEngine.h (revision 155fa31ec619414bb0e0fb1ffe9ad913e4ecd398)
1 /*
2  * Copyright 2005, Jérôme DUVAL. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef _CopyEngine_h
7 #define _CopyEngine_h
8 
9 #include "InstallerCopyLoopControl.h"
10 
11 #include <DiskDevice.h>
12 #include <DiskDeviceRoster.h>
13 #include <Looper.h>
14 #include <Messenger.h>
15 #include <Partition.h>
16 #include <Volume.h>
17 
18 class BLocker;
19 class InstallerWindow;
20 
21 const uint32 ENGINE_START = 'eSRT';
22 
23 class CopyEngine : public BLooper {
24 	public:
25 		CopyEngine(InstallerWindow *window);
26 		void MessageReceived(BMessage *msg);
27 		void ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu);
28 		void SetPackagesList(BList *list);
29 		void SetSpaceRequired(off_t bytes) { fSpaceRequired = bytes; };
30 		bool Cancel();
31 		void SetLock(BLocker* lock) { fCancelLock = lock; }
32 		void WriteBootSector(BMenu *targetMenu);
33 
34 	private:
35 		void LaunchInitScript(BPath &path);
36 		void LaunchFinishScript(BPath &path);
37 		void SetStatusMessage(char *status);
38 		void Start(BMenu *srcMenu, BMenu *targetMenu);
39 		status_t CopyFolder(BDirectory &srcDir, BDirectory &targetDir);
40 
41 		InstallerWindow *fWindow;
42 		BDiskDeviceRoster fDDRoster;
43 		InstallerCopyLoopControl *fControl;
44 		BList *fPackages;
45 		off_t fSpaceRequired;
46 		BLocker* fCancelLock;
47 };
48 
49 #endif /* _CopyEngine_h */
50