• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Applets

taskgroupitem.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>          *
00003  *   Copyright (C) 2008 by Alexis Ménard <darktears31@gmail.com>           *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
00019  ***************************************************************************/
00020 
00021 
00022 #ifndef TASKGROUPITEM_H
00023 #define TASKGROUPITEM_H
00024 
00025 #include "abstracttaskitem.h"
00026 #include "windowtaskitem.h"
00027 // Own
00028 #include <taskmanager/taskmanager.h>
00029 #include "tasks.h"
00030 #include <QMap>
00031 #include <QHash>
00032 
00033 using TaskManager::TaskGroup;
00034 using TaskManager::GroupPtr;
00035 using TaskManager::TaskItem;
00036 using TaskManager::AbstractGroupableItem;
00037 
00038 
00039 class LayoutWidget;
00040 class SplitGroupItem;
00041 class QGraphicsLinearLayout;
00042 typedef QMap<int, AbstractTaskItem*> Order;
00043 
00047 class TaskGroupItem : public AbstractTaskItem
00048 {
00049     Q_OBJECT
00050 
00051 public:
00053     TaskGroupItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip);
00054 
00056     void setGroup(TaskManager::GroupPtr);
00057 
00059     TaskManager::GroupPtr group() const;
00060 
00061     virtual void close();
00062 
00063     QList <AbstractTaskItem*> memberList() const;
00064     AbstractTaskItem * activeSubTask();
00065 
00066     virtual bool isWindowItem() const;
00067     virtual bool isActive() const;
00068 
00069     bool collapsed() const;
00070 
00072     AbstractTaskItem *directMember(AbstractTaskItem *);
00073 
00075     int maxRows();
00076     //TODO remove and calculate reasonable value in the layout itself
00077     void setMaxRows(int);
00078 
00079     void setForceRows(bool);
00080     bool forceRows();
00081 
00082     /*
00083     *Why the split group works.
00084     *drag split group: in the drop event the getDirectMember function is used which retrieves the parent item of the split group
00085     *drop on split group: //on unsplitGroup the group adds all items from splitgroup / the grouping is done via the taskgroup in lib
00086     *collapse on split group: because windowTaskItems retrive its parentgroup via tasks
00087     */
00089     TaskGroupItem * splitGroup();
00091     TaskGroupItem * splitGroup(int position);
00093     void unsplitGroup();
00095     void setSplitGroup(TaskGroup *group);
00096     bool isSplit();
00097 
00098     LayoutWidget *layoutWidget();
00099 
00100     int indexOf (AbstractTaskItem *task);
00101 
00102     int optimumCapacity();
00103 
00104     AbstractTaskItem* abstractItem(AbstractItemPtr);
00105 
00106     void setAdditionalMimeData(QMimeData* mimeData);
00107     void publishIconGeometry() const;
00108     void publishIconGeometry(const QRect &rect) const;
00109 
00110 signals:
00112     void groupSelected(TaskGroupItem *);
00113     void sizeHintChanged(Qt::SizeHint);
00115     void changed();
00116 
00117 public slots:
00118     virtual void activate();
00123     void reload();
00124 
00125     void expand();
00126     void collapse();
00127     void updatePreferredSize();
00128 
00129 protected:
00130     AbstractTaskItem *taskItemForWId(WId id);
00131     virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
00132     virtual void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,QWidget *widget);
00133 
00134     virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
00135     virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
00136     void handleDroppedId(WId id, AbstractTaskItem *targetTask, QGraphicsSceneDragDropEvent *event);
00137 
00138     void mousePressEvent(QGraphicsSceneMouseEvent *event);
00139     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00140     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00141 
00142 public slots:
00143     void updateActive(AbstractTaskItem *);
00144 
00145 protected:
00146     void updateToolTip();
00147 
00148 protected slots:
00149     virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
00150 
00151 private slots:
00152     void updateTask(::TaskManager::TaskChanges changes);
00153 
00155     void itemAdded(AbstractItemPtr);
00156     void itemRemoved(AbstractItemPtr);
00157 
00159     void editGroup();
00161     void itemPositionChanged(AbstractItemPtr);
00162 
00163     void popupMenu();
00164 
00165 private:
00166     AbstractTaskItem* createAbstractItem(AbstractItemPtr groupableItem);
00167     TaskGroupItem* createNewGroup(QList <AbstractTaskItem *> members);
00168     WindowTaskItem * createWindowTask(TaskManager::TaskItem* task);
00169     TaskGroupItem * createTaskGroup(GroupPtr);
00170     WindowTaskItem *createStartingTask(TaskManager::TaskItem* task);
00171 
00172     void removeItem(AbstractTaskItem *item);
00173 
00174     void layoutTaskItem(AbstractTaskItem* item, const QPointF &pos);
00175     void setSplitIndex(int position);
00176 
00177     int totalSubTasks();
00178     AbstractTaskItem * selectSubTask(int index);
00179 
00180     GroupPtr m_group;
00181 
00182     QHash<AbstractItemPtr, AbstractTaskItem*> m_groupMembers;
00183 
00184     LayoutWidget *m_expandedLayout;
00185     QTimer *m_popupMenuTimer;
00186     QHash <int, Order> m_taskOrder;
00187     int m_lastActivated;
00188     int m_activeTaskIndex;
00189     int m_maximumRows;
00190     bool m_forceRows;
00191     int m_splitPosition;
00192     TaskGroupItem *m_parentSplitGroup;
00193     TaskGroupItem *m_childSplitGroup;
00194 };
00195 
00196 #endif

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal