author | hash <hash> | 2002-10-13 01:56:34 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-13 01:56:34 (UTC) |
commit | 173c272fa2dc860dbb2ff54b6be2680c544340bb (patch) (unidiff) | |
tree | 345b83e9f72d9c0d2ec9e1f6d9c75576eef0ac2d | |
parent | 7d5d4758d459b744be27e5fbd8b9a2735d7c13f4 (diff) | |
download | opie-173c272fa2dc860dbb2ff54b6be2680c544340bb.zip opie-173c272fa2dc860dbb2ff54b6be2680c544340bb.tar.gz opie-173c272fa2dc860dbb2ff54b6be2680c544340bb.tar.bz2 |
better disable that for now
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 9b036f3..d8ade69 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -7,129 +7,129 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | |||
7 | pressedRow(0), pressedCol(0) { | 7 | pressedRow(0), pressedCol(0) { |
8 | 8 | ||
9 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 9 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
10 | 10 | ||
11 | Config conf("opie-console-keys"); | 11 | Config conf("opie-console-keys"); |
12 | conf.setGroup("keys"); | 12 | conf.setGroup("keys"); |
13 | for (int r = 0; r < numRows; r++) | 13 | for (int r = 0; r < numRows; r++) |
14 | for (int c = 0; c < numCols; c++) { | 14 | for (int c = 0; c < numCols; c++) { |
15 | 15 | ||
16 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 16 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
17 | QStringList value_list = conf.readListEntry( handle, '|'); | 17 | QStringList value_list = conf.readListEntry( handle, '|'); |
18 | 18 | ||
19 | if (value_list.isEmpty()) continue; | 19 | if (value_list.isEmpty()) continue; |
20 | 20 | ||
21 | keys.insert( | 21 | keys.insert( |
22 | 22 | ||
23 | handle, | 23 | handle, |
24 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) | 24 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) |
25 | ); | 25 | ); |
26 | } | 26 | } |
27 | qWarning("loaded %d keys", keys.count()); | 27 | qWarning("loaded %d keys", keys.count()); |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | FunctionKeyboard::~FunctionKeyboard() { | 33 | FunctionKeyboard::~FunctionKeyboard() { |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { | 37 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { |
38 | 38 | ||
39 | QPainter p(this); | 39 | QPainter p(this); |
40 | p.setClipRect(e->rect()); | 40 | p.setClipRect(e->rect()); |
41 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); | 41 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); |
42 | 42 | ||
43 | p.setPen(QColor(0,0,0)); | 43 | p.setPen(QColor(0,0,0)); |
44 | 44 | ||
45 | /* those decimals do count! becomes short if use plain int */ | 45 | /* those decimals do count! becomes short if use plain int */ |
46 | for (double i = 0; i <= width(); i += keyWidth) { | 46 | for (double i = 0; i <= width(); i += keyWidth) { |
47 | 47 | ||
48 | p.drawLine((int)i, 0, (int)i, height()); | 48 | p.drawLine((int)i, 0, (int)i, height()); |
49 | } | 49 | } |
50 | 50 | ||
51 | // sometimes the last line doesnt get drawn | 51 | // sometimes the last line doesnt get drawn |
52 | p.drawLine(width() -1, 0, width() -1, height()); | 52 | p.drawLine(width() -1, 0, width() -1, height()); |
53 | 53 | ||
54 | for (int i = 0; i <= height(); i += keyHeight) { | 54 | for (int i = 0; i <= height(); i += keyHeight) { |
55 | 55 | ||
56 | p.drawLine(0, i, width(), i); | 56 | p.drawLine(0, i, width(), i); |
57 | } | 57 | } |
58 | 58 | ||
59 | for (int r = 0; r < numRows; r++) { | 59 | for (int r = 0; r < numRows; r++) { |
60 | for (int c = 0; c < numCols; c++) { | 60 | for (int c = 0; c < numCols; c++) { |
61 | 61 | ||
62 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 62 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
63 | if (keys.contains(handle)) { | 63 | if (keys.contains(handle)) { |
64 | 64 | ||
65 | p.drawText( | 65 | p.drawText( |
66 | c * keyWidth + 1, r * keyHeight + 1, | 66 | c * keyWidth + 1, r * keyHeight + 1, |
67 | keyWidth, keyHeight, | 67 | keyWidth, keyHeight, |
68 | Qt::AlignHCenter | Qt::AlignVCenter, | 68 | Qt::AlignHCenter | Qt::AlignVCenter, |
69 | keys[handle].getL() | 69 | keys[handle].getL() |
70 | ); | 70 | ); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | void FunctionKeyboard::paintKey(int row, int col) { | 76 | void FunctionKeyboard::paintKey(int row, int col) { |
77 | 77 | ||
78 | QPainter p(this); | 78 | QPainter p(this); |
79 | 79 | ||
80 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), | 80 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), |
81 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), | 81 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), |
82 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); | 82 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); |
83 | p.drawText( | 83 | p.drawText( |
84 | col * keyWidth + 1, row * keyHeight + 1, | 84 | col * keyWidth + 1, row * keyHeight + 1, |
85 | keyWidth, keyHeight, | 85 | keyWidth, keyHeight, |
86 | Qt::AlignHCenter | Qt::AlignVCenter, | 86 | Qt::AlignHCenter | Qt::AlignVCenter, |
87 | keys["r" + QString::number(row) + "c" + QString::number(col)].getL() | 87 | keys["r" + QString::number(row) + "c" + QString::number(col)].getL() |
88 | ); | 88 | ); |
89 | 89 | ||
90 | } | 90 | } |
91 | 91 | ||
92 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { | 92 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { |
93 | 93 | ||
94 | pressedRow = e->y() / keyHeight; | 94 | pressedRow = e->y() / keyHeight; |
95 | pressedCol = e->x() / keyWidth; | 95 | pressedCol = e->x() / keyWidth; |
96 | 96 | ||
97 | paintKey(pressedRow, pressedCol); | 97 | paintKey(pressedRow, pressedCol); |
98 | 98 | ||
99 | // emit that sucker! | 99 | // emit that sucker! |
100 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; | 100 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; |
101 | //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0); | 101 | //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0); |
102 | //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0); | 102 | //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0); |
103 | qwsServer->sendKeyEvent(0x41, 0, 0, 1, 0); | 103 | //qwsServer->sendKeyEvent(0x41, 0, 0, 1, 0); |
104 | } | 104 | } |
105 | 105 | ||
106 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { | 106 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { |
107 | 107 | ||
108 | if (pressedRow != -1 && pressedRow != -1) { | 108 | if (pressedRow != -1 && pressedRow != -1) { |
109 | 109 | ||
110 | int row = pressedRow; pressedRow = -1; | 110 | int row = pressedRow; pressedRow = -1; |
111 | int col = pressedCol; pressedCol = -1; | 111 | int col = pressedCol; pressedCol = -1; |
112 | paintKey(row, col); | 112 | paintKey(row, col); |
113 | 113 | ||
114 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; | 114 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; |
115 | //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0); | 115 | //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0); |
116 | //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0); | 116 | //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0); |
117 | } | 117 | } |
118 | 118 | ||
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { | 122 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { |
123 | 123 | ||
124 | /* set he default font height/width */ | 124 | /* set he default font height/width */ |
125 | QFontMetrics fm=fontMetrics(); | 125 | QFontMetrics fm=fontMetrics(); |
126 | keyHeight = fm.lineSpacing() + 2; | 126 | keyHeight = fm.lineSpacing() + 2; |
127 | keyWidth = (double)width()/numCols; | 127 | keyWidth = (double)width()/numCols; |
128 | 128 | ||
129 | } | 129 | } |
130 | 130 | ||
131 | QSize FunctionKeyboard::sizeHint() const { | 131 | QSize FunctionKeyboard::sizeHint() const { |
132 | 132 | ||
133 | return QSize(width(), keyHeight * numRows + 1); | 133 | return QSize(width(), keyHeight * numRows + 1); |
134 | } | 134 | } |
135 | 135 | ||