Taskmanager with grouping support preview version

christian mollekopf chrigi_1 at hotmail.com
Thu Jul 3 14:17:41 CEST 2008


I am back with some code...
 
Today  ( after a week of coding =( ) i noticed that there is already some code with a AbstractTaskItem ( as aaron actually mentioned but i couldn't find it) .
I did  more or less the same thing for that part but there are some differences.
 
Because we have a Task class in workspace/libs/taskmanager/ i thought it would be nice to have also a non GUI  group there.
So the TaskGroupItems follow the groups they are associated to. This has the advantage that we can easely create some runners for ex. to
manipulate the groups. so one could type a groupname for ex. and the stored group automatically opens and all necessary programs are opened.
But however i just think its more flexible.
 
To manage the layout and drag & drop and so on, i created the LayoutWidget which is derived from a QGraphicsWidget.
I consists of a QGraphicsLinearLayout and the managing functions.
I works with AbstractTaskItems so you can drag WindowTaskItems and TaskGroupItems the same way.
You can also cycle through the windows an groups through he scrolling wheel.
 
Because the LayoutWidget manages the layout the Tasks class just remains as the interface for the signals form the Taskmanager class and  the applet.
It also holds some QHashes with all groups and tasks. 
 
The TaskGroupItems are actually just represented by a single TaskItem that looks like a WindowTaskItem unless that 
the name is replaced by the groupname and it has the Xorg icon at the moment (which of course should be a group icon).
It also has the group contextmenu. 
 
My idea is that the expanded group uses the LayoutWidget to show all its items. This way we have all functions like drag & drop or cycling through the
group's tasks without any effort. If you want to drag the whole group it would start a groupdrag after a single task gets dragged outside of the group, and we would move the layoutWidget.
If the GroupModifierKey would be pressed the task leaves the group instead. 
We could also use the LayoutWidget for the popup that sould show up after placing the cursor on a collapsed group.
With this approach we could even use different sorting strategies in different groups.
 
To Group Items just drop them on each other with the groupModifierKey (Alt is hardcoded right now) to group them.
The group gets a name and color created by the BasicGroupingStrategy class which just creates numbered names and random colors. 
 
The provided code is definitely not mature, but i would like to know if you think it is the right direction to go, or if there are some serious program design mistakes.
As you will notice there are some things that arent implemented yet:

In order to keep the custom ordering of a taskbar on a virtual desktop, I store the items in a QList. This is quite slow and there's likely a better solution. We could also create a LayoutWidget for every desktop and group and but this is probably a bit too memory consuming. And since the BasicGroupingStrategy should be able to store the ordering and come up with it next time the session is startet, there has to be a way to store it anyway.



Here's my current TODO list on what i intend to implement:

-Maybe fixed task size so not everything starts to resize if one task is removed
-Clics on collapsed group items should cycle through members
-doubleclick on collapsed group to expand group (fast action to collaps it again still needed)
-Implement show only current screen (desktops are already)
-Implement Startup tasks 
-show temporary LayoutWidget with group members if cursor stays on collapsed group
-the order should maybe stored in the groupstrategy so it could be suggested next time
-Grouping should be per taskbar and not globally as it currently is
-Save custom order on collapse group
-It should be possible to have multiple rows and force a certain number of rows or let the LayoutWidget automatically appen and remove rows as needed.
-Add Group editing window where name and color can be edited (with support of automatic guesses). It could look like the window that pops up when clock or the new device notifier is clicked. 
-Find a way to recognize a window over different sessions
-Implement Dragging of expanded groups by dragging groupmember outside of group

There is a bug that items dont show up on the session startup but it works like a charm after the first 'killall plasma && plasma' ;-)

If you think im not totally of the track i will continue on it.
 
The Code is uploaded here:  http://www.4shared.com/dir/7784195/dbc7ddd2/panel-devel.html

I didn't create diffs because i changed more or less everything.... Just replace the folders if you like to try it out.
I added a little UML Diagramm so you get an idea how it works....
 
Applies to: workspace/libs/taskmanager
            workspace/plasma/applets/tasks


 
Regards Chris
 


_________________________________________________________________
Hol dir 30 kostenlose Emoticons für deinen persönlichen Windows Live Messenger
http://www.livemessenger-emoticons/de-ch/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/panel-devel/attachments/20080703/828da90c/attachment-0001.html 


More information about the Panel-devel mailing list