I live in Barcelona and hike from here all the time. It is a great place to base oneself and there are many great areas from the Pyrenees to the mountains to the south.
It depends on what time of year you are here, as in the winter, the high mountains are still covered in snow, and this can last until May, if you are thinking of making some longer routes.
Here are some links to walks in Catalunya, in the pre Pyrenees:
Here you can see the national parks, and each one has a variety of trails and rules. My favourite is the Parc de L'Albera (10), on the border with France near the coast, with many fine day walks and places to camp overnight too. This you can do all year.
Here are some more:
This is a walk I haven't done, but takes a few days, or you can do sections, and stay in huts along the way with the locals.
Anyway, I know many little half day hikes where you can go from a coastal view to hiking over the mountain range to see the Pyrenees in the distance that are less than an hours drive from Barcelona too.
When you are in town, give me a call, or PM, and I'd be happy to meet up and show you some routes on maps etc over a cerveza, if I'm free.