Support out of srcdir builds.
Fix libtorrent 1.0.0 compilation. Closes #1659
fix issue #1674: AddNewTorrentDialog is shown again and again even if checkbox "dont ask me again" is set
Merge pull request #1676 from sorokin/fix-open-file

fix issue #1674: AddNewTorrentDialog is shown again and again even if checkbox "dont ask me again" is set
Fix nox build on MAC OSX.
Don't show availability bar for magnet links

This commit fixes an exception in PropertiesWidget:

"Caught exception in PropertiesWidget::loadDynamicData():  invalid
torrent handle used"

This exception occurs when an user clicks on a torrent that doesn't have
a metadata (when a magnet link is not resolved yet). One should not call
torrent_handle::get_torrent_info when torrent doesn't have a metadata.
Merge pull request #1685 from sorokin/fix-exception-in-prop-widget

Don't show availability bar for magnet links
Fix crash when the selected torrent disappears from the transfer list. Closes #1661
Fix tracker announcing problem(hit-and-run) when many torrents are being active. Closes #1571
Count magnet links in the 'downloading' filter and make them prevent system inhibition. Closes #1558
fewer calls to hash()
speed up icon loading
don't make the same request to TorrentModelItem twice
cache torrent_status
use set_alert_dispatch instead of timer to get an alerts from libtorrent

libtorrent allows setting a custom dispatch handler that is invoked in
libtorrent thread when new alerts are incoming. QAlertDispatcher is a
class that allows to translate these alerts to UI thread.

The concept is very simple:

1. On initialization QAlertDispatcher constructor calls set_alert_dispatch() passing
 QAlertDispatcher::dispatch as argument.

2. On deinitialization destructor calls set_alert_dispatch() passing a empty
 function. (line 25) libtorrent handles thos and switches back to queuing
 alerts in queue.

3. QAlertDispatcher::dispatch() adds alert to queue and notifies UI thread that new
 alerts are incoming. Enqueuing is done in function enqueueToMainThread().
 The invariant of class is the following:

    if alert queue is not empty, in message loop of UI thread contains a queued
    invocation of deliverSignal().

4. When message loop is pumped UI thread execute deliverSignal() function.
 It emit appropriate signal and if queue is still not empty (for example
 if slot doesn't grab alerts) rewind enqueuing to main thread.

This is a idea. But here is some details.

1. When QAlertDispatcher is destoyed, libtorrent still can call
QAlertDispatcher::dispatch a few times after destruction. This is
handled by passing a "tag". A tag is a object that references QAlertDispatch.
Tag could be invalidated. So on destruction QAlertDispatcher invalidates a tag
and then unsubscribes from alerts. When QAlertDispatcher::dispatch is called
with invalid tag it simply discard an alert.

    Therefore we could drop a few alerts during unsubscription. So we unsubscribe
    only at exit when missing some alerts is not a problem.

2. Another problem is in QBtSession::saveFastResumeData(). It pumps alert
queue synchronously. My first attempt was to destroy QAlertDispatcher
and then pump libtorrent queue. But as I was afraid of losing alerts I
supported synchronous querying of alerts in QAlertDispatcher.
(QAlertDispatcher::getPendingAlerts)

Conflicts:
	src/qtlibtorrent/qbtsession.cpp
use post_status_update()

Conflicts:
	src/qtlibtorrent/qbtsession.cpp
extract torrent statistics from torrent speed monitor to separate file
use stats_alert in TorrentSpeedMonitor

Conflicts:
	src/qtlibtorrent/qbtsession.cpp
Merge pull request #1703 from sorokin/alerts

Use torrent_status to be more efficient.
Fix previous commits.