Diffstat (limited to 'noncore/apps/opie-console/function_keyboard.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.h | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h index 05b991d..496d932 100644 --- a/noncore/apps/opie-console/function_keyboard.h +++ b/noncore/apps/opie-console/function_keyboard.h | |||
@@ -1,65 +1,71 @@ | |||
1 | #ifndef OPIE_FUNCTION_KEYBOARD_H | 1 | #ifndef OPIE_FUNCTION_KEYBOARD_H |
2 | #define OPIE_FUNCTION_KEYBOARD_H | 2 | #define OPIE_FUNCTION_KEYBOARD_H |
3 | 3 | ||
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/qpeapplication.h> | ||
5 | #include <qframe.h> | 6 | #include <qframe.h> |
6 | #include <qpainter.h> | 7 | #include <qpainter.h> |
7 | #include <qvbox.h> | 8 | #include <qvbox.h> |
8 | #include <qgroupbox.h> | 9 | #include <qgroupbox.h> |
9 | #include <qmap.h> | 10 | #include <qmap.h> |
10 | #include <qspinbox.h> | 11 | #include <qspinbox.h> |
11 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
12 | #include "profiledialogwidget.h" | 13 | #include "profiledialogwidget.h" |
13 | 14 | ||
14 | 15 | ||
15 | class FKey { | 16 | struct FKey { |
16 | |||
17 | public: | ||
18 | 17 | ||
19 | FKey(): qcode(0), unicode(0) {}; | 18 | FKey(): qcode(0), unicode(0) {}; |
20 | FKey(const QString &l, ushort q, ushort u): label(l), qcode(q), unicode(u) {}; | 19 | FKey(const QString &l, const QString &f, ushort q, ushort u): |
20 | label(l), pixFile(f), qcode(q), unicode(u) { | ||
21 | |||
22 | if (!f.isEmpty()) { | ||
21 | 23 | ||
22 | QString getL() { return label; } | 24 | pix = new QPixmap (QPEApplication::qpeDir() + "pics/console/keys/" + f); |
23 | ushort getQ() { return qcode; } | ||
24 | ushort getU() { return unicode; } | ||
25 | 25 | ||
26 | 26 | } | |
27 | private: | 27 | }; |
28 | 28 | ||
29 | QString label; | 29 | QString label; |
30 | QPixmap *pix; | ||
31 | QString pixFile; | ||
30 | ushort qcode; | 32 | ushort qcode; |
31 | ushort unicode; | 33 | ushort unicode; |
32 | }; | 34 | }; |
33 | 35 | ||
34 | class FunctionKeyboard : public QFrame { | 36 | class FunctionKeyboard : public QFrame { |
35 | Q_OBJECT | 37 | Q_OBJECT |
36 | 38 | ||
37 | public: | 39 | public: |
38 | FunctionKeyboard(QWidget *parent = 0); | 40 | FunctionKeyboard(QWidget *parent = 0); |
39 | ~FunctionKeyboard(); | 41 | ~FunctionKeyboard(); |
40 | 42 | ||
43 | friend class FunctionKeyboardConfig; | ||
44 | |||
41 | void changeRows(int); | 45 | void changeRows(int); |
42 | void changeCols(int); | 46 | void changeCols(int); |
43 | 47 | ||
48 | //Key getKey(int, int); | ||
49 | |||
44 | void paintEvent(QPaintEvent *); | 50 | void paintEvent(QPaintEvent *); |
45 | void paintKey(int, int); | 51 | void paintKey(uint, uint); |
46 | void mousePressEvent(QMouseEvent*); | 52 | void mousePressEvent(QMouseEvent*); |
47 | void mouseReleaseEvent(QMouseEvent*); | 53 | void mouseReleaseEvent(QMouseEvent*); |
48 | void resizeEvent(QResizeEvent*); | 54 | void resizeEvent(QResizeEvent*); |
49 | QSize sizeHint() const; | 55 | QSize sizeHint() const; |
50 | 56 | ||
51 | signals: | 57 | signals: |
52 | 58 | ||
53 | void keyPressed(ushort, ushort, bool, bool, bool, ushort, ushort); | 59 | void keyPressed(FKey, ushort, ushort, bool); |
54 | 60 | ||
55 | private: | 61 | private: |
56 | 62 | ||
57 | void loadDefaults(); | 63 | void loadDefaults(); |
58 | 64 | ||
59 | 65 | ||
60 | private: | 66 | private: |
61 | 67 | ||
62 | // thie key for the map is the row/col | 68 | // thie key for the map is the row/col |
63 | QMap<QString, FKey> keys; | 69 | QMap<QString, FKey> keys; |
64 | 70 | ||
65 | uint numRows; | 71 | uint numRows; |
@@ -78,26 +84,29 @@ class FunctionKeyboardConfig : public ProfileDialogKeyWidget { | |||
78 | 84 | ||
79 | Q_OBJECT | 85 | Q_OBJECT |
80 | 86 | ||
81 | public: | 87 | public: |
82 | FunctionKeyboardConfig(const QString& name, QWidget *wid, const char* name = 0l ); | 88 | FunctionKeyboardConfig(const QString& name, QWidget *wid, const char* name = 0l ); |
83 | ~FunctionKeyboardConfig(); | 89 | ~FunctionKeyboardConfig(); |
84 | 90 | ||
85 | void load(const Profile&); | 91 | void load(const Profile&); |
86 | void save(Profile&); | 92 | void save(Profile&); |
87 | 93 | ||
88 | private slots: | 94 | private slots: |
89 | 95 | ||
90 | void slotKeyPressed(ushort, ushort, bool, bool, bool, ushort, ushort); | 96 | void slotKeyPressed(FKey, ushort, ushort, bool); |
91 | void slotChangeRows(int); | 97 | void slotChangeRows(int); |
92 | void slotChangeCols(int); | 98 | void slotChangeCols(int); |
93 | void slotChangeIcon(int); | 99 | void slotChangeIcon(int); |
100 | void slotChangeLabelText(const QString &); | ||
94 | 101 | ||
95 | private: | 102 | private: |
96 | 103 | ||
104 | ushort selectedRow, selectedCol; | ||
105 | |||
97 | FunctionKeyboard *kb; | 106 | FunctionKeyboard *kb; |
98 | QSpinBox *m_rowBox, *m_colBox; | 107 | QSpinBox *m_rowBox, *m_colBox; |
99 | QComboBox *m_labels; | 108 | QComboBox *m_labels, *m_qvalues; |
100 | 109 | ||
101 | }; | 110 | }; |
102 | 111 | ||
103 | #endif | 112 | #endif |