author | hash <hash> | 2002-08-19 17:47:09 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-19 17:47:09 (UTC) |
commit | d68e038d1ba78a816e60990d5a36d6c52d8e11d3 (patch) (side-by-side diff) | |
tree | 4b63d843d3a64d35567205d4aa50e1cfc53d99b4 /inputmethods/multikey/keyboard.cpp | |
parent | 9cc94030d7f6a04b79da8db83e6c609c1580a3d3 (diff) | |
download | opie-d68e038d1ba78a816e60990d5a36d6c52d8e11d3.zip opie-d68e038d1ba78a816e60990d5a36d6c52d8e11d3.tar.gz opie-d68e038d1ba78a816e60990d5a36d6c52d8e11d3.tar.bz2 |
added simple color changing
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 @@ -51,2 +51,3 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : { + // get the default font @@ -74,2 +75,4 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : + loadKeyboardColors(); + keys = new Keys(); @@ -80,2 +83,3 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : } + Keyboard::~Keyboard() { @@ -158,7 +162,2 @@ 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); @@ -184,4 +183,4 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) - if (!pix) { - p.setPen(textcolor); + p.setPen(textcolor); + if (!pix) p.drawText(x, y, @@ -189,3 +188,2 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c); - } else @@ -294,2 +292,4 @@ void Keyboard::mousePressEvent(QMouseEvent *e) this, SLOT(setMapToFile(QString))); + connect(configdlg, SIGNAL(reloadKeyboard()), + this, SLOT(reloadKeyboard())); configdlg->showMaximized(); @@ -550,2 +550,51 @@ 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 |