summaryrefslogtreecommitdiff
path: root/noncore
authorhash <hash>2002-10-24 17:39:47 (UTC)
committer hash <hash>2002-10-24 17:39:47 (UTC)
commitb01703c4b1de7006c88aa814ca00472b966b2464 (patch) (unidiff)
tree9d0f4e708646ddbf1a0198f1ac2dd4b67e2c45fa /noncore
parent1364899f2b250d1605e1a49cb7c65ce950c57fda (diff)
downloadopie-b01703c4b1de7006c88aa814ca00472b966b2464.zip
opie-b01703c4b1de7006c88aa814ca00472b966b2464.tar.gz
opie-b01703c4b1de7006c88aa814ca00472b966b2464.tar.bz2
i think it loads according to the session properly now
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp43
-rw-r--r--noncore/apps/opie-console/function_keyboard.h7
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp6
3 files changed, 48 insertions, 8 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index 3da8d61..ce65052 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -56,5 +56,7 @@ void FunctionKeyboard::changeRows(int r) {
56 56
57 numRows = r; 57 numRows = r;
58 repaint(false); 58
59 // have to do this so the whole thing gets redrawn
60 hide(); show();
59} 61}
60void FunctionKeyboard::changeCols(int c) { 62void FunctionKeyboard::changeCols(int c) {
@@ -64,4 +66,38 @@ void FunctionKeyboard::changeCols(int c) {
64 repaint(false); 66 repaint(false);
65} 67}
68void FunctionKeyboard::load (const Profile& prof) {
69
70 keys.clear();
71
72 numRows = prof.readNumEntry("keb_rows", 2);
73 numCols = prof.readNumEntry("keb_cols", 10);
74 keyWidth = (double)width()/numCols; // have to reset this thing too
75
76 /* load all the keys to the keyboard */
77 for (ushort i = 0; i <= numRows - 1; i++)
78 for (ushort j = 0; j <= numCols - 1; j++) {
79
80 QString h = "r" + QString::number(i) + "c" + QString::number(j);
81 QString values = prof.readEntry("keb_" + h);
82
83 if (!values.isEmpty()) {
84
85 QStringList l = QStringList::split(QChar('|'), values, TRUE);
86 keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt());
87
88 // load pixmap if used
89 if (!l[1].isEmpty()) {
90
91 keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) );
92 }
93 }
94 }
95
96 if (keys.isEmpty()) loadDefaults();
97
98 hide();
99 show();
100
101}
66 102
67void FunctionKeyboard::paintEvent(QPaintEvent *e) { 103void FunctionKeyboard::paintEvent(QPaintEvent *e) {
@@ -274,4 +310,7 @@ FunctionKeyboardConfig::~FunctionKeyboardConfig() {
274void FunctionKeyboardConfig::load (const Profile& prof) { 310void FunctionKeyboardConfig::load (const Profile& prof) {
275 311
312 kb->keys.clear();
313 kb->loadDefaults();
314
276 m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); 315 m_rowBox->setValue(prof.readNumEntry("keb_rows", 2));
277 m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); 316 m_colBox->setValue(prof.readNumEntry("keb_cols", 10));
@@ -321,6 +360,4 @@ void FunctionKeyboardConfig::slotChangeRows(int r) {
321 kb->changeRows(r); 360 kb->changeRows(r);
322 361
323 // have to do this so the whole thing gets redrawn
324 kb->hide(); kb->show();
325} 362}
326void FunctionKeyboardConfig::slotChangeCols(int c) { 363void FunctionKeyboardConfig::slotChangeCols(int c) {
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h
index 80d9f29..a60ff4b 100644
--- a/noncore/apps/opie-console/function_keyboard.h
+++ b/noncore/apps/opie-console/function_keyboard.h
@@ -46,5 +46,6 @@ public:
46 void changeCols(int); 46 void changeCols(int);
47 47
48 //Key getKey(int, int); 48 void load(const Profile &);
49 void loadDefaults();
49 50
50 void paintEvent(QPaintEvent *); 51 void paintEvent(QPaintEvent *);
@@ -59,8 +60,4 @@ signals:
59 void keyPressed(FKey, ushort, ushort, bool); 60 void keyPressed(FKey, ushort, ushort, bool);
60 61
61private:
62
63 void loadDefaults();
64
65 62
66private: 63private:
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index b177fa5..745efaf 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -408,4 +408,6 @@ void MainWindow::slotClose() {
408 m_closewindow->setEnabled( false ); 408 m_closewindow->setEnabled( false );
409 } 409 }
410
411 m_kb->loadDefaults();
410} 412}
411 413
@@ -457,4 +459,6 @@ void MainWindow::create( const Profile& prof ) {
457 QWidget *w = currentSession()->widget(); 459 QWidget *w = currentSession()->widget();
458 if(w) w->setFocus(); 460 if(w) w->setFocus();
461
462 m_kb->load(currentSession()->profile());
459} 463}
460 464
@@ -520,4 +524,6 @@ void MainWindow::slotSessionChanged( Session* ses ) {
520 QWidget *w = m_curSession->widget(); 524 QWidget *w = m_curSession->widget();
521 if(w) w->setFocus(); 525 if(w) w->setFocus();
526
527 m_kb->load(currentSession()->profile());
522 } 528 }
523} 529}