xref: /haiku/src/apps/haikudepot/server/ServerIconExportUpdateProcess.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 /*
2  * Copyright 2017-2018, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef SERVER_ICON_EXPORT_UPDATE_PROCESS_H
6 #define SERVER_ICON_EXPORT_UPDATE_PROCESS_H
7 
8 
9 #include <File.h>
10 #include <Path.h>
11 #include <String.h>
12 #include <Url.h>
13 
14 #include "AbstractServerProcess.h"
15 #include "LocalIconStore.h"
16 #include "Model.h"
17 
18 
19 class DumpExportPkg;
20 
21 
22 class ServerIconExportUpdateProcess : public AbstractServerProcess {
23 public:
24 
25 								ServerIconExportUpdateProcess(
26 									Model* model, uint32 serverProcessOptions);
27 	virtual						~ServerIconExportUpdateProcess();
28 
29 			const char*			Name() const;
30 			const char*			Description() const;
31 
32 			status_t			RunInternal();
33 
34 protected:
35 			status_t			PopulateForPkg(const PackageInfoRef& package);
36 			status_t			PopulateForDepot(const DepotInfo& depot);
37 			status_t			Populate();
38 			status_t			HasLocalData(bool* result) const;
39 			status_t			GetStandardMetaDataPath(BPath& path) const;
40 			void				GetStandardMetaDataJsonPath(
41 									BString& jsonPath) const;
42 private:
43 			status_t			_Unpack(BPath& tarGzFilePath);
44 			status_t			_HandleDownloadFailure();
45 			status_t			_DownloadAndUnpack();
46 			status_t			_Download(BPath& tarGzFilePath);
47 
48 			Model*				fModel;
49 			BPath				fLocalIconStoragePath;
50 			LocalIconStore*		fLocalIconStore;
51 			int32				fCountIconsSet;
52 
53 };
54 
55 #endif // SERVER_ICON_EXPORT_UPDATE_PROCESS_H
56