diff options
Diffstat (limited to 'client-qt/udm-client-qt/udm_main.cpp')
-rw-r--r-- | client-qt/udm-client-qt/udm_main.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/client-qt/udm-client-qt/udm_main.cpp b/client-qt/udm-client-qt/udm_main.cpp index 91cfb10..bf58911 100644 --- a/client-qt/udm-client-qt/udm_main.cpp +++ b/client-qt/udm-client-qt/udm_main.cpp @@ -55,7 +55,7 @@ udm_main::udm_main(QWidget *parent) tbl_downloads = new QTableView; tbl_downloads->setShowGrid(false); - mdl_downloads = new downloads_model; + mdl_downloads = new downloads_model(downloads); tbl_downloads->setModel(mdl_downloads); tbl_downloads->setSelectionBehavior(QAbstractItemView::SelectRows); tbl_downloads->setSortingEnabled(true); @@ -135,10 +135,11 @@ void udm_main::client_pre_connect_init() session = new client_session(0, io_service_); //parent must be 0 here connect(session, SIGNAL(server_message_received(server_msg)), this, SLOT(server_message_received(server_msg))); connect(session, SIGNAL(client_connected(bool,QString)), this, SLOT(client_connected(bool,QString))); + connect(session, SIGNAL(client_disconnected()), this, SLOT(client_disconnected())); + connect(session, SIGNAL(terminate_thread()), thread_client_session, SLOT(quit())); } void udm_main::client_connect_finalize() { - connect(session, SIGNAL(terminate_thread()), thread_client_session, SLOT(quit())); session->moveToThread(thread_client_session); thread_client_session->start(); } @@ -201,17 +202,22 @@ void udm_main::server_message_received(server_msg msg) } break; case SERVER_MSG_TYPE::SERVER_CORE_INFO_REPLY: - { - } + server_info = msg.server_core_info_reply(); 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); } break; case SERVER_MSG_TYPE::SERVER_DOWNLOADS_LIST_REPLY: { - + downloads.clear(); //TODO: something better + for(auto i : msg.downloads()) + downloads.push_back(i.download()); } break; default: @@ -236,3 +242,8 @@ void udm_main::client_connected(bool success, QString error_text) msg.setText(success?"client connected with message:":"client connection error with error:" + error_text); msg.exec(); */ } + +void udm_main::client_disconnected() +{ + lbl_state->setText(tr("State") + ": " + tr("Disconnected")); +} |