Fix File Transfert Progress Sorting.

This commit is contained in:
Phenom 2017-09-07 18:09:21 +02:00
parent 1dc6bef985
commit d81f9a351e
2 changed files with 7 additions and 4 deletions

View File

@ -161,7 +161,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
case COLUMN_PROGRESS:
{
// create a xProgressBar
FileProgressInfo pinfo = index.data().value<FileProgressInfo>() ;
FileProgressInfo pinfo = index.data(Qt::UserRole).value<FileProgressInfo>() ;
// std::cerr << "drawing progress info: nb_chunks = " << pinfo.nb_chunks ;
// for(uint i=0;i<pinfo.cmap._map.size();++i)

View File

@ -979,7 +979,8 @@ int TransfersDialog::addDLItem(int row, const FileInfo &fileInfo)
DLListModel->setData(DLListModel->index(row, COLUMN_COMPLETED), QVariant((qlonglong)completed));
DLListModel->setData(DLListModel->index(row, COLUMN_DLSPEED), QVariant((double)fileDlspeed));
DLListModel->setData(DLListModel->index(row, COLUMN_PROGRESS), QVariant::fromValue(pinfo));
DLListModel->setData(DLListModel->index(row, COLUMN_PROGRESS), QVariant((float)pinfo.progress));
DLListModel->setData(DLListModel->index(row, COLUMN_PROGRESS), QVariant::fromValue(pinfo), Qt::UserRole);
DLListModel->setData(DLListModel->index(row, COLUMN_STATUS), QVariant(status));
DLListModel->setData(DLListModel->index(row, COLUMN_PRIORITY), QVariant(priority));
DLListModel->setData(DLListModel->index(row, COLUMN_REMAINING), QVariant((qlonglong)remaining));
@ -1083,7 +1084,8 @@ int TransfersDialog::addPeerToDLItem(QStandardItem *dlItem, const QString& name,
iSize->setData(QVariant(QString()), Qt::DisplayRole);
iCompleted->setData(QVariant(QString()), Qt::DisplayRole);
iDlSpeed->setData(QVariant((double)dlspeed), Qt::DisplayRole);
iProgress->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole);
iProgress->setData(QVariant((float)peerInfo.progress), Qt::DisplayRole);
iProgress->setData(QVariant::fromValue(peerInfo), Qt::UserRole);
iSource->setData(QVariant(QString()), Qt::DisplayRole);
iPriority->setData(QVariant(QString()), Qt::DisplayRole); // blank field for priority
@ -1113,7 +1115,8 @@ int TransfersDialog::addPeerToDLItem(QStandardItem *dlItem, const QString& name,
} else {
// just update the child (peer)
dlItem->child(childRow, COLUMN_DLSPEED)->setData(QVariant((double)dlspeed), Qt::DisplayRole);
dlItem->child(childRow, COLUMN_PROGRESS)->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole);
dlItem->child(childRow, COLUMN_PROGRESS)->setData(QVariant((float)peerInfo.progress), Qt::DisplayRole);
dlItem->child(childRow, COLUMN_PROGRESS)->setData(QVariant::fromValue(peerInfo), Qt::UserRole);
siName = dlItem->child(childRow,COLUMN_NAME);
siStatus = dlItem->child(childRow, COLUMN_STATUS);