[digiKam] Tags Manager – how to enable multiple selection

On my previous post I told you about setting up the GUI for Tags Manager. Well, setting up a GUI is easy to do 80% of work , but it will take the same amount of time to polish everything.  Before finishing everything, all options must be fitted in, and I can’t do this right know.

After browsing digiKam code, I figured out that drag-n-drop was enabled by default, I thought „It’s cool, less work for me”.  After digging a little bit further, I found an attempt to support multiple tags as a TODO and few lines of code.  After few minutes of work tag  tree was supporting the multiple drops.

But it was only the beginning: Later I figured out that the center of every album action is related to AlbumManager::setCurrentAlbum, and I need to make it support a list of Album if I want to feed it with multiple selected tags. After 4 days of hard work I managed to make everything to use lists.

Result:

3 fat commits of about 200 insertion, 200 deletion and a lot of changes in different files only to port AlbumManager, and another one to port ImageAlbumModel(a class that is responsible for displaying current album’s content into the main window)

Another big challenge was implementing a delete option that can delete multiple tags safely.

Why it’s not safe? Because if you delete a parent tag and you have one of it’s children selected, and attempt to delete it after parent with result in accessing non-existent tag.

I came with a nice solution with ordering them by the distance to the root tag.  Porting delete option to context menu was also hard, because the tag id was encoded into QAction and I had to figure out how to encode a list. Here, I lost a day because of compilation error : I can’t encode a QList into a QVariant until I register QList with qt-metacall.

Conclusion:  A lot of code browsing and a lot of things that I changed. Now, I reached the bottom and need to patch database access, because requesting data for each tag is too slow. Hope my mentor, Marcel Viewsweg, will help me with this. Also, a lot of options need to be patched.

I’m happy that at least, dragon’s heads begin to fall as I slice them one after another…

Anunțuri
  1. No trackbacks yet.

Lasă un răspuns

Completează mai jos detaliile tale sau dă clic pe un icon pentru a te autentifica:

Logo WordPress.com

Comentezi folosind contul tău WordPress.com. Dezautentificare / Schimbă )

Poză Twitter

Comentezi folosind contul tău Twitter. Dezautentificare / Schimbă )

Fotografie Facebook

Comentezi folosind contul tău Facebook. Dezautentificare / Schimbă )

Fotografie Google+

Comentezi folosind contul tău Google+. Dezautentificare / Schimbă )

Conectare la %s

%d blogeri au apreciat asta: