xref: /haiku/src/bin/pkgman/PackageManager.h (revision 1149fa6ece3567c466008a04ae8a830a63bafdaa)
1 /*
2  * Copyright 2013, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Ingo Weinhold <ingo_weinhold@gmx.de>
7  *		Rene Gollent <rene@gollent.com>
8  */
9 #ifndef PACKAGE_MANAGER_H
10 #define PACKAGE_MANAGER_H
11 
12 
13 #include <package/DaemonClient.h>
14 #include <package/manager/PackageManager.h>
15 
16 #include "DecisionProvider.h"
17 
18 
19 using namespace BPackageKit;
20 using BPackageKit::BPrivate::BDaemonClient;
21 using BManager::BPrivate::BPackageManager;
22 
23 
24 class PackageManager : public BPackageManager,
25 	private BPackageManager::UserInteractionHandler {
26 public:
27 								PackageManager(
28 									BPackageInstallationLocation location);
29 								~PackageManager();
30 
31 	virtual	void				JobFailed(BJob* job);
32 	virtual	void				JobAborted(BJob* job);
33 
34 private:
35 	// UserInteractionHandler
36 	virtual	void				HandleProblems();
37 	virtual	void				ConfirmChanges(bool fromMostSpecific);
38 
39 	virtual	void				Warn(status_t error, const char* format, ...);
40 
41 
42 	virtual	void				ProgressPackageDownloadStarted(
43 									const char* packageName);
44 	virtual	void				ProgressPackageDownloadActive(
45 									const char* packageName,
46 									float completionPercentage);
47 	virtual	void				ProgressPackageDownloadComplete(
48 									const char* packageName);
49 	virtual	void				ProgressPackageChecksumStarted(
50 									const char* packageName);
51 	virtual	void				ProgressPackageChecksumComplete(
52 									const char* packageName);
53 
54 	virtual	void				ProgressStartApplyingChanges(
55 									InstalledRepository& repository);
56 	virtual	void				ProgressTransactionCommitted(
57 									InstalledRepository& repository,
58 									const char* transactionDirectoryName);
59 	virtual	void				ProgressApplyingChangesDone(
60 									InstalledRepository& repository);
61 
62 private:
63 			void				_PrintResult(InstalledRepository&
64 									installationRepository);
65 
66 private:
67 			DecisionProvider	fDecisionProvider;
68 			BPackageManager::ClientInstallationInterface
69 									fClientInstallationInterface;
70 			int32				fPreviousDownloadPercentage;
71 };
72 
73 
74 #endif	// PACKAGE_MANAGER_H
75