author | hash <hash> | 2002-08-19 17:47:09 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-19 17:47:09 (UTC) |
commit | d68e038d1ba78a816e60990d5a36d6c52d8e11d3 (patch) (unidiff) | |
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 | |||
@@ -49,6 +49,7 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | |||
49 | configdlg(0) | 49 | configdlg(0) |
50 | 50 | ||
51 | { | 51 | { |
52 | |||
52 | // get the default font | 53 | // get the default font |
53 | Config *config = new Config( "qpe" ); | 54 | Config *config = new Config( "qpe" ); |
54 | config->setGroup( "Appearance" ); | 55 | config->setGroup( "Appearance" ); |
@@ -72,12 +73,15 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | |||
72 | 73 | ||
73 | } else picks->hide(); | 74 | } else picks->hide(); |
74 | 75 | ||
76 | loadKeyboardColors(); | ||
77 | |||
75 | keys = new Keys(); | 78 | keys = new Keys(); |
76 | 79 | ||
77 | repeatTimer = new QTimer( this ); | 80 | repeatTimer = new QTimer( this ); |
78 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 81 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
79 | 82 | ||
80 | } | 83 | } |
84 | |||
81 | Keyboard::~Keyboard() { | 85 | Keyboard::~Keyboard() { |
82 | 86 | ||
83 | if ( configdlg ) { | 87 | if ( configdlg ) { |
@@ -156,11 +160,6 @@ void Keyboard::paintEvent(QPaintEvent* e) | |||
156 | 160 | ||
157 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) | 161 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) |
158 | { | 162 | { |
159 | QColor keycolor = | ||
160 | QColor(240,240,240); | ||
161 | QColor keycolor_pressed = QColor(171,183,198); | ||
162 | QColor keycolor_lines = QColor(138,148,160); | ||
163 | QColor textcolor = QColor(43,54,68); | ||
164 | 163 | ||
165 | 164 | ||
166 | if (row != -1 && col != -1) { //just redraw one key | 165 | if (row != -1 && col != -1) { //just redraw one key |
@@ -182,12 +181,11 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
182 | 181 | ||
183 | ushort c = keys->uni(row, col); | 182 | ushort c = keys->uni(row, col); |
184 | 183 | ||
185 | if (!pix) { | 184 | p.setPen(textcolor); |
186 | p.setPen(textcolor); | 185 | if (!pix) |
187 | p.drawText(x, y, | 186 | p.drawText(x, y, |
188 | defaultKeyWidth * keyWidth, keyHeight, | 187 | defaultKeyWidth * keyWidth, keyHeight, |
189 | AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c); | 188 | AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c); |
190 | } | ||
191 | else | 189 | else |
192 | // center the image in the middle of the key | 190 | // center the image in the middle of the key |
193 | p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, | 191 | p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, |
@@ -292,6 +290,8 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
292 | this, SLOT(setMapToDefault())); | 290 | this, SLOT(setMapToDefault())); |
293 | connect(configdlg, SIGNAL(setMapToFile(QString)), | 291 | connect(configdlg, SIGNAL(setMapToFile(QString)), |
294 | this, SLOT(setMapToFile(QString))); | 292 | this, SLOT(setMapToFile(QString))); |
293 | connect(configdlg, SIGNAL(reloadKeyboard()), | ||
294 | this, SLOT(reloadKeyboard())); | ||
295 | configdlg->showMaximized(); | 295 | configdlg->showMaximized(); |
296 | configdlg->show(); | 296 | configdlg->show(); |
297 | configdlg->raise(); | 297 | configdlg->raise(); |
@@ -548,6 +548,55 @@ void Keyboard::setMapToFile(QString map) { | |||
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | /* Keybaord::setColor {{{1 */ | ||
552 | void Keyboard::reloadKeyboard() { | ||
553 | |||
554 | // reload colors and redraw | ||
555 | loadKeyboardColors(); | ||
556 | repaint(); | ||
557 | |||
558 | } | ||
559 | |||
560 | void Keyboard::loadKeyboardColors() { | ||
561 | |||
562 | Config config ("multikey"); | ||
563 | config.setGroup("colors"); | ||
564 | |||
565 | QStringList color; | ||
566 | color = config.readListEntry("keycolor", QChar(',')); | ||
567 | if (color.isEmpty()) { | ||
568 | color = QStringList::split(",", "240,240,240"); | ||
569 | config.writeEntry("keycolor", color.join(",")); | ||
570 | |||
571 | } | ||
572 | keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | ||
573 | |||
574 | color = config.readListEntry("keycolor_pressed", QChar(',')); | ||
575 | if (color.isEmpty()) { | ||
576 | color = QStringList::split(",", "171,183,198"); | ||
577 | config.writeEntry("keycolor_pressed", color.join(",")); | ||
578 | |||
579 | } | ||
580 | keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | ||
581 | |||
582 | color = config.readListEntry("keycolor_lines", QChar(',')); | ||
583 | if (color.isEmpty()) { | ||
584 | color = QStringList::split(",", "138,148,160"); | ||
585 | config.writeEntry("keycolor_lines", color.join(",")); | ||
586 | |||
587 | } | ||
588 | keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | ||
589 | |||
590 | color = config.readListEntry("textcolor", QChar(',')); | ||
591 | if (color.isEmpty()) { | ||
592 | color = QStringList::split(",", "43,54,68"); | ||
593 | config.writeEntry("textcolor", color.join(",")); | ||
594 | |||
595 | } | ||
596 | textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); | ||
597 | |||
598 | } | ||
599 | |||
551 | /* korean input functions {{{1 | 600 | /* korean input functions {{{1 |
552 | * | 601 | * |
553 | * TODO | 602 | * TODO |