1 /* 2 * Copyright 2013-2014, 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 bool interactive = true); 30 ~PackageManager(); 31 32 void SetInteractive(bool interactive); 33 34 virtual void JobFailed(BJob* job); 35 virtual void JobAborted(BJob* job); 36 37 private: 38 // UserInteractionHandler 39 virtual void HandleProblems(); 40 virtual void ConfirmChanges(bool fromMostSpecific); 41 42 virtual void Warn(status_t error, const char* format, ...); 43 44 45 virtual void ProgressPackageDownloadStarted( 46 const char* packageName); 47 virtual void ProgressPackageDownloadActive( 48 const char* packageName, 49 float completionPercentage); 50 virtual void ProgressPackageDownloadComplete( 51 const char* packageName); 52 virtual void ProgressPackageChecksumStarted( 53 const char* packageName); 54 virtual void ProgressPackageChecksumComplete( 55 const char* packageName); 56 57 virtual void ProgressStartApplyingChanges( 58 InstalledRepository& repository); 59 virtual void ProgressTransactionCommitted( 60 InstalledRepository& repository, 61 const BCommitTransactionResult& result); 62 virtual void ProgressApplyingChangesDone( 63 InstalledRepository& repository); 64 65 private: 66 void _PrintResult(InstalledRepository& 67 installationRepository); 68 69 private: 70 DecisionProvider fDecisionProvider; 71 BPackageManager::ClientInstallationInterface 72 fClientInstallationInterface; 73 int32 fPreviousDownloadPercentage; 74 bool fInteractive; 75 }; 76 77 78 #endif // PACKAGE_MANAGER_H 79