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

« back to all changes in this revision

Viewing changes to libs/plasmagenericshell/widgetsexplorer/appletslist.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
 *   Copyright (C) 2009 by Ana Cecília Martins <anaceciliamb@gmail.com>
 
3
 *   Copyright (C) 2009 by Ivan Cukic <ivan.cukic+kde@gmail.com>
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or modify
 
6
 *   it under the terms of the GNU Library/Lesser General Public License
 
7
 *   version 2, or (at your option) any later version, as published by the
 
8
 *   Free Software Foundation
 
9
 *
 
10
 *   This program is distributed in the hope that it will be useful,
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *   GNU General Public License for more details
 
14
 *
 
15
 *   You should have received a copy of the GNU Library/Lesser General Public
 
16
 *   License along with this program; if not, write to the
 
17
 *   Free Software Foundation, Inc.,
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef APPLETSLIST_H
 
22
#define APPLETSLIST_H
 
23
 
 
24
#include <QBasicTimer>
 
25
#include <QTimeLine>
 
26
 
 
27
#include "kcategorizeditemsviewmodels_p.h"
 
28
#include "plasmaappletitemmodel_p.h"
 
29
#include "appleticon.h"
 
30
#include "applettooltip.h"
 
31
#include "abstracticonlist.h"
 
32
 
 
33
 
 
34
class AppletsListWidget : public Plasma::AbstractIconList
 
35
{
 
36
 
 
37
    Q_OBJECT
 
38
 
 
39
public:
 
40
    AppletsListWidget(Plasma::Location location = Plasma::BottomEdge, QGraphicsItem *parent = 0);
 
41
    ~AppletsListWidget();
 
42
 
 
43
    //not used yet and probably never will be
 
44
    QList <KCategorizedItemsViewModels::AbstractItem *> selectedItems() const;
 
45
 
 
46
    void setItemModel(PlasmaAppletItemModel *model);
 
47
    void setFilterModel(QStandardItemModel *model);
 
48
 
 
49
private:
 
50
    KCategorizedItemsViewModels::AbstractItem *getItemByProxyIndex(const QModelIndex &index) const;
 
51
 
 
52
    void populateAllAppletsHash();
 
53
 
 
54
    //Creates a new applet icon and puts it into the hash
 
55
    AppletIconWidget *createAppletIcon(PlasmaAppletItem *appletItem);
 
56
 
 
57
    void setToolTipPosition();
 
58
 
 
59
private slots:
 
60
    void filterChanged(int index);
 
61
 
 
62
    void appletIconDoubleClicked(Plasma::AbstractIcon *icon);
 
63
    void appletIconHoverLeave(Plasma::AbstractIcon *icon);
 
64
    void appletIconHoverEnter(Plasma::AbstractIcon *icon);
 
65
    void appletIconDragging(Plasma::AbstractIcon *icon);
 
66
    void onToolTipEnter();
 
67
    void onToolTipLeave();
 
68
 
 
69
    void animateToolTipMove();
 
70
    void toolTipMoveTimeLineFrameChanged(int frame);
 
71
    void rowsAboutToBeRemoved(const QModelIndex& parent, int row, int column);
 
72
 
 
73
protected: //FIXME wuh?
 
74
    void timerEvent(QTimerEvent *event);
 
75
    QVariant itemChange(GraphicsItemChange change, const QVariant & value);
 
76
 
 
77
    //virtuals from AbstractIconList
 
78
    void updateVisibleIcons();
 
79
    void setSearch(const QString &searchString);
 
80
 
 
81
Q_SIGNALS:
 
82
    void appletDoubleClicked(PlasmaAppletItem *appletItem);
 
83
 
 
84
private:
 
85
 
 
86
    //One single tootip to show applets info
 
87
    AppletToolTipWidget *m_toolTip;
 
88
 
 
89
    QStandardItemModel *m_modelItems;
 
90
 
 
91
    //categories models
 
92
    QStandardItemModel *m_modelFilters;
 
93
 
 
94
    //model that filters the item models
 
95
    KCategorizedItemsViewModels::DefaultItemFilterProxyModel *m_modelFilterItems;
 
96
 
 
97
    QVariant m_dataFilterAboutToApply;
 
98
    QBasicTimer m_filterApplianceTimer;
 
99
    QBasicTimer m_toolTipAppearTimer;
 
100
    QBasicTimer m_toolTipDisappearTimer;
 
101
    QBasicTimer m_toolTipAppearWhenAlreadyVisibleTimer;
 
102
 
 
103
    QTimeLine toolTipMoveTimeLine;
 
104
    QPoint toolTipMoveFrom;
 
105
    QPoint toolTipMoveTo;
 
106
};
 
107
 
 
108
#endif //APPLETSLIST_H