-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 | |||
@@ -1,35 +1,36 @@ | |||
1 | #include "io_serial.h" | 1 | #include "io_serial.h" |
2 | #include "io_irda.h" | 2 | #include "io_irda.h" |
3 | #include "io_bt.h" | 3 | #include "io_bt.h" |
4 | #include "io_modem.h" | 4 | #include "io_modem.h" |
5 | #include "filetransfer.h" | 5 | #include "filetransfer.h" |
6 | #include "filereceive.h" | 6 | #include "filereceive.h" |
7 | #include "serialconfigwidget.h" | 7 | #include "serialconfigwidget.h" |
8 | #include "irdaconfigwidget.h" | 8 | #include "irdaconfigwidget.h" |
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" |
15 | 16 | ||
16 | extern "C" { | 17 | extern "C" { |
17 | // FILE Transfer Stuff | 18 | // FILE Transfer Stuff |
18 | FileTransferLayer* newSZTransfer(IOLayer* lay) { | 19 | FileTransferLayer* newSZTransfer(IOLayer* lay) { |
19 | return new FileTransfer( FileTransfer::SZ, lay ); | 20 | return new FileTransfer( FileTransfer::SZ, lay ); |
20 | } | 21 | } |
21 | FileTransferLayer* newSYTransfer(IOLayer* lay) { | 22 | FileTransferLayer* newSYTransfer(IOLayer* lay) { |
22 | return new FileTransfer( FileTransfer::SY, lay ); | 23 | return new FileTransfer( FileTransfer::SY, lay ); |
23 | } | 24 | } |
24 | FileTransferLayer* newSXTransfer(IOLayer* lay) { | 25 | FileTransferLayer* newSXTransfer(IOLayer* lay) { |
25 | return new FileTransfer(FileTransfer ::SX, lay ); | 26 | return new FileTransfer(FileTransfer ::SX, lay ); |
26 | } | 27 | } |
27 | 28 | ||
28 | // FILE Transfer Receive Stuff | 29 | // FILE Transfer Receive Stuff |
29 | ReceiveLayer* newSZReceive(IOLayer* lay) { | 30 | ReceiveLayer* newSZReceive(IOLayer* lay) { |
30 | return new FileReceive( FileReceive::SZ, lay ); | 31 | return new FileReceive( FileReceive::SZ, lay ); |
31 | } | 32 | } |
32 | ReceiveLayer* newSYReceive(IOLayer* lay) { | 33 | ReceiveLayer* newSYReceive(IOLayer* lay) { |
33 | return new FileReceive( FileReceive::SY, lay ); | 34 | return new FileReceive( FileReceive::SY, lay ); |
34 | } | 35 | } |
35 | ReceiveLayer* newSXReceive(IOLayer* lay) { | 36 | ReceiveLayer* newSXReceive(IOLayer* lay) { |
@@ -55,59 +56,66 @@ extern "C" { | |||
55 | 56 | ||
56 | // Connection Widgets | 57 | // Connection Widgets |
57 | ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { | 58 | ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { |
58 | return new SerialConfigWidget( str, wid ); | 59 | return new SerialConfigWidget( str, wid ); |
59 | } | 60 | } |
60 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { | 61 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { |
61 | return new IrdaConfigWidget( str, wid ); | 62 | return new IrdaConfigWidget( str, wid ); |
62 | } | 63 | } |
63 | ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) { | 64 | ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) { |
64 | return new ModemConfigWidget(str, wid ); | 65 | return new ModemConfigWidget(str, wid ); |
65 | } | 66 | } |
66 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) { | 67 | ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid ) { |
67 | return new BTConfigWidget(str, wid ); | 68 | return new BTConfigWidget(str, wid ); |
68 | } | 69 | } |
69 | ProfileDialogWidget* newConsoleWid( const QString& str, QWidget* wid ) { | 70 | ProfileDialogWidget* newConsoleWid( const QString& str, QWidget* wid ) { |
70 | return 0l; | 71 | return 0l; |
71 | } | 72 | } |
72 | 73 | ||
73 | 74 | ||
74 | // Terminal Widget(s) | 75 | // Terminal Widget(s) |
75 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { | 76 | ProfileDialogWidget* newTerminalWidget(const QString& na, QWidget* wid) { |
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 ); |
82 | } | 88 | } |
83 | */ | 89 | */ |
84 | }; | 90 | }; |
85 | 91 | ||
86 | Default::Default( MetaFactory* fact ) { | 92 | Default::Default( MetaFactory* fact ) { |
87 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); | 93 | fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer ); |
88 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); | 94 | fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer ); |
89 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); | 95 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); |
90 | 96 | ||
91 | fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive ); | 97 | fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive ); |
92 | fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive ); | 98 | fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive ); |
93 | fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive ); | 99 | fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive ); |
94 | 100 | ||
95 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); | 101 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); |
96 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); | 102 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); |
97 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); | 103 | fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer ); |
98 | fact->addIOLayerFactory( "modem", QObject::tr("Modem"), newModemLayer ); | 104 | fact->addIOLayerFactory( "modem", QObject::tr("Modem"), newModemLayer ); |
99 | fact->addIOLayerFactory( "console", QObject::tr("Console"), newConsole ); | 105 | fact->addIOLayerFactory( "console", QObject::tr("Console"), newConsole ); |
100 | 106 | ||
101 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); | 107 | fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget ); |
102 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); | 108 | fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget ); |
103 | fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget ); | 109 | fact->addConnectionWidgetFactory( "modem", QObject::tr("Modem"), newModemWidget ); |
104 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); | 110 | fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget ); |
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 | } |
111 | Default::~Default() { | 119 | Default::~Default() { |
112 | 120 | ||
113 | } | 121 | } |
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 | |||
@@ -4,37 +4,38 @@ | |||
4 | #include "metafactory.h" | 4 | #include "metafactory.h" |
5 | 5 | ||
6 | class Widget; | 6 | class Widget; |
7 | 7 | ||
8 | extern "C" { | 8 | extern "C" { |
9 | FileTransferLayer* newSZTransfer(IOLayer*); | 9 | FileTransferLayer* newSZTransfer(IOLayer*); |
10 | FileTransferLayer* newSYTransfer(IOLayer*); | 10 | FileTransferLayer* newSYTransfer(IOLayer*); |
11 | FileTransferLayer* newSXTransfer(IOLayer*); | 11 | FileTransferLayer* newSXTransfer(IOLayer*); |
12 | 12 | ||
13 | ReceiveLayer* newSZReceive(IOLayer*); | 13 | ReceiveLayer* newSZReceive(IOLayer*); |
14 | ReceiveLayer* newSYReceive(IOLayer*); | 14 | ReceiveLayer* newSYReceive(IOLayer*); |
15 | ReceiveLayer* newSXReceive(IOLayer*); | 15 | ReceiveLayer* newSXReceive(IOLayer*); |
16 | 16 | ||
17 | IOLayer* newSerialLayer(const Profile&); | 17 | IOLayer* newSerialLayer(const Profile&); |
18 | IOLayer* newBTLayer(const Profile& ); | 18 | IOLayer* newBTLayer(const Profile& ); |
19 | IOLayer* newIrDaLayer(const Profile& ); | 19 | IOLayer* newIrDaLayer(const Profile& ); |
20 | IOLayer* newConsole(const Profile& ); | 20 | IOLayer* newConsole(const Profile& ); |
21 | 21 | ||
22 | ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); | 22 | ProfileDialogWidget* newSerialWidget(const QString&, QWidget* ); |
23 | ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); | 23 | ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* ); |
24 | ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); | 24 | ProfileDialogWidget* newBTWidget (const QString&, QWidget* ); |
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 | }; |
31 | 32 | ||
32 | class MetaFactory; | 33 | class MetaFactory; |
33 | struct Default { | 34 | struct Default { |
34 | public: | 35 | public: |
35 | Default(MetaFactory* ); | 36 | Default(MetaFactory* ); |
36 | ~Default(); | 37 | ~Default(); |
37 | }; | 38 | }; |
38 | 39 | ||
39 | 40 | ||
40 | #endif | 41 | #endif |
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 | |||
@@ -1,87 +1,88 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | #include <qsizepolicy.h> | 2 | #include <qsizepolicy.h> |
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 | ||
7 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 8 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
8 | QFrame(parent), numRows(2), numCols(11), | 9 | QFrame(parent), numRows(2), numCols(11), |
9 | pressedRow(0), pressedCol(0) { | 10 | pressedRow(0), pressedCol(0) { |
10 | 11 | ||
11 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 12 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
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, '|'); |
20 | 21 | ||
21 | if (value_list.isEmpty()) continue; | 22 | if (value_list.isEmpty()) continue; |
22 | 23 | ||
23 | keys.insert( | 24 | keys.insert( |
24 | 25 | ||
25 | handle, | 26 | handle, |
26 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) | 27 | FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) |
27 | ); | 28 | ); |
28 | } | 29 | } |
29 | //qWarning("loaded %d keys", keys.count()); | 30 | //qWarning("loaded %d keys", keys.count()); |
30 | if (keys.isEmpty()) loadDefaults(); | 31 | if (keys.isEmpty()) loadDefaults(); |
31 | 32 | ||
32 | 33 | ||
33 | 34 | ||
34 | } | 35 | } |
35 | 36 | ||
36 | FunctionKeyboard::~FunctionKeyboard() { | 37 | FunctionKeyboard::~FunctionKeyboard() { |
37 | 38 | ||
38 | } | 39 | } |
39 | 40 | ||
40 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { | 41 | void FunctionKeyboard::paintEvent(QPaintEvent *e) { |
41 | 42 | ||
42 | QPainter p(this); | 43 | QPainter p(this); |
43 | p.setClipRect(e->rect()); | 44 | p.setClipRect(e->rect()); |
44 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); | 45 | p.fillRect(0, 0, width(), height(), QColor(255,255,255)); |
45 | 46 | ||
46 | p.setPen(QColor(0,0,0)); | 47 | p.setPen(QColor(0,0,0)); |
47 | 48 | ||
48 | /* those decimals do count! becomes short if use plain int */ | 49 | /* those decimals do count! becomes short if use plain int */ |
49 | for (double i = 0; i <= width(); i += keyWidth) { | 50 | for (double i = 0; i <= width(); i += keyWidth) { |
50 | 51 | ||
51 | p.drawLine((int)i, 0, (int)i, height()); | 52 | p.drawLine((int)i, 0, (int)i, height()); |
52 | } | 53 | } |
53 | 54 | ||
54 | // sometimes the last line doesnt get drawn | 55 | // sometimes the last line doesnt get drawn |
55 | p.drawLine(width() -1, 0, width() -1, height()); | 56 | p.drawLine(width() -1, 0, width() -1, height()); |
56 | 57 | ||
57 | for (int i = 0; i <= height(); i += keyHeight) { | 58 | for (int i = 0; i <= height(); i += keyHeight) { |
58 | 59 | ||
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)) { |
67 | 68 | ||
68 | p.drawText( | 69 | p.drawText( |
69 | c * keyWidth + 1, r * keyHeight + 1, | 70 | c * keyWidth + 1, r * keyHeight + 1, |
70 | keyWidth, keyHeight, | 71 | keyWidth, keyHeight, |
71 | Qt::AlignHCenter | Qt::AlignVCenter, | 72 | Qt::AlignHCenter | Qt::AlignVCenter, |
72 | keys[handle].getL() | 73 | keys[handle].getL() |
73 | ); | 74 | ); |
74 | } | 75 | } |
75 | } | 76 | } |
76 | } | 77 | } |
77 | } | 78 | } |
78 | 79 | ||
79 | void FunctionKeyboard::paintKey(int row, int col) { | 80 | void FunctionKeyboard::paintKey(int row, int col) { |
80 | 81 | ||
81 | QPainter p(this); | 82 | QPainter p(this); |
82 | 83 | ||
83 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), | 84 | p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), |
84 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), | 85 | QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), |
85 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); | 86 | (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); |
86 | p.drawText( | 87 | p.drawText( |
87 | col * keyWidth + 1, row * keyHeight + 1, | 88 | col * keyWidth + 1, row * keyHeight + 1, |
@@ -134,24 +135,48 @@ QSize FunctionKeyboard::sizeHint() const { | |||
134 | return QSize(width(), keyHeight * numRows + 1); | 135 | return QSize(width(), keyHeight * numRows + 1); |
135 | } | 136 | } |
136 | 137 | ||
137 | void FunctionKeyboard::loadDefaults() { | 138 | void FunctionKeyboard::loadDefaults() { |
138 | 139 | ||
139 | /* what keys should be default? */ | 140 | /* what keys should be default? */ |
140 | keys.insert( "r0c0", FKey ("F1", 4144, 0)); | 141 | keys.insert( "r0c0", FKey ("F1", 4144, 0)); |
141 | keys.insert( "r0c1", FKey ("F2", 4145, 0)); | 142 | keys.insert( "r0c1", FKey ("F2", 4145, 0)); |
142 | keys.insert( "r0c2", FKey ("F3", 4145, 0)); | 143 | keys.insert( "r0c2", FKey ("F3", 4145, 0)); |
143 | keys.insert( "r0c3", FKey ("F4", 4146, 0)); | 144 | keys.insert( "r0c3", FKey ("F4", 4146, 0)); |
144 | keys.insert( "r0c4", FKey ("F5", 4147, 0)); | 145 | keys.insert( "r0c4", FKey ("F5", 4147, 0)); |
145 | keys.insert( "r0c5", FKey ("F6", 4148, 0)); | 146 | keys.insert( "r0c5", FKey ("F6", 4148, 0)); |
146 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); | 147 | keys.insert( "r0c6", FKey ("F7", 4149, 0)); |
147 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); | 148 | keys.insert( "r0c7", FKey ("F8", 4150, 0)); |
148 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); | 149 | keys.insert( "r0c8", FKey ("F9", 4151, 0)); |
149 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); | 150 | keys.insert( "r0c9", FKey ("F10", 4152, 0)); |
150 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); | 151 | keys.insert( "r0c10", FKey ("F11", 4153, 0)); |
151 | 152 | ||
152 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); | 153 | keys.insert( "r1c7", FKey ("Ho", 4112, 0)); |
153 | keys.insert( "r1c8", FKey ("End", 4113, 0)); | 154 | keys.insert( "r1c8", FKey ("End", 4113, 0)); |
154 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); | 155 | keys.insert( "r1c9", FKey ("PU", 4118, 0)); |
155 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); | 156 | keys.insert( "r1c10", FKey ("PD", 4119, 0)); |
156 | 157 | ||
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 | |||
@@ -1,31 +1,34 @@ | |||
1 | #ifndef OPIE_FUNCTION_KEYBOARD_H | 1 | #ifndef OPIE_FUNCTION_KEYBOARD_H |
2 | #define OPIE_FUNCTION_KEYBOARD_H | 2 | #define OPIE_FUNCTION_KEYBOARD_H |
3 | 3 | ||
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 | ||
9 | class FKey { | 12 | class FKey { |
10 | 13 | ||
11 | public: | 14 | public: |
12 | 15 | ||
13 | FKey(): qcode(0), unicode(0) {}; | 16 | FKey(): qcode(0), unicode(0) {}; |
14 | FKey(const QString &l, ushort q, ushort u): label(l), qcode(q), unicode(u) {}; | 17 | FKey(const QString &l, ushort q, ushort u): label(l), qcode(q), unicode(u) {}; |
15 | 18 | ||
16 | QString getL() { return label; } | 19 | QString getL() { return label; } |
17 | ushort getQ() { return qcode; } | 20 | ushort getQ() { return qcode; } |
18 | ushort getU() { return unicode; } | 21 | ushort getU() { return unicode; } |
19 | 22 | ||
20 | 23 | ||
21 | private: | 24 | private: |
22 | 25 | ||
23 | QString label; | 26 | QString label; |
24 | ushort qcode; | 27 | ushort qcode; |
25 | ushort unicode; | 28 | ushort unicode; |
26 | }; | 29 | }; |
27 | 30 | ||
28 | class FunctionKeyboard : public QFrame { | 31 | class FunctionKeyboard : public QFrame { |
29 | Q_OBJECT | 32 | Q_OBJECT |
30 | 33 | ||
31 | public: | 34 | public: |
@@ -43,25 +46,38 @@ signals: | |||
43 | 46 | ||
44 | void keyPressed(ushort, ushort, bool, bool, bool); | 47 | void keyPressed(ushort, ushort, bool, bool, bool); |
45 | 48 | ||
46 | private: | 49 | private: |
47 | 50 | ||
48 | void loadDefaults(); | 51 | void loadDefaults(); |
49 | 52 | ||
50 | 53 | ||
51 | private: | 54 | private: |
52 | 55 | ||
53 | // thie key for the map is the row/col | 56 | // thie key for the map is the row/col |
54 | QMap<QString, FKey> keys; | 57 | QMap<QString, FKey> keys; |
55 | 58 | ||
56 | uint numRows; | 59 | uint numRows; |
57 | uint numCols; | 60 | uint numCols; |
58 | uint keyHeight; | 61 | uint keyHeight; |
59 | double keyWidth; // decimal point matters! | 62 | double keyWidth; // decimal point matters! |
60 | 63 | ||
61 | int pressedRow, pressedCol; | 64 | int pressedRow, pressedCol; |
62 | 65 | ||
63 | QObject *parent; | 66 | QObject *parent; |
64 | 67 | ||
65 | }; | 68 | }; |
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 | |||
@@ -1,44 +1,51 @@ | |||
1 | #include <qpe/config.h> | 1 | #include <qpe/config.h> |
2 | #include "metafactory.h" | 2 | #include "metafactory.h" |
3 | 3 | ||
4 | MetaFactory::MetaFactory() { | 4 | MetaFactory::MetaFactory() { |
5 | } | 5 | } |
6 | MetaFactory::~MetaFactory() { | 6 | MetaFactory::~MetaFactory() { |
7 | 7 | ||
8 | } | 8 | } |
9 | void MetaFactory::addConnectionWidgetFactory( const QCString& name, | 9 | void MetaFactory::addConnectionWidgetFactory( const QCString& name, |
10 | const QString& str, | 10 | const QString& str, |
11 | configWidget wid) { | 11 | configWidget wid) { |
12 | m_strings.insert( str, name ); | 12 | m_strings.insert( str, name ); |
13 | m_conFact.insert( str, wid ); | 13 | m_conFact.insert( str, wid ); |
14 | } | 14 | } |
15 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, | 15 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, |
16 | const QString& str, | 16 | const QString& str, |
17 | configWidget wid ) { | 17 | configWidget wid ) { |
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 | } |
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, |
22 | const QString& str, | 29 | const QString& str, |
23 | iolayer lay) { | 30 | iolayer lay) { |
24 | m_strings.insert( str, name ); | 31 | m_strings.insert( str, name ); |
25 | m_layerFact.insert( str, lay ); | 32 | m_layerFact.insert( str, lay ); |
26 | } | 33 | } |
27 | void MetaFactory::addFileTransferLayer( const QCString& name, | 34 | void MetaFactory::addFileTransferLayer( const QCString& name, |
28 | const QString& str, | 35 | const QString& str, |
29 | filelayer lay) { | 36 | filelayer lay) { |
30 | m_strings.insert(str, name ); | 37 | m_strings.insert(str, name ); |
31 | m_fileFact.insert( str, lay ); | 38 | m_fileFact.insert( str, lay ); |
32 | } | 39 | } |
33 | void MetaFactory::addReceiveLayer( const QCString& name, | 40 | void MetaFactory::addReceiveLayer( const QCString& name, |
34 | const QString& str, | 41 | const QString& str, |
35 | receivelayer lay) { | 42 | receivelayer lay) { |
36 | m_strings.insert(str, name ); | 43 | m_strings.insert(str, name ); |
37 | m_receiveFact.insert( str, lay ); | 44 | m_receiveFact.insert( str, lay ); |
38 | } | 45 | } |
39 | void MetaFactory::addEmulationLayer( const QCString& name, | 46 | void MetaFactory::addEmulationLayer( const QCString& name, |
40 | const QString& str, | 47 | const QString& str, |
41 | emulationLayer em) { | 48 | emulationLayer em) { |
42 | m_strings.insert(str, name ); | 49 | m_strings.insert(str, name ); |
43 | m_emu.insert( str, em ); | 50 | m_emu.insert( str, em ); |
44 | } | 51 | } |
@@ -107,48 +114,61 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | |||
107 | } | 114 | } |
108 | 115 | ||
109 | ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) { | 116 | ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) { |
110 | ProfileDialogWidget* wid = 0l; | 117 | ProfileDialogWidget* wid = 0l; |
111 | 118 | ||
112 | QMap<QString, configWidget>::Iterator it; | 119 | QMap<QString, configWidget>::Iterator it; |
113 | it = m_conFact.find( str ); | 120 | it = m_conFact.find( str ); |
114 | if ( it != m_conFact.end() ) { | 121 | if ( it != m_conFact.end() ) { |
115 | wid = (*(it.data() ) )(str,parent); | 122 | wid = (*(it.data() ) )(str,parent); |
116 | } | 123 | } |
117 | return wid; | 124 | return wid; |
118 | } | 125 | } |
119 | ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) { | 126 | ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) { |
120 | if (str.isEmpty() ) | 127 | if (str.isEmpty() ) |
121 | return 0l; | 128 | return 0l; |
122 | ProfileDialogWidget* wid = 0l; | 129 | ProfileDialogWidget* wid = 0l; |
123 | 130 | ||
124 | QMap<QString, configWidget>::Iterator it; | 131 | QMap<QString, configWidget>::Iterator it; |
125 | it = m_termFact.find( str ); | 132 | it = m_termFact.find( str ); |
126 | if ( it != m_termFact.end() ) { | 133 | if ( it != m_termFact.end() ) { |
127 | wid = (*(it.data() ) )(str,parent); | 134 | wid = (*(it.data() ) )(str,parent); |
128 | } | 135 | } |
129 | return wid; | 136 | return wid; |
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) { |
132 | EmulationLayer* lay = 0l; | 152 | EmulationLayer* lay = 0l; |
133 | 153 | ||
134 | QMap<QString, emulationLayer>::Iterator it; | 154 | QMap<QString, emulationLayer>::Iterator it; |
135 | it = m_emu.find( str ); | 155 | it = m_emu.find( str ); |
136 | if ( it != m_emu.end() ) { | 156 | if ( it != m_emu.end() ) { |
137 | lay = (*(it.data() ) )(wid); | 157 | lay = (*(it.data() ) )(wid); |
138 | } | 158 | } |
139 | 159 | ||
140 | return lay; | 160 | return lay; |
141 | } | 161 | } |
142 | FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) { | 162 | FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) { |
143 | FileTransferLayer* file = 0l; | 163 | FileTransferLayer* file = 0l; |
144 | QMap<QString, filelayer>::Iterator it; | 164 | QMap<QString, filelayer>::Iterator it; |
145 | it = m_fileFact.find( str ); | 165 | it = m_fileFact.find( str ); |
146 | if ( it != m_fileFact.end() ) { | 166 | if ( it != m_fileFact.end() ) { |
147 | file = (*(it.data() ) )(lay); | 167 | file = (*(it.data() ) )(lay); |
148 | } | 168 | } |
149 | return file; | 169 | return file; |
150 | } | 170 | } |
151 | ReceiveLayer* MetaFactory::newReceive(const QString& str, IOLayer* lay ) { | 171 | ReceiveLayer* MetaFactory::newReceive(const QString& str, IOLayer* lay ) { |
152 | ReceiveLayer* file = 0l; | 172 | ReceiveLayer* file = 0l; |
153 | QMap<QString, receivelayer>::Iterator it; | 173 | QMap<QString, receivelayer>::Iterator it; |
154 | it = m_receiveFact.find( str ); | 174 | it = m_receiveFact.find( str ); |
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 | |||
@@ -19,97 +19,102 @@ | |||
19 | #include "emulation_layer.h" | 19 | #include "emulation_layer.h" |
20 | 20 | ||
21 | class WidgetLayer; | 21 | class WidgetLayer; |
22 | class MetaFactory { | 22 | class MetaFactory { |
23 | public: | 23 | public: |
24 | typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); | 24 | typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent); |
25 | typedef IOLayer* (*iolayer)(const Profile& ); | 25 | typedef IOLayer* (*iolayer)(const Profile& ); |
26 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 26 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
27 | typedef ReceiveLayer* (*receivelayer)(IOLayer*); | 27 | typedef ReceiveLayer* (*receivelayer)(IOLayer*); |
28 | typedef EmulationLayer* (*emulationLayer)(WidgetLayer* ); | 28 | typedef EmulationLayer* (*emulationLayer)(WidgetLayer* ); |
29 | 29 | ||
30 | MetaFactory(); | 30 | MetaFactory(); |
31 | ~MetaFactory(); | 31 | ~MetaFactory(); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * add a ProfileDialogWidget to the factory | 34 | * add a ProfileDialogWidget to the factory |
35 | * name is the name shown to the user | 35 | * name is the name shown to the user |
36 | */ | 36 | */ |
37 | void addConnectionWidgetFactory( const QCString& internalName, | 37 | void addConnectionWidgetFactory( const QCString& internalName, |
38 | const QString& uiString, | 38 | const QString& uiString, |
39 | configWidget ); | 39 | configWidget ); |
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 |
46 | */ | 49 | */ |
47 | void addIOLayerFactory( const QCString&, | 50 | void addIOLayerFactory( const QCString&, |
48 | const QString&, | 51 | const QString&, |
49 | iolayer ); | 52 | iolayer ); |
50 | 53 | ||
51 | /** | 54 | /** |
52 | * adds a FileTransfer Layer | 55 | * adds a FileTransfer Layer |
53 | */ | 56 | */ |
54 | void addFileTransferLayer( const QCString& name, | 57 | void addFileTransferLayer( const QCString& name, |
55 | const QString&, | 58 | const QString&, |
56 | filelayer ); | 59 | filelayer ); |
57 | void addReceiveLayer( const QCString& name, | 60 | void addReceiveLayer( const QCString& name, |
58 | const QString&, | 61 | const QString&, |
59 | receivelayer); | 62 | receivelayer); |
60 | 63 | ||
61 | /** | 64 | /** |
62 | * adds a Factory for Emulation to the Layer.. | 65 | * adds a Factory for Emulation to the Layer.. |
63 | */ | 66 | */ |
64 | void addEmulationLayer ( const QCString& name, | 67 | void addEmulationLayer ( const QCString& name, |
65 | const QString& uiString, | 68 | const QString& uiString, |
66 | emulationLayer ); | 69 | emulationLayer ); |
67 | 70 | ||
68 | /* translated UI Strings */ | 71 | /* translated UI Strings */ |
69 | QStringList ioLayers()const; | 72 | QStringList ioLayers()const; |
70 | QStringList connectionWidgets()const; | 73 | QStringList connectionWidgets()const; |
71 | 74 | ||
72 | /** | 75 | /** |
73 | * Terminal Configuration widgets | 76 | * Terminal Configuration widgets |
74 | */ | 77 | */ |
75 | QStringList terminalWidgets()const; | 78 | QStringList terminalWidgets()const; |
76 | QStringList fileTransferLayers()const; | 79 | QStringList fileTransferLayers()const; |
77 | QStringList receiveLayers()const; | 80 | QStringList receiveLayers()const; |
78 | QStringList emulationLayers()const; | 81 | QStringList emulationLayers()const; |
79 | 82 | ||
80 | /** | 83 | /** |
81 | * the generation... | 84 | * the generation... |
82 | */ | 85 | */ |
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* ); |
89 | 93 | ||
90 | /* | 94 | /* |
91 | * internal takes the maybe translated | 95 | * internal takes the maybe translated |
92 | * public QString and maps it to the internal | 96 | * public QString and maps it to the internal |
93 | * not translatable QCString | 97 | * not translatable QCString |
94 | */ | 98 | */ |
95 | QCString internal( const QString& )const; | 99 | QCString internal( const QString& )const; |
96 | 100 | ||
97 | /* | 101 | /* |
98 | * external takes the internal name | 102 | * external takes the internal name |
99 | * it returns a translated name | 103 | * it returns a translated name |
100 | */ | 104 | */ |
101 | QString external( const QCString& )const; | 105 | QString external( const QCString& )const; |
102 | 106 | ||
103 | 107 | ||
104 | private: | 108 | 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; |
111 | QMap<QString, emulationLayer> m_emu; | 116 | QMap<QString, emulationLayer> m_emu; |
112 | }; | 117 | }; |
113 | 118 | ||
114 | 119 | ||
115 | #endif | 120 | #endif |
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 | |||
@@ -9,24 +9,35 @@ ProfileDialogWidget::~ProfileDialogWidget() { | |||
9 | 9 | ||
10 | ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na, | 10 | ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na, |
11 | QWidget* parent, | 11 | QWidget* parent, |
12 | const char* name ) | 12 | const char* name ) |
13 | : ProfileDialogWidget( na, parent, name ) | 13 | : ProfileDialogWidget( na, parent, name ) |
14 | { | 14 | { |
15 | } | 15 | } |
16 | ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() { | 16 | ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() { |
17 | } | 17 | } |
18 | ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const { | 18 | ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const { |
19 | return Terminal; | 19 | return Terminal; |
20 | } | 20 | } |
21 | 21 | ||
22 | ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na, | 22 | ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na, |
23 | QWidget* parent, | 23 | QWidget* parent, |
24 | const char* name ) | 24 | const char* name ) |
25 | : ProfileDialogWidget(na, parent, name ) | 25 | : ProfileDialogWidget(na, parent, name ) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() { | 28 | ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() { |
29 | } | 29 | } |
30 | ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { | 30 | ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { |
31 | return Connection; | 31 | return Connection; |
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 | |||
@@ -1,50 +1,59 @@ | |||
1 | #ifndef OPIE_PROFILE_DIALOG_WIDGET_H | 1 | #ifndef OPIE_PROFILE_DIALOG_WIDGET_H |
2 | #define OPIE_PROFILE_DIALOG_WIDGET_H | 2 | #define OPIE_PROFILE_DIALOG_WIDGET_H |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | 5 | ||
6 | #include "profile.h" | 6 | #include "profile.h" |
7 | 7 | ||
8 | class ProfileDialogWidget : public QWidget { | 8 | class ProfileDialogWidget : public QWidget { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | public: | 10 | public: |
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(); |
17 | 18 | ||
18 | /* | 19 | /* |
19 | * load data from a Profile into | 20 | * load data from a Profile into |
20 | * the DialogWidget | 21 | * the DialogWidget |
21 | */ | 22 | */ |
22 | virtual void load( const Profile& ) = 0; | 23 | virtual void load( const Profile& ) = 0; |
23 | 24 | ||
24 | /* | 25 | /* |
25 | * save data into a profile | 26 | * save data into a profile |
26 | * from the DialogWidget | 27 | * from the DialogWidget |
27 | */ | 28 | */ |
28 | virtual void save( Profile& ) = 0; | 29 | virtual void save( Profile& ) = 0; |
29 | 30 | ||
30 | virtual Type type()const = 0; | 31 | virtual Type type()const = 0; |
31 | }; | 32 | }; |
32 | class ProfileDialogTerminalWidget : public ProfileDialogWidget { | 33 | class ProfileDialogTerminalWidget : public ProfileDialogWidget { |
33 | Q_OBJECT | 34 | Q_OBJECT |
34 | public: | 35 | public: |
35 | ProfileDialogTerminalWidget( const QString& name, QWidget* widget, | 36 | ProfileDialogTerminalWidget( const QString& name, QWidget* widget, |
36 | const char* name =0l); | 37 | const char* name =0l); |
37 | ~ProfileDialogTerminalWidget(); | 38 | ~ProfileDialogTerminalWidget(); |
38 | Type type()const; | 39 | Type type()const; |
39 | }; | 40 | }; |
40 | class ProfileDialogConnectionWidget : public ProfileDialogWidget { | 41 | class ProfileDialogConnectionWidget : public ProfileDialogWidget { |
41 | Q_OBJECT | 42 | Q_OBJECT |
42 | public: | 43 | public: |
43 | ProfileDialogConnectionWidget( const QString& name, QWidget* parent, | 44 | ProfileDialogConnectionWidget( const QString& name, QWidget* parent, |
44 | const char* name =0l); | 45 | const char* name =0l); |
45 | ~ProfileDialogConnectionWidget(); | 46 | ~ProfileDialogConnectionWidget(); |
46 | Type type() const; | 47 | Type type() const; |
47 | 48 | ||
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 | ||
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 | |||
@@ -32,173 +32,191 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | |||
32 | // Apply current profile | 32 | // Apply current profile |
33 | // plugin_plugin->load(profile); | 33 | // plugin_plugin->load(profile); |
34 | // ... (reset profile name line edit etc.) | 34 | // ... (reset profile name line edit etc.) |
35 | } | 35 | } |
36 | 36 | ||
37 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 37 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
38 | : QDialog(0, 0, TRUE), m_fact( fact ) | 38 | : QDialog(0, 0, TRUE), m_fact( fact ) |
39 | { | 39 | { |
40 | // Default profile | 40 | // Default profile |
41 | m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); | 41 | m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); |
42 | 42 | ||
43 | initUI(); | 43 | initUI(); |
44 | 44 | ||
45 | // Apply current profile | 45 | // Apply current profile |
46 | // plugin_plugin->load(profile); | 46 | // plugin_plugin->load(profile); |
47 | } | 47 | } |
48 | 48 | ||
49 | Profile ProfileEditorDialog::profile() const | 49 | Profile ProfileEditorDialog::profile() const |
50 | { | 50 | { |
51 | return m_prof; | 51 | return m_prof; |
52 | } | 52 | } |
53 | 53 | ||
54 | void ProfileEditorDialog::initUI() | 54 | void 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 ); |
60 | tabWidget->setTabStyle(OTabWidget::TextTab); | 60 | tabWidget->setTabStyle(OTabWidget::TextTab); |
61 | mainLayout->add(tabWidget); | 61 | mainLayout->add(tabWidget); |
62 | 62 | ||
63 | /* base tabs */ | 63 | /* base tabs */ |
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 | ||
74 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 76 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
75 | m_name = new QLineEdit(tabprof); | 77 | m_name = new QLineEdit(tabprof); |
76 | QLabel *con = new QLabel(tr("Connection"), tabprof ); | 78 | QLabel *con = new QLabel(tr("Connection"), tabprof ); |
77 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); | 79 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); |
78 | m_conCmb = new QComboBox( tabprof ); | 80 | m_conCmb = new QComboBox( tabprof ); |
79 | m_termCmb = new QComboBox( tabprof ); | 81 | m_termCmb = new QComboBox( tabprof ); |
80 | m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); | 82 | m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); |
81 | 83 | ||
82 | // layouting | 84 | // layouting |
83 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 85 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
84 | vbox3->add(name); | 86 | vbox3->add(name); |
85 | vbox3->add(m_name); | 87 | vbox3->add(m_name); |
86 | vbox3->add(con ); | 88 | vbox3->add(con ); |
87 | vbox3->add(m_conCmb ); | 89 | vbox3->add(m_conCmb ); |
88 | vbox3->add(term ); | 90 | vbox3->add(term ); |
89 | vbox3->add(m_termCmb ); | 91 | vbox3->add(m_termCmb ); |
90 | vbox3->add(m_autoConnect); | 92 | vbox3->add(m_autoConnect); |
91 | vbox3->addStretch(1); | 93 | vbox3->addStretch(1); |
92 | 94 | ||
93 | m_showconntab = 0; | 95 | m_showconntab = 0; |
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 | ||
100 | // fill the comboboxes | 103 | // fill the comboboxes |
101 | QStringList list = m_fact->connectionWidgets(); | 104 | QStringList list = m_fact->connectionWidgets(); |
102 | QStringList::Iterator it; | 105 | QStringList::Iterator it; |
103 | for (it =list.begin(); it != list.end(); ++it ) { | 106 | for (it =list.begin(); it != list.end(); ++it ) { |
104 | m_conCmb->insertItem( (*it) ); | 107 | m_conCmb->insertItem( (*it) ); |
105 | } | 108 | } |
106 | list = m_fact->terminalWidgets(); | 109 | list = m_fact->terminalWidgets(); |
107 | for (it =list.begin(); it != list.end(); ++it ) { | 110 | for (it =list.begin(); it != list.end(); ++it ) { |
108 | m_termCmb->insertItem( (*it) ); | 111 | m_termCmb->insertItem( (*it) ); |
109 | } | 112 | } |
110 | 113 | ||
111 | // load profile values | 114 | // load profile values |
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()); |
118 | 122 | ||
119 | 123 | ||
120 | // signal and slots | 124 | // signal and slots |
121 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), | 125 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), |
122 | this, SLOT(slotConActivated(const QString&) ) ); | 126 | this, SLOT(slotConActivated(const QString&) ) ); |
123 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), | 127 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), |
124 | this, SLOT(slotTermActivated(const QString& ) ) ); | 128 | this, SLOT(slotTermActivated(const QString& ) ) ); |
125 | 129 | ||
126 | } | 130 | } |
127 | 131 | ||
128 | ProfileEditorDialog::~ProfileEditorDialog() { | 132 | ProfileEditorDialog::~ProfileEditorDialog() { |
129 | 133 | ||
130 | } | 134 | } |
131 | void ProfileEditorDialog::accept() | 135 | void ProfileEditorDialog::accept() |
132 | { | 136 | { |
133 | if(profName().isEmpty()) | 137 | if(profName().isEmpty()) |
134 | { | 138 | { |
135 | QMessageBox::information(this, | 139 | QMessageBox::information(this, |
136 | QObject::tr("Invalid profile"), | 140 | QObject::tr("Invalid profile"), |
137 | QObject::tr("Please enter a profile name.")); | 141 | QObject::tr("Please enter a profile name.")); |
138 | return; | 142 | return; |
139 | } | 143 | } |
140 | // Save profile and plugin profile | 144 | // Save profile and plugin profile |
141 | //if(plugin_plugin) plugin_plugin->save(); | 145 | //if(plugin_plugin) plugin_plugin->save(); |
142 | 146 | ||
143 | // Save general values | 147 | // Save general values |
144 | m_prof.setName(profName()); | 148 | m_prof.setName(profName()); |
145 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); | 149 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); |
146 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); | 150 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); |
147 | m_prof.setAutoConnect( m_autoConnect->isChecked() ); | 151 | m_prof.setAutoConnect( m_autoConnect->isChecked() ); |
148 | 152 | ||
149 | if (m_con ) | 153 | if (m_con ) |
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 | } |
156 | 162 | ||
157 | 163 | ||
158 | QString ProfileEditorDialog::profName()const | 164 | QString ProfileEditorDialog::profName()const |
159 | { | 165 | { |
160 | return m_name->text(); | 166 | return m_name->text(); |
161 | } | 167 | } |
162 | 168 | ||
163 | QCString ProfileEditorDialog::profType()const | 169 | QCString ProfileEditorDialog::profType()const |
164 | { | 170 | { |
165 | /*QStringList w = m_fact->configWidgets(); | 171 | /*QStringList w = m_fact->configWidgets(); |
166 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) | 172 | for(QStringList::Iterator it = w.begin(); it != w.end(); it++) |
167 | if(device_box->currentText() == m_fact->name((*it))) return (*it); | 173 | if(device_box->currentText() == m_fact->name((*it))) return (*it); |
168 | */ | 174 | */ |
169 | return QCString(); | 175 | return QCString(); |
170 | } | 176 | } |
171 | /* | 177 | /* |
172 | * we need to switch the widget | 178 | * we need to switch the widget |
173 | */ | 179 | */ |
174 | void ProfileEditorDialog::slotConActivated( const QString& str ) { | 180 | void ProfileEditorDialog::slotConActivated( const QString& str ) { |
175 | delete m_con; | 181 | delete m_con; |
176 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); | 182 | m_con = m_fact->newConnectionPlugin( str, m_tabCon ); |
177 | 183 | ||
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") ); |
184 | tabWidget->setCurrentTab( tabprof ); | 191 | tabWidget->setCurrentTab( tabprof ); |
185 | m_showconntab = 1; | 192 | m_showconntab = 1; |
186 | } | 193 | } |
187 | } else { | 194 | } else { |
188 | tabWidget->removePage( m_tabCon ); | 195 | tabWidget->removePage( m_tabCon ); |
189 | m_showconntab = 0; | 196 | m_showconntab = 0; |
190 | } | 197 | } |
191 | } | 198 | } |
192 | /* | 199 | /* |
193 | * we need to switch the widget | 200 | * we need to switch the widget |
194 | */ | 201 | */ |
195 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { | 202 | void ProfileEditorDialog::slotTermActivated( const QString& str ) { |
196 | delete m_term; | 203 | delete m_term; |
197 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); | 204 | m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); |
198 | 205 | ||
199 | if (m_term) { | 206 | if (m_term) { |
200 | m_term->load(m_prof ); | 207 | m_term->load(m_prof ); |
201 | m_layTerm->addWidget( m_term ); | 208 | m_layTerm->addWidget( m_term ); |
202 | } | 209 | } |
203 | } | 210 | } |
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 | |||
@@ -12,46 +12,47 @@ class QTabWidget; | |||
12 | class QHBoxLayout; | 12 | class QHBoxLayout; |
13 | class QLineEdit; | 13 | class QLineEdit; |
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QCheckBox; | 15 | class QCheckBox; |
16 | class QLabel; | 16 | class QLabel; |
17 | class ProfileDialogWidget; | 17 | class ProfileDialogWidget; |
18 | 18 | ||
19 | class ProfileEditorDialog : public QDialog { | 19 | class ProfileEditorDialog : public QDialog { |
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | public: | 21 | public: |
22 | ProfileEditorDialog(MetaFactory* fact, | 22 | ProfileEditorDialog(MetaFactory* fact, |
23 | const Profile& prof ); | 23 | const Profile& prof ); |
24 | ProfileEditorDialog(MetaFactory* fact ); | 24 | ProfileEditorDialog(MetaFactory* fact ); |
25 | ~ProfileEditorDialog(); | 25 | ~ProfileEditorDialog(); |
26 | Profile profile()const; | 26 | Profile profile()const; |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | public slots: | 30 | public slots: |
31 | void accept(); | 31 | void accept(); |
32 | 32 | ||
33 | private slots: | 33 | private 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&); | ||
36 | private: | 37 | private: |
37 | void initUI(); | 38 | void initUI(); |
38 | QString profName()const; | 39 | QString profName()const; |
39 | QCString profType()const; | 40 | QCString profType()const; |
40 | 41 | ||
41 | MetaFactory* m_fact; | 42 | MetaFactory* m_fact; |
42 | QHBoxLayout* m_lay; | 43 | QHBoxLayout* m_lay; |
43 | Profile m_prof; | 44 | Profile m_prof; |
44 | 45 | ||
45 | QLineEdit *m_name; | 46 | QLineEdit *m_name; |
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; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | #endif | 58 | #endif |