summaryrefslogtreecommitdiff
path: root/client-qt
diff options
context:
space:
mode:
Diffstat (limited to 'client-qt')
-rw-r--r--client-qt/udm-client-qt/downloads_model.cpp3
-rw-r--r--client-qt/udm-client-qt/udm_main.cpp21
2 files changed, 19 insertions, 5 deletions
diff --git a/client-qt/udm-client-qt/downloads_model.cpp b/client-qt/udm-client-qt/downloads_model.cpp
index f5d8817..5789151 100644
--- a/client-qt/udm-client-qt/downloads_model.cpp
+++ b/client-qt/udm-client-qt/downloads_model.cpp
@@ -55,7 +55,6 @@ QVariant downloads_model::data(const QModelIndex &index, int role) const
case 2:
return (qint64)downloads[index.row()].downloaded();
break;
- //
case 3:
if(downloads[index.row()].size())
return (qint64)((double)downloads[index.row()].downloaded() / (double)downloads[index.row()].size()) * 100.0;
@@ -70,7 +69,7 @@ QVariant downloads_model::data(const QModelIndex &index, int role) const
return tr("Stopped");
break;
case 1:
- return tr("Stopped");
+ return tr("Started");
break;
//TODO: handle module defined states
default:
diff --git a/client-qt/udm-client-qt/udm_main.cpp b/client-qt/udm-client-qt/udm_main.cpp
index 48ff7c8..ab9b898 100644
--- a/client-qt/udm-client-qt/udm_main.cpp
+++ b/client-qt/udm-client-qt/udm_main.cpp
@@ -369,10 +369,26 @@ void udm_main::server_message_received(server_msg msg)
switch(i.state())
{
case SUBSCRIPTION_DOWNLOAD_STATE::SDS_STARTED:
- //TODO:
+ for(auto d = downloads.begin(), end = downloads.end(); d != end; ++d)
+ {
+ if(d->id() == i.download_id())
+ {
+ d->set_state(1); //TODO: use human readable enum for states ?
+ mdl_downloads->refresh(); //TODO: udapte only changed item
+ break;
+ }
+ }
break;
case SUBSCRIPTION_DOWNLOAD_STATE::SDS_STOPPED:
- //TODO:
+ for(auto d = downloads.begin(), end = downloads.end(); d != end; ++d)
+ {
+ if(d->id() == i.download_id())
+ {
+ d->set_state(0); //TODO: use human readable enum for states ?
+ mdl_downloads->refresh(); //TODO: udapte only changed item
+ break;
+ }
+ }
break;
case SUBSCRIPTION_DOWNLOAD_STATE::SDS_DELETED:
{
@@ -391,7 +407,6 @@ void udm_main::server_message_received(server_msg msg)
BOOST_LOG_TRIVIAL(error)<<"error: deleted download which is not exist\n"<<msg.DebugString();
}
}
- //TODO:
break;
default:
BOOST_LOG_TRIVIAL(error)<<"error: unhandled download state in server message message\n"<<msg.DebugString();