* \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 */
| 168 | * @param total as the total size of the file |
| 169 | */ |
| 170 | void 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 |