summaryrefslogtreecommitdiff
authorhash <hash>2002-08-19 19:27:19 (UTC)
committer hash <hash>2002-08-19 19:27:19 (UTC)
commitfc58f8b2dea3629fdd486852b74e425a3da29b52 (patch) (side-by-side diff)
tree6d3393d5f04c2a5447d3d2ca489e4bd74a7e8df4
parentaaa640a47a707b4d4e6aff37bf78c11bfc903b3c (diff)
downloadopie-fc58f8b2dea3629fdd486852b74e425a3da29b52.zip
opie-fc58f8b2dea3629fdd486852b74e425a3da29b52.tar.gz
opie-fc58f8b2dea3629fdd486852b74e425a3da29b52.tar.bz2
added a 'key repeat' toggle button
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp31
-rw-r--r--inputmethods/multikey/configdlg.h3
-rw-r--r--inputmethods/multikey/keyboard.cpp37
-rw-r--r--inputmethods/multikey/keyboard.h2
4 files changed, 56 insertions, 17 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 59a290b..566b2b9 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -106,28 +106,40 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
connect(add_button, SIGNAL(clicked()), SLOT(addMap()));
remove_button = new QPushButton(tr("Remove"), add_remove_grid);
remove_button->setFlat((bool)1);
if ((int)map_dir.count() >= keymaps->currentItem())
remove_button->setDisabled(true);
connect(remove_button, SIGNAL(clicked()), SLOT(removeMap()));
- pick_button = new QCheckBox(tr("Pickboard"), gen_box);
+ // make a box that will contain the buttons on the bottom
+ QGrid *other_grid = new QGrid(2, gen_box);
+ pick_button = new QCheckBox(tr("Pickboard"), other_grid);
- config.setGroup ("pickboard");
- bool pick_open = config.readBoolEntry ("open", "0"); // default closed
+ config.setGroup ("general");
+ bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed
if (pick_open) {
pick_button->setChecked(true);
}
// by connecting it after checking it, the signal isn't emmited
connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog()));
+ repeat_button = new QCheckBox(tr("Key Repeat"), other_grid);
+ bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1);
+
+ if (repeat_on) {
+
+ repeat_button->setChecked(true);
+ }
+ connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog()));
+
+
/*
* 'color' tab
*/
QGrid *color_box = new QGrid(2, this);
color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
color_box->setMargin(3);
color_box->setSpacing(3);
@@ -164,22 +176,31 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
label = new QLabel("", color_box); // a spacer so the above buttons dont expand
label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
}
void ConfigDlg::pickTog() {
Config config ("multikey");
- config.setGroup ("pickboard");
- config.writeEntry ("open", pick_button->isChecked()); // default closed
+ config.setGroup ("general");
+ config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed
emit pickboardToggled(pick_button->isChecked());
}
+void ConfigDlg::repeatTog() {
+
+ Config config ("multikey");
+ config.setGroup ("general");
+ config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed
+
+ emit repeatToggled(repeat_button->isChecked());
+}
+
/*
* the index is kinda screwy, because in the config file, index 0 is just the
* first element in the QStringList, but here it's the "Current Language"
* listItem. therefor you have to minus one to the index before you access it.
*
*/
// ConfigDlg::setMap {{{1
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h
index ae7afe2..a000e60 100644
--- a/inputmethods/multikey/configdlg.h
+++ b/inputmethods/multikey/configdlg.h
@@ -11,31 +11,34 @@ class ConfigDlg : public QTabWidget
{
Q_OBJECT
public:
ConfigDlg ();
signals:
void pickboardToggled(bool on_off);
+ void repeatToggled(bool on_off);
void setMapToDefault();
void setMapToFile(QString map);
void reloadKeyboard();
private slots:
void pickTog();
+ void repeatTog();
void setMap(int index);
void addMap();
void removeMap();
// all those required slots for the color push buttons
void keyColorButtonClicked();
private:
QCheckBox *pick_button;
+ QCheckBox *repeat_button;
QListBox *keymaps;
QPushButton *add_button;
QPushButton *remove_button;
QStringList default_maps; // the maps in your share/multikey/ dir
QStringList custom_maps; // maps you added with the 'add' button
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 8280297..7334c1c 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -34,38 +34,38 @@
#include <qfile.h>
#include <qtextstream.h>
#include <qstringlist.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),
+ alt(0), useLargeKeys(TRUE), usePicks(0), useRepeat(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
+ config->setGroup ("general");
+ usePicks = config->readBoolEntry ("usePickboard", "0"); // default closed
+ useRepeat = config->readBoolEntry ("useRepeat", "1");
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) ),
@@ -279,22 +279,24 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
if (qkeycode == Qt::Key_F1) { // toggle the pickboard
if ( configdlg ) {
delete (ConfigDlg *) configdlg;
configdlg = 0;
}
else {
configdlg = new ConfigDlg ();
- connect(configdlg, SIGNAL(pickboardToggled(bool)),
- this, SLOT(togglePickboard(bool)));
connect(configdlg, SIGNAL(setMapToDefault()),
this, SLOT(setMapToDefault()));
connect(configdlg, SIGNAL(setMapToFile(QString)),
this, SLOT(setMapToFile(QString)));
+ connect(configdlg, SIGNAL(pickboardToggled(bool)),
+ this, SLOT(togglePickboard(bool)));
+ connect(configdlg, SIGNAL(repeatToggled(bool)),
+ this, SLOT(toggleRepeat(bool)));
connect(configdlg, SIGNAL(reloadKeyboard()),
this, SLOT(reloadKeyboard()));
configdlg->showMaximized();
configdlg->show();
configdlg->raise();
}
} else if (qkeycode == Qt::Key_Control) {
@@ -390,26 +392,27 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
QPainter p(this);
drawKeyboard(p, row, col);
}
- pressTid = startTimer(80);
+ if (useRepeat) repeatTimer->start( 800 );
+ //pressTid = startTimer(80);
}
/* Keyboard::mouseReleaseEvent {{{1 */
void Keyboard::mouseReleaseEvent(QMouseEvent*)
{
pressed = FALSE;
- if ( pressTid == 0 )
+ //if ( pressTid == 0 )
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
if ( unicode != -1 ) {
emit key( unicode, qkeycode, modifiers, false, false );
repeatTimer->stop();
}
#endif
if (shift && unicode != 0) {
@@ -420,34 +423,38 @@ void Keyboard::mouseReleaseEvent(QMouseEvent*)
}
else
clearHighlight();
}
/* Keyboard::timerEvent {{{1 */
-/*
+
+/* dont know what this does, but i think it is here so that if your screen
+ * sticks (like on an ipaq) then it will stop repeating if you click another
+ * key... but who knows what anything does in this thing anyway?
+
void Keyboard::timerEvent(QTimerEvent* e)
{
if ( e->timerId() == pressTid ) {
killTimer(pressTid);
pressTid = 0;
if ( !pressed )
cout << "calling clearHighlight from timerEvent\n";
- clearHighlight();
+ //clearHighlight();
}
}
*/
void Keyboard::repeat()
{
repeatTimer->start( 200 );
- emit key( unicode, 0, modifiers, true, true );
+ emit key( unicode, qkeycode, modifiers, true, true );
}
void Keyboard::clearHighlight()
{
if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) {
int tmpRow = pressedKeyRow;
int tmpCol = pressedKeyCol;
@@ -498,16 +505,22 @@ void Keyboard::togglePickboard(bool on_off)
}
/*
* this closes && opens the input method
*/
QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
}
+void Keyboard::toggleRepeat(bool on) {
+
+ useRepeat = on;
+ cout << "setting useRepeat to: " << useRepeat << "\n";
+}
+
/* Keyboard::setMapTo ... {{{1 */
void Keyboard::setMapToDefault() {
/* load current locale language map */
Config *config = new Config("locale");
config->setGroup( "Language" );
QString l = config->readEntry( "Language" , "en" );
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index 6e577ab..dc50e55 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -107,32 +107,34 @@ public:
QSize sizeHint() const;
signals:
void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool );
private slots:
void repeat();
void togglePickboard(bool on_off);
+ void toggleRepeat(bool on_off);
void setMapToDefault();
void setMapToFile(QString map);
// used to redraw keyboard after edited colors
void reloadKeyboard();
private:
int getKey( int &w, int j = -1 );
void clearHighlight();
bool *shift;
bool *lock;
bool *ctrl;
bool *alt;
uint useLargeKeys:1;
uint usePicks:1;
+ uint useRepeat:1;
int pressedKeyRow;
int pressedKeyCol;
KeyboardPicks *picks;
int keyHeight;
int defaultKeyWidth;