Changeset 90527 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 5, 2021 11:24:33 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/networking
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkRequest.cpp
r90526 r90527 44 44 , m_pCustomer(pCustomer) 45 45 , m_pNetworkManager(pNetworkManager) 46 , m_uuid(QUuid::createUuid())47 46 , m_iUrlIndex(-1) 48 47 , m_fRunning(false) … … 63 62 void UINetworkRequest::sltHandleNetworkReplyProgress(qint64 iReceived, qint64 iTotal) 64 63 { 65 /* Notify common network-request listeners: */ 66 emit sigProgress(m_uuid, iReceived, iTotal); 67 /* Notify own network-request listeners: */ 64 /* Notify network-request listeners: */ 68 65 emit sigProgress(iReceived, iTotal); 69 66 } … … 81 78 if (m_pReply->error() == UINetworkReply::NoError) 82 79 { 83 /* Notify ownnetwork-request listeners: */80 /* Notify network-request listeners: */ 84 81 emit sigFinished(); 85 /* Notify common network-request listeners: */86 emit sigFinished(m_uuid);87 82 } 88 83 /* If network-request was canceled: */ 89 84 else if (m_pReply->error() == UINetworkReply::OperationCanceledError) 90 85 { 91 /* Notify network- manager: */92 emit sigCanceled( m_uuid);86 /* Notify network-request listeners: */ 87 emit sigCanceled(); 93 88 } 94 89 /* If some other error occured: */ … … 143 138 else 144 139 { 145 /* Notify ownnetwork-request listeners: */140 /* Notify network-request listeners: */ 146 141 emit sigFailed(m_pReply->errorString()); 147 /* Notify common network-request listeners: */148 emit sigFailed(m_uuid, m_pReply->errorString());149 142 } 150 143 } … … 173 166 m_pReply->abort(); 174 167 else 175 emit sigCanceled( m_uuid);168 emit sigCanceled(); 176 169 } 177 170 } … … 206 199 m_fRunning = true; 207 200 208 /* Notify common network-request listeners: */ 209 emit sigStarted(m_uuid); 210 /* Notify own network-request listeners: */ 201 /* Notify network-request listeners: */ 211 202 emit sigStarted(); 212 203 } -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkRequest.h
r90525 r90527 25 25 #include <QObject> 26 26 #include <QPointer> 27 #include <QUuid>28 27 29 28 /* GUI inludes: */ … … 45 44 signals: 46 45 47 /** Notifies common UINetworkRequestManager about progress with @a uId changed. 48 * @param iReceived Holds the amount of bytes received. 49 * @param iTotal Holds the amount of total bytes to receive. */ 50 void sigProgress(const QUuid &uId, qint64 iReceived, qint64 iTotal); 51 /** Notifies UINetworkRequestManager about progress with @a uId started. */ 52 void sigStarted(const QUuid &uId); 53 /** Notifies UINetworkRequestManager about progress with @a uId canceled. */ 54 void sigCanceled(const QUuid &uId); 55 /** Notifies UINetworkRequestManager about progress with @a uId finished. */ 56 void sigFinished(const QUuid &uId); 57 /** Notifies UINetworkRequestManager about progress with @a uId failed with @a strError. */ 58 void sigFailed(const QUuid &uId, const QString &strError); 59 60 /** Notifies own UINetworkRequestWidget about progress changed. 61 * @param iReceived Holds the amount of bytes received. 62 * @param iTotal Holds the amount of total bytes to receive. */ 46 /** Notifies listener about progress changed. 47 * @param iReceived Brings the amount of bytes received. 48 * @param iTotal Brings the amount of total bytes to receive. */ 63 49 void sigProgress(qint64 iReceived, qint64 iTotal); 64 /** Notifies own UINetworkRequestWidgetabout progress started. */50 /** Notifies listener about progress started. */ 65 51 void sigStarted(); 66 /** Notifies own UINetworkRequestWidget about progress finished. */ 52 /** Notifies listener about progress canceled. */ 53 void sigCanceled(); 54 /** Notifies listener about progress finished. */ 67 55 void sigFinished(); 68 /** Notifies own UINetworkRequestWidget about progress failed with @a strError. */ 56 /** Notifies listener about progress failed. 57 * @param strError Brings the error progress failed with . */ 69 58 void sigFailed(const QString &strError); 70 59 … … 93 82 /** Returns the request manager. */ 94 83 UINetworkRequestManager *manager() const { return m_pNetworkManager; } 95 /** Returns unique request QUuid. */96 const QUuid &uuid() const { return m_uuid; }97 84 /** Returns the request reply. */ 98 85 UINetworkReply *reply() { return m_pReply; } … … 138 125 /** Holds the request manager. */ 139 126 UINetworkRequestManager *m_pNetworkManager; 140 /** Holds unique request QUuid. */141 const QUuid m_uuid;142 127 143 128 /** Holds current request url. */ -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkRequestManager.cpp
r90526 r90527 99 99 { 100 100 /* Configure request listeners: */ 101 connect(pNetworkRequest, static_cast<void(UINetworkRequest::*)(const QUuid&, qint64, qint64)>(&UINetworkRequest::sigProgress),101 connect(pNetworkRequest, &UINetworkRequest::sigProgress, 102 102 this, &UINetworkRequestManager::sltHandleNetworkRequestProgress); 103 103 connect(pNetworkRequest, &UINetworkRequest::sigCanceled, 104 104 this, &UINetworkRequestManager::sltHandleNetworkRequestCancel); 105 connect(pNetworkRequest, static_cast<void(UINetworkRequest::*)(const QUuid&)>(&UINetworkRequest::sigFinished),105 connect(pNetworkRequest, &UINetworkRequest::sigFinished, 106 106 this, &UINetworkRequestManager::sltHandleNetworkRequestFinish); 107 connect(pNetworkRequest, static_cast<void(UINetworkRequest::*)(const QUuid &uuid, const QString &strError)>(&UINetworkRequest::sigFailed),107 connect(pNetworkRequest, &UINetworkRequest::sigFailed, 108 108 this, &UINetworkRequestManager::sltHandleNetworkRequestFailure); 109 109 110 /* [Re]generate ID until unique: */ 111 QUuid uId = QUuid::createUuid(); 112 while (m_requests.contains(uId)) 113 uId = QUuid::createUuid(); 114 110 115 /* Add request to map: */ 111 m_requests.insert( pNetworkRequest->uuid(), pNetworkRequest);116 m_requests.insert(uId, pNetworkRequest); 112 117 113 118 /* Add network-request widget to network-manager dialog: */ 114 m_pNetworkManagerDialog->addNetworkRequestWidget( pNetworkRequest);119 m_pNetworkManagerDialog->addNetworkRequestWidget(uId, pNetworkRequest); 115 120 } 116 121 … … 139 144 } 140 145 141 void UINetworkRequestManager::sltHandleNetworkRequestProgress( const QUuid &uId,qint64 iReceived, qint64 iTotal)142 { 143 /* Make sure we have this request registered: */ 144 AssertReturnVoid(!uId.isNull());145 Assert ReturnVoid(m_requests.contains(uId));146 UINetworkRequest *pNetworkRequest = m_requests.value(uId);147 Assert PtrReturnVoid(pNetworkRequest);146 void UINetworkRequestManager::sltHandleNetworkRequestProgress(qint64 iReceived, qint64 iTotal) 147 { 148 /* Make sure we have this request registered: */ 149 UINetworkRequest *pNetworkRequest = qobject_cast<UINetworkRequest*>(sender()); 150 AssertPtrReturnVoid(pNetworkRequest); 151 const QUuid uId = m_requests.key(pNetworkRequest); 152 AssertReturnVoid(!uId.isNull()); 148 153 149 154 /* Delegate request to customer: */ … … 153 158 } 154 159 155 void UINetworkRequestManager::sltHandleNetworkRequestCancel( const QUuid &uId)156 { 157 /* Make sure we have this request registered: */ 158 AssertReturnVoid(!uId.isNull());159 Assert ReturnVoid(m_requests.contains(uId));160 UINetworkRequest *pNetworkRequest = m_requests.value(uId);161 Assert PtrReturnVoid(pNetworkRequest);160 void UINetworkRequestManager::sltHandleNetworkRequestCancel() 161 { 162 /* Make sure we have this request registered: */ 163 UINetworkRequest *pNetworkRequest = qobject_cast<UINetworkRequest*>(sender()); 164 AssertPtrReturnVoid(pNetworkRequest); 165 const QUuid uId = m_requests.key(pNetworkRequest); 166 AssertReturnVoid(!uId.isNull()); 162 167 163 168 /* Delegate request to customer: */ … … 170 175 } 171 176 172 void UINetworkRequestManager::sltHandleNetworkRequestFinish( const QUuid &uId)173 { 174 /* Make sure we have this request registered: */ 175 AssertReturnVoid(!uId.isNull());176 Assert ReturnVoid(m_requests.contains(uId));177 UINetworkRequest *pNetworkRequest = m_requests.value(uId);178 Assert PtrReturnVoid(pNetworkRequest);177 void UINetworkRequestManager::sltHandleNetworkRequestFinish() 178 { 179 /* Make sure we have this request registered: */ 180 UINetworkRequest *pNetworkRequest = qobject_cast<UINetworkRequest*>(sender()); 181 AssertPtrReturnVoid(pNetworkRequest); 182 const QUuid uId = m_requests.key(pNetworkRequest); 183 AssertReturnVoid(!uId.isNull()); 179 184 180 185 /* Delegate request to customer: */ … … 187 192 } 188 193 189 void UINetworkRequestManager::sltHandleNetworkRequestFailure(const Q Uuid &uId, const QString &)190 { 191 /* Make sure we have this request registered: */ 192 AssertReturnVoid(!uId.isNull());193 Assert ReturnVoid(m_requests.contains(uId));194 UINetworkRequest *pNetworkRequest = m_requests.value(uId);195 Assert PtrReturnVoid(pNetworkRequest);194 void UINetworkRequestManager::sltHandleNetworkRequestFailure(const QString &) 195 { 196 /* Make sure we have this request registered: */ 197 UINetworkRequest *pNetworkRequest = qobject_cast<UINetworkRequest*>(sender()); 198 AssertPtrReturnVoid(pNetworkRequest); 199 const QUuid uId = m_requests.key(pNetworkRequest); 200 AssertReturnVoid(!uId.isNull()); 196 201 197 202 /* Delegate request to customer: */ -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkRequestManager.h
r90526 r90527 101 101 private slots: 102 102 103 /** Handles progress for @a iReceived amount of bytes among @a iTotal for request specified by @a uId. */104 void sltHandleNetworkRequestProgress( const QUuid &uId,qint64 iReceived, qint64 iTotal);105 /** Handles canceling of request specified by @a uId. */106 void sltHandleNetworkRequestCancel( const QUuid &uId);107 /** Handles finishing of request specified by @a uId. */108 void sltHandleNetworkRequestFinish( const QUuid &uId);109 /** Handles @a strError of request specified by @a uId. */110 void sltHandleNetworkRequestFailure(const Q Uuid &uId, const QString &strError);103 /** Handles progress for @a iReceived amount of bytes among @a iTotal. */ 104 void sltHandleNetworkRequestProgress(qint64 iReceived, qint64 iTotal); 105 /** Handles request canceling. */ 106 void sltHandleNetworkRequestCancel(); 107 /** Handles request finishing. */ 108 void sltHandleNetworkRequestFinish(); 109 /** Handles request @a strError. */ 110 void sltHandleNetworkRequestFailure(const QString &strError); 111 111 112 112 private: -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkRequestManagerWindow.cpp
r86996 r90527 92 92 } 93 93 94 void UINetworkRequestManagerWindow::addNetworkRequestWidget( UINetworkRequest *pNetworkRequest)94 void UINetworkRequestManagerWindow::addNetworkRequestWidget(const QUuid &uuid, UINetworkRequest *pNetworkRequest) 95 95 { 96 96 /* Make sure network-request is really exists: */ … … 100 100 UINetworkRequestWidget *pNetworkRequestWidget = new UINetworkRequestWidget(this, pNetworkRequest); 101 101 m_pWidgetsLayout->addWidget(pNetworkRequestWidget); 102 m_widgets.insert( pNetworkRequest->uuid(), pNetworkRequestWidget);102 m_widgets.insert(uuid, pNetworkRequestWidget); 103 103 104 104 /* Hide label: */ -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkRequestManagerWindow.h
r86996 r90527 64 64 friend class UINetworkRequest; 65 65 /** Adds network-request widget. */ 66 void addNetworkRequestWidget( UINetworkRequest *pNetworkRequest);66 void addNetworkRequestWidget(const QUuid &uuid, UINetworkRequest *pNetworkRequest); 67 67 /** Removes network-request widget. */ 68 68 void removeNetworkRequestWidget(const QUuid &uuid);
Note:
See TracChangeset
for help on using the changeset viewer.