mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 09:05:48 -04:00
fixed download/upload lists issues (backport of commits 1650 and 1653)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.4.x@1657 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7e596c58bb
commit
fade169f30
2 changed files with 69 additions and 0 deletions
|
@ -98,6 +98,13 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||||
_header->resizeSection ( STATUS, 100 );
|
_header->resizeSection ( STATUS, 100 );
|
||||||
_header->resizeSection ( REMAINING, 100 );
|
_header->resizeSection ( REMAINING, 100 );
|
||||||
|
|
||||||
|
connect(_header, SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSortIndicatorDwl(int, Qt::SortOrder)));
|
||||||
|
|
||||||
|
// set default column and sort order for download
|
||||||
|
_sortColDwl = 0;
|
||||||
|
_sortOrderDwl = Qt::AscendingOrder;
|
||||||
|
|
||||||
|
|
||||||
// Set Upload list model
|
// Set Upload list model
|
||||||
ULListModel = new QStandardItemModel(0,7);
|
ULListModel = new QStandardItemModel(0,7);
|
||||||
ULListModel->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name"));
|
ULListModel->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name"));
|
||||||
|
@ -114,6 +121,30 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||||
// ui.uploadsList->setAutoScroll(false) ;
|
// ui.uploadsList->setAutoScroll(false) ;
|
||||||
ui.uploadsList->setRootIsDecorated(false);
|
ui.uploadsList->setRootIsDecorated(false);
|
||||||
|
|
||||||
|
/* Set header resize modes and initial section sizes Uploads TreeView*/
|
||||||
|
QHeaderView * upheader = ui.uploadsList->header () ;
|
||||||
|
upheader->setResizeMode (UNAME, QHeaderView::Interactive);
|
||||||
|
upheader->setResizeMode (USIZE, QHeaderView::Interactive);
|
||||||
|
upheader->setResizeMode (UTRANSFERRED, QHeaderView::Interactive);
|
||||||
|
upheader->setResizeMode (ULSPEED, QHeaderView::Interactive);
|
||||||
|
upheader->setResizeMode (UPROGRESS, QHeaderView::Interactive);
|
||||||
|
upheader->setResizeMode (USTATUS, QHeaderView::Interactive);
|
||||||
|
upheader->setResizeMode (USERNAME, QHeaderView::Interactive);
|
||||||
|
|
||||||
|
upheader->resizeSection ( UNAME, 170 );
|
||||||
|
upheader->resizeSection ( USIZE, 70 );
|
||||||
|
upheader->resizeSection ( UTRANSFERRED, 75 );
|
||||||
|
upheader->resizeSection ( ULSPEED, 75 );
|
||||||
|
upheader->resizeSection ( UPROGRESS, 170 );
|
||||||
|
upheader->resizeSection ( USTATUS, 100 );
|
||||||
|
upheader->resizeSection ( USERNAME, 75 );
|
||||||
|
|
||||||
|
connect(upheader, SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSortIndicatorUpl(int, Qt::SortOrder)));
|
||||||
|
|
||||||
|
// set default column and sort order for upload
|
||||||
|
_sortColUpl = 0;
|
||||||
|
_sortOrderUpl = Qt::AscendingOrder;
|
||||||
|
|
||||||
//Selection Setup
|
//Selection Setup
|
||||||
//selection = ui.uploadsList->selectionModel();
|
//selection = ui.uploadsList->selectionModel();
|
||||||
|
|
||||||
|
@ -376,6 +407,13 @@ void TransfersDialog::insertTransfers()
|
||||||
delUploadItem(i);
|
delUploadItem(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.downloadList->sortByColumn(_sortColDwl, _sortOrderDwl);
|
||||||
|
/* disable for performance issues, enable after insert all transfers */
|
||||||
|
ui.downloadList->setSortingEnabled(false);
|
||||||
|
|
||||||
|
QModelIndex firstSelIdx;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* get the download and upload lists */
|
/* get the download and upload lists */
|
||||||
std::list<std::string> downHashes;
|
std::list<std::string> downHashes;
|
||||||
|
@ -451,6 +489,8 @@ void TransfersDialog::insertTransfers()
|
||||||
selection->select(DLListModel->index(dlCount, 0),
|
selection->select(DLListModel->index(dlCount, 0),
|
||||||
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
||||||
|
|
||||||
|
if (!firstSelIdx.isValid())
|
||||||
|
firstSelIdx = DLListModel->index(dlCount, NAME);
|
||||||
}
|
}
|
||||||
dlCount++;
|
dlCount++;
|
||||||
}
|
}
|
||||||
|
@ -497,11 +537,22 @@ void TransfersDialog::insertTransfers()
|
||||||
selection->select(DLListModel->index(dlCount, 0),
|
selection->select(DLListModel->index(dlCount, 0),
|
||||||
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
||||||
|
|
||||||
|
if (!firstSelIdx.isValid())
|
||||||
|
firstSelIdx = DLListModel->index(dlCount, NAME);
|
||||||
}
|
}
|
||||||
dlCount++;
|
dlCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (firstSelIdx.isValid())
|
||||||
|
ui.downloadList->scrollTo(firstSelIdx);
|
||||||
|
|
||||||
|
ui.downloadList->setSortingEnabled(true);
|
||||||
|
|
||||||
|
ui.uploadsList->sortByColumn(_sortColUpl, _sortOrderUpl);
|
||||||
|
/* disable for performance issues, enable after insert all transfers */
|
||||||
|
ui.uploadsList->setSortingEnabled(false);
|
||||||
|
|
||||||
for(it = upHashes.begin(); it != upHashes.end(); it++)
|
for(it = upHashes.begin(); it != upHashes.end(); it++)
|
||||||
{
|
{
|
||||||
FileInfo info;
|
FileInfo info;
|
||||||
|
@ -631,6 +682,18 @@ void TransfersDialog::clearcompleted()
|
||||||
rsFiles->FileClearCompleted();
|
rsFiles->FileClearCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TransfersDialog::saveSortIndicatorDwl(int logicalIndex, Qt::SortOrder order)
|
||||||
|
{
|
||||||
|
_sortColDwl = logicalIndex;;
|
||||||
|
_sortOrderDwl = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransfersDialog::saveSortIndicatorUpl(int logicalIndex, Qt::SortOrder order)
|
||||||
|
{
|
||||||
|
_sortColUpl = logicalIndex;;
|
||||||
|
_sortOrderUpl = order;
|
||||||
|
}
|
||||||
|
|
||||||
double TransfersDialog::getProgress(int row, QStandardItemModel *model)
|
double TransfersDialog::getProgress(int row, QStandardItemModel *model)
|
||||||
{
|
{
|
||||||
return model->data(model->index(row, PROGRESS), Qt::DisplayRole).toDouble();
|
return model->data(model->index(row, PROGRESS), Qt::DisplayRole).toDouble();
|
||||||
|
|
|
@ -62,6 +62,10 @@ class TransfersDialog : public MainPage
|
||||||
void clearcompleted();
|
void clearcompleted();
|
||||||
void playSelectedTransfer();
|
void playSelectedTransfer();
|
||||||
|
|
||||||
|
void saveSortIndicatorDwl(int logicalIndex, Qt::SortOrder order);
|
||||||
|
void saveSortIndicatorUpl(int logicalIndex, Qt::SortOrder order);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void playFiles(QStringList files);
|
void playFiles(QStringList files);
|
||||||
|
|
||||||
|
@ -77,6 +81,8 @@ class TransfersDialog : public MainPage
|
||||||
QString status, icon, name;
|
QString status, icon, name;
|
||||||
qlonglong completed, remaining;
|
qlonglong completed, remaining;
|
||||||
|
|
||||||
|
int _sortColDwl, _sortColUpl;
|
||||||
|
Qt::SortOrder _sortOrderDwl, _sortOrderUpl;
|
||||||
|
|
||||||
/** Create the actions on the tray menu or menubar */
|
/** Create the actions on the tray menu or menubar */
|
||||||
void createActions();
|
void createActions();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue