By perceiving gauge invariance as an analytical tool in order to get insight into the states of the "generalized Landau problem" (a charged quantum particle moving inside a magnetic, and possibly electric field), and motivated by an early article that correctly warns against a naive use of gauge transformation procedures in the usual Landau problem (i.e. with the magnetic field being static and uniform), we first show how to bypass the complications pointed out in that article by solving the problem in full generality through gauge transformation techniques in a more appropriate manner. Our solution provides in simple and closed analytical forms all Landau Level-wavefunctions without the need to specify a particular vector potential. This we do by proper handling of the so-called pseudomomentum K (or of a quantity that we term pseudoangular momentum Lz), a method that is crucially different from the old warning argument, but also from standard treatments in textbooks and in research literature (where the usual Landau wavefunctions are employed - labeled with canonical momenta quantum numbers). Most importantly, we go further by showing that a similar procedure can be followed in the more difficult case of spatially-nonuniform magnetic fields: in such case we define K and Lz as plausible generalizations of the previous ordinary case, namely as appropriate line integrals of the inhomogeneous magnetic field - our method providing closed analytical expressions for all stationary state wavefunctions.. (see paper) ... also provide explicit Berry's phase calculations and their connection to probability currents and ...issues in elementary Quantum Mechanics and Condensed Matter Physics. As an added feature, we also show how the possible presence of an additional electric field can be treated through a further generalization of pseudomomenta and their proper handling.