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