xref: /haiku/src/apps/installer/InstallerWindow.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2009-2010, 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 
10 #include <String.h>
11 #include <Window.h>
12 
13 
14 namespace BPrivate {
15 	class PaneSwitch;
16 };
17 using namespace BPrivate;
18 
19 class BButton;
20 class BLayoutItem;
21 class BGroupView;
22 class BMenu;
23 class BMenuField;
24 class BMenuItem;
25 class BStatusBar;
26 class BStringView;
27 class BTextView;
28 class PackagesView;
29 class WorkerThread;
30 
31 enum InstallStatus {
32 	kReadyForInstall,
33 	kInstalling,
34 	kFinished,
35 	kCancelled
36 };
37 
38 
39 class InstallerWindow : public BWindow {
40 public:
41 								InstallerWindow();
42 	virtual						~InstallerWindow();
43 
44 	virtual	void				MessageReceived(BMessage* message);
45 	virtual	bool				QuitRequested();
46 
47 private:
48 			void				_ShowOptionalPackages();
49 			void				_LaunchDriveSetup();
50 			void				_LaunchBootManager();
51 			void				_DisableInterface(bool disable);
52 			void				_ScanPartitions();
53 			void				_UpdateControls();
54 			void				_PublishPackages();
55 			void				_SetStatusMessage(const char* text);
56 
57 			void				_SetCopyEngineCancelSemaphore(sem_id id,
58 									bool alreadyLocked = false);
59 			void				_QuitCopyEngine(bool askUser);
60 
61 	static	int					_ComparePackages(const void* firstArg,
62 									const void* secondArg);
63 
64 			BGroupView*			fLogoGroup;
65 			BTextView*			fStatusView;
66 			BMenu*				fSrcMenu;
67 			BMenu*				fDestMenu;
68 			BMenuField*			fSrcMenuField;
69 			BMenuField*			fDestMenuField;
70 
71 			PaneSwitch*			fPackagesSwitch;
72 			PackagesView*		fPackagesView;
73 			BStringView*		fSizeView;
74 
75 			BStatusBar*			fProgressBar;
76 
77 			BLayoutItem*		fPkgSwitchLayoutItem;
78 			BLayoutItem*		fPackagesLayoutItem;
79 			BLayoutItem*		fSizeViewLayoutItem;
80 			BLayoutItem*		fProgressLayoutItem;
81 
82 			BButton*			fBeginButton;
83 			BButton*			fLaunchDriveSetupButton;
84 			BMenuItem*			fLaunchBootManagerItem;
85 			BMenuItem*			fMakeBootableItem;
86 
87 			bool				fEncouragedToSetupPartitions;
88 
89 			bool				fDriveSetupLaunched;
90 			bool				fBootManagerLaunched;
91 			InstallStatus		fInstallStatus;
92 
93 			WorkerThread*		fWorkerThread;
94 			BString				fLastStatus;
95 			sem_id				fCopyEngineCancelSemaphore;
96 };
97 
98 
99 #endif // INSTALLER_WINDOW_H
100