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) (show 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
@@ -8,8 +8,9 @@
#include "irdaconfigwidget.h"
#include "btconfigwidget.h"
#include "modemconfigwidget.h"
#include "terminalwidget.h"
+#include "function_keyboard.h"
#include "MyPty.h"
#include "default.h"
@@ -75,8 +76,13 @@ extern "C" {
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 );
}
@@ -104,8 +110,10 @@ Default::Default( MetaFactory* fact ) {
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
@@ -24,8 +24,9 @@ extern "C" {
ProfileDialogWidget* newBTWidget (const QString&, QWidget* );
ProfileDialogWidget* newConsoleWid (const QString&, QWidget* );
ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
+ ProfileDialogWidget* newKeyboardWidget(const QString&, QWidget* );
// EmulationLayer* newVT102( WidgetLayer* );
};
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
@@ -2,8 +2,9 @@
#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) {
@@ -11,10 +12,10 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
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, '|');
@@ -58,10 +59,10 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) {
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)) {
@@ -154,4 +155,28 @@ void FunctionKeyboard::loadDefaults() {
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
@@ -3,9 +3,12 @@
#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:
@@ -63,5 +66,18 @@ private:
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
@@ -17,8 +17,15 @@ void MetaFactory::addTerminalWidgetFactory( const QCString& name,
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 );
@@ -127,8 +134,21 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget
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;
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
@@ -39,8 +39,11 @@ public:
configWidget );
void addTerminalWidgetFactory ( const QCString& internalName,
const QString& name,
configWidget );
+ void addKeyboardWidgetFactory ( const QCString& internalName,
+ const QString& name,
+ configWidget );
/**
* adds an IOLayer factory
*/
@@ -82,8 +85,9 @@ public:
*/
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* );
@@ -104,8 +108,9 @@ 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
@@ -29,4 +29,15 @@ 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
@@ -9,9 +9,10 @@ class ProfileDialogWidget : public QWidget {
Q_OBJECT
public:
enum Type {
Connection,
- Terminal
+ Terminal,
+ Keyboard
};
ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l);
~ProfileDialogWidget();
@@ -45,6 +46,14 @@ public:
~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
@@ -52,9 +52,9 @@ Profile ProfileEditorDialog::profile() const
}
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);
@@ -63,12 +63,14 @@ void ProfileEditorDialog::initUI()
/* 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);
@@ -93,8 +95,9 @@ void ProfileEditorDialog::initUI()
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
@@ -111,8 +114,9 @@ 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());
@@ -149,8 +153,10 @@ void ProfileEditorDialog::accept()
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();
}
@@ -177,8 +183,9 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) {
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 );
@@ -201,4 +208,15 @@ void ProfileEditorDialog::slotTermActivated( const QString& str ) {
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
@@ -32,8 +32,9 @@ public slots:
private slots:
void slotConActivated(const QString& );
void slotTermActivated( const QString& );
+ void slotKeyActivated(const QString&);
private:
void initUI();
QString profName()const;
QCString profType()const;
@@ -45,11 +46,11 @@ private:
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;
};