From 1a345f933f5b86fb297463863bd82334c94592c7 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 10 Dec 2015 06:15:47 +0300 Subject: docs: added BUGS file with known bugs server: fixed bug with download_deleted event optimized download state change event (send nothing on no subscriptions match) client-qt: implemented download deleted event handler --- client-qt/udm-client-qt/udm_main.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'client-qt/udm-client-qt/udm_main.cpp') diff --git a/client-qt/udm-client-qt/udm_main.cpp b/client-qt/udm-client-qt/udm_main.cpp index fcd07ff..48ff7c8 100644 --- a/client-qt/udm-client-qt/udm_main.cpp +++ b/client-qt/udm-client-qt/udm_main.cpp @@ -251,6 +251,7 @@ void udm_main::client_connect_ssl(QString &host, QString &password, int port, QS void udm_main::server_message_received(server_msg msg) { + BOOST_LOG_TRIVIAL(trace)<<"recieved server message\n"<set_module_name(""); s->mutable_download_state_change()->add_states(SDS_STARTED); //subscript to download started event s->mutable_download_state_change()->add_states(SDS_STOPPED); //subscript to download stopped event + s->mutable_download_state_change()->add_states(SDS_DELETED); //subscript to download deleted event session->send_message(msg); } @@ -373,10 +375,26 @@ void udm_main::server_message_received(server_msg msg) //TODO: break; case SUBSCRIPTION_DOWNLOAD_STATE::SDS_DELETED: + { + bool found = false; + unsigned int pos = 0; + for(auto d = downloads.begin(), end = downloads.end(); d != end; ++d, ++pos) + { + if(d->id() == i.download_id()) + { + found = true; + downloads.erase(d); + mdl_downloads->removeRows(pos, 1); + break; + } + if(!found) + BOOST_LOG_TRIVIAL(error)<<"error: deleted download which is not exist\n"<