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