| 1 | #ifndef GAME_CLIENT_COMPONENTS_COMMUNITY_ICONS_H |
| 2 | #define |
| 3 | |
| 4 | #include <base/hash.h> |
| 5 | |
| 6 | #include <engine/graphics.h> |
| 7 | #include <engine/serverbrowser.h> |
| 8 | #include <engine/shared/jobs.h> |
| 9 | |
| 10 | #include <game/client/component.h> |
| 11 | #include <game/client/ui_rect.h> |
| 12 | |
| 13 | #include <optional> |
| 14 | |
| 15 | class IHttpRequest; |
| 16 | |
| 17 | class |
| 18 | { |
| 19 | friend class CCommunityIcons; |
| 20 | |
| 21 | private: |
| 22 | char [CServerInfo::MAX_COMMUNITY_ID_LENGTH]; |
| 23 | SHA256_DIGEST ; |
| 24 | IGraphics::CTextureHandle ; |
| 25 | IGraphics::CTextureHandle ; |
| 26 | }; |
| 27 | |
| 28 | class : public CComponentInterfaces |
| 29 | { |
| 30 | public: |
| 31 | const CCommunityIcon *(const char *); |
| 32 | void (const CCommunityIcon *pIcon, CUIRect Rect, bool Active); |
| 33 | void (); |
| 34 | void (); |
| 35 | void (); |
| 36 | |
| 37 | private: |
| 38 | class |
| 39 | { |
| 40 | protected: |
| 41 | CCommunityIcons *; |
| 42 | char [CServerInfo::MAX_COMMUNITY_ID_LENGTH]; |
| 43 | char [IO_MAX_PATH_LENGTH]; |
| 44 | int ; |
| 45 | bool = false; |
| 46 | SHA256_DIGEST ; |
| 47 | |
| 48 | (CCommunityIcons *, const char *, int StorageType); |
| 49 | |
| 50 | public: |
| 51 | const char *() const { return m_aCommunityId; } |
| 52 | bool () const { return m_Success; } |
| 53 | const SHA256_DIGEST &() const { return m_Sha256; } |
| 54 | virtual () = default; |
| 55 | }; |
| 56 | |
| 57 | class : public IJob, public CAbstractCommunityIconJob |
| 58 | { |
| 59 | CImageInfo ; |
| 60 | CImageInfo ; |
| 61 | |
| 62 | protected: |
| 63 | void () override; |
| 64 | |
| 65 | public: |
| 66 | (CCommunityIcons *, const char *, int StorageType); |
| 67 | () override; |
| 68 | |
| 69 | CImageInfo &() { return m_ImageInfo; } |
| 70 | CImageInfo &() { return m_ImageInfoGrayscale; } |
| 71 | }; |
| 72 | |
| 73 | class : public CAbstractCommunityIconJob |
| 74 | { |
| 75 | std::shared_ptr<IHttpRequest> ; |
| 76 | |
| 77 | public: |
| 78 | (CCommunityIcons *, const char *, const char *pUrl, const SHA256_DIGEST &Sha256); |
| 79 | std::shared_ptr<IHttpRequest> () { return m_pHttpRequest; } |
| 80 | }; |
| 81 | |
| 82 | std::vector<CCommunityIcon> ; |
| 83 | std::deque<std::shared_ptr<CCommunityIconLoadJob>> ; |
| 84 | std::deque<std::shared_ptr<CCommunityIconDownloadJob>> ; |
| 85 | std::optional<SHA256_DIGEST> ; |
| 86 | static int (const char *pName, int IsDir, int DirType, void *pUser); |
| 87 | bool (const char *pPath, int DirType, CImageInfo &Info, CImageInfo &InfoGrayscale, SHA256_DIGEST &Sha256); |
| 88 | void (const char *, CImageInfo &Info, CImageInfo &InfoGrayscale, const SHA256_DIGEST &Sha256); |
| 89 | }; |
| 90 | |
| 91 | #endif |
| 92 | |