MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / onDownloadUpdated

Method onDownloadUpdated

src/gui/UBDownloadWidget.cpp:170–190  ·  view source on GitHub ↗

* \brief Update the progress bar * @param id as the downloaded file id * @param crnt as the current transfered size * @param total as the total size of the file */

Source from the content-addressed store, hash-verified

168 * @param total as the total size of the file
169 */
170void UBDownloadWidget::onDownloadUpdated(int id, qint64 crnt, qint64 total)
171{
172 if(NULL != mpTree)
173 {
174 QAbstractItemModel* model = mpTree->model();
175 if(NULL != model)
176 {
177 for(int i=0; i< model->rowCount(); i++)
178 {
179 QModelIndex currentIndex = model->index(i, eItemColumn_Desc);
180 if(id == currentIndex.data(Qt::UserRole + 2))
181 {
182 // We found the right item, now we update the progress bar
183 model->setData(currentIndex, crnt, Qt::UserRole);
184 model->setData(currentIndex, total, Qt::UserRole + 1);
185 break;
186 }
187 }
188 }
189 }
190}
191
192/**
193 * \brief Handles the download finish notification

Callers

nothing calls this directly

Calls 5

modelMethod · 0.80
rowCountMethod · 0.45
indexMethod · 0.45
dataMethod · 0.45
setDataMethod · 0.45

Tested by

no test coverage detected