~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/applets/systemtray/ui/applet.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   applet.h                                                              *
 
3
 *                                                                         *
 
4
 *   Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com>              *
 
5
 *   Copyright (C) 2010 Marco Martin <notmart@gmail.com>                   *
 
6
 *                                                                         *
 
7
 *   This program is free software; you can redistribute it and/or modify  *
 
8
 *   it under the terms of the GNU General Public License as published by  *
 
9
 *   the Free Software Foundation; either version 2 of the License, or     *
 
10
 *   (at your option) any later version.                                   *
 
11
 *                                                                         *
 
12
 *   This program is distributed in the hope that it will be useful,       *
 
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
15
 *   GNU General Public License for more details.                          *
 
16
 *                                                                         *
 
17
 *   You should have received a copy of the GNU General Public License     *
 
18
 *   along with this program; if not, write to the                         *
 
19
 *   Free Software Foundation, Inc.,                                       *
 
20
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
 
21
 ***************************************************************************/
 
22
 
 
23
#ifndef APPLET_H
 
24
#define APPLET_H
 
25
 
 
26
#include <plasma/popupapplet.h>
 
27
 
 
28
#include "ui_autohide.h"
 
29
#include "ui_visibleitems.h"
 
30
 
 
31
#include "../core/task.h"
 
32
 
 
33
namespace Plasma
 
34
{
 
35
class ExtenderItem;
 
36
class TabBar;
 
37
class Dialog;
 
38
}
 
39
 
 
40
class QStandardItemModel;
 
41
 
 
42
namespace SystemTray
 
43
{
 
44
 
 
45
class Manager;
 
46
class TaskArea;
 
47
 
 
48
class Applet : public Plasma::PopupApplet
 
49
{
 
50
    Q_OBJECT
 
51
    Q_PROPERTY(bool firstRun READ isFirstRun)
 
52
 
 
53
public:
 
54
    explicit Applet(QObject *parent, const QVariantList &arguments = QVariantList());
 
55
    ~Applet();
 
56
 
 
57
    void init();
 
58
    QGraphicsWidget *graphicsWidget();
 
59
    void constraintsEvent(Plasma::Constraints constraints);
 
60
    Manager *manager() const;
 
61
    QSet<Task::Category> shownCategories() const;
 
62
    bool isFirstRun();
 
63
    bool isPopupShowing() const;
 
64
 
 
65
protected:
 
66
    void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
 
67
    void createConfigurationInterface(KConfigDialog *parent);
 
68
    void configChanged();
 
69
    void popupEvent(bool show);
 
70
 
 
71
    void mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event); }
 
72
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event); }
 
73
    void hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); }
 
74
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); }
 
75
 
 
76
private Q_SLOTS:
 
77
    void configAccepted();
 
78
    void unlockContainment();
 
79
    void propogateSizeHintChange(Qt::SizeHint which);
 
80
    void themeChanged();
 
81
    void checkSizes();
 
82
    void checkDefaultApplets();
 
83
 
 
84
private:
 
85
    static SystemTray::Manager *s_manager;
 
86
    static int s_managerUsage;
 
87
 
 
88
    TaskArea *m_taskArea;
 
89
    TaskArea *m_hiddenTaskArea;
 
90
    QWeakPointer<QWidget> m_autoHideInterface;
 
91
    QWeakPointer<QWidget> m_visibleItemsInterface;
 
92
    QSet<Task::Category> m_shownCategories;
 
93
    QDateTime m_lastActivity;
 
94
 
 
95
    Plasma::FrameSvg *m_background;
 
96
    Plasma::FrameSvg *m_separator;
 
97
    Plasma::Svg *m_icons;
 
98
 
 
99
    Ui::AutoHideConfig m_autoHideUi;
 
100
    Ui::VisibleItemsConfig m_visibleItemsUi;
 
101
 
 
102
    QWeakPointer<QStandardItemModel> m_visibleItemsSourceModel;
 
103
 
 
104
    bool m_firstRun;
 
105
};
 
106
 
 
107
}
 
108
 
 
109
 
 
110
#endif