author | hash <hash> | 2002-10-24 16:24:00 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-24 16:24:00 (UTC) |
commit | f8875264ece878f5bb7e8e528200f6ba437138c5 (patch) (unidiff) | |
tree | 343ef25aae76316e4931f15b63938388ff0d5dd8 /noncore/apps/opie-console/function_keyboard.cpp | |
parent | 07811d76c261ece00a45589a2eb9d2bb8971943e (diff) | |
download | opie-f8875264ece878f5bb7e8e528200f6ba437138c5.zip opie-f8875264ece878f5bb7e8e528200f6ba437138c5.tar.gz opie-f8875264ece878f5bb7e8e528200f6ba437138c5.tar.bz2 |
got rid of those warnings
Diffstat (limited to 'noncore/apps/opie-console/function_keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index fa11701..3da8d61 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -79,76 +79,76 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | // sometimes the last line doesnt get drawn | 81 | // sometimes the last line doesnt get drawn |
82 | p.drawLine(width() -1, 0, width() -1, height()); | 82 | p.drawLine(width() -1, 0, width() -1, height()); |
83 | 83 | ||
84 | for (int i = 0; i <= height(); i += keyHeight) { | 84 | for (int i = 0; i <= height(); i += keyHeight) { |
85 | 85 | ||
86 | p.drawLine(0, i, width(), i); | 86 | p.drawLine(0, i, width(), i); |
87 | } | 87 | } |
88 | 88 | ||
89 | for (uint r = 0; r < numRows; r++) { | 89 | for (uint r = 0; r < numRows; r++) { |
90 | for (uint c = 0; c < numCols; c++) { | 90 | for (uint c = 0; c < numCols; c++) { |
91 | 91 | ||
92 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 92 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
93 | if (keys.contains(handle)) { | 93 | if (keys.contains(handle)) { |
94 | 94 | ||
95 | if (keys[handle].pixFile.isEmpty()) | 95 | if (keys[handle].pixFile.isEmpty()) |
96 | p.drawText( c * keyWidth + 1, r * keyHeight + 1, | 96 | p.drawText( c * keyWidth + 1, r * keyHeight + 1, |
97 | keyWidth, keyHeight, | 97 | keyWidth, keyHeight, |
98 | Qt::AlignHCenter | Qt::AlignVCenter, | 98 | Qt::AlignHCenter | Qt::AlignVCenter, |
99 | keys[handle].label | 99 | keys[handle].label |
100 | ); | 100 | ); |
101 | else { | 101 | else { |
102 | 102 | ||
103 | ushort centerX = c *keyWidth + (keyWidth - keys[handle].pix->width()) / 2; | 103 | ushort centerX = (ushort)(c *keyWidth) + (ushort)(keyWidth - keys[handle].pix->width()) / 2; |
104 | ushort centerY = r * keyHeight + (keyHeight - keys[handle].pix->height()) / 2; | 104 | ushort centerY = r * keyHeight + (keyHeight - keys[handle].pix->height()) / 2; |
105 | p.drawPixmap(centerX, centerY, *keys[handle].pix); | 105 | p.drawPixmap(centerX, centerY, *keys[handle].pix); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | } | 108 | } |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | void FunctionKeyboard::paintKey(uint row, uint col) { | 112 | void FunctionKeyboard::paintKey(uint row, uint col) { |
113 | 113 | ||
114 | QPainter p(this); | 114 | QPainter p(this); |
115 | 115 | ||
116 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), | 116 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), |
117 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), | 117 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), |
118 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); | 118 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); |
119 | 119 | ||
120 | QString handle ("r" + QString::number(row) + "c" + QString::number(col)); | 120 | QString handle ("r" + QString::number(row) + "c" + QString::number(col)); |
121 | if (keys[handle].pixFile.isEmpty()) | 121 | if (keys[handle].pixFile.isEmpty()) |
122 | p.drawText( | 122 | p.drawText( |
123 | col * keyWidth + 1, row * keyHeight + 1, | 123 | col * keyWidth + 1, row * keyHeight + 1, |
124 | keyWidth, keyHeight, | 124 | keyWidth, keyHeight, |
125 | Qt::AlignHCenter | Qt::AlignVCenter, | 125 | Qt::AlignHCenter | Qt::AlignVCenter, |
126 | keys[handle].label | 126 | keys[handle].label |
127 | ); | 127 | ); |
128 | else { | 128 | else { |
129 | 129 | ||
130 | ushort centerX = col *keyWidth + (keyWidth - keys[handle].pix->width()) / 2; | 130 | ushort centerX = (ushort)(col *keyWidth) + (ushort)(keyWidth - keys[handle].pix->width()) / 2; |
131 | ushort centerY = row * keyHeight + (keyHeight - keys[handle].pix->height()) / 2; | 131 | ushort centerY = row * keyHeight + (keyHeight - keys[handle].pix->height()) / 2; |
132 | p.drawPixmap(centerX, centerY, *keys[handle].pix); | 132 | p.drawPixmap(centerX, centerY, *keys[handle].pix); |
133 | } | 133 | } |
134 | 134 | ||
135 | if (col == numCols - 1) { | 135 | if (col == numCols - 1) { |
136 | 136 | ||
137 | // sometimes it doesnt draw the last line | 137 | // sometimes it doesnt draw the last line |
138 | 138 | ||
139 | p.drawLine((col+1) * keyWidth -1, row * keyHeight, | 139 | p.drawLine((col+1) * keyWidth -1, row * keyHeight, |
140 | (col+1) * keyWidth -1, (row + 1) * keyHeight | 140 | (col+1) * keyWidth -1, (row + 1) * keyHeight |
141 | ); | 141 | ); |
142 | } | 142 | } |
143 | 143 | ||
144 | } | 144 | } |
145 | 145 | ||
146 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { | 146 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { |
147 | 147 | ||
148 | pressedRow = e->y() / keyHeight; | 148 | pressedRow = e->y() / keyHeight; |
149 | pressedCol = (int) (e->x() / keyWidth); | 149 | pressedCol = (int) (e->x() / keyWidth); |
150 | 150 | ||
151 | paintKey(pressedRow, pressedCol); | 151 | paintKey(pressedRow, pressedCol); |
152 | 152 | ||
153 | // emit that sucker! | 153 | // emit that sucker! |
154 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; | 154 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; |