Browse Source

- Updated changelog

- Made sorting work in the finished torrents list
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
cfe979c8dd
  1. 11
      Changelog
  2. 1
      TODO
  3. 73
      src/FinishedTorrents.cpp
  4. 3
      src/FinishedTorrents.h

11
Changelog

@ -1,19 +1,28 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.10.0 * Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.10.0
- FEATURE: Added UPnP / NAT-PMP port forwarding support - FEATURE: Added UPnP / NAT-PMP port forwarding support
- FEATURE: Added RSS support - FEATURE: Added RSS support
- FEATURE: Finished torrents are moved to another tab - FEATURE: Finished torrents are now moved to another tab for seeding
- FEATURE: Display more infos about the torrent in its properties - FEATURE: Display more infos about the torrent in its properties
- FEATURE: Allow the user to edit torrents' trackers - FEATURE: Allow the user to edit torrents' trackers
- FEATURE: Allow user to change qBT's style (Plastique, Cleanlooks, Motif, CDE, MacOSX, WinXP) - FEATURE: Allow user to change qBT's style (Plastique, Cleanlooks, Motif, CDE, MacOSX, WinXP)
- FEATURE: Allow the user to disable system tray integration - FEATURE: Allow the user to disable system tray integration
- FEATURE: Search engine is now using one thread per website for faster results - FEATURE: Search engine is now using one thread per website for faster results
- FEATURE: Improved a lot the torrent creation module - FEATURE: Improved a lot the torrent creation module
- FEATURE: Allow to set upload/download limit per torrent (right click)
- FEATURE: Ask for exit confirmation only if download list is not empty - FEATURE: Ask for exit confirmation only if download list is not empty
- BUGFIX: Window can now stay maximized on exit - BUGFIX: Window can now stay maximized on exit
- COSMETIC: Redesigned torrent properties a little - COSMETIC: Redesigned torrent properties a little
- COSMETIC: Redesigned options a little - COSMETIC: Redesigned options a little
- COSMETIC: Display more logs messages concerning features - COSMETIC: Display more logs messages concerning features
* Tue Apr 10 2007 - Christophe Dumez <chris@qbittorrent.org> - v0.9.2
- BUGFIX: Window can now stay maximized on exit
- BUGFIX: Use PKGCONFIG again for configuring libtorrent
- BUGFIX: Allow to compile with libtorrent v0.11
- BUGFIX: Disabled main window context menu (annoying)
- I18N: Added Japanese translation
- I18N: Updated Turkish translation
* Wed Apr 04 2007 - Christophe Dumez <chris@qbittorrent.org> - v0.9.1 * Wed Apr 04 2007 - Christophe Dumez <chris@qbittorrent.org> - v0.9.1
- BUGFIX: A lot of fixes in configure file - BUGFIX: A lot of fixes in configure file

1
TODO

@ -48,3 +48,4 @@
- Use buttonboxes when possible - Use buttonboxes when possible
- Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list - Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list
- Support column sorting in finished list - Support column sorting in finished list
- Sorting in Download Status column should be smarter than just an alphabetical sort

73
src/FinishedTorrents.cpp

@ -47,6 +47,10 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){
if(!loadColWidthFinishedList()){ if(!loadColWidthFinishedList()){
finishedList->header()->resizeSection(0, 200); finishedList->header()->resizeSection(0, 200);
} }
// Make download list header clickable for sorting
finishedList->header()->setClickable(true);
finishedList->header()->setSortIndicatorShown(true);
connect(finishedList->header(), SIGNAL(sectionPressed(int)), this, SLOT(sortFinishedList(int)));
finishedListDelegate = new DLListDelegate(); finishedListDelegate = new DLListDelegate();
finishedList->setItemDelegate(finishedListDelegate); finishedList->setItemDelegate(finishedListDelegate);
connect(finishedList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFinishedListMenu(const QPoint&))); connect(finishedList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFinishedListMenu(const QPoint&)));
@ -111,6 +115,75 @@ void FinishedTorrents::setRowColor(int row, const QString& color){
} }
} }
void FinishedTorrents::sortFinishedList(int index){
static Qt::SortOrder sortOrder = Qt::AscendingOrder;
if(finishedList->header()->sortIndicatorSection() == index){
if(sortOrder == Qt::AscendingOrder){
sortOrder = Qt::DescendingOrder;
}else{
sortOrder = Qt::AscendingOrder;
}
}
finishedList->header()->setSortIndicator(index, sortOrder);
switch(index){
case SIZE:
case ETA:
case UPSPEED:
case DLSPEED:
case PROGRESS:
sortFinishedListFloat(index, sortOrder);
break;
default:
sortFinishedListString(index, sortOrder);
}
}
void FinishedTorrents::sortFinishedListFloat(int index, Qt::SortOrder sortOrder){
QList<QPair<int, double> > lines;
// insertion sorting
unsigned int nbRows = finishedListModel->rowCount();
for(unsigned int i=0; i<nbRows; ++i){
misc::insertSort(lines, QPair<int,double>(i, finishedListModel->data(finishedListModel->index(i, index)).toDouble()), sortOrder);
}
// Insert items in new model, in correct order
unsigned int nbRows_old = lines.size();
for(unsigned int row=0; row<nbRows_old; ++row){
finishedListModel->insertRow(finishedListModel->rowCount());
unsigned int sourceRow = lines[row].first;
unsigned int nbColumns = finishedListModel->columnCount();
for(unsigned int col=0; col<nbColumns; ++col){
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col)));
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::DecorationRole), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::TextColorRole), Qt::TextColorRole);
}
}
// Remove old rows
finishedListModel->removeRows(0, nbRows_old);
}
void FinishedTorrents::sortFinishedListString(int index, Qt::SortOrder sortOrder){
QList<QPair<int, QString> > lines;
// Insertion sorting
unsigned int nbRows = finishedListModel->rowCount();
for(unsigned int i=0; i<nbRows; ++i){
misc::insertSortString(lines, QPair<int, QString>(i, finishedListModel->data(finishedListModel->index(i, index)).toString()), sortOrder);
}
// Insert items in new model, in correct order
unsigned int nbRows_old = lines.size();
for(unsigned int row=0; row<nbRows_old; ++row){
finishedListModel->insertRow(finishedListModel->rowCount());
unsigned int sourceRow = lines[row].first;
unsigned int nbColumns = finishedListModel->columnCount();
for(unsigned int col=0; col<nbColumns; ++col){
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col)));
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::DecorationRole), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::TextColorRole), Qt::TextColorRole);
}
}
// Remove old rows
finishedListModel->removeRows(0, nbRows_old);
}
// Load columns width in a file that were saved previously // Load columns width in a file that were saved previously
// (finished list) // (finished list)
bool FinishedTorrents::loadColWidthFinishedList(){ bool FinishedTorrents::loadColWidthFinishedList(){

3
src/FinishedTorrents.h

@ -55,6 +55,9 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
void displayFinishedListMenu(const QPoint&); void displayFinishedListMenu(const QPoint&);
void setRowColor(int row, const QString& color); void setRowColor(int row, const QString& color);
void saveColWidthFinishedList() const; void saveColWidthFinishedList() const;
void sortFinishedList(int index);
void sortFinishedListFloat(int index, Qt::SortOrder sortOrder);
void sortFinishedListString(int index, Qt::SortOrder sortOrder);
protected slots: protected slots:
void on_actionSet_upload_limit_triggered(); void on_actionSet_upload_limit_triggered();

Loading…
Cancel
Save