xref: /haiku/src/apps/haikudepot/process/ProcessCoordinatorFactory.h (revision 9a6a20d4689307142a7ed26a1437ba47e244e73f)
1 /*
2  * Copyright 2018-2024, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef PROCESS_COORDINATOR_FACTORY_H
6 #define PROCESS_COORDINATOR_FACTORY_H
7 
8 #include <SupportDefs.h>
9 
10 #include "AbstractProcess.h"
11 #include "PackageInfo.h"
12 #include "PackageScreenshotRepository.h"
13 
14 class Model;
15 class PackageInfoListener;
16 class ProcessCoordinator;
17 class ProcessCoordinatorListener;
18 class UserDetailVerifierListener;
19 
20 /*! This class is able to create ProcessCoordinators that are loaded-up with
21     Processes that together complete some larger job.
22 */
23 
24 class ProcessCoordinatorFactory {
25 public:
26 	static	ProcessCoordinator*	CreateIncrementViewCounter(Model* model,
27 									const PackageInfoRef package);
28 
29 	static	ProcessCoordinator*	CreateBulkLoadCoordinator(
30 									PackageInfoListenerRef packageInfoListener,
31 									Model* model, bool forceLocalUpdate);
32 
33 	static	ProcessCoordinator*	CreateUserDetailVerifierCoordinator(
34 									UserDetailVerifierListener*
35 										userDetailVerifierListener,
36 									Model* model);
37 
38 	static	ProcessCoordinator*	CreatePackageActionCoordinator(
39 									Model* model, BMessage* message);
40 
41 	static	ProcessCoordinator*	CacheScreenshotCoordinator(
42 									Model* model, ScreenshotCoordinate& screenshotCoordinate);
43 
44 	static	ProcessCoordinator*	PopulatePkgChangelogCoordinator(Model* model,
45 									PackageInfoRef package);
46 
47 	static	ProcessCoordinator*	PopulatePkgUserRatingsCoordinator(Model* model,
48 									PackageInfoRef package);
49 
50 private:
51 	static	uint32				_CalculateServerProcessOptions();
52 
53 	static	PackageInfoRef		_ExtractPackageFromMessage(
54 									Model* model, BMessage* message);
55 
56 	static	ProcessCoordinator*	_CreateInstallPackageActionCoordinator(
57 									Model* model, BMessage* message);
58 
59 	static	ProcessCoordinator*	_CreateUninstallPackageActionCoordinator(
60 									Model* model, BMessage* message);
61 
62 	static	ProcessCoordinator*	_CreateOpenPackageActionCoordinator(
63 									Model* model, BMessage* message);
64 
65 	static	ProcessCoordinator*	_CreateSingleProcessCoordinator(const char* name,
66 									AbstractProcess *process);
67 
68 };
69 
70 #endif // PROCESS_COORDINATOR_FACTORY_H
71