Quantum principal bundles, Gauge groupoids and coherent HOPF 2-algebras