summaryrefslogtreecommitdiff
authorhash <hash>2002-10-22 16:01:27 (UTC)
committer hash <hash>2002-10-22 16:01:27 (UTC)
commit6843a1bd8f8e679c220431f8377abcd2ffd2019b (patch) (unidiff)
treecec84037b60d0ae1e69c69a21e6da2dea3aaf5b6
parentdca783a6564d7d0d8c857cef8586167bc0609647 (diff)
downloadopie-6843a1bd8f8e679c220431f8377abcd2ffd2019b.zip
opie-6843a1bd8f8e679c220431f8377abcd2ffd2019b.tar.gz
opie-6843a1bd8f8e679c220431f8377abcd2ffd2019b.tar.bz2
cant figure out why modifying a private var in FunctionKeyboardConfig causes it to segfault.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp92
-rw-r--r--noncore/apps/opie-console/function_keyboard.h19
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp6
-rw-r--r--noncore/apps/opie-console/mainwindow.h2
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,3 +1,6 @@
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>
@@ -5,4 +8,10 @@
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
8FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 17FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
@@ -39,4 +48,16 @@ FunctionKeyboard::~FunctionKeyboard() {
39} 48}
40 49
50void FunctionKeyboard::changeRows(int r) {
51
52 numRows = r;
53 repaint(false);
54}
55void FunctionKeyboard::changeCols(int c) {
56
57 numCols = c;
58 keyWidth = (double)width()/numCols; // have to reset this thing too
59 repaint(false);
60}
61
41void FunctionKeyboard::paintEvent(QPaintEvent *e) { 62void FunctionKeyboard::paintEvent(QPaintEvent *e) {
42 63
@@ -92,4 +113,12 @@ void FunctionKeyboard::paintKey(int row, int col) {
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
@@ -103,5 +132,5 @@ void FunctionKeyboard::mousePressEvent(QMouseEvent *e) {
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}
@@ -116,5 +145,5 @@ void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
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
@@ -158,4 +187,5 @@ void FunctionKeyboard::loadDefaults() {
158} 187}
159 188
189/* FunctionKeyboardConfig {{{1 */
160 190
161FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : 191FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) :
@@ -163,7 +193,28 @@ FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* par
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);
@@ -175,8 +226,37 @@ FunctionKeyboardConfig::~FunctionKeyboardConfig() {
175 226
176} 227}
177void FunctionKeyboardConfig::load (const Profile& ) { 228void FunctionKeyboardConfig::load (const Profile& prof) {
229 int i = prof.readNumEntry("keb_rows", 1);
230 //m_rowBox->setValue(i);
231}
232void FunctionKeyboardConfig::save (Profile& prof) {
233
234 //prof.writeEntry("keb_rows", m_rowBox->value());
235
236}
237void 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}
244void FunctionKeyboardConfig::slotChangeCols(int c) {
245
246 kb->changeCols(c);
247}
248void FunctionKeyboardConfig::slotKeyPressed(ushort, ushort, bool, bool, bool, ushort row, ushort col) {
178 249
179} 250}
180void FunctionKeyboardConfig::save (Profile& ) { 251void 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
@@ -8,6 +8,9 @@
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
12class FKey { 15class FKey {
13 16
@@ -36,4 +39,7 @@ public:
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);
@@ -45,5 +51,5 @@ public:
45signals: 51signals:
46 52
47 void keyPressed(ushort, ushort, bool, bool, bool); 53 void keyPressed(ushort, ushort, bool, bool, bool, ushort, ushort);
48 54
49private: 55private:
@@ -77,6 +83,17 @@ public:
77 void save(Profile&); 83 void save(Profile&);
78 84
85private 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
79private: 92private:
80 93
94 FunctionKeyboard *kb;
95 QSpinBox *m_rowBox, *m_colBox;
96 QComboBox *m_labels;
97
81}; 98};
82 99
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
@@ -209,6 +209,6 @@ void MainWindow::initUI() {
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 );
@@ -524,5 +524,5 @@ void MainWindow::slotFullscreen() {
524 524
525 525
526void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool) { 526void 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");
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
@@ -68,5 +68,5 @@ private slots:
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
72private: 72private: