author | hash <hash> | 2002-10-22 16:01:27 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-22 16:01:27 (UTC) |
commit | 6843a1bd8f8e679c220431f8377abcd2ffd2019b (patch) (unidiff) | |
tree | cec84037b60d0ae1e69c69a21e6da2dea3aaf5b6 | |
parent | dca783a6564d7d0d8c857cef8586167bc0609647 (diff) | |
download | opie-6843a1bd8f8e679c220431f8377abcd2ffd2019b.zip opie-6843a1bd8f8e679c220431f8377abcd2ffd2019b.tar.gz opie-6843a1bd8f8e679c220431f8377abcd2ffd2019b.tar.bz2 |
cant figure out why modifying a private var in FunctionKeyboardConfig causes it to segfault.
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 92 | ||||
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.h | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 2 |
4 files changed, 108 insertions, 11 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 100fdfc..977a384 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,22 +1,31 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | |||
3 | #include <qpe/resource.h> | ||
4 | #include <qpe/qpeapplication.h> | ||
2 | #include <qsizepolicy.h> | 5 | #include <qsizepolicy.h> |
3 | #include <qevent.h> | 6 | #include <qevent.h> |
4 | #include <qwindowsystem_qws.h> | 7 | #include <qwindowsystem_qws.h> |
5 | #include <qapplication.h> | 8 | #include <qapplication.h> |
6 | #include <qlayout.h> | 9 | #include <qlayout.h> |
10 | #include <qspinbox.h> | ||
11 | #include <qlabel.h> | ||
12 | #include <qcombobox.h> | ||
13 | #include <qdir.h> | ||
14 | |||
15 | /* FunctionKeyboard {{{1 */ | ||
7 | 16 | ||
8 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 17 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
9 | QFrame(parent), numRows(2), numCols(11), | 18 | QFrame(parent), numRows(2), numCols(11), |
10 | pressedRow(0), pressedCol(0) { | 19 | pressedRow(0), pressedCol(0) { |
11 | 20 | ||
12 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 21 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
13 | 22 | ||
14 | Config conf("opie-console-keys"); | 23 | Config conf("opie-console-keys"); |
15 | conf.setGroup("keys"); | 24 | conf.setGroup("keys"); |
16 | for (uint r = 0; r < numRows; r++) | 25 | for (uint r = 0; r < numRows; r++) |
17 | for (uint c = 0; c < numCols; c++) { | 26 | for (uint c = 0; c < numCols; c++) { |
18 | 27 | ||
19 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 28 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
20 | QStringList value_list = conf.readListEntry( handle, '|'); | 29 | QStringList value_list = conf.readListEntry( handle, '|'); |
21 | 30 | ||
22 | if (value_list.isEmpty()) continue; | 31 | if (value_list.isEmpty()) continue; |
@@ -25,32 +34,44 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | |||
25 | 34 | ||
26 | handle, | 35 | handle, |
27 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) | 36 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) |
28 | ); | 37 | ); |
29 | } | 38 | } |
30 | //qWarning("loaded %d keys", keys.count()); | 39 | //qWarning("loaded %d keys", keys.count()); |
31 | if (keys.isEmpty()) loadDefaults(); | 40 | if (keys.isEmpty()) loadDefaults(); |
32 | 41 | ||
33 | 42 | ||
34 | 43 | ||
35 | } | 44 | } |
36 | 45 | ||
37 | FunctionKeyboard::~FunctionKeyboard() { | 46 | FunctionKeyboard::~FunctionKeyboard() { |
38 | 47 | ||
39 | } | 48 | } |
40 | 49 | ||
50 | void FunctionKeyboard::changeRows(int r) { | ||
51 | |||
52 | numRows = r; | ||
53 | repaint(false); | ||
54 | } | ||
55 | void FunctionKeyboard::changeCols(int c) { | ||
56 | |||
57 | numCols = c; | ||
58 | keyWidth = (double)width()/numCols; // have to reset this thing too | ||
59 | repaint(false); | ||
60 | } | ||
61 | |||
41 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { | 62 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { |
42 | 63 | ||
43 | QPainter p(this); | 64 | QPainter p(this); |
44 | p.setClipRect(e->rect()); | 65 | p.setClipRect(e->rect()); |
45 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); | 66 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); |
46 | 67 | ||
47 | p.setPen(QColor(0,0,0)); | 68 | p.setPen(QColor(0,0,0)); |
48 | 69 | ||
49 | /* those decimals do count! becomes short if use plain int */ | 70 | /* those decimals do count! becomes short if use plain int */ |
50 | for (double i = 0; i <= width(); i += keyWidth) { | 71 | for (double i = 0; i <= width(); i += keyWidth) { |
51 | 72 | ||
52 | p.drawLine((int)i, 0, (int)i, height()); | 73 | p.drawLine((int)i, 0, (int)i, height()); |
53 | } | 74 | } |
54 | 75 | ||
55 | // sometimes the last line doesnt get drawn | 76 | // sometimes the last line doesnt get drawn |
56 | p.drawLine(width() -1, 0, width() -1, height()); | 77 | p.drawLine(width() -1, 0, width() -1, height()); |
@@ -78,57 +99,65 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { | |||
78 | } | 99 | } |
79 | 100 | ||
80 | void FunctionKeyboard::paintKey(int row, int col) { | 101 | void FunctionKeyboard::paintKey(int row, int col) { |
81 | 102 | ||
82 | QPainter p(this); | 103 | QPainter p(this); |
83 | 104 | ||
84 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), | 105 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), |
85 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), | 106 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), |
86 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); | 107 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); |
87 | p.drawText( | 108 | p.drawText( |
88 | col * keyWidth + 1, row * keyHeight + 1, | 109 | col * keyWidth + 1, row * keyHeight + 1, |
89 | keyWidth, keyHeight, | 110 | keyWidth, keyHeight, |
90 | Qt::AlignHCenter | Qt::AlignVCenter, | 111 | Qt::AlignHCenter | Qt::AlignVCenter, |
91 | keys["r" + QString::number(row) + "c" + QString::number(col)].getL() | 112 | keys["r" + QString::number(row) + "c" + QString::number(col)].getL() |
92 | ); | 113 | ); |
93 | 114 | ||
115 | if (row == numRows) { | ||
116 | |||
117 | // sometimes it doesnt draw the last line | ||
118 | p.drawLine((col+1) * keyWidth -2, row * keyHeight, | ||
119 | (col+1) * keyWidth -2, (row + 1) * keyHeight | ||
120 | ); | ||
121 | } | ||
122 | |||
94 | } | 123 | } |
95 | 124 | ||
96 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { | 125 | void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { |
97 | 126 | ||
98 | pressedRow = e->y() / keyHeight; | 127 | pressedRow = e->y() / keyHeight; |
99 | pressedCol = (int) (e->x() / keyWidth); | 128 | pressedCol = (int) (e->x() / keyWidth); |
100 | 129 | ||
101 | paintKey(pressedRow, pressedCol); | 130 | paintKey(pressedRow, pressedCol); |
102 | 131 | ||
103 | // emit that sucker! | 132 | // emit that sucker! |
104 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; | 133 | FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; |
105 | emit keyPressed(k.getU(), k.getQ(), 0, 1, 0); | 134 | emit keyPressed(k.getU(), k.getQ(), 0, 1, 0, pressedRow, pressedCol); |
106 | 135 | ||
107 | } | 136 | } |
108 | 137 | ||
109 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { | 138 | void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { |
110 | 139 | ||
111 | if (pressedRow != -1 && pressedRow != -1) { | 140 | if (pressedRow != -1 && pressedRow != -1) { |
112 | 141 | ||
113 | int row = pressedRow; pressedRow = -1; | 142 | int row = pressedRow; pressedRow = -1; |
114 | int col = pressedCol; pressedCol = -1; | 143 | int col = pressedCol; pressedCol = -1; |
115 | paintKey(row, col); | 144 | paintKey(row, col); |
116 | 145 | ||
117 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; | 146 | FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; |
118 | emit keyPressed(k.getU(), k.getQ(), 0, 0, 0); | 147 | emit keyPressed(k.getU(), k.getQ(), 0, 0, 0, pressedRow, pressedCol); |
119 | } | 148 | } |
120 | 149 | ||
121 | } | 150 | } |
122 | 151 | ||
123 | 152 | ||
124 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { | 153 | void FunctionKeyboard::resizeEvent(QResizeEvent*) { |
125 | 154 | ||
126 | /* set he default font height/width */ | 155 | /* set he default font height/width */ |
127 | QFontMetrics fm=fontMetrics(); | 156 | QFontMetrics fm=fontMetrics(); |
128 | keyHeight = fm.lineSpacing() + 2; | 157 | keyHeight = fm.lineSpacing() + 2; |
129 | keyWidth = (double)width()/numCols; | 158 | keyWidth = (double)width()/numCols; |
130 | 159 | ||
131 | } | 160 | } |
132 | 161 | ||
133 | QSize FunctionKeyboard::sizeHint() const { | 162 | QSize FunctionKeyboard::sizeHint() const { |
134 | 163 | ||
@@ -144,39 +173,90 @@ void FunctionKeyboard::loadDefaults() { | |||
144 | keys.insert( "r0c3", FKey ("F4", 4146, 0)); | 173 | keys.insert( "r0c3", FKey ("F4", 4146, 0)); |
145 | keys.insert( "r0c4", FKey ("F5", 4147, 0)); | 174 | keys.insert( "r0c4", FKey ("F5", 4147, 0)); |
146 | keys.insert( "r0c5", FKey ("F6", 4148, 0)); | 175 | keys.insert( "r0c5", FKey ("F6", 4148, 0)); |
147 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); | 176 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); |
148 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); | 177 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); |
149 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); | 178 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); |
150 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); | 179 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); |
151 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); | 180 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); |
152 | 181 | ||
153 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); | 182 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); |
154 | keys.insert( "r1c8", FKey ("End", 4113, 0)); | 183 | keys.insert( "r1c8", FKey ("End", 4113, 0)); |
155 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); | 184 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); |
156 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); | 185 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); |
157 | 186 | ||
158 | } | 187 | } |
159 | 188 | ||
189 | /* FunctionKeyboardConfig {{{1 */ | ||
160 | 190 | ||
161 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : | 191 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : |
162 | ProfileDialogKeyWidget(name, parent) { | 192 | ProfileDialogKeyWidget(name, parent) { |
163 | 193 | ||
164 | 194 | ||
165 | FunctionKeyboard *kb = new FunctionKeyboard(this); | 195 | kb = new FunctionKeyboard(this); |
196 | |||
166 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); | 197 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); |
167 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this); | 198 | QLabel *l = new QLabel("Rows", dimentions); |
199 | QSpinBox *m_rowBox = new QSpinBox(1, 15, 1, dimentions); | ||
200 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); | ||
201 | l = new QLabel("Columns", dimentions); | ||
202 | m_colBox = new QSpinBox(1, 15, 1, dimentions); | ||
203 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); | ||
204 | |||
205 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); | ||
206 | l = new QLabel("Label", editKey); | ||
207 | /* | ||
208 | m_labels = new QComboBox(false, editKey); | ||
209 | labels->insertItem("text"); | ||
210 | |||
211 | QStringList files = QDir(QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); | ||
212 | |||
213 | for (uint i = 0; i < files.count(); i++) { | ||
214 | |||
215 | m_labels->insertItem(Resource::loadPixmap("console/keys/" + files[i])); | ||
216 | } | ||
217 | connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); | ||
218 | */ | ||
168 | 219 | ||
169 | QVBoxLayout *root = new QVBoxLayout(this, 2); | 220 | QVBoxLayout *root = new QVBoxLayout(this, 2); |
170 | root->addWidget(kb); | 221 | root->addWidget(kb); |
171 | root->addWidget(dimentions); | 222 | root->addWidget(dimentions); |
172 | root->addWidget(editKey); | 223 | root->addWidget(editKey); |
173 | } | 224 | } |
174 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | 225 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { |
175 | 226 | ||
176 | } | 227 | } |
177 | void FunctionKeyboardConfig::load (const Profile& ) { | 228 | void FunctionKeyboardConfig::load (const Profile& prof) { |
229 | int i = prof.readNumEntry("keb_rows", 1); | ||
230 | //m_rowBox->setValue(i); | ||
231 | } | ||
232 | void FunctionKeyboardConfig::save (Profile& prof) { | ||
233 | |||
234 | //prof.writeEntry("keb_rows", m_rowBox->value()); | ||
235 | |||
236 | } | ||
237 | void FunctionKeyboardConfig::slotChangeRows(int r) { | ||
238 | |||
239 | kb->changeRows(r); | ||
240 | |||
241 | // have to do this so the whole thing gets redrawn | ||
242 | kb->hide(); kb->show(); | ||
243 | } | ||
244 | void FunctionKeyboardConfig::slotChangeCols(int c) { | ||
245 | |||
246 | kb->changeCols(c); | ||
247 | } | ||
248 | void FunctionKeyboardConfig::slotKeyPressed(ushort, ushort, bool, bool, bool, ushort row, ushort col) { | ||
178 | 249 | ||
179 | } | 250 | } |
180 | void FunctionKeyboardConfig::save (Profile& ) { | 251 | void FunctionKeyboardConfig::slotChangeIcon(int index) { |
181 | 252 | ||
253 | if (index == 0) { | ||
254 | |||
255 | // is text | ||
256 | //if(!labels->editable()) labels->setEditable(true); | ||
257 | } else { | ||
258 | |||
259 | // is a pixmap | ||
260 | //if (labels->editable()) labels->setEditable(false); | ||
261 | } | ||
182 | } | 262 | } |
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h index 2be74b4..efeff6d 100644 --- a/noncore/apps/opie-console/function_keyboard.h +++ b/noncore/apps/opie-console/function_keyboard.h | |||
@@ -1,83 +1,100 @@ | |||
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 <qframe.h> | 5 | #include <qframe.h> |
6 | #include <qpainter.h> | 6 | #include <qpainter.h> |
7 | #include <qvbox.h> | 7 | #include <qvbox.h> |
8 | #include <qgroupbox.h> | 8 | #include <qgroupbox.h> |
9 | #include <qmap.h> | 9 | #include <qmap.h> |
10 | #include <qspinbox.h> | ||
11 | #include <qcombobox.h> | ||
10 | #include "profiledialogwidget.h" | 12 | #include "profiledialogwidget.h" |
11 | 13 | ||
14 | |||
12 | class FKey { | 15 | class FKey { |
13 | 16 | ||
14 | public: | 17 | public: |
15 | 18 | ||
16 | FKey(): qcode(0), unicode(0) {}; | 19 | FKey(): qcode(0), unicode(0) {}; |
17 | FKey(const QString &l, ushort q, ushort u): label(l), qcode(q), unicode(u) {}; | 20 | FKey(const QString &l, ushort q, ushort u): label(l), qcode(q), unicode(u) {}; |
18 | 21 | ||
19 | QString getL() { return label; } | 22 | QString getL() { return label; } |
20 | ushort getQ() { return qcode; } | 23 | ushort getQ() { return qcode; } |
21 | ushort getU() { return unicode; } | 24 | ushort getU() { return unicode; } |
22 | 25 | ||
23 | 26 | ||
24 | private: | 27 | private: |
25 | 28 | ||
26 | QString label; | 29 | QString label; |
27 | ushort qcode; | 30 | ushort qcode; |
28 | ushort unicode; | 31 | ushort unicode; |
29 | }; | 32 | }; |
30 | 33 | ||
31 | class FunctionKeyboard : public QFrame { | 34 | class FunctionKeyboard : public QFrame { |
32 | Q_OBJECT | 35 | Q_OBJECT |
33 | 36 | ||
34 | public: | 37 | public: |
35 | FunctionKeyboard(QWidget *parent = 0); | 38 | FunctionKeyboard(QWidget *parent = 0); |
36 | ~FunctionKeyboard(); | 39 | ~FunctionKeyboard(); |
37 | 40 | ||
41 | void changeRows(int); | ||
42 | void changeCols(int); | ||
43 | |||
38 | void paintEvent(QPaintEvent *); | 44 | void paintEvent(QPaintEvent *); |
39 | void paintKey(int, int); | 45 | void paintKey(int, int); |
40 | void mousePressEvent(QMouseEvent*); | 46 | void mousePressEvent(QMouseEvent*); |
41 | void mouseReleaseEvent(QMouseEvent*); | 47 | void mouseReleaseEvent(QMouseEvent*); |
42 | void resizeEvent(QResizeEvent*); | 48 | void resizeEvent(QResizeEvent*); |
43 | QSize sizeHint() const; | 49 | QSize sizeHint() const; |
44 | 50 | ||
45 | signals: | 51 | signals: |
46 | 52 | ||
47 | void keyPressed(ushort, ushort, bool, bool, bool); | 53 | void keyPressed(ushort, ushort, bool, bool, bool, ushort, ushort); |
48 | 54 | ||
49 | private: | 55 | private: |
50 | 56 | ||
51 | void loadDefaults(); | 57 | void loadDefaults(); |
52 | 58 | ||
53 | 59 | ||
54 | private: | 60 | private: |
55 | 61 | ||
56 | // thie key for the map is the row/col | 62 | // thie key for the map is the row/col |
57 | QMap<QString, FKey> keys; | 63 | QMap<QString, FKey> keys; |
58 | 64 | ||
59 | uint numRows; | 65 | uint numRows; |
60 | uint numCols; | 66 | uint numCols; |
61 | uint keyHeight; | 67 | uint keyHeight; |
62 | double keyWidth; // decimal point matters! | 68 | double keyWidth; // decimal point matters! |
63 | 69 | ||
64 | int pressedRow, pressedCol; | 70 | int pressedRow, pressedCol; |
65 | 71 | ||
66 | QObject *parent; | 72 | QObject *parent; |
67 | 73 | ||
68 | }; | 74 | }; |
69 | 75 | ||
70 | class FunctionKeyboardConfig : public ProfileDialogKeyWidget { | 76 | class FunctionKeyboardConfig : public ProfileDialogKeyWidget { |
71 | Q_OBJECT | 77 | Q_OBJECT |
72 | public: | 78 | public: |
73 | FunctionKeyboardConfig(const QString& name, QWidget *wid); | 79 | FunctionKeyboardConfig(const QString& name, QWidget *wid); |
74 | ~FunctionKeyboardConfig(); | 80 | ~FunctionKeyboardConfig(); |
75 | 81 | ||
76 | void load(const Profile&); | 82 | void load(const Profile&); |
77 | void save(Profile&); | 83 | void save(Profile&); |
78 | 84 | ||
85 | private slots: | ||
86 | |||
87 | void slotKeyPressed(ushort, ushort, bool, bool, bool, ushort, ushort); | ||
88 | void slotChangeRows(int); | ||
89 | void slotChangeCols(int); | ||
90 | void slotChangeIcon(int); | ||
91 | |||
79 | private: | 92 | private: |
80 | 93 | ||
94 | FunctionKeyboard *kb; | ||
95 | QSpinBox *m_rowBox, *m_colBox; | ||
96 | QComboBox *m_labels; | ||
97 | |||
81 | }; | 98 | }; |
82 | 99 | ||
83 | #endif | 100 | #endif |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 89f3516..30dd21c 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -195,34 +195,34 @@ void MainWindow::initUI() { | |||
195 | /* insert the connection menu */ | 195 | /* insert the connection menu */ |
196 | m_bar->insertItem( tr("Connection"), m_console ); | 196 | m_bar->insertItem( tr("Connection"), m_console ); |
197 | 197 | ||
198 | /* the scripts menu */ | 198 | /* the scripts menu */ |
199 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 199 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
200 | 200 | ||
201 | /* the settings menu */ | 201 | /* the settings menu */ |
202 | // m_bar->insertItem( tr("Settings"), m_settings ); | 202 | // m_bar->insertItem( tr("Settings"), m_settings ); |
203 | 203 | ||
204 | /* and the keyboard */ | 204 | /* and the keyboard */ |
205 | m_keyBar = new QToolBar(this); | 205 | m_keyBar = new QToolBar(this); |
206 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 206 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
207 | m_keyBar->setHorizontalStretchable( TRUE ); | 207 | m_keyBar->setHorizontalStretchable( TRUE ); |
208 | m_keyBar->hide(); | 208 | m_keyBar->hide(); |
209 | 209 | ||
210 | m_kb = new FunctionKeyboard(m_keyBar); | 210 | m_kb = new FunctionKeyboard(m_keyBar); |
211 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), | 211 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool, ushort, ushort)), |
212 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); | 212 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool, ushort, ushort))); |
213 | 213 | ||
214 | m_buttonBar = new QToolBar( this ); | 214 | m_buttonBar = new QToolBar( this ); |
215 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | 215 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); |
216 | m_buttonBar->setHorizontalStretchable( TRUE ); | 216 | m_buttonBar->setHorizontalStretchable( TRUE ); |
217 | m_buttonBar->hide(); | 217 | m_buttonBar->hide(); |
218 | 218 | ||
219 | m_qb = new QuickButton( m_buttonBar ); | 219 | m_qb = new QuickButton( m_buttonBar ); |
220 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), | 220 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), |
221 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); | 221 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); |
222 | 222 | ||
223 | 223 | ||
224 | m_connect->setEnabled( false ); | 224 | m_connect->setEnabled( false ); |
225 | m_disconnect->setEnabled( false ); | 225 | m_disconnect->setEnabled( false ); |
226 | m_terminate->setEnabled( false ); | 226 | m_terminate->setEnabled( false ); |
227 | m_transfer->setEnabled( false ); | 227 | m_transfer->setEnabled( false ); |
228 | m_recordScript->setEnabled( false ); | 228 | m_recordScript->setEnabled( false ); |
@@ -510,33 +510,33 @@ void MainWindow::slotFullscreen() { | |||
510 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 510 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
511 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 511 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
512 | , QPoint(0,0), false ); | 512 | , QPoint(0,0), false ); |
513 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 513 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
514 | ( m_curSession->widgetStack() )->setFocus(); | 514 | ( m_curSession->widgetStack() )->setFocus(); |
515 | ( m_curSession->widgetStack() )->show(); | 515 | ( m_curSession->widgetStack() )->show(); |
516 | 516 | ||
517 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 517 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
518 | 518 | ||
519 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 519 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
520 | } | 520 | } |
521 | 521 | ||
522 | m_isFullscreen = !m_isFullscreen; | 522 | m_isFullscreen = !m_isFullscreen; |
523 | } | 523 | } |
524 | 524 | ||
525 | 525 | ||
526 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool) { | 526 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool, ushort, ushort) { |
527 | 527 | ||
528 | //qWarning("unicode: %x, qkey: %x, %s", u, q, pressed ? "pressed" : "released"); | 528 | //qWarning("unicode: %x, qkey: %x, %s", u, q, pressed ? "pressed" : "released"); |
529 | 529 | ||
530 | if ( m_curSession ) { | 530 | if ( m_curSession ) { |
531 | 531 | ||
532 | QEvent::Type state; | 532 | QEvent::Type state; |
533 | 533 | ||
534 | if (pressed) state = QEvent::KeyPress; | 534 | if (pressed) state = QEvent::KeyPress; |
535 | else state = QEvent::KeyRelease; | 535 | else state = QEvent::KeyRelease; |
536 | 536 | ||
537 | QKeyEvent ke(state, q, u, 0, QString(QChar(u))); | 537 | QKeyEvent ke(state, q, u, 0, QString(QChar(u))); |
538 | 538 | ||
539 | // where should i send this event? doesnt work sending it here | 539 | // where should i send this event? doesnt work sending it here |
540 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 540 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
541 | ke.ignore(); | 541 | ke.ignore(); |
542 | } | 542 | } |
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index cc4ef76..68f6fa8 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -54,33 +54,33 @@ public: | |||
54 | private slots: | 54 | private slots: |
55 | void slotNew(); | 55 | void slotNew(); |
56 | void slotConnect(); | 56 | void slotConnect(); |
57 | void slotDisconnect(); | 57 | void slotDisconnect(); |
58 | void slotTerminate(); | 58 | void slotTerminate(); |
59 | void slotConfigure(); | 59 | void slotConfigure(); |
60 | void slotClose(); | 60 | void slotClose(); |
61 | void slotProfile(int); | 61 | void slotProfile(int); |
62 | void slotTransfer(); | 62 | void slotTransfer(); |
63 | void slotOpenKeb(bool); | 63 | void slotOpenKeb(bool); |
64 | void slotOpenButtons(bool); | 64 | void slotOpenButtons(bool); |
65 | void slotRecordScript(); | 65 | void slotRecordScript(); |
66 | void slotSaveScript(); | 66 | void slotSaveScript(); |
67 | void slotRunScript(); | 67 | void slotRunScript(); |
68 | void slotFullscreen(); | 68 | void slotFullscreen(); |
69 | void slotSessionChanged( Session* ); | 69 | void slotSessionChanged( Session* ); |
70 | void slotKeyReceived(ushort, ushort, bool, bool, bool); | 70 | void slotKeyReceived(ushort, ushort, bool, bool, bool, ushort, ushort); |
71 | 71 | ||
72 | private: | 72 | private: |
73 | void initUI(); | 73 | void initUI(); |
74 | void populateProfiles(); | 74 | void populateProfiles(); |
75 | void create( const Profile& ); | 75 | void create( const Profile& ); |
76 | /** | 76 | /** |
77 | * the current session | 77 | * the current session |
78 | */ | 78 | */ |
79 | Session* m_curSession; | 79 | Session* m_curSession; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * the session list | 82 | * the session list |
83 | */ | 83 | */ |
84 | QList<Session> m_sessions; | 84 | QList<Session> m_sessions; |
85 | 85 | ||
86 | /** | 86 | /** |