Changeset 58245 in vbox
- Timestamp:
- Oct 14, 2015 2:38:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
r58243 r58245 61 61 #endif 62 62 63 signals: 64 65 /** Notifies listeners about download progress change. 66 * @param iCurrent holds the current amount of bytes downloaded. 67 * @param iTotal holds the total amount of bytes to be downloaded. */ 68 void sigDownloadProgress(qint64 iCurrent, qint64 iTotal); 69 63 70 public: 64 71 … … 96 103 97 104 private: 105 98 106 /** @name Helpers - HTTP stuff 99 107 * @{ */ 108 int applyConfiguration(); 100 109 int applyProxyRules(); 101 110 int applyHttpsCertificates(); … … 130 139 /** @} */ 131 140 141 /** @name HTTP download progress handling. 142 * @{ */ 143 /** Redirects download progress callback to particular object which can handle it. */ 144 static void handleProgressChange(RTHTTP hHttp, void *pvUser, uint64_t cbDownloadTotal, uint64_t cbDownloaded); 145 /** Handles download progress callback. */ 146 void handleProgressChange(uint64_t cbDownloadTotal, uint64_t cbDownloaded); 147 /** @} */ 148 132 149 /** Holds short descriptive context of thread's current operation. */ 133 150 QString m_strContext; … … 234 251 if (m_hHttp != NIL_RTHTTP) 235 252 RTHttpAbort(m_hHttp); 253 } 254 255 int UINetworkReplyPrivateThread::applyConfiguration() 256 { 257 /* Install downloading progress callback: */ 258 return RTHttpSetDownloadProgressCallback(m_hHttp, &UINetworkReplyPrivateThread::handleProgressChange, this); 236 259 } 237 260 … … 441 464 if (RT_SUCCESS(m_iError)) 442 465 { 466 /* Apply configuration: */ 467 if (RT_SUCCESS(m_iError)) 468 m_iError = applyConfiguration(); 469 443 470 /* Apply proxy-rules: */ 444 471 if (RT_SUCCESS(m_iError)) … … 790 817 } 791 818 819 /* static */ 820 void UINetworkReplyPrivateThread::handleProgressChange(RTHTTP hHttp, void *pvUser, uint64_t cbDownloadTotal, uint64_t cbDownloaded) 821 { 822 /* Redirect callback to particular object: */ 823 Q_UNUSED(hHttp); 824 AssertPtrReturnVoid(pvUser); 825 static_cast<UINetworkReplyPrivateThread*>(pvUser)->handleProgressChange(cbDownloadTotal, cbDownloaded); 826 } 827 828 void UINetworkReplyPrivateThread::handleProgressChange(uint64_t cbDownloadTotal, uint64_t cbDownloaded) 829 { 830 /* Notify listeners about progress change: */ 831 emit sigDownloadProgress(cbDownloaded, cbDownloadTotal); 832 } 833 792 834 #ifndef VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS 793 835 … … 816 858 /* Create and run network-reply thread: */ 817 859 m_pThread = new UINetworkReplyPrivateThread(request, type); 860 connect(m_pThread, SIGNAL(sigDownloadProgress(qint64, qint64)), 861 this, SIGNAL(downloadProgress(qint64, qint64)), Qt::QueuedConnection); 818 862 connect(m_pThread, SIGNAL(finished()), this, SLOT(sltFinished())); 819 863 m_pThread->start();
Note:
See TracChangeset
for help on using the changeset viewer.