Formation and settling of a disc galaxy during the last 8 billion years in a cosmological simulation