From 6f3f670abe3d2d78a13cd3862e3a587dd4fe4e85 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 28 Aug 2015 21:21:02 +0300 Subject: 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 --- server/include/api_module_downloader.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'server/include/api_module_downloader.h') 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 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 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 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 children; int64_t size = 0, downloaded = 0; //file/dir size, downloaded size, optional std::map 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 get_downloads(std::map params = std::map()) = 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 params = std::map()) = 0; //same as above, except this one is for single download, not a complete list +protected: + downloader_module_info info; }; -- cgit v1.2.3