-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 @@ -10,4 +10,5 @@ #include "modemconfigwidget.h" #include "terminalwidget.h" +#include "function_keyboard.h" #include "MyPty.h" @@ -77,4 +78,9 @@ extern "C" { } + // Function Keyboard Widget + ProfileDialogWidget* newKeyboardWidget(const QString& na, QWidget *wid) { + return new FunctionKeyboardConfig(na, wid); + } + /* // VT Emulations EmulationLayer* newVT102( WidgetLayer* wid ) { @@ -106,4 +112,6 @@ Default::Default( MetaFactory* fact ) { 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 @@ -26,4 +26,5 @@ extern "C" { 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 @@ -4,4 +4,5 @@ #include <qwindowsystem_qws.h> #include <qapplication.h> +#include <qlayout.h> FunctionKeyboard::FunctionKeyboard(QWidget *parent) : @@ -13,6 +14,6 @@ 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); @@ -60,6 +61,6 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { } - 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); @@ -156,2 +157,26 @@ void FunctionKeyboard::loadDefaults() { } + + +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 @@ -5,5 +5,8 @@ #include <qframe.h> #include <qpainter.h> +#include <qvbox.h> +#include <qgroupbox.h> #include <qmap.h> +#include "profiledialogwidget.h" class FKey { @@ -65,3 +68,16 @@ 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 @@ -19,4 +19,11 @@ void MetaFactory::addTerminalWidgetFactory( const QCString& 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, @@ -129,4 +136,17 @@ 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 @@ -41,4 +41,7 @@ public: const QString& name, configWidget ); + void addKeyboardWidgetFactory ( const QCString& internalName, + const QString& name, + configWidget ); /** @@ -84,4 +87,5 @@ public: 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* ); @@ -106,4 +110,5 @@ private: 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; 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 @@ -31,2 +31,13 @@ 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 @@ -11,5 +11,6 @@ public: enum Type { Connection, - Terminal + Terminal, + Keyboard }; ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l); @@ -47,4 +48,12 @@ public: }; +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 @@ -54,5 +54,5 @@ Profile ProfileEditorDialog::profile() const void ProfileEditorDialog::initUI() { - m_con = m_term = 0l; + m_con = m_term = m_key = 0l; QVBoxLayout *mainLayout = new QVBoxLayout( this ); @@ -65,8 +65,10 @@ void ProfileEditorDialog::initUI() 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 @@ -95,4 +97,5 @@ void ProfileEditorDialog::initUI() //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 ); @@ -113,4 +116,5 @@ void ProfileEditorDialog::initUI() 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 ); @@ -151,4 +155,6 @@ void ProfileEditorDialog::accept() if (m_term ) m_term->save( m_prof ); + if (m_key) + m_key->save( m_prof ); QDialog::accept(); @@ -179,4 +185,5 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) { m_con->load( m_prof ); m_layCon->addWidget( m_con ); + if(!m_showconntab) { @@ -203,2 +210,13 @@ 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 @@ -34,4 +34,5 @@ private slots: void slotConActivated(const QString& ); void slotTermActivated( const QString& ); + void slotKeyActivated(const QString&); private: void initUI(); @@ -47,7 +48,7 @@ private: 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; |