Hitchin systems, N = 2 gauge theories and W-gravity