@p_d
I'm a noob too, so my advice is worth *less* than what you pay for it. ;-)
However, I recently learned a little about this type of circuit with a failed
experiment.
You didn't specify the range of your input voltage, but I'd guess that it may be higher than what your mcu can handle since it looks like Q3 is intended to switch that voltage onto the gate of Q2 without frying the I/O pin. Couldn't you use a diode instead? That's a simpler part and a logic high appearing on PB17 should be enough to turn on Q2 even with the diode drop. The diode would protect the mcu from the unregulated voltage input.
Is D1 to protect against reverse voltage (i.e., batteries in backwards)? Note D1 will drop up to 0.6v from your input. If your source is already close to what the regulator spits out, D1's voltage drop might cause problems.
Have you thought about switch bounce? The voltage regulator circuit probably won't care, but your mcu might start doing strange things if it doesn't get a clean start at power-on.
Lastly, the LM2940 datasheet says that Cout should be at least 22uF, but you've specified only 0.1uF.
BTW, it's kinda fun to just dive in and build a simple circuit like this even if you're not sure it'll work. No matter what, you'll learn something along the way.