summaryrefslogtreecommitdiff
path: root/client-qt/udm-client-qt/download_add_widget.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-09-14 12:31:13 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-09-14 12:31:13 +0300
commit1d6ced38a89547aaf2cc3745876360f0e5086474 (patch)
treebbc627e26fb759884d8aefd4a789805a98beec31 /client-qt/udm-client-qt/download_add_widget.cpp
parentb8dd66d71676603dc3081b1de07f2e76732737bd (diff)
protocol:
added module field to client_download_add_request as required server: small handle_command redesign to avoid crashes client-qt: implemented all basic features of download add widget (working now, tested)
Diffstat (limited to 'client-qt/udm-client-qt/download_add_widget.cpp')
-rw-r--r--client-qt/udm-client-qt/download_add_widget.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/client-qt/udm-client-qt/download_add_widget.cpp b/client-qt/udm-client-qt/download_add_widget.cpp
index 813ac7a..366c7d6 100644
--- a/client-qt/udm-client-qt/download_add_widget.cpp
+++ b/client-qt/udm-client-qt/download_add_widget.cpp
@@ -76,6 +76,16 @@ download_add_widget::download_add_widget(std::list<module_info> &modules_, QWidg
void download_add_widget::combo_modules_currentIndexChanged(QString module)
{
+ current_module = module;
+ {
+ int rows = layout_settings->rowCount(), columns = layout_settings->columnCount();
+ for(int i = 0; i < rows; i++)
+ {
+ for(int ii = 0; ii < columns; ii ++)
+ delete layout_settings->itemAtPosition(i, ii);
+ }
+ }
+
for (QLayoutItem *item = layout_settings->takeAt(0); item != 0; item = layout_settings->takeAt(0))
delete item;
@@ -98,6 +108,7 @@ void download_add_widget::combo_modules_currentIndexChanged(QString module)
{
marked_class<QLineEdit> *edit = new marked_class<QLineEdit>;
edit->set_mark(ui.id());
+ edit->set_type(widget_type_e::QLineEdit_t);
layout_settings->addWidget(edit, row, 2);
}
break;
@@ -105,6 +116,7 @@ void download_add_widget::combo_modules_currentIndexChanged(QString module)
{
marked_class<QSpinBox> *edit = new marked_class<QSpinBox>;
edit->set_mark(ui.id());
+ edit->set_type(widget_type_e::QSpinBox_t);
layout_settings->addWidget(edit, row, 2);
}
break;
@@ -120,7 +132,33 @@ void download_add_widget::combo_modules_currentIndexChanged(QString module)
void download_add_widget::btn_ok_clicked()
{
-
+ int rows = layout_settings->rowCount();
+ std::map<int, std::string> settings;
+ for (int i = 0; i < rows; ++i)
+ {
+ QWidget *w_ = layout_settings->itemAtPosition(i, 2)->widget();
+ marked_class<QWidget> *w = static_cast<marked_class<QWidget> *>(w_);
+ switch(w->get_type())
+ {
+ case widget_type_e::QLineEdit_t:
+ {
+ marked_class<QLineEdit> *l = static_cast<marked_class<QLineEdit> *>(w_);
+ settings[l->get_mark()] = l->text().toStdString();
+ }
+ break;
+ case widget_type_e::QSpinBox_t:
+ {
+ marked_class<QSpinBox> *l = static_cast<marked_class<QSpinBox> *>(w_);
+ settings[l->get_mark()] = l->text().toStdString();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ emit got_download_settings(current_module.toStdString(), settings);
+ close();
+ deleteLater();
}
void download_add_widget::btn_cancel_clicked()