xref: /haiku/src/apps/installer/WorkerThread.h (revision a1163de83ea633463a79de234b8742ee106531b2)
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 BLocker;
18 class BMenu;
19 class InstallerWindow;
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(BLocker* lock)
36 									{ fCancelLock = lock; }
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, BMenu* dstMenu);
46 
47 			void				_SetStatusMessage(const char* status);
48 
49 			InstallerWindow*	fWindow;
50 			BDiskDeviceRoster	fDDRoster;
51 			BList*				fPackages;
52 			off_t				fSpaceRequired;
53 			BLocker*			fCancelLock;
54 };
55 
56 #endif // WORKER_THREAD_H
57