xref: /haiku/src/apps/haikudepot/packagemanagement/AbstractPackageProcess.h (revision c078962803230aa4e37330a125accf955e4d8287)
1a18f873fSAndrew Lindesay /*
2f67e0538SAndrew Lindesay  * Copyright 2022, Andrew Lindesay <apl@lindesay.co.nz>
3a18f873fSAndrew Lindesay  * All rights reserved. Distributed under the terms of the MIT License.
4a18f873fSAndrew Lindesay  */
5a18f873fSAndrew Lindesay #ifndef ABSTRACT_PACKAGE_PROCESS_H
6a18f873fSAndrew Lindesay #define ABSTRACT_PACKAGE_PROCESS_H
7a18f873fSAndrew Lindesay 
8a18f873fSAndrew Lindesay 
9a18f873fSAndrew Lindesay #include <Referenceable.h>
10a18f873fSAndrew Lindesay 
11a18f873fSAndrew Lindesay #include "AbstractProcess.h"
12a18f873fSAndrew Lindesay #include "PackageInfo.h"
13a18f873fSAndrew Lindesay 
14a18f873fSAndrew Lindesay 
15a18f873fSAndrew Lindesay class PackageManager;
16a18f873fSAndrew Lindesay class Model;
17a18f873fSAndrew Lindesay 
18a18f873fSAndrew Lindesay 
19a18f873fSAndrew Lindesay class AbstractPackageProcess : public BReferenceable, public AbstractProcess {
20a18f873fSAndrew Lindesay public:
21a18f873fSAndrew Lindesay 								AbstractPackageProcess(PackageInfoRef package,
22a18f873fSAndrew Lindesay 									Model* model);
23a18f873fSAndrew Lindesay 	virtual						~AbstractPackageProcess();
24a18f873fSAndrew Lindesay 
InstallLocation()25a18f873fSAndrew Lindesay 			int32				InstallLocation() const
26a18f873fSAndrew Lindesay 									{ return fInstallLocation; }
27a18f873fSAndrew Lindesay 
28a18f873fSAndrew Lindesay protected:
29a18f873fSAndrew Lindesay 			PackageInfoRef		FindPackageByName(const BString& name);
30a18f873fSAndrew Lindesay 
31*c0789628SAndrew Lindesay 			void				SetPackageState(PackageInfoRef& package, PackageState state);
32*c0789628SAndrew Lindesay 			void				SetPackageDownloadProgress(PackageInfoRef& package, float value);
33*c0789628SAndrew Lindesay 			void				ClearPackageInstallationLocations(PackageInfoRef& package);
34*c0789628SAndrew Lindesay 
35a18f873fSAndrew Lindesay protected:
36a18f873fSAndrew Lindesay 			PackageManager*		fPackageManager;
37a18f873fSAndrew Lindesay 			PackageInfoRef		fPackage;
38a18f873fSAndrew Lindesay 
39a18f873fSAndrew Lindesay private:
40a18f873fSAndrew Lindesay 			Model*				fModel;
41a18f873fSAndrew Lindesay 			int32				fInstallLocation;
42a18f873fSAndrew Lindesay };
43a18f873fSAndrew Lindesay 
44a18f873fSAndrew Lindesay 
45a18f873fSAndrew Lindesay typedef BReference<AbstractPackageProcess> PackageProcessRef;
46a18f873fSAndrew Lindesay 
47a18f873fSAndrew Lindesay 
48a18f873fSAndrew Lindesay #endif // ABSTRACT_PACKAGE_PROCESS_H
49