~ubuntu-branches/ubuntu/vivid/muon/vivid-proposed

« back to all changes in this revision

Viewing changes to installer/ApplicationView/ApplicationDelegate.h

Tags: upstream-1.3.65
ImportĀ upstreamĀ versionĀ 1.3.65

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
 
3
 *   Copyright (C) 2008 Daniel Nicoletti <dantti85-pk@yahoo.com.br>
 
4
 *   Copyright (C) 2010 Jonathan Thomas <echidnaman@kubuntu.org>
 
5
 *
 
6
 *   This program is free software; you can redistribute it and/or modify
 
7
 *   it under the terms of the GNU Library/Lesser General Public License
 
8
 *   version 2, or (at your option) any later version, as published by the
 
9
 *   Free Software Foundation
 
10
 *
 
11
 *   This program is distributed in the hope that it will be useful,
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *   GNU General Public License for more details
 
15
 *
 
16
 *   You should have received a copy of the GNU Library/Lesser General Public
 
17
 *   License along with this program; if not, write to the
 
18
 *   Free Software Foundation, Inc.,
 
19
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
20
 */
 
21
 
 
22
#ifndef APPLICATIONDELEGATE_H
 
23
#define APPLICATIONDELEGATE_H
 
24
 
 
25
// KDE includes
 
26
#include <KExtendableItemDelegate>
 
27
#include <KIcon>
 
28
 
 
29
class KIconLoader;
 
30
class KRatingPainter;
 
31
 
 
32
class Application;
 
33
class ApplicationBackend;
 
34
class ApplicationExtender;
 
35
 
 
36
/**
 
37
 * Delegate for displaying the applications
 
38
 */
 
39
class ApplicationDelegate: public KExtendableItemDelegate
 
40
{
 
41
    Q_OBJECT
 
42
public:
 
43
    ApplicationDelegate(QAbstractItemView *parent, ApplicationBackend *backend);
 
44
 
 
45
    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
 
46
    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
 
47
    bool editorEvent(QEvent *event,
 
48
                     QAbstractItemModel *model,
 
49
                     const QStyleOptionViewItem &option,
 
50
                     const QModelIndex &index);
 
51
    void setShowInfoButton(bool show);
 
52
 
 
53
private:
 
54
    ApplicationBackend *m_appBackend;
 
55
 
 
56
    QSize   m_buttonSize;
 
57
    QPersistentModelIndex m_oldIndex;
 
58
    ApplicationExtender *m_extender;
 
59
    KRatingPainter *m_ratingPainter;
 
60
    QPixmap m_emblem;
 
61
    bool m_showInfoButton;
 
62
 
 
63
    int calcItemHeight(const QStyleOptionViewItem &option) const;
 
64
 
 
65
public Q_SLOTS:
 
66
    void itemActivated(QModelIndex index);
 
67
    void invalidate();
 
68
 
 
69
Q_SIGNALS:
 
70
    void showExtendItem(const QModelIndex &index);
 
71
    void infoButtonClicked(Application *app);
 
72
    void installButtonClicked(Application *app);
 
73
    void removeButtonClicked(Application *app);
 
74
    void cancelButtonClicked(Application *app);
 
75
};
 
76
 
 
77
#endif