xref: /haiku/src/bin/pkgman/PackageManager.h (revision bc6674c89e09a09850616b4b149eeba68fc0344d)
13ac0de3bSIngo Weinhold /*
21aaa0c21SAxel Dörfler  * Copyright 2013-2015, Haiku, Inc. All Rights Reserved.
33ac0de3bSIngo Weinhold  * Distributed under the terms of the MIT License.
43ac0de3bSIngo Weinhold  *
53ac0de3bSIngo Weinhold  * Authors:
63ac0de3bSIngo Weinhold  *		Ingo Weinhold <ingo_weinhold@gmx.de>
79345049aSRene Gollent  *		Rene Gollent <rene@gollent.com>
83ac0de3bSIngo Weinhold  */
93ac0de3bSIngo Weinhold #ifndef PACKAGE_MANAGER_H
103ac0de3bSIngo Weinhold #define PACKAGE_MANAGER_H
113ac0de3bSIngo Weinhold 
123ac0de3bSIngo Weinhold 
1383462cc2SIngo Weinhold #include <package/DaemonClient.h>
1483462cc2SIngo Weinhold #include <package/manager/PackageManager.h>
153ac0de3bSIngo Weinhold 
16*bc6674c8SEmir SARI #include <NumberFormat.h>
17*bc6674c8SEmir SARI 
183ac0de3bSIngo Weinhold #include "DecisionProvider.h"
193ac0de3bSIngo Weinhold 
203ac0de3bSIngo Weinhold 
213ac0de3bSIngo Weinhold using namespace BPackageKit;
2283462cc2SIngo Weinhold using BPackageKit::BPrivate::BDaemonClient;
2383462cc2SIngo Weinhold using BManager::BPrivate::BPackageManager;
243ac0de3bSIngo Weinhold 
253ac0de3bSIngo Weinhold 
2683462cc2SIngo Weinhold class PackageManager : public BPackageManager,
2783462cc2SIngo Weinhold 	private BPackageManager::UserInteractionHandler {
283ac0de3bSIngo Weinhold public:
293ac0de3bSIngo Weinhold 								PackageManager(
3083f63a21SIngo Weinhold 									BPackageInstallationLocation location,
3183f63a21SIngo Weinhold 									bool interactive = true);
323ac0de3bSIngo Weinhold 								~PackageManager();
333ac0de3bSIngo Weinhold 
3483f63a21SIngo Weinhold 			void				SetInteractive(bool interactive);
3583f63a21SIngo Weinhold 
36e711e6e4SAxel Dörfler 	virtual	void				JobFailed(BSupportKit::BJob* job);
379345049aSRene Gollent 
3883462cc2SIngo Weinhold private:
3983462cc2SIngo Weinhold 	// UserInteractionHandler
4083462cc2SIngo Weinhold 	virtual	void				HandleProblems();
4183462cc2SIngo Weinhold 	virtual	void				ConfirmChanges(bool fromMostSpecific);
423ac0de3bSIngo Weinhold 
4383462cc2SIngo Weinhold 	virtual	void				Warn(status_t error, const char* format, ...);
449345049aSRene Gollent 
459345049aSRene Gollent 
469345049aSRene Gollent 	virtual	void				ProgressPackageDownloadStarted(
479345049aSRene Gollent 									const char* packageName);
489345049aSRene Gollent 	virtual	void				ProgressPackageDownloadActive(
499345049aSRene Gollent 									const char* packageName,
501aaa0c21SAxel Dörfler 									float completionPercentage,
511aaa0c21SAxel Dörfler 									off_t bytes, off_t totalBytes);
529345049aSRene Gollent 	virtual	void				ProgressPackageDownloadComplete(
539345049aSRene Gollent 									const char* packageName);
549345049aSRene Gollent 	virtual	void				ProgressPackageChecksumStarted(
559345049aSRene Gollent 									const char* packageName);
569345049aSRene Gollent 	virtual	void				ProgressPackageChecksumComplete(
579345049aSRene Gollent 									const char* packageName);
589345049aSRene Gollent 
5983462cc2SIngo Weinhold 	virtual	void				ProgressStartApplyingChanges(
6083462cc2SIngo Weinhold 									InstalledRepository& repository);
6183462cc2SIngo Weinhold 	virtual	void				ProgressTransactionCommitted(
6283462cc2SIngo Weinhold 									InstalledRepository& repository,
63eee42275SIngo Weinhold 									const BCommitTransactionResult& result);
6483462cc2SIngo Weinhold 	virtual	void				ProgressApplyingChangesDone(
6583462cc2SIngo Weinhold 									InstalledRepository& repository);
66a54a50b4SIngo Weinhold 
673ac0de3bSIngo Weinhold private:
6883462cc2SIngo Weinhold 			void				_PrintResult(InstalledRepository&
6983462cc2SIngo Weinhold 									installationRepository);
7083462cc2SIngo Weinhold 
7183462cc2SIngo Weinhold private:
723ac0de3bSIngo Weinhold 			DecisionProvider	fDecisionProvider;
73*bc6674c8SEmir SARI 			BNumberFormat		fNumberFormat;
74cf3bb0d7SIngo Weinhold 			BPackageManager::ClientInstallationInterface
75cf3bb0d7SIngo Weinhold 									fClientInstallationInterface;
7683f63a21SIngo Weinhold 			bool				fInteractive;
77a9c1157aSAugustin Cavalier 
7845c3eb3aSAugustin Cavalier 			bool				fShowProgress;
79a9c1157aSAugustin Cavalier 			off_t				fLastBytes;
80a9c1157aSAugustin Cavalier 			bigtime_t			fLastRateCalcTime;
81a9c1157aSAugustin Cavalier 			float				fDownloadRate;
823381a1bfSIngo Weinhold };
833381a1bfSIngo Weinhold 
843381a1bfSIngo Weinhold 
853ac0de3bSIngo Weinhold #endif	// PACKAGE_MANAGER_H
86