summaryrefslogtreecommitdiff
authorhash <hash>2002-10-15 16:26:14 (UTC)
committer hash <hash>2002-10-15 16:26:14 (UTC)
commit9861ca46526e65ecb00641008b9e8c1105ba1dc9 (patch) (side-by-side diff)
tree457e4a90667bbc1c133b9eca91f31f7e641b1e4c
parentd0cd09e4a68ca8dc3acf50c13a0acce39cd36b55 (diff)
downloadopie-9861ca46526e65ecb00641008b9e8c1105ba1dc9.zip
opie-9861ca46526e65ecb00641008b9e8c1105ba1dc9.tar.gz
opie-9861ca46526e65ecb00641008b9e8c1105ba1dc9.tar.bz2
still trying to figure out how to get those events out wihtout crashing the damn thing
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp24
-rw-r--r--noncore/apps/opie-console/function_keyboard.h6
2 files changed, 23 insertions, 7 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index a5b19c0..ac35d1c 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,19 +1,20 @@
#include "function_keyboard.h"
#include <qsizepolicy.h>
#include <qevent.h>
+#include <qwindowsystem_qws.h>
#include <qapplication.h>
FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
QFrame(parent), numRows(1), numCols(11),
pressedRow(0), pressedCol(0) {
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
Config conf("opie-console-keys");
conf.setGroup("keys");
for (int r = 0; r < numRows; r++)
for (int c = 0; c < numCols; c++) {
QString handle = "r" + QString::number(r) + "c" + QString::number(c);
QStringList value_list = conf.readListEntry( handle, '|');
@@ -86,54 +87,63 @@ void FunctionKeyboard::paintKey(int row, int col) {
keyWidth, keyHeight,
Qt::AlignHCenter | Qt::AlignVCenter,
keys["r" + QString::number(row) + "c" + QString::number(col)].getL()
);
}
void FunctionKeyboard::mousePressEvent(QMouseEvent *e) {
pressedRow = e->y() / keyHeight;
pressedCol = (int) (e->x() / keyWidth);
paintKey(pressedRow, pressedCol);
// emit that sucker!
FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)];
- //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
- //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
- //qwsServer->sendKeyEvent(0x41, 0, 0, 1, 0);
+ emit keyPressed(k.getU(), k.getQ(), 0, 1, 0);
+ /*
+ *
+ QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
+ qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
+ qwsServer->sendKeyEvent(0x41, 0, 0, 1, 0);
QKeyEvent ke(QEvent::KeyPress, k.getQ(), k.getU(), 0);
- QApplication::sendEvent(this, &ke);
+ QApplication::sendEvent((QObject *)parent, &ke);
+ */
}
void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
if (pressedRow != -1 && pressedRow != -1) {
int row = pressedRow; pressedRow = -1;
int col = pressedCol; pressedCol = -1;
paintKey(row, col);
FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)];
- //QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
- //qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
+ emit keyPressed(k.getU(), k.getQ(), 0, 0, 0);
+
+ /*
+ QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
+ qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
+
QKeyEvent ke(QEvent::KeyRelease, k.getQ(), k.getU(), 0);
- QApplication::sendEvent(this, &ke);
+ QApplication::sendEvent((QObject *)parent, &ke);
+ */
}
}
void FunctionKeyboard::resizeEvent(QResizeEvent*) {
/* set he default font height/width */
QFontMetrics fm=fontMetrics();
keyHeight = fm.lineSpacing() + 2;
keyWidth = (double)width()/numCols;
}
QSize FunctionKeyboard::sizeHint() const {
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h
index bc3e25c..b8420ae 100644
--- a/noncore/apps/opie-console/function_keyboard.h
+++ b/noncore/apps/opie-console/function_keyboard.h
@@ -28,31 +28,37 @@ class FunctionKeyboard : public QFrame {
Q_OBJECT
public:
FunctionKeyboard(QWidget *parent = 0);
~FunctionKeyboard();
void paintEvent(QPaintEvent *);
void paintKey(int, int);
void mousePressEvent(QMouseEvent*);
void mouseReleaseEvent(QMouseEvent*);
void resizeEvent(QResizeEvent*);
QSize sizeHint() const;
+signals:
+
+ void keyPressed(ushort, ushort, bool, bool, bool);
+
private:
// thie key for the map is the row/col
QMap<QString, FKey> keys;
uint numRows;
uint numCols;
uint keyHeight;
double keyWidth; // decimal point matters!
int pressedRow, pressedCol;
+ QObject *parent;
+
};
#endif