This makes it possible to run a task in another thread.
I added a variable to toggle debug prints because they seem to trigger
an assertion on Qt internals when the task in on another thread. Of
course, this isn't awesome, but can wait until we improve our logging.
Signed-off-by: flow <flowlnlnln@gmail.com>