Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
Key.h
1/*
2 * Key.h
3 * This file is part of Open-Typer
4 *
5 * Copyright (C) 2023 - adazem009
6 * Copyright (C) 2023 - Roker2
7 *
8 * Open-Typer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * Open-Typer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Open-Typer. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef KEY_H
23#define KEY_H
24
25#include <QObject>
26#include "KeyboardUtils.h"
27
29class Q_DECL_EXPORT Key
30{
31 Q_GADGET
32 Q_PROPERTY(QString text READ text WRITE setText)
33 Q_PROPERTY(QString shiftText READ shiftText WRITE setShiftText)
34 Q_PROPERTY(KeyboardUtils::KeyType type READ type WRITE setType)
35 Q_PROPERTY(QString displayText READ displayText WRITE setDisplayText)
36 Q_PROPERTY(QString displayShiftText READ displayShiftText WRITE setDisplayShiftText)
37 Q_PROPERTY(bool dead READ dead WRITE setDead)
38 Q_PROPERTY(bool shiftDead READ shiftDead WRITE setShiftDead)
39 public:
40 explicit Key();
41 Key(QString text, QString shiftText);
42 QString text(void);
43 void setText(QString text);
44 QString shiftText(void);
45 void setShiftText(QString text);
46 KeyboardUtils::KeyType type(void);
47 void setType(KeyboardUtils::KeyType type);
48 QString displayText(void);
49 void setDisplayText(QString text);
50 QString displayShiftText(void);
51 void setDisplayShiftText(QString text);
52 bool dead(void);
53 bool isDead(void);
54 void setDead(bool dead);
55 bool shiftDead(void);
56 bool isShiftDead(void);
57 void setShiftDead(bool dead);
58
59 private:
60 QString m_text;
61 QString m_shiftText;
62 KeyboardUtils::KeyType m_type = KeyboardUtils::KeyType_Any;
63 QString m_displayText;
64 QString m_displayShiftText;
65 bool m_dead = false;
66 bool m_shiftDead = false;
67};
68
69using KeyboardRow = QList<Key>;
70
71Q_DECLARE_METATYPE(Key)
72Q_DECLARE_METATYPE(KeyboardRow)
73
74#endif // KEY_H
The Key class is used for the keys on the on screen keyboard.
Definition Key.h:30
The KeyboardUtils class provides functions related to keyboard and input method.
Definition KeyboardUtils.h:31