setgenerate creates multiple blocks in -regtest mode

I'm writing some wallet regression tests using -regtest mode, and
need to generate an initial multi-hundred-block chain. Repeatedly
calling setgenerate to generate one block is slow and doesn't
work properly, because block creation happens asynchronously.

This adds two features to setgenerate in -regtest mode:

1) Instead of being interpreted as number of threads to start, the
third argument is the number of blocks to generate.

2) setgenerate will not return until the block creation threads
have created the requested number of blocks.
Merge pull request #3294

c8b7425 setgenerate creates multiple blocks in -regtest mode (Gavin Andresen)
Fix uninitialized variable added in b33b9a6fe

After discussing with BlueMatt, this appears to be harmless in its
current state since it's always set before it's used. Initialize it
anyway for readability and future safety.
Merge pull request #3316

106f133 Fix uninitialized variable added in b33b9a6fe (theuni)
Add some additional logging to give extra network insight.
Store and use a sanitized subVer
qt: restore icon dock menu

This was removed by 25c0cce7f. It was apparently removed in qt5, but
may return for 5.1.
Merge pull request #3319

871ac37 qt: restore icon dock menu (theuni)
Merge pull request #3296

a946aa8 Store and use a sanitized subVer (Mike Hearn)
ba6a4ea Add some additional logging to give extra network insight. (Mike Hearn)