Applets
tasks.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef TASKS_H
00022 #define TASKS_H
00023
00024
00025 #include "ui_tasksConfig.h"
00026
00027
00028 #include <QTimer>
00029
00030
00031 #include <taskmanager/taskmanager.h>
00032 #include <KDialog>
00033
00034
00035 #include <plasma/applet.h>
00036
00037 class QGraphicsLinearLayout;
00038
00039 class KColorScheme;
00040
00041 namespace Plasma
00042 {
00043 class LayoutAnimator;
00044 class PanelSvg;
00045 }
00046
00047 class WindowTaskItem;
00048
00049 using TaskManager::StartupPtr;
00050 using TaskManager::TaskPtr;
00051
00059 class Tasks : public Plasma::Applet
00060 {
00061 Q_OBJECT
00062 public:
00067 explicit Tasks(QObject *parent, const QVariantList &args = QVariantList());
00068 ~Tasks();
00069
00070 void init();
00071
00072 void constraintsEvent(Plasma::Constraints constraints);
00073
00074 Plasma::PanelSvg *itemBackground();
00075 QPixmap *taskAlphaPixmap(const QSize &size);
00076 KColorScheme *colorScheme();
00077
00078 qreal itemLeftMargin() { return m_leftMargin; }
00079 qreal itemRightMargin() { return m_rightMargin; }
00080 qreal itemTopMargin() { return m_topMargin; }
00081 qreal itemBottomMargin() { return m_bottomMargin; }
00082 void resizeItemBackground(const QSizeF &newSize);
00083
00084 protected slots:
00085 void configAccepted();
00086 virtual void wheelEvent(QGraphicsSceneWheelEvent *);
00087 void themeRefresh();
00088 void updateActive(WindowTaskItem *task);
00089
00090 protected:
00091 void createConfigurationInterface(KConfigDialog *parent);
00092
00093 private slots:
00094 void addWindowTask(TaskPtr);
00095 void removeWindowTask(TaskPtr);
00096
00097 void addStartingTask(StartupPtr);
00098 void removeStartingTask(StartupPtr);
00099
00100 void currentDesktopChanged(int);
00101 void taskMovedDesktop(TaskPtr task);
00102 void windowChangedGeometry(TaskPtr task);
00103 void checkScreenChange();
00104
00105 private:
00106
00107
00108
00109 void registerWindowTasks();
00110
00111
00112 void removeAllWindowTasks();
00113
00114 void insertItemBeforeSpacer(QGraphicsWidget * item);
00115 void adjustStretch();
00116
00117 bool isOnMyScreen(TaskPtr task);
00118 void reconnect();
00119
00120 QHash<TaskPtr,WindowTaskItem*> m_windowTaskItems;
00121 QHash<StartupPtr,WindowTaskItem*> m_startupTaskItems;
00122 QHash<TaskPtr,WindowTaskItem*>::iterator m_activeTask;
00123
00124 bool m_showTooltip;
00125 bool m_showOnlyCurrentDesktop;
00126 bool m_showOnlyCurrentScreen;
00127 Plasma::LayoutAnimator *m_animator;
00128 QGraphicsLinearLayout *m_layout;
00129 Ui::tasksConfig m_ui;
00130 QList<TaskPtr> m_geometryTasks;
00131 QTimer m_screenTimer;
00132 QGraphicsWidget *m_spacer;
00133
00134 Plasma::PanelSvg *m_taskItemBackground;
00135 QPixmap *m_taskAlphaPixmap;
00136 KColorScheme *m_colorScheme;
00137 qreal m_leftMargin;
00138 qreal m_topMargin;
00139 qreal m_rightMargin;
00140 qreal m_bottomMargin;
00141 };
00142
00143 #endif