Form factors in sinh- and sine-Gordon models, deformed Virasoro algebra, Macdonald polynomials and resonance identities