1
/* * This file is part of Maliit framework *
3
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
6
* Contact: maliit-discuss@lists.maliit.org
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
15
#ifndef MALIIT_QUICK_KEY_OVERRIDE_H
16
#define MALIIT_QUICK_KEY_OVERRIDE_H
19
#include <QScopedPointer>
20
#include <QSharedPointer>
22
#include <maliit/plugins/keyoverride.h>
27
class KeyOverrideQuickPrivate;
29
//! KeyOverrideQuick stores some attributes of a key for QtQuick virtual keyboard.
30
class KeyOverrideQuick : public QObject
33
Q_DISABLE_COPY(KeyOverrideQuick)
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)
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)
52
virtual ~KeyOverrideQuick();
54
//! Returns text from the key
55
QString label() const;
60
//! Return true if the key is highlighted; otherwise return false.
61
bool highlighted() const;
63
//! Return true if the key is enabled; otherwise return false.
66
//! Returns default text from the key
67
QString defaultLabel() const;
69
//! Returns default icon name
70
QString defaultIcon() const;
72
//! Return true if the key is by default highlighted; otherwise return false.
73
bool defaultHighlighted() const;
75
//! Return true if the key is by default enabled; otherwise return false.
76
bool defaultEnabled() const;
79
//! Applies overrides given in \a keyOverride.
80
void applyOverride(const QSharedPointer<MKeyOverride>& keyOverride,
81
const MKeyOverride::KeyOverrideAttributes changedAttributes);
83
//! Override actual label.
84
void overrideLabel(const QString &label);
86
//! Override actual icon.
87
void overrideIcon(const QString &icon);
89
//! Override actual highlighted.
90
void overrideHighlighted(bool highlighted);
92
//! Override actual enabled.
93
void overrideEnabled(bool enabled);
95
//! Set default text for the key.
96
void setDefaultLabel(const QString &label);
98
//! Set default icon name.
99
void setDefaultIcon(const QString &icon);
101
//! Set default highlighted state for item.
102
void setDefaultHighlighted(bool highlighted);
104
//! Set default enabled state for item.
105
void setDefaultEnabled(bool enabled);
107
//! Set actual label to use a default one.
108
void useDefaultLabel();
110
//! Set actual icon to use a default one.
111
void useDefaultIcon();
113
//! Set actual highlighted to use a default one.
114
void useDefaultHighlighted();
116
//! Set actual enabled to use a default one.
117
void useDefaultEnabled();
120
//! Emitted when actual label is changed.
121
void labelChanged(const QString &label);
123
//! Emitted when actual icon is changed.
124
void iconChanged(const QString &icon);
126
//! Emitted when actual highlighted is changed.
127
void highlightedChanged(bool highlighted);
129
//! Emitted when actual enabled is changed.
130
void enabledChanged(bool enabled);
132
//! Emitted when default label is changed.
133
void defaultLabelChanged(const QString &label);
135
//! Emitted when default icon is changed.
136
void defaultIconChanged(const QString &icon);
138
//! Emitted when default highlighted is changed.
139
void defaultHighlightedChanged(bool highlighted);
141
//! Emitted when default enabled is changed.
142
void defaultEnabledChanged(bool enabled);
145
//! Sets actual label and marks it as either overriden or default.
146
void setLabel(const QString &label, bool overriden);
148
//! Sets actual icon and marks it as either overriden or default.
149
void setIcon(const QString &icon, bool overriden);
151
//! Sets actual highlighted and marks it as either overriden or default.
152
void setHighlighted(bool highlighted, bool overriden);
154
//! Sets actual enabled and marks it as either overriden or default.
155
void setEnabled(bool enabled, bool overriden);
157
Q_DECLARE_PRIVATE(KeyOverrideQuick)
159
const QScopedPointer<KeyOverrideQuickPrivate> d_ptr;
162
} // namespace Maliit
164
#endif // MALIIT_QUICK_KEY_OVERRIDE_H