Qt uses binary search to convert string to QColor, we don't need that
binary search at all. This patch could be considered as optimization, but
in reality creating QColor takes only 0.2% of time. So it should be visible
at all.
This could be considered as cleanup for not calling expensive functions
from non-expensive ones.
Previous implementation used QRegExp to find a first digit. That is
utterly ineffective.
When torrent list is sorted by name (a column that uses the naturalSort() for
comparison), naturalSort could take 18.6% of the time of the UI thread. Optimize it
so now it takes 1% of the time of the UI thread.
libtorrent has a relatively heavy headers, that take lots of time to
process. This commit removes unnecessary includes of libtorrent headers
and replaces them with forward declarations.
I had to move some functions in QBtSession from slots to regular
functions because moc'ed file want to see complete types of all
parameters of slots.
"time make" of full rebuild before this series of commits:
real 13m35.937s
user 12m1.295s
sys 1m25.908s
after:
real 10m54.390s
user 9m31.167s
sys 1m12.580s
Since the content of some sections is right aligned, automatically
resizing the width of the last one to fill the header could be
sometimes undesired.
Let the user choose the width of each section and never change his
preference.
Change also the default width and set it to the minimum.
This minimum width prevents the horizontal scrollbar from appearing.
The size of the items in the list depends on the Qt style, so the
left panel could be few pixels larger than required with some of them.
The maximum size of the icons is now 256x256 pixels so that
Windows can correctly scale them.
The 256x256 layer for the main icon was created upscaling the
192x192 png available in the source tree. Hence, the icon might
not be perfect at the maximum size.
The icon for the file association was made from scratch and it's
visually similar to the previous icon.
As we never use {push,pop}_front std::vector works here perfectly.
Also reserve memory for std::vector out of lock.
This could be considered as an optimization, but in reality this is just
using right container in right place. According to my measurements total
speedup is under 0.2%.
* also had to account for "Append the label of the torrent to the save path",
but again, this was only an issue when "Keep incomplete torrents in:" is
selected
* A multi-file torrent with only one file (ie: a single file within a folder),
was being treated as a single-file torrent, making it impossible to import.
Multi-file torrent detection code was copied from libtorrent. The
information is available in libtorrent (under torrent_info::m_multifile),
however it's a private member and I chose to go with copying the code that
determines it, rather than modifying a library qBittorrent depends on.
Conflicts:
src/torrentimportdlg.cpp