author | hash <hash> | 2002-08-15 19:29:19 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-15 19:29:19 (UTC) |
commit | d9cc9bedf72e921f8f7d8edeb189db127c5651e3 (patch) (side-by-side diff) | |
tree | e43631d8b74db204d9c60c34b0782aa37df185c2 /inputmethods/multikey/keyboard.cpp | |
parent | f568b83e0ef16a0e3b46d41b2cfaa5fdda9d1d45 (diff) | |
download | opie-d9cc9bedf72e921f8f7d8edeb189db127c5651e3.zip opie-d9cc9bedf72e921f8f7d8edeb189db127c5651e3.tar.gz opie-d9cc9bedf72e921f8f7d8edeb189db127c5651e3.tar.bz2 |
changed the keymap selector widget style
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 2a80f1e..b71f929 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp @@ -4,108 +4,115 @@ ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "keyboard.h" #include "configdlg.h" #include <qpe/global.h> #include <qpe/qcopenvelope_qws.h> #include <qwindowsystem_qws.h> #include <qpainter.h> #include <qfontmetrics.h> #include <qtimer.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <ctype.h> #include <qfile.h> #include <qtextstream.h> -#include <iostream.h> #include <sys/utsname.h> #define USE_SMALL_BACKSPACE /* Keyboard::Keyboard {{{1 */ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), configdlg(0) { // get the default font Config *config = new Config( "qpe" ); config->setGroup( "Appearance" ); QString familyStr = config->readEntry( "FontFamily", "fixed" ); delete config; config = new Config("multikey"); config->setGroup ("pickboard"); usePicks = config->readBoolEntry ("open", "0"); // default closed delete config; setFont( QFont( familyStr, 10 ) ); picks = new KeyboardPicks( this ); picks->setFont( QFont( familyStr, 10 ) ); picks->initialise(); if (usePicks) { QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); } else picks->hide(); keys = new Keys(); repeatTimer = new QTimer( this ); connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); } +Keyboard::~Keyboard() { + + if ( configdlg ) { + delete (ConfigDlg *) configdlg; + configdlg = 0; + } + +} /* Keyboard::resizeEvent {{{1 */ void Keyboard::resizeEvent(QResizeEvent*) { int ph = picks->sizeHint().height(); picks->setGeometry( 0, 0, width(), ph ); keyHeight = (height()-(usePicks ? ph : 0))/5; int nk; // number of keys? if ( useLargeKeys ) { nk = 15; } else { nk = 19; } defaultKeyWidth = (width()/nk)/2; xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? } /* KeyboardPicks::initialize {{{1 */ void KeyboardPicks::initialise() { setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); mode = 0; dc = new KeyboardConfig(this); configs.append(dc); } /* KeyboardPicks::sizeHint {{{1 */ QSize KeyboardPicks::sizeHint() const { return QSize(240,fontMetrics().lineSpacing()); @@ -930,65 +937,64 @@ void Keys::setKeysFromFile(const char * filename) { delete [] (xpm[i]); } setKey(row, qcode, unicode, width, xpm2pix); } // shift map else if (buf.contains(QRegExp("^[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { QTextStream tmp (buf, IO_ReadOnly); ushort lower, shift; tmp >> lower >> shift; shiftMap.insert(lower, shift); buf = t.readLine(); } // other variables like lang & title else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { QTextStream tmp (buf, IO_ReadOnly); QString name, equals, value; tmp >> name >> equals >> value; if (name == "lang") { lang = value; } - cout << name << " = " << value << "\n"; buf = t.readLine(); } // comments else if (buf.contains(QRegExp("^\\s*#"))) { buf = t.readLine(); } else { // blank line, or garbage buf = t.readLine(); } } f.close(); } } // Keys::setKey {{{2 void Keys::setKey(const int row, const int qcode, const ushort unicode, const int width, QPixmap *pix) { Key * key; key = new Key; key->qcode = qcode; key->unicode = unicode; key->width = width; // share key->pressed between same keys bool found = 0; for (int i = 1; i <= 5; i++) { |