2 * Copyright 2013-2014, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef PACKAGE_MANAGER_H
6 #define PACKAGE_MANAGER_H
12 #include <package/Context.h>
13 #include <package/Job.h>
15 #include <package/DaemonClient.h>
16 #include <package/manager/PackageManager.h>
19 using BPackageKit::BCommitTransactionResult
;
20 using BPackageKit::BContext
;
21 using BPackageKit::BPackageInstallationLocation
;
22 using BPackageKit::BRepositoryConfig
;
23 using BPackageKit::BSolverPackage
;
24 using BSupportKit::BJob
;
25 using BSupportKit::BJobStateListener
;
27 using BPackageKit::BPrivate::BDaemonClient
;
28 using BPackageKit::BManager::BPrivate::BPackageManager
;
38 class PackageManager
: public BPackageManager
,
39 private BPackageManager::InstallationInterface
,
40 private BPackageManager::UserInteractionHandler
{
42 PackageManager(Root
* root
, Volume
* volume
);
45 void HandleUserChanges();
48 // InstallationInterface
49 virtual void InitInstalledRepository(
50 InstalledRepository
& repository
);
51 virtual void ResultComputed(InstalledRepository
& repository
);
53 virtual status_t
PrepareTransaction(Transaction
& transaction
);
54 virtual status_t
CommitTransaction(Transaction
& transaction
,
55 BCommitTransactionResult
& _result
);
58 // UserInteractionHandler
59 virtual void HandleProblems();
60 virtual void ConfirmChanges(bool fromMostSpecific
);
62 virtual void Warn(status_t error
, const char* format
, ...);
64 virtual void ProgressPackageDownloadStarted(
65 const char* packageName
);
66 virtual void ProgressPackageDownloadActive(
67 const char* packageName
,
68 float completionPercentage
,
69 off_t bytes
, off_t totalBytes
);
70 virtual void ProgressPackageDownloadComplete(
71 const char* packageName
);
72 virtual void ProgressPackageChecksumStarted(
74 virtual void ProgressPackageChecksumComplete(
77 virtual void ProgressStartApplyingChanges(
78 InstalledRepository
& repository
);
79 virtual void ProgressTransactionCommitted(
80 InstalledRepository
& repository
,
81 const BCommitTransactionResult
& result
);
82 virtual void ProgressApplyingChangesDone(
83 InstalledRepository
& repository
);
87 virtual void JobFailed(BSupportKit::BJob
* job
);
88 virtual void JobAborted(BSupportKit::BJob
* job
);
91 typedef std::set
<BSolverPackage
*> SolverPackageSet
;
92 typedef std::map
<Package
*, BSolverPackage
*> SolverPackageMap
;
95 bool _AddResults(InstalledRepository
& repository
,
96 ResultWindow
* window
);
98 BSolverPackage
* _SolverPackageFor(Package
* package
) const;
105 SolverPackageMap fSolverPackages
;
106 SolverPackageSet fPackagesAddedByUser
;
107 SolverPackageSet fPackagesRemovedByUser
;
108 ProblemWindow
* fProblemWindow
;
112 #endif // PACKAGE_MANAGER_H