summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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) {
numRows = r;
- repaint(false);
+
+ // have to do this so the whole thing gets redrawn
+ hide(); show();
}
void FunctionKeyboard::changeCols(int c) {
@@ -64,4 +66,38 @@ void FunctionKeyboard::changeCols(int c) {
repaint(false);
}
+void FunctionKeyboard::load (const Profile& prof) {
+
+ keys.clear();
+
+ numRows = prof.readNumEntry("keb_rows", 2);
+ numCols = prof.readNumEntry("keb_cols", 10);
+ keyWidth = (double)width()/numCols; // have to reset this thing too
+
+ /* load all the keys to the keyboard */
+ for (ushort i = 0; i <= numRows - 1; i++)
+ for (ushort j = 0; j <= numCols - 1; j++) {
+
+ QString h = "r" + QString::number(i) + "c" + QString::number(j);
+ QString values = prof.readEntry("keb_" + h);
+
+ if (!values.isEmpty()) {
+
+ QStringList l = QStringList::split(QChar('|'), values, TRUE);
+ keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt());
+
+ // load pixmap if used
+ if (!l[1].isEmpty()) {
+
+ keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) );
+ }
+ }
+ }
+
+ if (keys.isEmpty()) loadDefaults();
+
+ hide();
+ show();
+
+}
void FunctionKeyboard::paintEvent(QPaintEvent *e) {
@@ -274,4 +310,7 @@ FunctionKeyboardConfig::~FunctionKeyboardConfig() {
void FunctionKeyboardConfig::load (const Profile& prof) {
+ kb->keys.clear();
+ kb->loadDefaults();
+
m_rowBox->setValue(prof.readNumEntry("keb_rows", 2));
m_colBox->setValue(prof.readNumEntry("keb_cols", 10));
@@ -321,6 +360,4 @@ void FunctionKeyboardConfig::slotChangeRows(int r) {
kb->changeRows(r);
- // have to do this so the whole thing gets redrawn
- kb->hide(); kb->show();
}
void 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:
void changeCols(int);
- //Key getKey(int, int);
+ void load(const Profile &);
+ void loadDefaults();
void paintEvent(QPaintEvent *);
@@ -59,8 +60,4 @@ signals:
void keyPressed(FKey, ushort, ushort, bool);
-private:
-
- void loadDefaults();
-
private:
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() {
m_closewindow->setEnabled( false );
}
+
+ m_kb->loadDefaults();
}
@@ -457,4 +459,6 @@ void MainWindow::create( const Profile& prof ) {
QWidget *w = currentSession()->widget();
if(w) w->setFocus();
+
+ m_kb->load(currentSession()->profile());
}
@@ -520,4 +524,6 @@ void MainWindow::slotSessionChanged( Session* ses ) {
QWidget *w = m_curSession->widget();
if(w) w->setFocus();
+
+ m_kb->load(currentSession()->profile());
}
}