diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2015-09-10 00:15:07 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2015-09-10 00:15:07 +0300 |
commit | ccffc685c412183b56f822438da5cc8a575d757e (patch) | |
tree | 4ff9b3abb4ac1d94941ff5aa5aee9ee4cbe74a3e /client-qt/udm-client-qt/udm_main.cpp | |
parent | b5af51e358073145cdf66470cc890d98547a6dac (diff) |
client-qt:
handle disconnect
basic downloads model (still draft with unimplemented basic features like dynamic columns count, dynamic columns will be implemented next)
basic handler for download list (in theory it's already working now, but untested)
basic modules info handler (just store data in memory for now, all basic features still unimplemented, download info ui templates generation will be implemented next here)
basic core info handler (just store data in memory for now, core settings and core info ui will be implemented next here.)
server:
api:
added client metadata manipulation api for downloader modules
added metadata map to download structure in downloader modules
curl_downloader:
implemented new api's
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")); +} |