Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 65 |
1 files changed, 57 insertions, 8 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index ac3d9be..68918a6 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp @@ -50,4 +50,5 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : { + // get the default font Config *config = new Config( "qpe" ); @@ -73,4 +74,6 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : } else picks->hide(); + loadKeyboardColors(); + keys = new Keys(); @@ -79,4 +82,5 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : } + Keyboard::~Keyboard() { @@ -157,9 +161,4 @@ void Keyboard::paintEvent(QPaintEvent* e) void Keyboard::drawKeyboard(QPainter &p, int row, int col) { - QColor keycolor = - QColor(240,240,240); - QColor keycolor_pressed = QColor(171,183,198); - QColor keycolor_lines = QColor(138,148,160); - QColor textcolor = QColor(43,54,68); @@ -183,10 +182,9 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) ushort c = keys->uni(row, col); - if (!pix) { - p.setPen(textcolor); + p.setPen(textcolor); + if (!pix) p.drawText(x, y, defaultKeyWidth * keyWidth, keyHeight, AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c); - } else // center the image in the middle of the key @@ -293,4 +291,6 @@ void Keyboard::mousePressEvent(QMouseEvent *e) connect(configdlg, SIGNAL(setMapToFile(QString)), this, SLOT(setMapToFile(QString))); + connect(configdlg, SIGNAL(reloadKeyboard()), + this, SLOT(reloadKeyboard())); configdlg->showMaximized(); configdlg->show(); @@ -549,4 +549,53 @@ void Keyboard::setMapToFile(QString map) { } +/* Keybaord::setColor {{{1 */ +void Keyboard::reloadKeyboard() { + + // reload colors and redraw + loadKeyboardColors(); + repaint(); + +} + +void Keyboard::loadKeyboardColors() { + + Config config ("multikey"); + config.setGroup("colors"); + + QStringList color; + color = config.readListEntry("keycolor", QChar(',')); + if (color.isEmpty()) { + color = QStringList::split(",", "240,240,240"); + config.writeEntry("keycolor", color.join(",")); + + } + keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); + + color = config.readListEntry("keycolor_pressed", QChar(',')); + if (color.isEmpty()) { + color = QStringList::split(",", "171,183,198"); + config.writeEntry("keycolor_pressed", color.join(",")); + + } + keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); + + color = config.readListEntry("keycolor_lines", QChar(',')); + if (color.isEmpty()) { + color = QStringList::split(",", "138,148,160"); + config.writeEntry("keycolor_lines", color.join(",")); + + } + keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); + + color = config.readListEntry("textcolor", QChar(',')); + if (color.isEmpty()) { + color = QStringList::split(",", "43,54,68"); + config.writeEntry("textcolor", color.join(",")); + + } + textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); + +} + /* korean input functions {{{1 * |