Skip to content

Commit

Permalink
Improve drawing speed of transferlist with many torrents.
Browse files Browse the repository at this point in the history
Conflicts:
	Changelog
  • Loading branch information
sledgehammer999 committed Jun 29, 2013
1 parent ae3eda2 commit d095d7f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
- LIBTORRENT: SOCKS5 fixes (0.16.10)
- LIBTORRENT: Fix hanging issue on Windows when closing files (0.16.10)
- LIBTORRENT: Cache can now be returned to the OS (0.16.10)

- PERFORMANCE: Impove drawing speed of tranferlist when there are many torrents(>100)

* Sat Mar 16 2013 - Christophe Dumez <chris@qbittorrent.org> - v3.0.9
- BUGFIX: Raise qBittorrent windows when another instance is launched
- BUGFIX: Show human readable names for network interfaces in preferences (Windows)
Expand Down
14 changes: 14 additions & 0 deletions src/qtlibtorrent/torrentmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/

#include <QDebug>
#include <QFontMetrics>

#include "torrentmodel.h"
#include "torrentpersistentdata.h"
Expand Down Expand Up @@ -297,6 +298,19 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const
if (!index.isValid()) return QVariant();
try {
if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0 && index.column() < columnCount())
if (role == Qt::SizeHintRole)
{
QSize size(m_torrents[index.row()]->data(index.column(), role).toSize());
QFont font;
QFontMetrics fm(font);
QIcon icon(":/Icons/skin/downloading.png");
int fm_height(fm.height());
QList<QSize> ic_sizes(icon.availableSizes());
int icon_height(ic_sizes[0].height());
size.setHeight(fm_height > icon_height ? fm_height : icon_height);
return QVariant(size);
}
else
return m_torrents[index.row()]->data(index.column(), role);
} catch(invalid_handle&) {}
return QVariant();
Expand Down
1 change: 1 addition & 0 deletions src/transferlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ using namespace libtorrent;
TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window, QBtSession *_BTSession):
QTreeView(parent), BTSession(_BTSession), main_window(main_window) {

setUniformRowHeights(true);
// Load settings
bool column_loaded = loadSettings();

Expand Down

0 comments on commit d095d7f

Please sign in to comment.