keeps transfers sorted when redisplay them

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1650 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-09-14 20:29:46 +00:00
parent 858951be63
commit 6dfa252bf6
2 changed files with 22 additions and 0 deletions

View File

@ -126,6 +126,12 @@ TransfersDialog::TransfersDialog(QWidget *parent)
_header->resizeSection ( PRIORITY, 100 );
_header->resizeSection ( REMAINING, 100 );
connect(_header, SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSortIndicator(int, Qt::SortOrder)));
// set default column and sort order
_sortCol = 0;
_sortOrder = Qt::AscendingOrder;
// Set Upload list model
ULListModel = new QStandardItemModel(0,7);
ULListModel->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name"));
@ -614,6 +620,9 @@ void TransfersDialog::insertTransfers()
delUploadItem(i);
}
ui.downloadList->sortByColumn(_sortCol, _sortOrder);
/* disable for performance issues, enable after insert all transfers */
ui.downloadList->setSortingEnabled(false);
/* get the download and upload lists */
std::list<std::string> downHashes;
@ -799,6 +808,8 @@ void TransfersDialog::insertTransfers()
if (firstSelIdx.isValid())
ui.downloadList->scrollTo(firstSelIdx);
ui.downloadList->setSortingEnabled(true);
for(it = upHashes.begin(); it != upHashes.end(); it++)
{
FileInfo info;
@ -1261,6 +1272,11 @@ void TransfersDialog::rootisnotdecorated()
ui.downloadList->setRootIsDecorated(false);
}
void TransfersDialog::saveSortIndicator(int logicalIndex, Qt::SortOrder order)
{
_sortCol = logicalIndex;;
_sortOrder = order;
}
double TransfersDialog::getProgress(int row, QStandardItemModel *model)
{

View File

@ -87,6 +87,9 @@ class TransfersDialog : public MainPage
void priorityHigh();
void priorityAuto();
/** save sort indicator for next transfers display */
void saveSortIndicator(int logicalIndex, Qt::SortOrder order);
signals:
void playFiles(QStringList files);
@ -106,6 +109,9 @@ class TransfersDialog : public MainPage
QString status, icon, name;
qlonglong completed, remaining;
int _sortCol;
Qt::SortOrder _sortOrder;
/** Create the actions on the tray menu or menubar */
void createActions();