summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/BUGS4
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp3
2 files changed, 6 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/BUGS b/noncore/apps/opie-console/BUGS
index 23a1026..2f66df1 100644
--- a/noncore/apps/opie-console/BUGS
+++ b/noncore/apps/opie-console/BUGS
@@ -1,24 +1,28 @@
1Ok we all know we write perfect code 1Ok we all know we write perfect code
2but sometimes the compiler produces bad code 2but sometimes the compiler produces bad code
3and we need to work around some compiler bugs!! -zecke 3and we need to work around some compiler bugs!! -zecke
4 4
5 5
6Send/receive: lrzsz behaves strange when trying to use 6Send/receive: lrzsz behaves strange when trying to use
7--overwrite or --rename. 7--overwrite or --rename.
8 8
9- console should autoconnect by default 9- console should autoconnect by default
10 10
11- keys and buttonbar merge 11- keys and buttonbar merge
12 12
13- keys really working 13- keys really working
14 mc is working
15 but F11 on bar seems to be the F10 key and so on
16 F9 is F8... -zecke
17 Should be fixed -zecke
14 18
15- scripting with "direct subpopup" 19- scripting with "direct subpopup"
16 20
17- kill more compiler warnings. 21- kill more compiler warnings.
18 22
19- more colorshemes ( "orange is ugly" ) 23- more colorshemes ( "orange is ugly" )
20 24
21- irda and bluetooth out ( can be done with normal serial as long as the 25- irda and bluetooth out ( can be done with normal serial as long as the
22connection is allready up, and extended stuff is a lot of work; maybe later 26connection is allready up, and extended stuff is a lot of work; maybe later
23in again ). 27in again ).
24 28
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index c314949..b2f1c78 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,262 +1,263 @@
1#include "function_keyboard.h" 1#include "function_keyboard.h"
2 2
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qsizepolicy.h> 5#include <qsizepolicy.h>
6#include <qevent.h> 6#include <qevent.h>
7#include <qwindowsystem_qws.h> 7#include <qwindowsystem_qws.h>
8#include <qapplication.h> 8#include <qapplication.h>
9#include <qlayout.h> 9#include <qlayout.h>
10#include <qspinbox.h> 10#include <qspinbox.h>
11#include <qlabel.h> 11#include <qlabel.h>
12#include <qcombobox.h> 12#include <qcombobox.h>
13#include <qdir.h> 13#include <qdir.h>
14 14
15/* FunctionKeyboard {{{1 */ 15/* FunctionKeyboard {{{1 */
16 16
17FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 17FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
18 QFrame(parent), numRows(2), numCols(11), 18 QFrame(parent), numRows(2), numCols(11),
19 pressedRow(0), pressedCol(0) { 19 pressedRow(0), pressedCol(0) {
20 20
21 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); 21 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
22 22
23 Config conf("opie-console-keys"); 23 Config conf("opie-console-keys");
24 conf.setGroup("keys"); 24 conf.setGroup("keys");
25 for (uint r = 0; r < numRows; r++) 25 for (uint r = 0; r < numRows; r++)
26 for (uint c = 0; c < numCols; c++) { 26 for (uint c = 0; c < numCols; c++) {
27 27
28 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 28 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
29 QStringList value_list = conf.readListEntry( handle, '|'); 29 QStringList value_list = conf.readListEntry( handle, '|');
30 30
31 if (value_list.isEmpty()) continue; 31 if (value_list.isEmpty()) continue;
32 32
33 keys.insert( 33 keys.insert(
34 34
35 handle, 35 handle,
36 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())
37 ); 37 );
38 } 38 }
39 //qWarning("loaded %d keys", keys.count()); 39 //qWarning("loaded %d keys", keys.count());
40 if (keys.isEmpty()) loadDefaults(); 40 if (keys.isEmpty()) loadDefaults();
41 41
42 42
43 43
44} 44}
45 45
46FunctionKeyboard::~FunctionKeyboard() { 46FunctionKeyboard::~FunctionKeyboard() {
47 47
48} 48}
49 49
50void FunctionKeyboard::changeRows(int r) { 50void FunctionKeyboard::changeRows(int r) {
51 51
52 numRows = r; 52 numRows = r;
53 repaint(false); 53 repaint(false);
54} 54}
55void FunctionKeyboard::changeCols(int c) { 55void FunctionKeyboard::changeCols(int c) {
56 56
57 numCols = c; 57 numCols = c;
58 keyWidth = (double)width()/numCols; // have to reset this thing too 58 keyWidth = (double)width()/numCols; // have to reset this thing too
59 repaint(false); 59 repaint(false);
60} 60}
61 61
62void FunctionKeyboard::paintEvent(QPaintEvent *e) { 62void FunctionKeyboard::paintEvent(QPaintEvent *e) {
63 63
64 QPainter p(this); 64 QPainter p(this);
65 p.setClipRect(e->rect()); 65 p.setClipRect(e->rect());
66 p.fillRect(0, 0, width(), height(), QColor(255,255,255)); 66 p.fillRect(0, 0, width(), height(), QColor(255,255,255));
67 67
68 p.setPen(QColor(0,0,0)); 68 p.setPen(QColor(0,0,0));
69 69
70 /* those decimals do count! becomes short if use plain int */ 70 /* those decimals do count! becomes short if use plain int */
71 for (double i = 0; i <= width(); i += keyWidth) { 71 for (double i = 0; i <= width(); i += keyWidth) {
72 72
73 p.drawLine((int)i, 0, (int)i, height()); 73 p.drawLine((int)i, 0, (int)i, height());
74 } 74 }
75 75
76 // sometimes the last line doesnt get drawn 76 // sometimes the last line doesnt get drawn
77 p.drawLine(width() -1, 0, width() -1, height()); 77 p.drawLine(width() -1, 0, width() -1, height());
78 78
79 for (int i = 0; i <= height(); i += keyHeight) { 79 for (int i = 0; i <= height(); i += keyHeight) {
80 80
81 p.drawLine(0, i, width(), i); 81 p.drawLine(0, i, width(), i);
82 } 82 }
83 83
84 for (uint r = 0; r < numRows; r++) { 84 for (uint r = 0; r < numRows; r++) {
85 for (uint c = 0; c < numCols; c++) { 85 for (uint c = 0; c < numCols; c++) {
86 86
87 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 87 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
88 if (keys.contains(handle)) { 88 if (keys.contains(handle)) {
89 89
90 p.drawText( 90 p.drawText(
91 c * keyWidth + 1, r * keyHeight + 1, 91 c * keyWidth + 1, r * keyHeight + 1,
92 keyWidth, keyHeight, 92 keyWidth, keyHeight,
93 Qt::AlignHCenter | Qt::AlignVCenter, 93 Qt::AlignHCenter | Qt::AlignVCenter,
94 keys[handle].getL() 94 keys[handle].getL()
95 ); 95 );
96 } 96 }
97 } 97 }
98 } 98 }
99} 99}
100 100
101void FunctionKeyboard::paintKey(int row, int col) { 101void FunctionKeyboard::paintKey(int row, int col) {
102 102
103 QPainter p(this); 103 QPainter p(this);
104 104
105 p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), 105 p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1),
106 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), 106 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)),
107 (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));
108 p.drawText( 108 p.drawText(
109 col * keyWidth + 1, row * keyHeight + 1, 109 col * keyWidth + 1, row * keyHeight + 1,
110 keyWidth, keyHeight, 110 keyWidth, keyHeight,
111 Qt::AlignHCenter | Qt::AlignVCenter, 111 Qt::AlignHCenter | Qt::AlignVCenter,
112 keys["r" + QString::number(row) + "c" + QString::number(col)].getL() 112 keys["r" + QString::number(row) + "c" + QString::number(col)].getL()
113 ); 113 );
114 114
115 if (row == numRows) { 115 if (row == numRows) {
116 116
117 // sometimes it doesnt draw the last line 117 // sometimes it doesnt draw the last line
118 p.drawLine((col+1) * keyWidth -2, row * keyHeight, 118 p.drawLine((col+1) * keyWidth -2, row * keyHeight,
119 (col+1) * keyWidth -2, (row + 1) * keyHeight 119 (col+1) * keyWidth -2, (row + 1) * keyHeight
120 ); 120 );
121 } 121 }
122 122
123} 123}
124 124
125void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { 125void FunctionKeyboard::mousePressEvent(QMouseEvent *e) {
126 126
127 pressedRow = e->y() / keyHeight; 127 pressedRow = e->y() / keyHeight;
128 pressedCol = (int) (e->x() / keyWidth); 128 pressedCol = (int) (e->x() / keyWidth);
129 129
130 paintKey(pressedRow, pressedCol); 130 paintKey(pressedRow, pressedCol);
131 131
132 // emit that sucker! 132 // emit that sucker!
133 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; 133 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)];
134 emit keyPressed(k.getU(), k.getQ(), 0, 1, 0, pressedRow, pressedCol); 134 emit keyPressed(k.getU(), k.getQ(), 0, 1, 0, pressedRow, pressedCol);
135 135
136} 136}
137 137
138void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { 138void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
139 139
140 if (pressedRow != -1 && pressedRow != -1) { 140 if (pressedRow != -1 && pressedRow != -1) {
141 141
142 int row = pressedRow; pressedRow = -1; 142 int row = pressedRow; pressedRow = -1;
143 int col = pressedCol; pressedCol = -1; 143 int col = pressedCol; pressedCol = -1;
144 paintKey(row, col); 144 paintKey(row, col);
145 145
146 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; 146 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)];
147 emit keyPressed(k.getU(), k.getQ(), 0, 0, 0, pressedRow, pressedCol); 147 emit keyPressed(k.getU(), k.getQ(), 0, 0, 0, pressedRow, pressedCol);
148 } 148 }
149 149
150} 150}
151 151
152 152
153void FunctionKeyboard::resizeEvent(QResizeEvent*) { 153void FunctionKeyboard::resizeEvent(QResizeEvent*) {
154 154
155 /* set he default font height/width */ 155 /* set he default font height/width */
156 QFontMetrics fm=fontMetrics(); 156 QFontMetrics fm=fontMetrics();
157 keyHeight = fm.lineSpacing() + 2; 157 keyHeight = fm.lineSpacing() + 2;
158 keyWidth = (double)width()/numCols; 158 keyWidth = (double)width()/numCols;
159 159
160} 160}
161 161
162QSize FunctionKeyboard::sizeHint() const { 162QSize FunctionKeyboard::sizeHint() const {
163 163
164 return QSize(width(), keyHeight * numRows + 1); 164 return QSize(width(), keyHeight * numRows + 1);
165} 165}
166 166
167void FunctionKeyboard::loadDefaults() { 167void FunctionKeyboard::loadDefaults() {
168 168
169 /* what keys should be default? */ 169 /* what keys should be default? */
170 keys.insert( "r0c0", FKey ("F1", 4144, 0)); 170 keys.insert( "r0c0", FKey ("F1", 4144, 0));
171 keys.insert( "r0c1", FKey ("F2", 4145, 0)); 171 keys.insert( "r0c1", FKey ("F2", 4145, 0));
172 keys.insert( "r0c2", FKey ("F3", 4145, 0)); 172 keys.insert( "r0c2", FKey ("F3", 4145, 0));
173 keys.insert( "r0c3", FKey ("F4", 4146, 0)); 173 keys.insert( "r0c3", FKey ("F4", 4146, 0));
174 keys.insert( "r0c4", FKey ("F5", 4147, 0)); 174 keys.insert( "r0c4", FKey ("F5", 4147, 0));
175 keys.insert( "r0c5", FKey ("F6", 4148, 0)); 175 keys.insert( "r0c5", FKey ("F6", 4148, 0));
176 keys.insert( "r0c6", FKey ("F7", 4149, 0)); 176 keys.insert( "r0c6", FKey ("F7", 4149, 0));
177 keys.insert( "r0c7", FKey ("F8", 4150, 0)); 177 keys.insert( "r0c7", FKey ("F8", 4150, 0));
178 keys.insert( "r0c8", FKey ("F9", 4151, 0)); 178 keys.insert( "r0c8", FKey ("F9", 4151, 0));
179 keys.insert( "r0c9", FKey ("F10", 4152, 0)); 179 keys.insert( "r0c9", FKey ("F10", 4152, 0));
180 keys.insert( "r0c10", FKey ("F11", 4153, 0)); 180 keys.insert( "r0c10", FKey ("F11", 4153, 0));
181 181
182 keys.insert( "r1c7", FKey ("Ho", 4112, 0)); 182 keys.insert( "r1c7", FKey ("Ho", 4112, 0));
183 keys.insert( "r1c8", FKey ("End", 4113, 0)); 183 keys.insert( "r1c8", FKey ("End", 4113, 0));
184 keys.insert( "r1c9", FKey ("PU", 4118, 0)); 184 keys.insert( "r1c9", FKey ("PU", 4118, 0));
185 keys.insert( "r1c10", FKey ("PD", 4119, 0)); 185 keys.insert( "r1c10", FKey ("PD", 4119, 0));
186 186
187} 187}
188 188
189/* FunctionKeyboardConfig {{{1 */ 189/* FunctionKeyboardConfig {{{1 */
190 190
191FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) 191FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na )
192 : ProfileDialogKeyWidget(name, parent, na) { 192 : ProfileDialogKeyWidget(name, parent, na) {
193 qWarning("FunctionKeyboardConfig");
193 194
194 195
195 kb = new FunctionKeyboard(this); 196 kb = new FunctionKeyboard(this);
196 197
197 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); 198 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this);
198 QLabel *l = new QLabel("Rows", dimentions); 199 QLabel *l = new QLabel("Rows", dimentions);
199 QSpinBox *m_rowBox = new QSpinBox(1, 15, 1, dimentions); 200 m_rowBox = new QSpinBox(1, 15, 1, dimentions);
200 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); 201 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int)));
201 l = new QLabel("Columns", dimentions); 202 l = new QLabel("Columns", dimentions);
202 m_colBox = new QSpinBox(1, 15, 1, dimentions); 203 m_colBox = new QSpinBox(1, 15, 1, dimentions);
203 connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); 204 connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int)));
204 205
205 QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); 206 QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this);
206 l = new QLabel("Label", editKey); 207 l = new QLabel("Label", editKey);
207 /* 208 /*
208 m_labels = new QComboBox(false, editKey); 209 m_labels = new QComboBox(false, editKey);
209 labels->insertItem("text"); 210 labels->insertItem("text");
210 211
211 QStringList files = QDir(QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); 212 QStringList files = QDir(QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList();
212 213
213 for (uint i = 0; i < files.count(); i++) { 214 for (uint i = 0; i < files.count(); i++) {
214 215
215 m_labels->insertItem(Resource::loadPixmap("console/keys/" + files[i])); 216 m_labels->insertItem(Resource::loadPixmap("console/keys/" + files[i]));
216 } 217 }
217 connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); 218 connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int)));
218 */ 219 */
219 220
220 QVBoxLayout *root = new QVBoxLayout(this, 2); 221 QVBoxLayout *root = new QVBoxLayout(this, 2);
221 root->addWidget(kb); 222 root->addWidget(kb);
222 root->addWidget(dimentions); 223 root->addWidget(dimentions);
223 root->addWidget(editKey); 224 root->addWidget(editKey);
224} 225}
225FunctionKeyboardConfig::~FunctionKeyboardConfig() { 226FunctionKeyboardConfig::~FunctionKeyboardConfig() {
226 227
227} 228}
228void FunctionKeyboardConfig::load (const Profile& prof) { 229void FunctionKeyboardConfig::load (const Profile& prof) {
229 //int i = prof.readNumEntry("keb_rows", 1); 230 //int i = prof.readNumEntry("keb_rows", 1);
230 m_rowBox->setValue( 2 ); 231 m_rowBox->setValue( 2 );
231} 232}
232void FunctionKeyboardConfig::save (Profile& prof) { 233void FunctionKeyboardConfig::save (Profile& prof) {
233 234
234 prof.writeEntry("keb_rows", m_rowBox->value()); 235 prof.writeEntry("keb_rows", m_rowBox->value());
235 236
236} 237}
237void FunctionKeyboardConfig::slotChangeRows(int r) { 238void FunctionKeyboardConfig::slotChangeRows(int r) {
238 239
239 kb->changeRows(r); 240 kb->changeRows(r);
240 241
241 // have to do this so the whole thing gets redrawn 242 // have to do this so the whole thing gets redrawn
242 kb->hide(); kb->show(); 243 kb->hide(); kb->show();
243} 244}
244void FunctionKeyboardConfig::slotChangeCols(int c) { 245void FunctionKeyboardConfig::slotChangeCols(int c) {
245 246
246 kb->changeCols(c); 247 kb->changeCols(c);
247} 248}
248void FunctionKeyboardConfig::slotKeyPressed(ushort, ushort, bool, bool, bool, ushort row, ushort col) { 249void FunctionKeyboardConfig::slotKeyPressed(ushort, ushort, bool, bool, bool, ushort row, ushort col) {
249 250
250} 251}
251void FunctionKeyboardConfig::slotChangeIcon(int index) { 252void FunctionKeyboardConfig::slotChangeIcon(int index) {
252 253
253 if (index == 0) { 254 if (index == 0) {
254 255
255 // is text 256 // is text
256 //if(!labels->editable()) labels->setEditable(true); 257 //if(!labels->editable()) labels->setEditable(true);
257 } else { 258 } else {
258 259
259 // is a pixmap 260 // is a pixmap
260 //if (labels->editable()) labels->setEditable(false); 261 //if (labels->editable()) labels->setEditable(false);
261 } 262 }
262} 263}