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