author | erik <erik> | 2007-01-29 21:33:42 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-29 21:33:42 (UTC) |
commit | 777cace646507cf4222f0a6d5beb2cd44ec45a0a (patch) (side-by-side diff) | |
tree | f6829136208c3f5929d82feffe0dd132194431e3 /noncore/apps | |
parent | 5a58a5974cb4dd017e6989d5ebca876b5764b0df (diff) | |
download | opie-777cace646507cf4222f0a6d5beb2cd44ec45a0a.zip opie-777cace646507cf4222f0a6d5beb2cd44ec45a0a.tar.gz opie-777cace646507cf4222f0a6d5beb2cd44ec45a0a.tar.bz2 |
Strictly removal of cruft (commented out old code).
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 389618c..c3209f4 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp @@ -1,137 +1,115 @@ #include "function_keyboard.h" /* QT */ #include <qlayout.h> #include <qlistbox.h> #include <qlabel.h> #include <qdir.h> #define DEFAULT_ROWS 2 #define DEFAULT_COLS 12 /* FunctionKeyboard {{{1 */ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), pressedRow(0), pressedCol(0) { setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); - /* - * all the saving/loading is now done in a profile. downside is that you cant modify - * the keyboard for all profiles, but must do it on a profile-basis - * - - Config conf("opie-console-keys"); - conf.setGroup("keys"); - for (uint r = 0; r < numRows; r++) - for (uint c = 0; c < numCols; c++) { - - QString handle = "r" + QString::number(r) + "c" + QString::number(c); - QStringList value_list = conf.readListEntry( handle, '|'); - - if (value_list.isEmpty()) continue; - - keys.insert( - - handle, - FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) - ); - } - */ if (keys.isEmpty()) loadDefaults(); } FunctionKeyboard::~FunctionKeyboard() {} void FunctionKeyboard::changeRows(int r) { numRows = r; // have to do this so the whole thing gets redrawn hide(); show(); } void FunctionKeyboard::changeCols(int c) { numCols = c; keyWidth = (double)width()/numCols; // have to reset this thing too 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( Opie::Core::OResource::loadPixmap( "console/keys/" + l[1] ) ); } } } if (keys.isEmpty()) loadDefaults(); hide(); show(); } void FunctionKeyboard::paintEvent(QPaintEvent *e) { QPainter p(this); p.setClipRect(e->rect()); p.fillRect(0, 0, width(), height(), QColor(255,255,255)); p.setPen(QColor(0,0,0)); /* those decimals do count! becomes short if use plain int */ for (double i = 0; i <= width(); i += keyWidth) { p.drawLine((int)i, 0, (int)i, height()); } // sometimes the last line doesnt get drawn p.drawLine(width() -1, 0, width() -1, height()); for (int i = 0; i <= height(); i += keyHeight) { p.drawLine(0, i, width(), i); } for (uint r = 0; r < numRows; r++) { for (uint c = 0; c < numCols; c++) { QString handle = "r" + QString::number(r) + "c" + QString::number(c); if (keys.contains(handle)) { if (keys[handle].pixFile.isEmpty()) p.drawText( c * keyWidth + 1, r * keyHeight + 1, keyWidth, keyHeight, Qt::AlignHCenter | Qt::AlignVCenter, keys[handle].label ); else { ushort centerX = (ushort)(c *keyWidth) + (ushort)(keyWidth - keys[handle].pix->width()) / 2; ushort centerY = r * keyHeight + (keyHeight - keys[handle].pix->height()) / 2; p.drawPixmap(centerX, centerY, *keys[handle].pix); } |