Landauer's principle in qubit-cavity quantum-field-theory interaction in vacuum and thermal states