summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-09-13 08:17:15 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-09-13 08:17:15 +0300
commiteb5bc25a3ce4eb9a650e433a5206f535c54b453c (patch)
tree913aaa9450937ebe6553195d853ed69b7a47bddc
parent53ecb7e48ede8dbfde85b6452d3fdbd7c56ae01e (diff)
protocol:
added "data_required" field to module_download_ui_element_info for download creation ui renamed download_children_menu to download_content_menu as it's more apropriate name server: added "data_required" field to module_download_ui_element_info_s for download creation ui changed "id" field in module_download_menu_element_info_s from string to int implemented helper functions to fill module_info protobuff structure implemented most of module_info structures filling (tested, working) client: basic implementation of "download add widget" "marked_class" template for adding module defined id's to ui elements basic action buttons toolbar in main windows
-rw-r--r--client-qt/udm-client-qt/client_session.cpp2
-rw-r--r--client-qt/udm-client-qt/download_add_widget.cpp109
-rw-r--r--client-qt/udm-client-qt/download_add_widget.h28
-rw-r--r--client-qt/udm-client-qt/marked_class.h23
-rw-r--r--client-qt/udm-client-qt/udm-client-qt.pro7
-rw-r--r--client-qt/udm-client-qt/udm_main.cpp67
-rw-r--r--client-qt/udm-client-qt/udm_main.h14
-rw-r--r--protocol/udm.proto6
-rw-r--r--server/include/api_module_downloader.h6
-rw-r--r--server/src/server_session.cpp183
10 files changed, 411 insertions, 34 deletions
diff --git a/client-qt/udm-client-qt/client_session.cpp b/client-qt/udm-client-qt/client_session.cpp
index 885598b..00e869a 100644
--- a/client-qt/udm-client-qt/client_session.cpp
+++ b/client-qt/udm-client-qt/client_session.cpp
@@ -234,7 +234,7 @@ void client_session::handle_connect(const boost::system::error_code &e)
}
}
-void client_session::handle_read(const boost::system::error_code& error, size_t bytes_transferred)
+void client_session::handle_read(const boost::system::error_code& error, size_t /*bytes_transferred*/)
{
if (!error)
{
diff --git a/client-qt/udm-client-qt/download_add_widget.cpp b/client-qt/udm-client-qt/download_add_widget.cpp
new file mode 100644
index 0000000..6dae8d0
--- /dev/null
+++ b/client-qt/udm-client-qt/download_add_widget.cpp
@@ -0,0 +1,109 @@
+#include "download_add_widget.h"
+#include <QComboBox>
+#include <QGridLayout>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QSpacerItem>
+#include <QSpinBox>
+
+#include "marked_class.h"
+
+download_add_widget::download_add_widget(std::list<module_info> &modules_, QWidget *parent) : QWidget(parent), modules(modules_)
+{
+ QGridLayout *l = new QGridLayout(this);
+ layout_settings = new QGridLayout; //must be created before first entry added to combobox to avoid crash
+ QLabel *lbl_modules = new QLabel(tr("module:"));
+ QComboBox *combo_modules = new QComboBox;
+ connect(combo_modules, SIGNAL(currentIndexChanged(QString)), this, SLOT(combo_modules_currentIndexChanged(QString)));
+ QHBoxLayout *layout_modules = new QHBoxLayout;
+ layout_modules->addWidget(lbl_modules);
+ QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
+ layout_modules->addItem(spacer);
+ layout_modules->addWidget(combo_modules);
+ l->addLayout(layout_modules, 0, 0, 1, 3);
+ for(auto m : modules)
+ {
+ if(m.type() == SERVER_MODULE_TYPE::SERVER_MODULE_DOWNLOADER)
+ combo_modules->addItem(m.name().c_str());
+ }
+
+
+ l->addLayout(layout_settings, 1, 0, 1, 3);
+
+ spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
+ l->addItem(spacer, 2, 0, 1, 3);
+
+
+ QPushButton *btn_ok = new QPushButton(tr("Ok")), *btn_cancel = new QPushButton(tr("Cancel"));
+ connect(btn_ok, SIGNAL(clicked(bool)), this, SLOT(btn_ok_clicked()));
+ connect(btn_cancel, SIGNAL(clicked(bool)), this, SLOT(btn_cancel_clicked()));
+ QHBoxLayout *layout_buttons = new QHBoxLayout;
+ layout_buttons->addWidget(btn_ok);
+ spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
+ layout_buttons->addItem(spacer);
+ layout_buttons->addWidget(btn_cancel);
+ l->addLayout(layout_buttons, 3, 0, 1, 3);
+
+
+
+ setLayout(l);
+}
+
+void download_add_widget::combo_modules_currentIndexChanged(QString module)
+{
+ for (QLayoutItem *item = layout_settings->takeAt(0); item != 0; item = layout_settings->takeAt(0))
+ delete item;
+
+ int row = 0;
+ for(auto m : modules)
+ {
+ if(m.name().c_str() == module)
+ {
+ for(auto ui : m.download_creation_ui())
+ {
+ if(ui.type() == MODULE_UI_ELEMENT_TYPE::UI_STR || ui.type() == MODULE_UI_ELEMENT_TYPE::UI_INTEGER)
+ {
+ QLabel *l = new QLabel(ui.name().c_str());
+ layout_settings->addWidget(l, row, 0);
+ QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
+ layout_settings->addItem(spacer, row, 1);
+ switch(ui.type())
+ {
+ case MODULE_UI_ELEMENT_TYPE::UI_STR:
+ {
+ marked_class<QLineEdit> *edit = new marked_class<QLineEdit>;
+ edit->set_mark(ui.id());
+ layout_settings->addWidget(edit, row, 2);
+ }
+ break;
+ case MODULE_UI_ELEMENT_TYPE::UI_INTEGER:
+ {
+ marked_class<QSpinBox> *edit = new marked_class<QSpinBox>;
+ edit->set_mark(ui.id());
+ layout_settings->addWidget(edit, row, 2);
+ }
+ break;
+ default:
+ break;
+ }
+ ++row;
+ }
+ }
+ }
+ }
+}
+
+void download_add_widget::btn_ok_clicked()
+{
+
+}
+
+void download_add_widget::btn_cancel_clicked()
+{
+ close();
+ deleteLater(); //?
+}
+
diff --git a/client-qt/udm-client-qt/download_add_widget.h b/client-qt/udm-client-qt/download_add_widget.h
new file mode 100644
index 0000000..1b619bb
--- /dev/null
+++ b/client-qt/udm-client-qt/download_add_widget.h
@@ -0,0 +1,28 @@
+#ifndef DOWNLOAD_ADD_WIDGET_H
+#define DOWNLOAD_ADD_WIDGET_H
+
+#include <QWidget>
+#include "../../protocol/udm.pb.h"
+
+class QGridLayout;
+
+
+class download_add_widget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit download_add_widget(std::list<module_info> &modules, QWidget *parent = 0);
+
+signals:
+
+public slots:
+protected slots:
+ void combo_modules_currentIndexChanged(QString);
+ void btn_ok_clicked();
+ void btn_cancel_clicked();
+private:
+ std::list<module_info> &modules;
+ QGridLayout *layout_settings;
+};
+
+#endif // DOWNLOAD_ADD_WIDGET_H
diff --git a/client-qt/udm-client-qt/marked_class.h b/client-qt/udm-client-qt/marked_class.h
new file mode 100644
index 0000000..c12d68d
--- /dev/null
+++ b/client-qt/udm-client-qt/marked_class.h
@@ -0,0 +1,23 @@
+#ifndef MARKED_CLASS
+#define MARKED_CLASS
+
+template <typename BASE>
+class marked_class : public BASE
+{
+public:
+
+ void set_mark(int mark)
+ {
+ this->mark = mark;
+ }
+ int get_mark()
+ {
+ return mark;
+ }
+
+private:
+ int mark = -1;
+};
+
+#endif // MARKED_CLASS
+
diff --git a/client-qt/udm-client-qt/udm-client-qt.pro b/client-qt/udm-client-qt/udm-client-qt.pro
index d64ebe4..ce04163 100644
--- a/client-qt/udm-client-qt/udm-client-qt.pro
+++ b/client-qt/udm-client-qt/udm-client-qt.pro
@@ -41,10 +41,13 @@ SOURCES += main.cpp\
connect_widget.cpp \
../../protocol/udm.pb.cc \
downloads_model.cpp \
- filters_model.cpp
+ filters_model.cpp \
+ download_add_widget.cpp
HEADERS += udm_main.h \
client_session.h \
connect_widget.h \
downloads_model.h \
- filters_model.h
+ filters_model.h \
+ download_add_widget.h \
+ marked_class.h
diff --git a/client-qt/udm-client-qt/udm_main.cpp b/client-qt/udm-client-qt/udm_main.cpp
index bf58911..ca5b397 100644
--- a/client-qt/udm-client-qt/udm_main.cpp
+++ b/client-qt/udm-client-qt/udm_main.cpp
@@ -31,11 +31,14 @@
#include <QHeaderView>
#include <QSplitter>
#include <QStackedLayout>
+#include <QPushButton>
+#include <QToolBar>
#include "connect_widget.h"
#include "client_session.h"
#include "downloads_model.h"
#include "filters_model.h"
+#include "download_add_widget.h"
udm_main::udm_main(QWidget *parent)
@@ -83,7 +86,6 @@ udm_main::udm_main(QWidget *parent)
-
spl_vert = new QSplitter(Qt::Vertical);
spl_vert->addWidget(spl_hor);
spl_vert->addWidget(tabs_info);
@@ -92,6 +94,7 @@ udm_main::udm_main(QWidget *parent)
spl_vert->setStretchFactor(1, 1);
setCentralWidget(spl_vert);
+ create_buttons();
}
udm_main::~udm_main()
@@ -99,7 +102,8 @@ udm_main::~udm_main()
if(thread_client_session)
{
thread_client_session->quit();
- delete thread_client_session;
+ thread_client_session->deleteLater();
+ //delete thread_client_session;
}
//TODO: clear all remaining data
}
@@ -206,7 +210,6 @@ void udm_main::server_message_received(server_msg msg)
break;
case SERVER_MSG_TYPE::SERVER_MODULES_REPLY:
{
- //TODO: create download info ui template for each module here
modules.clear(); //TODO: something better
for(auto i : msg.server_modules_reply())
modules.push_back(i);
@@ -225,6 +228,64 @@ void udm_main::server_message_received(server_msg msg)
}
}
+void udm_main::create_buttons()
+{
+ btn_start = new QPushButton(this);
+ connect(btn_start, SIGNAL(clicked(bool)), this, SLOT(btn_start_clicked()));
+ btn_stop = new QPushButton(this);
+ connect(btn_stop, SIGNAL(clicked(bool)), this, SLOT(btn_stop_clicked()));
+ btn_del = new QPushButton(this);
+ connect(btn_del, SIGNAL(clicked(bool)), this, SLOT(btn_del_clicked()));
+ btn_add = new QPushButton(this);
+ connect(btn_add, SIGNAL(clicked(bool)), this, SLOT(btn_add_clicked()));
+ button_bar = new QToolBar(this);
+ button_bar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ //TODO: support dynamic action buttons for modules
+ button_bar->addWidget(btn_start);
+ button_bar->addWidget(btn_stop);
+ button_bar->addSeparator();
+ button_bar->addWidget(btn_del);
+ button_bar->addWidget(btn_add);
+ btn_start->setText(tr("Start"));
+ btn_start->setToolTip(tr("Start download"));
+ btn_start->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ btn_stop->setText(tr("Stop"));
+ btn_stop->setToolTip(tr("Stop download"));
+ btn_stop->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ btn_del->setText(tr("Delete"));
+ btn_del->setToolTip(tr("Delete download"));
+ btn_del->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ btn_add->setText(tr("Add"));
+ btn_add->setToolTip(tr("Add download"));
+ btn_add->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+
+ this->addToolBar(button_bar);
+
+}
+
+void udm_main::btn_start_clicked()
+{
+
+}
+
+void udm_main::btn_stop_clicked()
+{
+
+}
+
+void udm_main::btn_add_clicked()
+{
+ download_add_widget *w = new download_add_widget(modules);
+ //TODO: connect slots/signals here
+ w->show();
+}
+
+void udm_main::btn_del_clicked()
+{
+
+}
+
+
void udm_main::client_connected(bool success, QString error_text)
{
if(!success)
diff --git a/client-qt/udm-client-qt/udm_main.h b/client-qt/udm-client-qt/udm_main.h
index 28d5440..eede952 100644
--- a/client-qt/udm-client-qt/udm_main.h
+++ b/client-qt/udm-client-qt/udm_main.h
@@ -35,6 +35,8 @@ class QTabWidget;
class downloads_model;
class filters_model;
class QSplitter;
+class QToolBar;
+class QPushButton;
namespace boost {
namespace asio {
@@ -52,6 +54,7 @@ class udm_main : public QMainWindow
public:
udm_main(QWidget *parent = 0);
~udm_main();
+
public slots:
void show_connect_widget();
void client_connect(QString &host, QString &password, int port);
@@ -59,12 +62,21 @@ public slots:
void server_message_received(server_msg msg);
void client_connected(bool success, QString error_text);
void client_disconnected();
+
+protected slots:
+ void btn_start_clicked();
+ void btn_stop_clicked();
+ void btn_add_clicked();
+ void btn_del_clicked();
+
signals:
void connect_signal(QString host, QString password, int port);
void connect_signal_ssl(QString host, QString password, int port, QString ssl_ca, QString ssl_crt, QString ssl_key);
+
private:
void client_pre_connect_init();
void client_connect_finalize();
+ void create_buttons();
QThread *thread_client_session;
client_session *session;
boost::asio::io_service *io_service_;
@@ -73,6 +85,8 @@ private:
QTableView *tbl_downloads;
QTreeView *tree_filters;
QTabWidget *tabs_info;
+ QToolBar *button_bar;
+ QPushButton *btn_start, *btn_stop, *btn_del, *btn_add;
downloads_model *mdl_downloads;
filters_model *mdl_filters;
QSplitter *spl_hor, *spl_vert;
diff --git a/protocol/udm.proto b/protocol/udm.proto
index 029183f..120fc9e 100644
--- a/protocol/udm.proto
+++ b/protocol/udm.proto
@@ -37,9 +37,11 @@ message module_download_ui_element_info {
required int32 id = 2; //internal element id used to get element value (should be unique for every loaded module)
optional string name = 3 [default = "not set"]; //can be non unique
optional string description = 4;
- repeated module_download_ui_element_info children = 5;
+ optional bool data_required = 5 [default = false]; //ui element may required data specified (used in download creation ui)
+ repeated module_download_ui_element_info children = 6;
}
+
message module_download_menu_element_info {
required int32 id = 1;
required string name = 2;
@@ -247,7 +249,7 @@ message module_info //general module info for client including settings, downloa
repeated module_download_ui_element_info download_info_ui = 6; //always complete here
repeated module_download_ui_element_info download_creation_ui = 7;
repeated module_download_menu_element_info download_menu = 8;
- repeated module_download_menu_element_info download_children_menu = 9; //menu for files and folders inside download root, may not present
+ repeated module_download_menu_element_info download_content_menu = 9; //menu for files and folders inside download root, may not present
repeated string_pair get_downloads_parameters_info = 10;
}
diff --git a/server/include/api_module_downloader.h b/server/include/api_module_downloader.h
index dc31811..33a3fce 100644
--- a/server/include/api_module_downloader.h
+++ b/server/include/api_module_downloader.h
@@ -38,14 +38,16 @@ enum MODULE_UI_ELEMENT_TYPE_e {
struct module_download_ui_element_info_s {
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
+ std::string name, description; // name can be non unique, description is optional
+ bool data_required = false; //set to true if ui element require data from client (used in download creation ui)
int id; //internal element id used to get element value (should be unique for every loaded module)
};
//TODO: some mechanism for module to tell it's abilities, for example if it can provide download content, e.t.c.
struct module_download_menu_element_info_s {
- std::string id, name, description; //internal element id used to get element value (should be unique for every loaded module), name can be non unique, description is optional
+ std::string name, description; // name can be non unique, description is optional
+ int id; //internal element id used to get element value (should be unique for every loaded module)
bool data_required = false; //set to true if menu element require data from client
std::list<module_download_menu_element_info_s> children; //element with children cannot be executed, it's just container
};
diff --git a/server/src/server_session.cpp b/server/src/server_session.cpp
index d0ff26c..ca4df5a 100644
--- a/server/src/server_session.cpp
+++ b/server/src/server_session.cpp
@@ -118,6 +118,147 @@ void server_session::handle_read(const boost::system::error_code& error, size_t
}
}
+void add_runtime_module_setting(const std::pair<std::string, setting_s> &s, module_info *mi)
+{
+ setting *msi = mi->add_settings();
+ msi->set_name(s.first);
+ msi->set_value(s.second.value);
+ for(auto di : s.second.info.dependencies)
+ msi->mutable_info()->add_dependencies(di);
+ for(auto bi : s.second.info.blockers)
+ msi->mutable_info()->add_blockers(bi);
+ msi->mutable_info()->set_default_value(s.second.info.default_value);
+ msi->mutable_info()->set_minimal_value(s.second.info.minimal_value);
+ msi->mutable_info()->set_maximal_value(s.second.info.maximal_value);
+ msi->mutable_info()->set_description(s.second.info.description);
+
+}
+
+
+void add_download_info_ui_element(module_download_ui_element_info_s& element, module_download_ui_element_info *mi)
+{
+ module_download_ui_element_info *e = mi->add_children();
+ e->set_description(element.description);
+ e->set_name(element.name);
+ e->set_id(element.id);
+ switch(element.type)
+ {
+ case MODULE_UI_ELEMENT_TYPE_e::UI_EMPTY_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_EMPTY);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_GROUP_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_GROUP);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_INTEGER_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_INTEGER);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_PROGRESS_BAR_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_PROGRESS_BAR);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_STR_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_STR);
+ break;
+ default:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_EMPTY);
+ break;
+ }
+ for(auto ui_element: element.children)
+ add_download_info_ui_element(ui_element, e);
+}
+
+void add_download_info_ui_element(module_download_ui_element_info_s& element, module_info *mi)
+{
+ module_download_ui_element_info *e = mi->add_download_info_ui();
+ e->set_description(element.description);
+ e->set_name(element.name);
+ e->set_id(element.id);
+ switch(element.type)
+ {
+ case MODULE_UI_ELEMENT_TYPE_e::UI_EMPTY_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_EMPTY);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_GROUP_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_GROUP);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_INTEGER_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_INTEGER);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_PROGRESS_BAR_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_PROGRESS_BAR);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_STR_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_STR);
+ break;
+ default:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_EMPTY);
+ break;
+ }
+ for(auto ui_element: element.children)
+ add_download_info_ui_element(ui_element, e);
+}
+
+void add_download_create_ui_element(module_download_ui_element_info_s& element, module_info *mi)
+{
+ module_download_ui_element_info *e = mi->add_download_creation_ui();
+ e->set_description(element.description);
+ e->set_name(element.name);
+ e->set_id(element.id);
+ switch(element.type)
+ {
+ case MODULE_UI_ELEMENT_TYPE_e::UI_EMPTY_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_EMPTY);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_GROUP_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_GROUP);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_INTEGER_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_INTEGER);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_PROGRESS_BAR_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_PROGRESS_BAR);
+ break;
+ case MODULE_UI_ELEMENT_TYPE_e::UI_STR_:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_STR);
+ break;
+ default:
+ e->set_type(MODULE_UI_ELEMENT_TYPE::UI_EMPTY);
+ break;
+ }
+ for(auto ui_element: element.children)
+ add_download_info_ui_element(ui_element, e);
+}
+
+void add_download_menu_element(module_download_menu_element_info_s &element, module_download_menu_element_info *mi)
+{
+ module_download_menu_element_info *e = mi->add_children();
+ e->set_description(element.description);
+ e->set_id(element.id);
+ e->set_name(element.name);
+ for(auto menu_element: element.children)
+ add_download_menu_element(menu_element, e);
+}
+
+void add_download_menu_element(module_download_menu_element_info_s &element, module_info *mi)
+{
+ module_download_menu_element_info *e = mi->add_download_menu();
+ e->set_description(element.description);
+ e->set_id(element.id);
+ e->set_name(element.name);
+ for(auto menu_element: element.children)
+ add_download_menu_element(menu_element, e);
+}
+
+void add_download_content_menu_element(module_download_menu_element_info_s &element, module_info *mi)
+{
+ module_download_menu_element_info *e = mi->add_download_content_menu();
+ e->set_description(element.description);
+ e->set_id(element.id);
+ e->set_name(element.name);
+ for(auto menu_element: element.children)
+ add_download_menu_element(menu_element, e);
+}
+
+
void server_session::handle_command(client_msg *msg)
{
if(msg->type() != CLIENT_MSG_TYPE::CLIENT_AUTH_REQUEST && clients.find(msg->auth_token()) == clients.end())
@@ -208,19 +349,25 @@ void server_session::handle_command(client_msg *msg)
mi->set_description(i->get_module_info().description);
mi->set_version(i->get_module_info().version);
for(auto ms : i->get_runtime_module_settings())
+ add_runtime_module_setting(ms, mi);
+ const downloader_module_info &dmi = static_cast<const downloader_module_info&>(i->get_module_info());
+ for(auto ui_element : dmi.download_info_ui)
+ add_download_info_ui_element(ui_element, mi);
+ for(auto ui_element : dmi.download_creation_ui)
+ add_download_create_ui_element(ui_element, mi);
+ for(auto menu_entry : dmi.download_root_menu)
+ add_download_menu_element(menu_entry, mi);
+ for(auto menu_entry : dmi.download_content_menu)
+ add_download_content_menu_element(menu_entry, mi);
+ for(auto si : dmi.get_downloads_parameters_info)
{
- setting *msi = mi->add_settings();
- msi->set_name(ms.first);
- msi->set_value(ms.second.value);
- for(auto di : ms.second.info.dependencies)
- msi->mutable_info()->add_dependencies(di);
- for(auto bi : ms.second.info.blockers)
- msi->mutable_info()->add_blockers(bi);
- msi->mutable_info()->set_default_value(ms.second.info.default_value);
- msi->mutable_info()->set_minimal_value(ms.second.info.minimal_value);
- msi->mutable_info()->set_maximal_value(ms.second.info.maximal_value);
- msi->mutable_info()->set_description(ms.second.info.description);
+ string_pair *p = mi->add_get_downloads_parameters_info();
+ p->set_name(si.first);
+ p->set_value(si.second);
}
+
+
+
}
for(auto i : modules->get_metadata_modules())
{
@@ -230,19 +377,7 @@ void server_session::handle_command(client_msg *msg)
mi->set_description(i->get_module_info().description);
mi->set_version(i->get_module_info().version);
for(auto ms : i->get_runtime_module_settings())
- {
- setting *msi = mi->add_settings();
- msi->set_name(ms.first);
- msi->set_value(ms.second.value);
- for(auto di : ms.second.info.dependencies)
- msi->mutable_info()->add_dependencies(di);
- for(auto bi : ms.second.info.blockers)
- msi->mutable_info()->add_blockers(bi);
- msi->mutable_info()->set_default_value(ms.second.info.default_value);
- msi->mutable_info()->set_minimal_value(ms.second.info.minimal_value);
- msi->mutable_info()->set_maximal_value(ms.second.info.maximal_value);
- msi->mutable_info()->set_description(ms.second.info.description);
- }
+ add_runtime_module_setting(ms, mi);
}
send_message(&msg);
}