~timo-jyrinki/ubuntu/trusty/maliit-framework/fix_qt52

« back to all changes in this revision

Viewing changes to src/quick/keyoverridequick.h

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo, Sergio Schvezov, Ricardo Salveti de Araujo
  • Date: 2013-07-23 19:47:04 UTC
  • mfrom: (1.1.2) (1.2.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130723194704-1lsy1kmlda069cea
Tags: 0.99.0+git20130615+97e8335-0ubuntu1
[ Sergio Schvezov ]
* New build from HEAD 97e8335.
* Packaging import from lp:phablet-extras/maliit-framework.

[ Ricardo Salveti de Araujo ]
* debian/control: adding vcs and fixing dependencies
* General package cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* * This file is part of Maliit framework *
 
2
 *
 
3
 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 
4
 * All rights reserved.
 
5
 *
 
6
 * Contact: maliit-discuss@lists.maliit.org
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public
 
10
 * License version 2.1 as published by the Free Software Foundation
 
11
 * and appearing in the file LICENSE.LGPL included in the packaging
 
12
 * of this file.
 
13
 */
 
14
 
 
15
#ifndef MALIIT_QUICK_KEY_OVERRIDE_H
 
16
#define MALIIT_QUICK_KEY_OVERRIDE_H
 
17
 
 
18
#include <QObject>
 
19
#include <QScopedPointer>
 
20
#include <QSharedPointer>
 
21
 
 
22
#include <maliit/plugins/keyoverride.h>
 
23
 
 
24
namespace Maliit
 
25
{
 
26
 
 
27
class KeyOverrideQuickPrivate;
 
28
 
 
29
//! KeyOverrideQuick stores some attributes of a key for QtQuick virtual keyboard.
 
30
class KeyOverrideQuick : public QObject
 
31
{
 
32
    Q_OBJECT
 
33
    Q_DISABLE_COPY(KeyOverrideQuick)
 
34
 
 
35
    // actual properties
 
36
    Q_PROPERTY(QString label    READ label       WRITE overrideLabel       NOTIFY labelChanged)
 
37
    Q_PROPERTY(QString icon     READ icon        WRITE overrideIcon        NOTIFY iconChanged)
 
38
    Q_PROPERTY(bool highlighted READ highlighted WRITE overrideHighlighted NOTIFY highlightedChanged)
 
39
    Q_PROPERTY(bool enabled     READ enabled     WRITE overrideEnabled     NOTIFY enabledChanged)
 
40
 
 
41
    // default properties
 
42
    Q_PROPERTY(QString defaultLabel    READ defaultLabel       WRITE setDefaultLabel       NOTIFY defaultLabelChanged)
 
43
    Q_PROPERTY(QString defaultIcon     READ defaultIcon        WRITE setDefaultIcon        NOTIFY defaultIconChanged)
 
44
    Q_PROPERTY(bool defaultHighlighted READ defaultHighlighted WRITE setDefaultHighlighted NOTIFY defaultHighlightedChanged)
 
45
    Q_PROPERTY(bool defaultEnabled     READ defaultEnabled     WRITE setDefaultEnabled     NOTIFY defaultEnabledChanged)
 
46
 
 
47
public:
 
48
    //! Constructor.
 
49
    KeyOverrideQuick();
 
50
 
 
51
    //! Destructor.
 
52
    virtual ~KeyOverrideQuick();
 
53
 
 
54
    //! Returns text from the key
 
55
    QString label() const;
 
56
 
 
57
    //! Returns icon name
 
58
    QString icon() const;
 
59
 
 
60
    //! Return true if the key is highlighted; otherwise return false.
 
61
    bool highlighted() const;
 
62
 
 
63
    //! Return true if the key is enabled; otherwise return false.
 
64
    bool enabled() const;
 
65
 
 
66
    //! Returns default text from the key
 
67
    QString defaultLabel() const;
 
68
 
 
69
    //! Returns default icon name
 
70
    QString defaultIcon() const;
 
71
 
 
72
    //! Return true if the key is by default highlighted; otherwise return false.
 
73
    bool defaultHighlighted() const;
 
74
 
 
75
    //! Return true if the key is by default enabled; otherwise return false.
 
76
    bool defaultEnabled() const;
 
77
 
 
78
public Q_SLOTS:
 
79
    //! Applies overrides given in \a keyOverride.
 
80
    void applyOverride(const QSharedPointer<MKeyOverride>& keyOverride,
 
81
                       const MKeyOverride::KeyOverrideAttributes changedAttributes);
 
82
 
 
83
    //! Override actual label.
 
84
    void overrideLabel(const QString &label);
 
85
 
 
86
    //! Override actual icon.
 
87
    void overrideIcon(const QString &icon);
 
88
 
 
89
    //! Override actual highlighted.
 
90
    void overrideHighlighted(bool highlighted);
 
91
 
 
92
    //! Override actual enabled.
 
93
    void overrideEnabled(bool enabled);
 
94
 
 
95
    //! Set default text for the key.
 
96
    void setDefaultLabel(const QString &label);
 
97
 
 
98
    //! Set default icon name.
 
99
    void setDefaultIcon(const QString &icon);
 
100
 
 
101
    //! Set default highlighted state for item.
 
102
    void setDefaultHighlighted(bool highlighted);
 
103
 
 
104
    //! Set default enabled state for item.
 
105
    void setDefaultEnabled(bool enabled);
 
106
 
 
107
    //! Set actual label to use a default one.
 
108
    void useDefaultLabel();
 
109
 
 
110
    //! Set actual icon to use a default one.
 
111
    void useDefaultIcon();
 
112
 
 
113
    //! Set actual highlighted to use a default one.
 
114
    void useDefaultHighlighted();
 
115
 
 
116
    //! Set actual enabled to use a default one.
 
117
    void useDefaultEnabled();
 
118
 
 
119
Q_SIGNALS:
 
120
    //! Emitted when actual label is changed.
 
121
    void labelChanged(const QString &label);
 
122
 
 
123
    //! Emitted when actual icon is changed.
 
124
    void iconChanged(const QString &icon);
 
125
 
 
126
    //! Emitted when actual highlighted is changed.
 
127
    void highlightedChanged(bool highlighted);
 
128
 
 
129
    //! Emitted when actual enabled is changed.
 
130
    void enabledChanged(bool enabled);
 
131
 
 
132
    //! Emitted when default label is changed.
 
133
    void defaultLabelChanged(const QString &label);
 
134
 
 
135
    //! Emitted when default icon is changed.
 
136
    void defaultIconChanged(const QString &icon);
 
137
 
 
138
    //! Emitted when default highlighted is changed.
 
139
    void defaultHighlightedChanged(bool highlighted);
 
140
 
 
141
    //! Emitted when default enabled is changed.
 
142
    void defaultEnabledChanged(bool enabled);
 
143
 
 
144
private:
 
145
    //! Sets actual label and marks it as either overriden or default.
 
146
    void setLabel(const QString &label, bool overriden);
 
147
 
 
148
    //! Sets actual icon and marks it as either overriden or default.
 
149
    void setIcon(const QString &icon, bool overriden);
 
150
 
 
151
    //! Sets actual highlighted and marks it as either overriden or default.
 
152
    void setHighlighted(bool highlighted, bool overriden);
 
153
 
 
154
    //! Sets actual enabled and marks it as either overriden or default.
 
155
    void setEnabled(bool enabled, bool overriden);
 
156
 
 
157
    Q_DECLARE_PRIVATE(KeyOverrideQuick)
 
158
 
 
159
    const QScopedPointer<KeyOverrideQuickPrivate> d_ptr;
 
160
};
 
161
 
 
162
} // namespace Maliit
 
163
 
 
164
#endif // MALIIT_QUICK_KEY_OVERRIDE_H