author | hash <hash> | 2002-10-20 14:04:33 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-20 14:04:33 (UTC) |
commit | 6924185b50abfa448daa16a9f7cb6e532ec77ff9 (patch) (unidiff) | |
tree | cd00862fc27c3739e7658e6dfaa39624197d8452 /noncore/apps | |
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 | |||
@@ -11,2 +11,3 @@ | |||
11 | #include "terminalwidget.h" | 11 | #include "terminalwidget.h" |
12 | #include "function_keyboard.h" | ||
12 | #include "MyPty.h" | 13 | #include "MyPty.h" |
@@ -78,2 +79,7 @@ extern "C" { | |||
78 | 79 | ||
80 | // Function Keyboard Widget | ||
81 | ProfileDialogWidget* newKeyboardWidget(const QString& na, QWidget *wid) { | ||
82 | return new FunctionKeyboardConfig(na, wid); | ||
83 | } | ||
84 | |||
79 | /* // VT Emulations | 85 | /* // VT Emulations |
@@ -107,2 +113,4 @@ Default::Default( MetaFactory* fact ) { | |||
107 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); | 113 | fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget ); |
114 | fact->addKeyboardWidgetFactory( "defaultKeys", QObject::tr("Default Keyboard"), | ||
115 | newKeyboardWidget ); | ||
108 | 116 | ||
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 | |||
@@ -27,2 +27,3 @@ extern "C" { | |||
27 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); | 27 | ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); |
28 | ProfileDialogWidget* newKeyboardWidget(const QString&, QWidget* ); | ||
28 | 29 | ||
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 | |||
@@ -5,2 +5,3 @@ | |||
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <qlayout.h> | ||
6 | 7 | ||
@@ -14,4 +15,4 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | |||
14 | conf.setGroup("keys"); | 15 | conf.setGroup("keys"); |
15 | for (int r = 0; r < numRows; r++) | 16 | for (uint r = 0; r < numRows; r++) |
16 | for (int c = 0; c < numCols; c++) { | 17 | for (uint c = 0; c < numCols; c++) { |
17 | 18 | ||
@@ -61,4 +62,4 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) { | |||
61 | 62 | ||
62 | for (int r = 0; r < numRows; r++) { | 63 | for (uint r = 0; r < numRows; r++) { |
63 | for (int c = 0; c < numCols; c++) { | 64 | for (uint c = 0; c < numCols; c++) { |
64 | 65 | ||
@@ -157 +158,25 @@ void FunctionKeyboard::loadDefaults() { | |||
157 | } | 158 | } |
159 | |||
160 | |||
161 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : | ||
162 | ProfileDialogKeyWidget(name, parent) { | ||
163 | |||
164 | |||
165 | FunctionKeyboard *kb = new FunctionKeyboard(this); | ||
166 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); | ||
167 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit"), this); | ||
168 | |||
169 | QVBoxLayout *root = new QVBoxLayout(this, 2); | ||
170 | root->addWidget(kb); | ||
171 | root->addWidget(dimentions); | ||
172 | root->addWidget(editKey); | ||
173 | } | ||
174 | FunctionKeyboardConfig::~FunctionKeyboardConfig() { | ||
175 | |||
176 | } | ||
177 | void FunctionKeyboardConfig::load (const Profile& prof) { | ||
178 | |||
179 | } | ||
180 | void FunctionKeyboardConfig::save (Profile& prof) { | ||
181 | |||
182 | } | ||
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 | |||
@@ -6,3 +6,6 @@ | |||
6 | #include <qpainter.h> | 6 | #include <qpainter.h> |
7 | #include <qvbox.h> | ||
8 | #include <qgroupbox.h> | ||
7 | #include <qmap.h> | 9 | #include <qmap.h> |
10 | #include "profiledialogwidget.h" | ||
8 | 11 | ||
@@ -66,2 +69,15 @@ private: | |||
66 | 69 | ||
70 | class FunctionKeyboardConfig : public ProfileDialogKeyWidget { | ||
71 | Q_OBJECT | ||
72 | public: | ||
73 | FunctionKeyboardConfig(const QString& name, QWidget *wid); | ||
74 | ~FunctionKeyboardConfig(); | ||
75 | |||
76 | void load(const Profile&); | ||
77 | void save(Profile&); | ||
78 | |||
79 | private: | ||
80 | |||
81 | }; | ||
82 | |||
67 | #endif | 83 | #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 | |||
@@ -20,2 +20,9 @@ void MetaFactory::addTerminalWidgetFactory( const QCString& name, | |||
20 | } | 20 | } |
21 | void MetaFactory::addKeyboardWidgetFactory( const QCString& name, | ||
22 | const QString & str, | ||
23 | configWidget wid) { | ||
24 | m_strings.insert( str, name ); | ||
25 | m_keyFact.insert( str, wid ); | ||
26 | |||
27 | } | ||
21 | void MetaFactory::addIOLayerFactory( const QCString& name, | 28 | void MetaFactory::addIOLayerFactory( const QCString& name, |
@@ -130,2 +137,15 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget | |||
130 | } | 137 | } |
138 | ProfileDialogWidget *MetaFactory::newKeyboardPlugin( const QString& str, QWidget *parent) { | ||
139 | |||
140 | if (str.isEmpty() ) | ||
141 | return 0l; | ||
142 | ProfileDialogWidget* wid = 0l; | ||
143 | |||
144 | QMap<QString, configWidget>::Iterator it; | ||
145 | it = m_keyFact.find( str ); | ||
146 | if ( it != m_keyFact.end() ) { | ||
147 | wid = (*(it.data() ) )(str,parent); | ||
148 | } | ||
149 | return wid; | ||
150 | } | ||
131 | EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { | 151 | EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { |
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 | |||
@@ -42,2 +42,5 @@ public: | |||
42 | configWidget ); | 42 | configWidget ); |
43 | void addKeyboardWidgetFactory ( const QCString& internalName, | ||
44 | const QString& name, | ||
45 | configWidget ); | ||
43 | 46 | ||
@@ -85,2 +88,3 @@ public: | |||
85 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); | 88 | ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* ); |
89 | ProfileDialogWidget* newKeyboardPlugin( const QString&, QWidget* ); | ||
86 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); | 90 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); |
@@ -107,2 +111,3 @@ private: | |||
107 | QMap<QString, configWidget> m_termFact; | 111 | QMap<QString, configWidget> m_termFact; |
112 | QMap<QString, configWidget> m_keyFact; | ||
108 | QMap<QString, iolayer> m_layerFact; | 113 | QMap<QString, iolayer> m_layerFact; |
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 | |||
@@ -32 +32,12 @@ ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { | |||
32 | } | 32 | } |
33 | ProfileDialogKeyWidget::ProfileDialogKeyWidget( const QString &na, | ||
34 | QWidget *parent, | ||
35 | const char *name) | ||
36 | : ProfileDialogWidget(na, parent, name ) | ||
37 | { | ||
38 | } | ||
39 | ProfileDialogKeyWidget::~ProfileDialogKeyWidget() { | ||
40 | } | ||
41 | ProfileDialogWidget::Type ProfileDialogKeyWidget::type() const{ | ||
42 | return Keyboard; | ||
43 | } | ||
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 | |||
@@ -12,3 +12,4 @@ public: | |||
12 | Connection, | 12 | Connection, |
13 | Terminal | 13 | Terminal, |
14 | Keyboard | ||
14 | }; | 15 | }; |
@@ -48,2 +49,10 @@ public: | |||
48 | }; | 49 | }; |
50 | class ProfileDialogKeyWidget : public ProfileDialogWidget { | ||
51 | Q_OBJECT | ||
52 | public: | ||
53 | ProfileDialogKeyWidget( const QString &name, QWidget* parent, | ||
54 | const char *name =0l); | ||
55 | ~ProfileDialogKeyWidget(); | ||
56 | Type type() const; | ||
57 | }; | ||
49 | 58 | ||
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 | |||
@@ -55,3 +55,3 @@ void ProfileEditorDialog::initUI() | |||
55 | { | 55 | { |
56 | m_con = m_term = 0l; | 56 | m_con = m_term = m_key = 0l; |
57 | 57 | ||
@@ -66,2 +66,3 @@ void ProfileEditorDialog::initUI() | |||
66 | m_tabCon = new QWidget(this); | 66 | m_tabCon = new QWidget(this); |
67 | m_tabKey = new QWidget(this); | ||
67 | 68 | ||
@@ -70,2 +71,3 @@ void ProfileEditorDialog::initUI() | |||
70 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); | 71 | m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); |
72 | m_layKey = new QHBoxLayout( m_tabKey, 2 ); | ||
71 | 73 | ||
@@ -96,2 +98,3 @@ void ProfileEditorDialog::initUI() | |||
96 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); | 98 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); |
99 | tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); | ||
97 | tabWidget->setCurrentTab( tabprof ); | 100 | tabWidget->setCurrentTab( tabprof ); |
@@ -114,2 +117,3 @@ void ProfileEditorDialog::initUI() | |||
114 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); | 117 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); |
118 | slotKeyActivated( "Default Keyboard" ); | ||
115 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); | 119 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); |
@@ -152,2 +156,4 @@ void ProfileEditorDialog::accept() | |||
152 | m_term->save( m_prof ); | 156 | m_term->save( m_prof ); |
157 | if (m_key) | ||
158 | m_key->save( m_prof ); | ||
153 | 159 | ||
@@ -180,2 +186,3 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) { | |||
180 | m_layCon->addWidget( m_con ); | 186 | m_layCon->addWidget( m_con ); |
187 | |||
181 | if(!m_showconntab) | 188 | if(!m_showconntab) |
@@ -204 +211,12 @@ void ProfileEditorDialog::slotTermActivated( const QString& str ) { | |||
204 | 211 | ||
212 | void ProfileEditorDialog::slotKeyActivated(const QString &str) { | ||
213 | delete m_key; | ||
214 | m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); | ||
215 | |||
216 | if (m_key) { | ||
217 | |||
218 | m_key->load(m_prof); | ||
219 | m_layKey->addWidget(m_key); | ||
220 | } | ||
221 | |||
222 | } | ||
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 | |||
@@ -35,2 +35,3 @@ private slots: | |||
35 | void slotTermActivated( const QString& ); | 35 | void slotTermActivated( const QString& ); |
36 | void slotKeyActivated(const QString&); | ||
36 | private: | 37 | private: |
@@ -48,5 +49,5 @@ private: | |||
48 | 49 | ||
49 | QWidget *m_tabCon, *m_tabTerm; | 50 | QWidget *m_tabCon, *m_tabTerm, *m_tabKey; |
50 | ProfileDialogWidget* m_con, *m_term; | 51 | ProfileDialogWidget* m_con, *m_term, *m_key; |
51 | QHBoxLayout *m_layCon, *m_layTerm; | 52 | QHBoxLayout *m_layCon, *m_layTerm, *m_layKey; |
52 | OTabWidget *tabWidget; | 53 | OTabWidget *tabWidget; |