diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2015-08-28 21:21:02 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2015-08-28 21:21:02 +0300 |
commit | 6f3f670abe3d2d78a13cd3862e3a587dd4fe4e85 (patch) | |
tree | 0d681fd23bf2e70e385d053aee1e54dbe08668b1 /server/include/api_module_downloader.h | |
parent | ba8247eaf522e8a129b7fbbf09a6fab010746e3a (diff) |
protocol:
typo fix
added description to setting_info
server:
api:
using structure with setting info instead of hust string for just value (a bit of necessary complication)
renamed few structs to avoid collision with protobuf ones
defined few module variables in api itself (a bit of simplification for module developer)
modules:
adapted to api changes
Diffstat (limited to 'server/include/api_module_downloader.h')
-rw-r--r-- | server/include/api_module_downloader.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/server/include/api_module_downloader.h b/server/include/api_module_downloader.h index ae91943..d980d62 100644 --- a/server/include/api_module_downloader.h +++ b/server/include/api_module_downloader.h @@ -27,16 +27,16 @@ //i decided to avoid protobuf dependency in modules, so here is a copy/past of some protobuf declared structures required by downloader module enum MODULE_UI_ELEMENT_TYPE_e { - UI_EMPTY = 0, //helper type to set empty element - UI_STR = 1, //ui elements containing strings - UI_INTEGER, //numeric only ui elements (use strings instead ?) - UI_PROGRESS_BAR, //generic progress bar - UI_WINDOW, //ui window ... - UI_GROUP //empty ui element to group children together in ui (tabs can be implemented using this type) + UI_EMPTY_ = 0, //helper type to set empty element + UI_STR_ = 1, //ui elements containing strings + UI_INTEGER_, //numeric only ui elements (use strings instead ?) + UI_PROGRESS_BAR_, //generic progress bar + UI_WINDOW_, //ui window ... + UI_GROUP_ //empty ui element to group children together in ui (tabs can be implemented using this type) }; struct module_download_ui_element_info_s { - MODULE_UI_ELEMENT_TYPE_e type = UI_EMPTY; + MODULE_UI_ELEMENT_TYPE_e type = UI_EMPTY_; std::list<module_download_ui_element_info_s> children; std::string name; // name can be non unique int id; //internal element id used to get element value (should be unique for every loaded module) @@ -51,7 +51,7 @@ struct module_download_menu_element_info_s { }; -struct downloader_module_info : public module_info //downloader_module_info must be returned via module_base::get_module_info() for downloader module +struct downloader_module_info : public module_info_base //downloader_module_info must be returned via module_base::get_module_info() for downloader module { std::list<module_download_menu_element_info_s> download_root_menu, download_content_menu; //downloader module can add additional menu entries for download root and download content if content management supported by protocol std::list<module_download_ui_element_info_s> download_info_ui, download_creation_ui; //downloader module should set all data fields required for download creation, also may set data fields for info in ui in client @@ -59,15 +59,15 @@ struct downloader_module_info : public module_info //downloader_module_info must }; enum DOWNLOAD_CONTENT_ENTRY_TYPE_s { - DOWNLOAD_CONTENT_ENTRY_TYPE_FILE = 0, - DOWNLOAD_CONTENT_ENTRY_TYPE_DIRECTORY = 1 + DOWNLOAD_CONTENT_ENTRY_TYPE_FILE_ = 0, + DOWNLOAD_CONTENT_ENTRY_TYPE_DIRECTORY_ = 1 }; struct download_content_entry_s { //here is basic content entry description, this may be file or directory, i have set basic attributes required, but additional may be specified in info_map std::string name; //file/dir name, required - DOWNLOAD_CONTENT_ENTRY_TYPE_s type = DOWNLOAD_CONTENT_ENTRY_TYPE_FILE; + DOWNLOAD_CONTENT_ENTRY_TYPE_s type = DOWNLOAD_CONTENT_ENTRY_TYPE_FILE_; std::list<download_content_entry_s> children; int64_t size = 0, downloaded = 0; //file/dir size, downloaded size, optional std::map<std::string, std::string> info_map; //any additional info @@ -93,6 +93,8 @@ public: virtual bool execute_action_on_download(int download_id, int action_id) = 0; //execute module defined action on download, by id received via add_download virtual std::list<download_s> get_downloads(std::map<int, std::string> params = std::map<int, std::string>()) = 0; //this function must return list of downloads, additional options may be passed via params map virtual download_s get_download_info(int download_id, std::map<int, std::string> params = std::map<int, std::string>()) = 0; //same as above, except this one is for single download, not a complete list +protected: + downloader_module_info info; }; |