btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / servers / package / PackageManager.h
blob123890d48b7c6f30f3da9b6e0dc7a0127447e700
1 /*
2 * Copyright 2013-2014, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef PACKAGE_MANAGER_H
6 #define PACKAGE_MANAGER_H
9 #include <map>
10 #include <set>
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;
31 class Package;
32 class ProblemWindow;
33 class ResultWindow;
34 class Root;
35 class Volume;
38 class PackageManager : public BPackageManager,
39 private BPackageManager::InstallationInterface,
40 private BPackageManager::UserInteractionHandler {
41 public:
42 PackageManager(Root* root, Volume* volume);
43 ~PackageManager();
45 void HandleUserChanges();
47 private:
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);
57 private:
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(
73 const char* title);
74 virtual void ProgressPackageChecksumComplete(
75 const char* title);
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);
85 private:
86 // BJobStateListener
87 virtual void JobFailed(BSupportKit::BJob* job);
88 virtual void JobAborted(BSupportKit::BJob* job);
90 private:
91 typedef std::set<BSolverPackage*> SolverPackageSet;
92 typedef std::map<Package*, BSolverPackage*> SolverPackageMap;
94 private:
95 bool _AddResults(InstalledRepository& repository,
96 ResultWindow* window);
98 BSolverPackage* _SolverPackageFor(Package* package) const;
100 void _InitGui();
102 private:
103 Root* fRoot;
104 Volume* fVolume;
105 SolverPackageMap fSolverPackages;
106 SolverPackageSet fPackagesAddedByUser;
107 SolverPackageSet fPackagesRemovedByUser;
108 ProblemWindow* fProblemWindow;
112 #endif // PACKAGE_MANAGER_H