Add custom library header save/restore code.

Should migrate current 1.12 installations from the old QT binary blob
to the new protobuf format.  This won't help us for users upgrading
from 1.11, but all future upgrades should be much smoother.
includes a small roundtrip test.

the copy was necessary to preserve the constness of the function.   But actually that doesn't make sense, since the process of restoring the state may change the internal state of the proto (as column logical orders change).  I think there are enough ways of constructing and destructing the state that a class makes sense.  note also the test