author | hash <hash> | 2002-10-20 14:04:33 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-20 14:04:33 (UTC) |
commit | 6924185b50abfa448daa16a9f7cb6e532ec77ff9 (patch) (side-by-side diff) | |
tree | cd00862fc27c3739e7658e6dfaa39624197d8452 /noncore | |
parent | 97be4ef8e0579791095b2383e942cc53dd1e7fba (diff) | |
download | opie-6924185b50abfa448daa16a9f7cb6e532ec77ff9.zip opie-6924185b50abfa448daa16a9f7cb6e532ec77ff9.tar.gz opie-6924185b50abfa448daa16a9f7cb6e532ec77ff9.tar.bz2 |
added preliminary support for configuring the keyboard for each profile.
-rw-r--r-- | noncore/apps/opie-console/default.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/default.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.cpp | 33 | ||||
-rw-r--r-- | noncore/apps/opie-console/function_keyboard.h | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/profiledialogwidget.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/profiledialogwidget.h | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 7 |
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 @@ -9,6 +9,7 @@ #include "btconfigwidget.h" #include "modemconfigwidget.h" #include "terminalwidget.h" +#include "function_keyboard.h" #include "MyPty.h" #include "default.h" @@ -76,6 +77,11 @@ extern "C" { 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 ); @@ -105,6 +111,8 @@ Default::Default( MetaFactory* fact ) { 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 ); } 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 @@ -25,6 +25,7 @@ extern "C" { 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 @@ -3,6 +3,7 @@ #include <qevent.h> #include <qwindowsystem_qws.h> #include <qapplication.h> +#include <qlayout.h> FunctionKeyboard::FunctionKeyboard(QWidget *parent) : QFrame(parent), numRows(2), numCols(11), @@ -12,8 +13,8 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 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, '|'); @@ -59,8 +60,8 @@ 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)) { @@ -155,3 +156,27 @@ void FunctionKeyboard::loadDefaults() { 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 @@ -4,7 +4,10 @@ #include <qpe/config.h> #include <qframe.h> #include <qpainter.h> +#include <qvbox.h> +#include <qgroupbox.h> #include <qmap.h> +#include "profiledialogwidget.h" class FKey { @@ -64,4 +67,17 @@ private: }; +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 @@ -18,6 +18,13 @@ void MetaFactory::addTerminalWidgetFactory( const QCString& name, 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) { @@ -128,6 +135,19 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget } 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; 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 @@ -40,6 +40,9 @@ public: void addTerminalWidgetFactory ( const QCString& internalName, const QString& name, configWidget ); + void addKeyboardWidgetFactory ( const QCString& internalName, + const QString& name, + configWidget ); /** * adds an IOLayer factory @@ -83,6 +86,7 @@ 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* ); @@ -105,6 +109,7 @@ 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; 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 @@ -30,3 +30,14 @@ 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 @@ -10,7 +10,8 @@ class ProfileDialogWidget : public QWidget { public: enum Type { Connection, - Terminal + Terminal, + Keyboard }; ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l); ~ProfileDialogWidget(); @@ -46,5 +47,13 @@ public: 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 @@ -53,7 +53,7 @@ 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 ); @@ -64,10 +64,12 @@ void ProfileEditorDialog::initUI() 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 @@ -94,6 +96,7 @@ void ProfileEditorDialog::initUI() 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 ); @@ -112,6 +115,7 @@ void ProfileEditorDialog::initUI() 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()); @@ -150,6 +154,8 @@ void ProfileEditorDialog::accept() m_con->save( m_prof ); if (m_term ) m_term->save( m_prof ); + if (m_key) + m_key->save( m_prof ); QDialog::accept(); } @@ -178,6 +184,7 @@ 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") ); @@ -202,3 +209,14 @@ void ProfileEditorDialog::slotTermActivated( const QString& str ) { } } +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 @@ -33,6 +33,7 @@ public slots: private slots: void slotConActivated(const QString& ); void slotTermActivated( const QString& ); + void slotKeyActivated(const QString&); private: void initUI(); QString profName()const; @@ -46,9 +47,9 @@ private: 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; |