summaryrefslogtreecommitdiff
authorhash <hash>2002-10-20 14:04:33 (UTC)
committer hash <hash>2002-10-20 14:04:33 (UTC)
commit6924185b50abfa448daa16a9f7cb6e532ec77ff9 (patch) (side-by-side diff)
treecd00862fc27c3739e7658e6dfaa39624197d8452
parent97be4ef8e0579791095b2383e942cc53dd1e7fba (diff)
downloadopie-6924185b50abfa448daa16a9f7cb6e532ec77ff9.zip
opie-6924185b50abfa448daa16a9f7cb6e532ec77ff9.tar.gz
opie-6924185b50abfa448daa16a9f7cb6e532ec77ff9.tar.bz2
added preliminary support for configuring the keyboard for each profile.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/default.cpp8
-rw-r--r--noncore/apps/opie-console/default.h1
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp33
-rw-r--r--noncore/apps/opie-console/function_keyboard.h16
-rw-r--r--noncore/apps/opie-console/metafactory.cpp20
-rw-r--r--noncore/apps/opie-console/metafactory.h5
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.cpp11
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.h11
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp20
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h7
10 files changed, 123 insertions, 9 deletions
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index 8b905e1..0160b56 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -6,12 +6,13 @@
#include "filereceive.h"
#include "serialconfigwidget.h"
#include "irdaconfigwidget.h"
#include "btconfigwidget.h"
#include "modemconfigwidget.h"
#include "terminalwidget.h"
+#include "function_keyboard.h"
#include "MyPty.h"
#include "default.h"
extern "C" {
// FILE Transfer Stuff
@@ -73,12 +74,17 @@ extern "C" {
// Terminal Widget(s)
ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) {
return new TerminalWidget(na, wid,0 );
}
+ // Function Keyboard Widget
+ ProfileDialogWidget* newKeyboardWidget(const QString& na, QWidget *wid) {
+ return new FunctionKeyboardConfig(na, wid);
+ }
+
/* // VT Emulations
EmulationLayer* newVT102( WidgetLayer* wid ) {
return new Vt102Emulation( wid );
}
*/
};
@@ -102,12 +108,14 @@ Default::Default( MetaFactory* fact ) {
fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget );
fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget );
fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget );
fact->addConnectionWidgetFactory( "console", QObject::tr("Console"), newConsoleWid );
fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
+ fact->addKeyboardWidgetFactory( "defaultKeys", QObject::tr("Default Keyboard"),
+ newKeyboardWidget );
// fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 );
}
Default::~Default() {
}
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h
index b8cda03..5b542f5 100644
--- a/noncore/apps/opie-console/default.h
+++ b/noncore/apps/opie-console/default.h
@@ -22,12 +22,13 @@ extern "C" {
ProfileDialogWidget* newSerialWidget(const QString&, QWidget* );
ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* );
ProfileDialogWidget* newBTWidget (const QString&, QWidget* );
ProfileDialogWidget* newConsoleWid (const QString&, QWidget* );
ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
+ ProfileDialogWidget* newKeyboardWidget(const QString&, QWidget* );
// EmulationLayer* newVT102( WidgetLayer* );
};
class MetaFactory;
struct Default {
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index 4119ad4..fd20e99 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,22 +1,23 @@
#include "function_keyboard.h"
#include <qsizepolicy.h>
#include <qevent.h>
#include <qwindowsystem_qws.h>
#include <qapplication.h>
+#include <qlayout.h>
FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
QFrame(parent), numRows(2), numCols(11),
pressedRow(0), pressedCol(0) {
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
Config conf("opie-console-keys");
conf.setGroup("keys");
- for (int r = 0; r < numRows; r++)
- for (int c = 0; c < numCols; c++) {
+ 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;
@@ -56,14 +57,14 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) {
for (int i = 0; i <= height(); i += keyHeight) {
p.drawLine(0, i, width(), i);
}
- for (int r = 0; r < numRows; r++) {
- for (int c = 0; c < numCols; c++) {
+ 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)) {
p.drawText(
c * keyWidth + 1, r * keyHeight + 1,
@@ -152,6 +153,30 @@ void FunctionKeyboard::loadDefaults() {
keys.insert( "r1c7", FKey ("Ho", 4112, 0));
keys.insert( "r1c8", FKey ("End", 4113, 0));
keys.insert( "r1c9", FKey ("PU", 4118, 0));
keys.insert( "r1c10", FKey ("PD", 4119, 0));
}
+
+
+FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) :
+ ProfileDialogKeyWidget(name, parent) {
+
+
+ FunctionKeyboard *kb = new FunctionKeyboard(this);
+ QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this);
+ QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this);
+
+ QVBoxLayout *root = new QVBoxLayout(this, 2);
+ root->addWidget(kb);
+ root->addWidget(dimentions);
+ root->addWidget(editKey);
+}
+FunctionKeyboardConfig::~FunctionKeyboardConfig() {
+
+}
+void FunctionKeyboardConfig::load (const Profile& prof) {
+
+}
+void FunctionKeyboardConfig::save (Profile& prof) {
+
+}
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h
index 8d05e2b..2be74b4 100644
--- a/noncore/apps/opie-console/function_keyboard.h
+++ b/noncore/apps/opie-console/function_keyboard.h
@@ -1,13 +1,16 @@
#ifndef OPIE_FUNCTION_KEYBOARD_H
#define OPIE_FUNCTION_KEYBOARD_H
#include <qpe/config.h>
#include <qframe.h>
#include <qpainter.h>
+#include <qvbox.h>
+#include <qgroupbox.h>
#include <qmap.h>
+#include "profiledialogwidget.h"
class FKey {
public:
FKey(): qcode(0), unicode(0) {};
@@ -61,7 +64,20 @@ private:
int pressedRow, pressedCol;
QObject *parent;
};
+class FunctionKeyboardConfig : public ProfileDialogKeyWidget {
+ Q_OBJECT
+public:
+ FunctionKeyboardConfig(const QString& name, QWidget *wid);
+ ~FunctionKeyboardConfig();
+
+ void load(const Profile&);
+ void save(Profile&);
+
+private:
+
+};
+
#endif
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index 04a5dfa..0b43e17 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -15,12 +15,19 @@ void MetaFactory::addConnectionWidgetFactory( const QCString& name,
void MetaFactory::addTerminalWidgetFactory( const QCString& name,
const QString& str,
configWidget wid ) {
m_strings.insert( str, name );
m_termFact.insert( str, wid );
}
+void MetaFactory::addKeyboardWidgetFactory( const QCString& name,
+ const QString & str,
+ configWidget wid) {
+ m_strings.insert( str, name );
+ m_keyFact.insert( str, wid );
+
+}
void MetaFactory::addIOLayerFactory( const QCString& name,
const QString& str,
iolayer lay) {
m_strings.insert( str, name );
m_layerFact.insert( str, lay );
}
@@ -125,12 +132,25 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget
it = m_termFact.find( str );
if ( it != m_termFact.end() ) {
wid = (*(it.data() ) )(str,parent);
}
return wid;
}
+ProfileDialogWidget *MetaFactory::newKeyboardPlugin( const QString& str, QWidget *parent) {
+
+ if (str.isEmpty() )
+ return 0l;
+ ProfileDialogWidget* wid = 0l;
+
+ QMap<QString, configWidget>::Iterator it;
+ it = m_keyFact.find( str );
+ if ( it != m_keyFact.end() ) {
+ wid = (*(it.data() ) )(str,parent);
+ }
+ return wid;
+}
EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) {
EmulationLayer* lay = 0l;
QMap<QString, emulationLayer>::Iterator it;
it = m_emu.find( str );
if ( it != m_emu.end() ) {
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index d6aa5e2..f89136c 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -37,12 +37,15 @@ public:
void addConnectionWidgetFactory( const QCString& internalName,
const QString& uiString,
configWidget );
void addTerminalWidgetFactory ( const QCString& internalName,
const QString& name,
configWidget );
+ void addKeyboardWidgetFactory ( const QCString& internalName,
+ const QString& name,
+ configWidget );
/**
* adds an IOLayer factory
*/
void addIOLayerFactory( const QCString&,
const QString&,
@@ -80,12 +83,13 @@ public:
/**
* the generation...
*/
IOLayer* newIOLayer( const QString&,const Profile& );
ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* );
ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
+ ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* );
EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* );
FileTransferLayer* newFileTransfer(const QString&, IOLayer* );
ReceiveLayer* newReceive(const QString&, IOLayer* );
/*
* internal takes the maybe translated
@@ -102,12 +106,13 @@ public:
private:
QMap<QString, QCString> m_strings;
QMap<QString, configWidget> m_conFact;
QMap<QString, configWidget> m_termFact;
+ QMap<QString, configWidget> m_keyFact;
QMap<QString, iolayer> m_layerFact;
QMap<QString, filelayer> m_fileFact;
QMap<QString, receivelayer> m_receiveFact;
QMap<QString, emulationLayer> m_emu;
};
diff --git a/noncore/apps/opie-console/profiledialogwidget.cpp b/noncore/apps/opie-console/profiledialogwidget.cpp
index 24d59bf..caad998 100644
--- a/noncore/apps/opie-console/profiledialogwidget.cpp
+++ b/noncore/apps/opie-console/profiledialogwidget.cpp
@@ -27,6 +27,17 @@ ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na,
}
ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() {
}
ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const {
return Connection;
}
+ProfileDialogKeyWidget::ProfileDialogKeyWidget( const QString &na,
+ QWidget *parent,
+ const char *name)
+ : ProfileDialogWidget(na, parent, name )
+{
+}
+ProfileDialogKeyWidget::~ProfileDialogKeyWidget() {
+}
+ProfileDialogWidget::Type ProfileDialogKeyWidget::type() const{
+ return Keyboard;
+}
diff --git a/noncore/apps/opie-console/profiledialogwidget.h b/noncore/apps/opie-console/profiledialogwidget.h
index 5d279e6..9d2d5ec 100644
--- a/noncore/apps/opie-console/profiledialogwidget.h
+++ b/noncore/apps/opie-console/profiledialogwidget.h
@@ -7,13 +7,14 @@
class ProfileDialogWidget : public QWidget {
Q_OBJECT
public:
enum Type {
Connection,
- Terminal
+ Terminal,
+ Keyboard
};
ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l);
~ProfileDialogWidget();
/*
* load data from a Profile into
@@ -43,8 +44,16 @@ public:
ProfileDialogConnectionWidget( const QString& name, QWidget* parent,
const char* name =0l);
~ProfileDialogConnectionWidget();
Type type() const;
};
+class ProfileDialogKeyWidget : public ProfileDialogWidget {
+ Q_OBJECT
+public:
+ ProfileDialogKeyWidget( const QString &name, QWidget* parent,
+ const char *name =0l);
+ ~ProfileDialogKeyWidget();
+ Type type() const;
+};
#endif
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index d124067..2dfc0fd 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -50,27 +50,29 @@ Profile ProfileEditorDialog::profile() const
{
return m_prof;
}
void ProfileEditorDialog::initUI()
{
- m_con = m_term = 0l;
+ m_con = m_term = m_key = 0l;
QVBoxLayout *mainLayout = new QVBoxLayout( this );
tabWidget = new OTabWidget( this );
tabWidget->setTabStyle(OTabWidget::TextTab);
mainLayout->add(tabWidget);
/* base tabs */
tabprof = new QWidget(this);
m_tabTerm = new QWidget(this);
m_tabCon = new QWidget(this);
+ m_tabKey = new QWidget(this);
/* base layout for tabs */
m_layCon = new QHBoxLayout( m_tabCon , 2 );
m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
+ m_layKey = new QHBoxLayout( m_tabKey, 2 );
// profile tab
QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
m_name = new QLineEdit(tabprof);
QLabel *con = new QLabel(tr("Connection"), tabprof );
@@ -91,12 +93,13 @@ void ProfileEditorDialog::initUI()
vbox3->addStretch(1);
m_showconntab = 0;
tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
//tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
+ tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys"));
tabWidget->setCurrentTab( tabprof );
// fill the comboboxes
QStringList list = m_fact->connectionWidgets();
QStringList::Iterator it;
@@ -109,12 +112,13 @@ void ProfileEditorDialog::initUI()
}
// load profile values
m_name->setText(m_prof.name());
slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
slotTermActivated( m_fact->external(m_prof.terminalName() ) );
+ slotKeyActivated( "Default Keyboard" );
setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
m_autoConnect->setChecked(m_prof.autoConnect());
// signal and slots
@@ -147,12 +151,14 @@ void ProfileEditorDialog::accept()
m_prof.setAutoConnect( m_autoConnect->isChecked() );
if (m_con )
m_con->save( m_prof );
if (m_term )
m_term->save( m_prof );
+ if (m_key)
+ m_key->save( m_prof );
QDialog::accept();
}
QString ProfileEditorDialog::profName()const
@@ -175,12 +181,13 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) {
delete m_con;
m_con = m_fact->newConnectionPlugin( str, m_tabCon );
if ( m_con ) {
m_con->load( m_prof );
m_layCon->addWidget( m_con );
+
if(!m_showconntab)
{
tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") );
tabWidget->setCurrentTab( tabprof );
m_showconntab = 1;
}
@@ -199,6 +206,17 @@ void ProfileEditorDialog::slotTermActivated( const QString& str ) {
if (m_term) {
m_term->load(m_prof );
m_layTerm->addWidget( m_term );
}
}
+void ProfileEditorDialog::slotKeyActivated(const QString &str) {
+ delete m_key;
+ m_key = m_fact->newKeyboardPlugin( str, m_tabKey );
+
+ if (m_key) {
+
+ m_key->load(m_prof);
+ m_layKey->addWidget(m_key);
+ }
+
+}
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index cbda689..6216660 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -30,12 +30,13 @@ public:
public slots:
void accept();
private slots:
void slotConActivated(const QString& );
void slotTermActivated( const QString& );
+ void slotKeyActivated(const QString&);
private:
void initUI();
QString profName()const;
QCString profType()const;
MetaFactory* m_fact;
@@ -43,15 +44,15 @@ private:
Profile m_prof;
QLineEdit *m_name;
QComboBox *m_conCmb, *m_termCmb;
QCheckBox *m_autoConnect;
- QWidget *m_tabCon, *m_tabTerm;
- ProfileDialogWidget* m_con, *m_term;
- QHBoxLayout *m_layCon, *m_layTerm;
+ QWidget *m_tabCon, *m_tabTerm, *m_tabKey;
+ ProfileDialogWidget* m_con, *m_term, *m_key;
+ QHBoxLayout *m_layCon, *m_layTerm, *m_layKey;
OTabWidget *tabWidget;
QWidget *tabprof;
int m_showconntab;
};
#endif