2 * Copyright 2013-2017, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
7 * Rene Gollent <rene@gollent.com>
8 * Brian Hill <supernova@tycho.email>
10 #ifndef UPDATE_MANAGER_H
11 #define UPDATE_MANAGER_H
14 #include <package/DaemonClient.h>
15 #include <package/manager/PackageManager.h>
17 #include "constants.h"
18 #include "SoftwareUpdaterWindow.h"
22 //using namespace BPackageKit;
23 using BPackageKit::BPackageInstallationLocation
;
24 using BPackageKit::BPrivate::BDaemonClient
;
25 using BPackageKit::BManager::BPrivate::BPackageManager
;
28 class UpdateManager
: public BPackageManager
,
29 private BPackageManager::UserInteractionHandler
{
32 BPackageInstallationLocation location
,
36 void CheckNetworkConnection();
37 update_type
GetUpdateType();
38 void CheckRepositories();
39 virtual void JobFailed(BSupportKit::BJob
* job
);
40 virtual void JobAborted(BSupportKit::BJob
* job
);
41 void FinalUpdate(const char* header
,
44 // UserInteractionHandler
45 virtual void HandleProblems();
46 virtual void ConfirmChanges(bool fromMostSpecific
);
47 virtual void Warn(status_t error
, const char* format
, ...);
49 virtual void ProgressPackageDownloadStarted(
50 const char* packageName
);
51 virtual void ProgressPackageDownloadActive(
52 const char* packageName
,
53 float completionValue
,
54 off_t bytes
, off_t totalBytes
);
55 virtual void ProgressPackageDownloadComplete(
56 const char* packageName
);
57 virtual void ProgressPackageChecksumStarted(
58 const char* packageName
);
59 virtual void ProgressPackageChecksumComplete(
60 const char* packageName
);
62 virtual void ProgressStartApplyingChanges(
63 InstalledRepository
& repository
);
64 virtual void ProgressTransactionCommitted(
65 InstalledRepository
& repository
,
66 const BPackageKit::BCommitTransactionResult
& result
);
67 virtual void ProgressApplyingChangesDone(
68 InstalledRepository
& repository
);
71 void _PrintResult(InstalledRepository
&
72 installationRepository
,
75 int32
& uninstallCount
);
76 void _UpdateStatusWindow(const char* header
,
78 void _UpdateDownloadProgress(const char* header
,
79 const char* packageName
,
80 float percentageComplete
);
81 void _FinalUpdate(const char* header
,
83 void _SetCurrentStep(int32 step
);
86 BPackageManager::ClientInstallationInterface
87 fClientInstallationInterface
;
89 SoftwareUpdaterWindow
* fStatusWindow
;
90 ProblemWindow
* fProblemWindow
;
92 bool fChangesConfirmed
;
93 bool fNewDownloadStarted
;
94 int32 fPackageDownloadsTotal
;
95 int32 fPackageDownloadsCount
;
100 #endif // UPDATE_MANAGER_H