Wednesday, June 18. 2008Introducing the Popup DropperAbout a year ago we had an issue in Amarok 2 development because we wanted to be able to move portable device track access into collections (this is happening with Alejandro's GSoC project), but we couldn't figure out a good paradigm for accessing the various device specific functions. There were some other concerns too, about the right-click menus getting too overloaded, making it hard to find common functions. Finally, when people wanted to drag music to the playlist, they now had to cross the entire window, whereas before it was a quick drag and drop...a lot less mouse movement, and possibly the difference between picking the mouse up and not. So I had a brainstorm. We have this ginormous context view area in the middle of A2. What if we could put it to good use, and allow it to act as a surrogate menu? For many people, dragging the mouse a bit to drop items on a big target is much easier than navigating small right-click menus, where it's easy to overshoot your destination and accidentally close submenus. Thus the PUD -- the PopUp Dropper -- was born. My first sketch of it is here:
(Here's the preceding page that talks about collection groups. If you like that idea, be sure to let us know at amarok@kde.org.) The PUD actually lived for a long time in the Amarok source tree, but there were problems. One was that it tied in too tightly to the existing Amarok context view code -- something that, as that code was refactored over and over again, was painfully obvious would not work. The other was that the actual popping up and drawing was painfully slow. It seems drawing a QGraphicsView on top of another one wasn't making Qt happy. Fortunately, as of Qt 4.4, this problem has been solved. The final nail in the coffin (related to the first one actually) is that some of the people that saw the work wanted to see it available for all of KDE to use. This approach wasn't going to work. When Qt 4.4 hit qt-copy, I started to play around with things again. Soon enough I was addicted to making it work. I took the Drag 'n Drop Robot example and started modifying it to use the PUD library I was making. The goals: make it Qt-only, make it very customizable so it could work in any situation, and make it actually able to replace a right-click menu. I'm happy to say that those goals have been met. Here's a list of current features:
I really wanted to make a video available, but I could get neither xvidcap, nor vnc2swf, nor captury working at all. recordmydesktop worked, but interfered with the drops, so it wouldn't work as intended. Instead, I'm making an "alpha" version of the PUD available for people to see (I had been using a local git repository, which is included in the tarball). Don't worry...despite me calling it alpha, it's quite stable (in fact, as you'll see, it's already used in Amarok). No dependencies are needed, just qmake the dragdroprobot.pro file, make, and run the dragdroprobot file. Caveats: it's not commented (see coloritem.cpp for usage examples), I know of a few bugs, it's not finished (I have several more things to add to it), there is at least one crash that I can't reproduce reliably and have not found, there are some things I need to test but have so far been unable to (such as more than one submenu layer), and note the copyrights and distribution requirements on the files -- it's a modified example from Qt. Preferably run in a Qt 4.4 environment (i.e. in a KDE trunk login) to get all the benefits of Alien, or else it might be rather slow depending on your system. But with that all said, let me know how you like it. Finally, it's been updated in the Amarok source tree. Now that I got the submenu support working, Nikolaj has gotten it integrated. In recent builds of Amarok you can simply start dragging an item from your collection and see it in motion. Some screenshots follow. The first is showing the normal menu, the second shows the submenu that pops up when you hover over the Organize Files item (you can see the previous menu behind it, through the transparency).
So what's next? Hopefully, this will eventually make it in some way shape or form into kdelibs, assuming the API stays stable (it was written in the kdelibs style, with a d pointer and private classes), making it easy for KDE apps to take advantage of it without being an external dependency. And as it gets completed I'll be making it available separately for any Qt app out there that wants to use it (not sure what license it will be under...either GPL or BSD). For now, if you want to see the latest versions, keep your eye on the Amarok source code in the src/popupdropper directory (it has a few modifications to my "master" source simply to make it build in the Amarok source tree...specifically, adding moc file includes since it's not using qmake, and exporting PopupDropperAction). Comments appreciated! Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
This is really cool stuff, and it is super smooth in action. Well done Jeff!
I just hope I did not annoy you too much with all my feature/change requests during integration
Nah, it worked out for the best, even though it added two months onto my development time
Wow, this must be the most innovative feature of Amarok 2! I must see I was a bit worried about the large distance for dragging stuff to the playlist as well, but seeing this I am actually considerating trying out the alpha version! Keep up the good work!
I assume you mean trying out the alpha version of Amarok? Try out the linked version there, the pd25.tar.gz file. It shows more than you can see in Amarok. It won't harm your computer in any way, I promise, and it's an extremely quick build. Play around with it...
Why in the middle?
You want to minimize the mouse moves, which is clearly a good idea. Why not around the mouse pointer instead? Like in a circle? You click, hold a second, then the circle appears with some fancy effects, and the distance "mouse to function" would just be the shortest possible one. Anyway, very nice idea.
I agree that it would be very cool to do that, but also very difficult. You'd pretty much have to pop up a transparent PUD across the entire Amarok window (the larger it is the more potential for slowness), then put your elements around the mouse, and then detect how far away the mouse moves to see when to dismiss it. Not only would it be complex to implement, for many apps it might be too complex to use. Not that you couldn't do this though -- since you could use the main window (which is a QWidget) as your parent!
This is still far less of a mouse distance than across the main window.
Wow, very good indeed. I think the Oxygen icon theme should be used instead of these blue icons, just to make the whole theme more consistent.
Very nice work!
Right now they're using the same Amarok icons that the actions currently have elsewhere in the app. If those switch to Oxygen, we'll probably switch these too (we want them to be consistent).
Good job! This is a new element of UI interaction and definitely needs to get pushed to kdelibs! Please, finish it, polish it, and let the people experience this intuitive way of interaction!!
Maybe you can improve performance by hooking events on a widget and having your qgraphicsscene and painting that one over the widget (so you're good in performance in non-alien contexts too!).
That's actually pretty much what I'm doing. I think. If I understand you correctly
Performance is actually quite good, especially if you're using a shared renderer that already has the file open (as is going to be the case in many an application).
this is quite cool - even though I dont fully understand how it works. So if maybe someone else could create a video showing it in action that would be awesome.
If you download the code and manage to make a video, I would be quite happy
Heh, putting more 'rock' into amarok!
This is a great idea and you can immediately see how it could be useful in small form factor interfaces like touch or stylus devices also.
Thanks! Yes, the thought that it could be useful for touch screen devices -- drag and drop with a finger -- has not been lost on me
Wow! Cool innovation..
I haven't got time to go through the code of pd dnd robot example but I did run it and was really impressed. Two suggestions 1) It would be nice if the there was a drop indicator indicating valid drop spots, say a color change. This is because i had no clue initially where to drop (on text or the icon). May be allowing to drop on the whole row would be good. I might be wrong, did i miss anything ? 2) This might sound stupid or too complex. Anyway consider a situation where i am already using a GraphicsView. Now i wish to use popup dropper. I think the performance would be better if the Popup dropper could reuse the same scene hooked with my GraphicsView. May be an approach like a base view/scene class which will enable Popup dropping whenever needed might also be a good idea. This way, i don't need to use transparent widgets(QGraphicsView) when i don't need to. Nice job anyways!!
Thanks for checking it! Responses:
1) This is a good idea. Not sure about dropping on the whole row, but I'll try to get some kind of visual indicator available. 2) This might be way too complex
Regarding your response to 2)
I compiled with qt-copy, so alien widget support was there and to be honest the performance wasn't bad. What i could see was, you used a stack of QGraphcisView's to add further overlays. This can be overkill for stacking depth > 2 but that is rarely used i guess. Infact your code is fine. But just to brainstorm more, i got an idea. How about implementing the entire overlay in terms of the QGraphicsItems stacked one over other since items support transparency , stacking order with zValue() and parent/child relationship. In this case , the only one GraphicsView can be overlaid and items can be overlaid on it to the required stacking level. The above is just an idea, may be i am thinking too much about performance I am waiting for my exams to get over, so that i can play with the code. On a sidenote, by anychance was this concept discussed in qtcentre.org/forum ? I remember the word popup dropper
Using the QGraphicsViews brings other benefits though (besides making item management easier, which is actually quite simple because of the way that d pointers are swapped out). For instance, you can blend colors as you add layers by controlling the background color and transparency of each new layer. You could do that kind of blending math on your own, but to be honest it doesn't have that much of an effect on performance with Alien, because that kind of calculation is really rather fast for the optimized code in Qt -- what does affect it more is the animation running in the background. So, my feeling is you are worrying a bit too much about performance
At some point, a long, long time ago, before Alien, I did bring it up in the qtcentre.org forum. Had issues with rendering, as well as speed. No longer though I'll blog about updates and updated tarballs with more stuff implemented, but the basics shouldn't change, so feel free to play around with the code.
I think you concept is great and I was very impressed seen it in neon first time. It's always amazing when developers do things differently and smart. However performance is low for me.
Thanks for the encouragement! Glad to hear you like the idea.
Sorry performance was a dog for you. But you didn't say anything about your environment, so not sure why that could be. Generally speaking, so long as you've compiled against 4.4 it should be pretty quick... |
Amarok LinksCalendar
QuicksearchCategoriesSyndicate This BlogBlog Administration |
|||||||||||||||||||||||||||||||||||||||||||||||||

