summaryrefslogtreecommitdiff
Unidiff
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
@@ -9,6 +9,7 @@
9#include "btconfigwidget.h" 9#include "btconfigwidget.h"
10#include "modemconfigwidget.h" 10#include "modemconfigwidget.h"
11#include "terminalwidget.h" 11#include "terminalwidget.h"
12#include "function_keyboard.h"
12#include "MyPty.h" 13#include "MyPty.h"
13 14
14#include "default.h" 15#include "default.h"
@@ -76,6 +77,11 @@ extern "C" {
76 return new TerminalWidget(na, wid,0 ); 77 return new TerminalWidget(na, wid,0 );
77 } 78 }
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
80 EmulationLayer* newVT102( WidgetLayer* wid ) { 86 EmulationLayer* newVT102( WidgetLayer* wid ) {
81 return new Vt102Emulation( wid ); 87 return new Vt102Emulation( wid );
@@ -105,6 +111,8 @@ Default::Default( MetaFactory* fact ) {
105 fact->addConnectionWidgetFactory( "console", QObject::tr("Console"), newConsoleWid ); 111 fact->addConnectionWidgetFactory( "console", QObject::tr("Console"), newConsoleWid );
106 112
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
109// fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 ); 117// fact->addEmulationLayer( "default", QObject::tr("Default Terminal"), newVT102 );
110} 118}
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" {
25 ProfileDialogWidget* newConsoleWid (const QString&, QWidget* ); 25 ProfileDialogWidget* newConsoleWid (const QString&, QWidget* );
26 26
27 ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ); 27 ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
28 ProfileDialogWidget* newKeyboardWidget(const QString&, QWidget* );
28 29
29// EmulationLayer* newVT102( WidgetLayer* ); 30// EmulationLayer* newVT102( WidgetLayer* );
30}; 31};
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 @@
3#include <qevent.h> 3#include <qevent.h>
4#include <qwindowsystem_qws.h> 4#include <qwindowsystem_qws.h>
5#include <qapplication.h> 5#include <qapplication.h>
6#include <qlayout.h>
6 7
7FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 8FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
8 QFrame(parent), numRows(2), numCols(11), 9 QFrame(parent), numRows(2), numCols(11),
@@ -12,8 +13,8 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
12 13
13 Config conf("opie-console-keys"); 14 Config conf("opie-console-keys");
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
18 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 19 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
19 QStringList value_list = conf.readListEntry( handle, '|'); 20 QStringList value_list = conf.readListEntry( handle, '|');
@@ -59,8 +60,8 @@ void FunctionKeyboard::paintEvent(QPaintEvent *e) {
59 p.drawLine(0, i, width(), i); 60 p.drawLine(0, i, width(), i);
60 } 61 }
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
65 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 66 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
66 if (keys.contains(handle)) { 67 if (keys.contains(handle)) {
@@ -155,3 +156,27 @@ void FunctionKeyboard::loadDefaults() {
155 keys.insert( "r1c10", FKey ("PD", 4119, 0)); 156 keys.insert( "r1c10", FKey ("PD", 4119, 0));
156 157
157} 158}
159
160
161FunctionKeyboardConfig::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}
174FunctionKeyboardConfig::~FunctionKeyboardConfig() {
175
176}
177void FunctionKeyboardConfig::load (const Profile& prof) {
178
179}
180void 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
@@ -4,7 +4,10 @@
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qframe.h> 5#include <qframe.h>
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
9class FKey { 12class FKey {
10 13
@@ -64,4 +67,17 @@ private:
64 67
65}; 68};
66 69
70class FunctionKeyboardConfig : public ProfileDialogKeyWidget {
71 Q_OBJECT
72public:
73 FunctionKeyboardConfig(const QString& name, QWidget *wid);
74 ~FunctionKeyboardConfig();
75
76 void load(const Profile&);
77 void save(Profile&);
78
79private:
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
@@ -18,6 +18,13 @@ void MetaFactory::addTerminalWidgetFactory( const QCString& name,
18 m_strings.insert( str, name ); 18 m_strings.insert( str, name );
19 m_termFact.insert( str, wid ); 19 m_termFact.insert( str, wid );
20} 20}
21void 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}
21void MetaFactory::addIOLayerFactory( const QCString& name, 28void MetaFactory::addIOLayerFactory( const QCString& name,
22 const QString& str, 29 const QString& str,
23 iolayer lay) { 30 iolayer lay) {
@@ -128,6 +135,19 @@ ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget
128 } 135 }
129 return wid; 136 return wid;
130} 137}
138ProfileDialogWidget *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}
131EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) { 151EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* wid) {
132 EmulationLayer* lay = 0l; 152 EmulationLayer* lay = 0l;
133 153
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:
40 void addTerminalWidgetFactory ( const QCString& internalName, 40 void addTerminalWidgetFactory ( const QCString& internalName,
41 const QString& name, 41 const QString& name,
42 configWidget ); 42 configWidget );
43 void addKeyboardWidgetFactory ( const QCString& internalName,
44 const QString& name,
45 configWidget );
43 46
44 /** 47 /**
45 * adds an IOLayer factory 48 * adds an IOLayer factory
@@ -83,6 +86,7 @@ public:
83 IOLayer* newIOLayer( const QString&,const Profile& ); 86 IOLayer* newIOLayer( const QString&,const Profile& );
84 ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* ); 87 ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* );
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* );
87 FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); 91 FileTransferLayer* newFileTransfer(const QString&, IOLayer* );
88 ReceiveLayer* newReceive(const QString&, IOLayer* ); 92 ReceiveLayer* newReceive(const QString&, IOLayer* );
@@ -105,6 +109,7 @@ private:
105 QMap<QString, QCString> m_strings; 109 QMap<QString, QCString> m_strings;
106 QMap<QString, configWidget> m_conFact; 110 QMap<QString, configWidget> m_conFact;
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;
109 QMap<QString, filelayer> m_fileFact; 114 QMap<QString, filelayer> m_fileFact;
110 QMap<QString, receivelayer> m_receiveFact; 115 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() {
30ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { 30ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const {
31 return Connection; 31 return Connection;
32} 32}
33ProfileDialogKeyWidget::ProfileDialogKeyWidget( const QString &na,
34 QWidget *parent,
35 const char *name)
36 : ProfileDialogWidget(na, parent, name )
37{
38}
39ProfileDialogKeyWidget::~ProfileDialogKeyWidget() {
40}
41ProfileDialogWidget::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
@@ -10,7 +10,8 @@ class ProfileDialogWidget : public QWidget {
10public: 10public:
11 enum Type { 11 enum Type {
12 Connection, 12 Connection,
13 Terminal 13 Terminal,
14 Keyboard
14 }; 15 };
15 ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l); 16 ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l);
16 ~ProfileDialogWidget(); 17 ~ProfileDialogWidget();
@@ -46,5 +47,13 @@ public:
46 Type type() const; 47 Type type() const;
47 48
48}; 49};
50class ProfileDialogKeyWidget : public ProfileDialogWidget {
51 Q_OBJECT
52public:
53 ProfileDialogKeyWidget( const QString &name, QWidget* parent,
54 const char *name =0l);
55 ~ProfileDialogKeyWidget();
56 Type type() const;
57};
49 58
50#endif 59#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
53 53
54void ProfileEditorDialog::initUI() 54void ProfileEditorDialog::initUI()
55{ 55{
56 m_con = m_term = 0l; 56 m_con = m_term = m_key = 0l;
57 57
58 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 58 QVBoxLayout *mainLayout = new QVBoxLayout( this );
59 tabWidget = new OTabWidget( this ); 59 tabWidget = new OTabWidget( this );
@@ -64,10 +64,12 @@ void ProfileEditorDialog::initUI()
64 tabprof = new QWidget(this); 64 tabprof = new QWidget(this);
65 m_tabTerm = new QWidget(this); 65 m_tabTerm = new QWidget(this);
66 m_tabCon = new QWidget(this); 66 m_tabCon = new QWidget(this);
67 m_tabKey = new QWidget(this);
67 68
68 /* base layout for tabs */ 69 /* base layout for tabs */
69 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 70 m_layCon = new QHBoxLayout( m_tabCon , 2 );
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
72 // profile tab 74 // profile tab
73 75
@@ -94,6 +96,7 @@ void ProfileEditorDialog::initUI()
94 tabWidget->addTab(tabprof, "", QObject::tr("Profile")); 96 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
95 //tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); 97 //tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
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 );
98 101
99 102
@@ -112,6 +115,7 @@ void ProfileEditorDialog::initUI()
112 m_name->setText(m_prof.name()); 115 m_name->setText(m_prof.name());
113 slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); 116 slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
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 );
116 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); 120 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
117 m_autoConnect->setChecked(m_prof.autoConnect()); 121 m_autoConnect->setChecked(m_prof.autoConnect());
@@ -150,6 +154,8 @@ void ProfileEditorDialog::accept()
150 m_con->save( m_prof ); 154 m_con->save( m_prof );
151 if (m_term ) 155 if (m_term )
152 m_term->save( m_prof ); 156 m_term->save( m_prof );
157 if (m_key)
158 m_key->save( m_prof );
153 159
154 QDialog::accept(); 160 QDialog::accept();
155} 161}
@@ -178,6 +184,7 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) {
178 if ( m_con ) { 184 if ( m_con ) {
179 m_con->load( m_prof ); 185 m_con->load( m_prof );
180 m_layCon->addWidget( m_con ); 186 m_layCon->addWidget( m_con );
187
181 if(!m_showconntab) 188 if(!m_showconntab)
182 { 189 {
183 tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") ); 190 tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") );
@@ -202,3 +209,14 @@ void ProfileEditorDialog::slotTermActivated( const QString& str ) {
202 } 209 }
203} 210}
204 211
212void 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
@@ -33,6 +33,7 @@ public slots:
33private slots: 33private slots:
34 void slotConActivated(const QString& ); 34 void slotConActivated(const QString& );
35 void slotTermActivated( const QString& ); 35 void slotTermActivated( const QString& );
36 void slotKeyActivated(const QString&);
36private: 37private:
37 void initUI(); 38 void initUI();
38 QString profName()const; 39 QString profName()const;
@@ -46,9 +47,9 @@ private:
46 QComboBox *m_conCmb, *m_termCmb; 47 QComboBox *m_conCmb, *m_termCmb;
47 QCheckBox *m_autoConnect; 48 QCheckBox *m_autoConnect;
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;
53 QWidget *tabprof; 54 QWidget *tabprof;
54 int m_showconntab; 55 int m_showconntab;