summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp43
-rw-r--r--noncore/apps/opie-console/function_keyboard.h9
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp2
3 files changed, 31 insertions, 23 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index ac35d1c..4119ad4 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,152 +1,157 @@
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 6
7FunctionKeyboard::FunctionKeyboard(QWidget *parent) : 7FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
8 QFrame(parent), numRows(1), numCols(11), 8 QFrame(parent), numRows(2), numCols(11),
9 pressedRow(0), pressedCol(0) { 9 pressedRow(0), pressedCol(0) {
10 10
11 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); 11 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
12 12
13 Config conf("opie-console-keys"); 13 Config conf("opie-console-keys");
14 conf.setGroup("keys"); 14 conf.setGroup("keys");
15 for (int r = 0; r < numRows; r++) 15 for (int r = 0; r < numRows; r++)
16 for (int c = 0; c < numCols; c++) { 16 for (int c = 0; c < numCols; c++) {
17 17
18 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 18 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
19 QStringList value_list = conf.readListEntry( handle, '|'); 19 QStringList value_list = conf.readListEntry( handle, '|');
20 20
21 if (value_list.isEmpty()) continue; 21 if (value_list.isEmpty()) continue;
22 22
23 keys.insert( 23 keys.insert(
24 24
25 handle, 25 handle,
26 FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort()) 26 FKey (value_list[0], value_list[1].toUShort(), value_list[2].toUShort())
27 ); 27 );
28 } 28 }
29 qWarning("loaded %d keys", keys.count()); 29 //qWarning("loaded %d keys", keys.count());
30 if (keys.isEmpty()) loadDefaults();
30 31
31 32
32 33
33} 34}
34 35
35FunctionKeyboard::~FunctionKeyboard() { 36FunctionKeyboard::~FunctionKeyboard() {
36 37
37} 38}
38 39
39void FunctionKeyboard::paintEvent(QPaintEvent *e) { 40void FunctionKeyboard::paintEvent(QPaintEvent *e) {
40 41
41 QPainter p(this); 42 QPainter p(this);
42 p.setClipRect(e->rect()); 43 p.setClipRect(e->rect());
43 p.fillRect(0, 0, width(), height(), QColor(255,255,255)); 44 p.fillRect(0, 0, width(), height(), QColor(255,255,255));
44 45
45 p.setPen(QColor(0,0,0)); 46 p.setPen(QColor(0,0,0));
46 47
47 /* those decimals do count! becomes short if use plain int */ 48 /* those decimals do count! becomes short if use plain int */
48 for (double i = 0; i <= width(); i += keyWidth) { 49 for (double i = 0; i <= width(); i += keyWidth) {
49 50
50 p.drawLine((int)i, 0, (int)i, height()); 51 p.drawLine((int)i, 0, (int)i, height());
51 } 52 }
52 53
53 // sometimes the last line doesnt get drawn 54 // sometimes the last line doesnt get drawn
54 p.drawLine(width() -1, 0, width() -1, height()); 55 p.drawLine(width() -1, 0, width() -1, height());
55 56
56 for (int i = 0; i <= height(); i += keyHeight) { 57 for (int i = 0; i <= height(); i += keyHeight) {
57 58
58 p.drawLine(0, i, width(), i); 59 p.drawLine(0, i, width(), i);
59 } 60 }
60 61
61 for (int r = 0; r < numRows; r++) { 62 for (int r = 0; r < numRows; r++) {
62 for (int c = 0; c < numCols; c++) { 63 for (int c = 0; c < numCols; c++) {
63 64
64 QString handle = "r" + QString::number(r) + "c" + QString::number(c); 65 QString handle = "r" + QString::number(r) + "c" + QString::number(c);
65 if (keys.contains(handle)) { 66 if (keys.contains(handle)) {
66 67
67 p.drawText( 68 p.drawText(
68 c * keyWidth + 1, r * keyHeight + 1, 69 c * keyWidth + 1, r * keyHeight + 1,
69 keyWidth, keyHeight, 70 keyWidth, keyHeight,
70 Qt::AlignHCenter | Qt::AlignVCenter, 71 Qt::AlignHCenter | Qt::AlignVCenter,
71 keys[handle].getL() 72 keys[handle].getL()
72 ); 73 );
73 } 74 }
74 } 75 }
75 } 76 }
76} 77}
77 78
78void FunctionKeyboard::paintKey(int row, int col) { 79void FunctionKeyboard::paintKey(int row, int col) {
79 80
80 QPainter p(this); 81 QPainter p(this);
81 82
82 p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1), 83 p.fillRect(QRect(QPoint(col * keyWidth + 1, row * keyHeight + 1),
83 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), 84 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)),
84 (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); 85 (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255));
85 p.drawText( 86 p.drawText(
86 col * keyWidth + 1, row * keyHeight + 1, 87 col * keyWidth + 1, row * keyHeight + 1,
87 keyWidth, keyHeight, 88 keyWidth, keyHeight,
88 Qt::AlignHCenter | Qt::AlignVCenter, 89 Qt::AlignHCenter | Qt::AlignVCenter,
89 keys["r" + QString::number(row) + "c" + QString::number(col)].getL() 90 keys["r" + QString::number(row) + "c" + QString::number(col)].getL()
90 ); 91 );
91 92
92} 93}
93 94
94void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { 95void FunctionKeyboard::mousePressEvent(QMouseEvent *e) {
95 96
96 pressedRow = e->y() / keyHeight; 97 pressedRow = e->y() / keyHeight;
97 pressedCol = (int) (e->x() / keyWidth); 98 pressedCol = (int) (e->x() / keyWidth);
98 99
99 paintKey(pressedRow, pressedCol); 100 paintKey(pressedRow, pressedCol);
100 101
101 // emit that sucker! 102 // emit that sucker!
102 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)]; 103 FKey k = keys["r" + QString::number(pressedRow) + "c" + QString::number(pressedCol)];
103 emit keyPressed(k.getU(), k.getQ(), 0, 1, 0); 104 emit keyPressed(k.getU(), k.getQ(), 0, 1, 0);
104 /*
105 *
106 QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
107 qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 1, 0);
108 qwsServer->sendKeyEvent(0x41, 0, 0, 1, 0);
109
110 QKeyEvent ke(QEvent::KeyPress, k.getQ(), k.getU(), 0);
111 QApplication::sendEvent((QObject *)parent, &ke);
112 */
113 105
114} 106}
115 107
116void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) { 108void FunctionKeyboard::mouseReleaseEvent(QMouseEvent *) {
117 109
118 if (pressedRow != -1 && pressedRow != -1) { 110 if (pressedRow != -1 && pressedRow != -1) {
119 111
120 int row = pressedRow; pressedRow = -1; 112 int row = pressedRow; pressedRow = -1;
121 int col = pressedCol; pressedCol = -1; 113 int col = pressedCol; pressedCol = -1;
122 paintKey(row, col); 114 paintKey(row, col);
123 115
124 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)]; 116 FKey k = keys["r" + QString::number(row) + "c" + QString::number(col)];
125 emit keyPressed(k.getU(), k.getQ(), 0, 0, 0); 117 emit keyPressed(k.getU(), k.getQ(), 0, 0, 0);
126
127 /*
128 QWSServer::sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
129 qwsServer->sendKeyEvent(k.getU(), k.getQ(), 0, 0, 0);
130
131 QKeyEvent ke(QEvent::KeyRelease, k.getQ(), k.getU(), 0);
132 QApplication::sendEvent((QObject *)parent, &ke);
133 */
134 } 118 }
135 119
136} 120}
137 121
138 122
139void FunctionKeyboard::resizeEvent(QResizeEvent*) { 123void FunctionKeyboard::resizeEvent(QResizeEvent*) {
140 124
141 /* set he default font height/width */ 125 /* set he default font height/width */
142 QFontMetrics fm=fontMetrics(); 126 QFontMetrics fm=fontMetrics();
143 keyHeight = fm.lineSpacing() + 2; 127 keyHeight = fm.lineSpacing() + 2;
144 keyWidth = (double)width()/numCols; 128 keyWidth = (double)width()/numCols;
145 129
146} 130}
147 131
148QSize FunctionKeyboard::sizeHint() const { 132QSize FunctionKeyboard::sizeHint() const {
149 133
150 return QSize(width(), keyHeight * numRows + 1); 134 return QSize(width(), keyHeight * numRows + 1);
151} 135}
152 136
137void FunctionKeyboard::loadDefaults() {
138
139 /* what keys should be default? */
140 keys.insert( "r0c0", FKey ("F1", 4144, 0));
141 keys.insert( "r0c1", FKey ("F2", 4145, 0));
142 keys.insert( "r0c2", FKey ("F3", 4145, 0));
143 keys.insert( "r0c3", FKey ("F4", 4146, 0));
144 keys.insert( "r0c4", FKey ("F5", 4147, 0));
145 keys.insert( "r0c5", FKey ("F6", 4148, 0));
146 keys.insert( "r0c6", FKey ("F7", 4149, 0));
147 keys.insert( "r0c7", FKey ("F8", 4150, 0));
148 keys.insert( "r0c8", FKey ("F9", 4151, 0));
149 keys.insert( "r0c9", FKey ("F10", 4152, 0));
150 keys.insert( "r0c10", FKey ("F11", 4153, 0));
151
152 keys.insert( "r1c7", FKey ("Ho", 4112, 0));
153 keys.insert( "r1c8", FKey ("End", 4113, 0));
154 keys.insert( "r1c9", FKey ("PU", 4118, 0));
155 keys.insert( "r1c10", FKey ("PD", 4119, 0));
156
157}
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h
index b8420ae..8d05e2b 100644
--- a/noncore/apps/opie-console/function_keyboard.h
+++ b/noncore/apps/opie-console/function_keyboard.h
@@ -1,64 +1,67 @@
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 <qmap.h> 7#include <qmap.h>
8 8
9class FKey { 9class FKey {
10 10
11public: 11public:
12 12
13 FKey(): qcode(0), unicode(0) {}; 13 FKey(): qcode(0), unicode(0) {};
14 FKey(const QString &l, ushort q, ushort u): label(l), qcode(q), unicode(u) {}; 14 FKey(const QString &l, ushort q, ushort u): label(l), qcode(q), unicode(u) {};
15 15
16 QString getL() { return label; } 16 QString getL() { return label; }
17 ushort getQ() { return qcode; } 17 ushort getQ() { return qcode; }
18 ushort getU() { return unicode; } 18 ushort getU() { return unicode; }
19 19
20
20private: 21private:
21 22
22 QString label; 23 QString label;
23 ushort qcode; 24 ushort qcode;
24 ushort unicode; 25 ushort unicode;
25}; 26};
26 27
27class FunctionKeyboard : public QFrame { 28class FunctionKeyboard : public QFrame {
28 Q_OBJECT 29 Q_OBJECT
29 30
30public: 31public:
31 FunctionKeyboard(QWidget *parent = 0); 32 FunctionKeyboard(QWidget *parent = 0);
32 ~FunctionKeyboard(); 33 ~FunctionKeyboard();
33 34
34 void paintEvent(QPaintEvent *); 35 void paintEvent(QPaintEvent *);
35 void paintKey(int, int); 36 void paintKey(int, int);
36 void mousePressEvent(QMouseEvent*); 37 void mousePressEvent(QMouseEvent*);
37 void mouseReleaseEvent(QMouseEvent*); 38 void mouseReleaseEvent(QMouseEvent*);
38 void resizeEvent(QResizeEvent*); 39 void resizeEvent(QResizeEvent*);
39
40
41
42 QSize sizeHint() const; 40 QSize sizeHint() const;
43 41
44signals: 42signals:
45 43
46 void keyPressed(ushort, ushort, bool, bool, bool); 44 void keyPressed(ushort, ushort, bool, bool, bool);
47 45
48private: 46private:
49 47
48 void loadDefaults();
49
50
51private:
52
50 // thie key for the map is the row/col 53 // thie key for the map is the row/col
51 QMap<QString, FKey> keys; 54 QMap<QString, FKey> keys;
52 55
53 uint numRows; 56 uint numRows;
54 uint numCols; 57 uint numCols;
55 uint keyHeight; 58 uint keyHeight;
56 double keyWidth; // decimal point matters! 59 double keyWidth; // decimal point matters!
57 60
58 int pressedRow, pressedCol; 61 int pressedRow, pressedCol;
59 62
60 QObject *parent; 63 QObject *parent;
61 64
62}; 65};
63 66
64#endif 67#endif
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 5900785..0c89620 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -36,257 +36,257 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(
36 KeyTrans* s = KeyTrans::find(i ); 36 KeyTrans* s = KeyTrans::find(i );
37 assert( s ); 37 assert( s );
38 } 38 }
39 m_factory = new MetaFactory(); 39 m_factory = new MetaFactory();
40 Default def(m_factory); 40 Default def(m_factory);
41 m_sessions.setAutoDelete( TRUE ); 41 m_sessions.setAutoDelete( TRUE );
42 m_curSession = 0; 42 m_curSession = 0;
43 m_manager = new ProfileManager( m_factory ); 43 m_manager = new ProfileManager( m_factory );
44 m_manager->load(); 44 m_manager->load();
45 45
46 initUI(); 46 initUI();
47 populateProfiles(); 47 populateProfiles();
48} 48}
49void MainWindow::initUI() { 49void MainWindow::initUI() {
50 setToolBarsMovable( FALSE ); 50 setToolBarsMovable( FALSE );
51 51
52 /* tool bar for the menu */ 52 /* tool bar for the menu */
53 m_tool = new QToolBar( this ); 53 m_tool = new QToolBar( this );
54 m_tool->setHorizontalStretchable( TRUE ); 54 m_tool->setHorizontalStretchable( TRUE );
55 55
56 m_bar = new QMenuBar( m_tool ); 56 m_bar = new QMenuBar( m_tool );
57 m_console = new QPopupMenu( this ); 57 m_console = new QPopupMenu( this );
58 m_scripts = new QPopupMenu( this ); 58 m_scripts = new QPopupMenu( this );
59 m_sessionsPop= new QPopupMenu( this ); 59 m_sessionsPop= new QPopupMenu( this );
60 //m_settings = new QPopupMenu( this ); 60 //m_settings = new QPopupMenu( this );
61 61
62 /* add a toolbar for icons */ 62 /* add a toolbar for icons */
63 m_icons = new QToolBar(this); 63 m_icons = new QToolBar(this);
64 64
65 65
66 66
67 67
68 /* 68 /*
69 * the settings action 69 * the settings action
70 */ 70 */
71 m_setProfiles = new QAction(tr("Configure Profiles"), 71 m_setProfiles = new QAction(tr("Configure Profiles"),
72 Resource::loadPixmap( "SettingsIcon" ), 72 Resource::loadPixmap( "SettingsIcon" ),
73 QString::null, 0, this, 0); 73 QString::null, 0, this, 0);
74 // m_setProfiles->addTo( m_settings ); 74 // m_setProfiles->addTo( m_settings );
75 m_setProfiles->addTo( m_icons ); 75 m_setProfiles->addTo( m_icons );
76 m_setProfiles->addTo( m_console ); 76 m_setProfiles->addTo( m_console );
77 connect( m_setProfiles, SIGNAL(activated() ), 77 connect( m_setProfiles, SIGNAL(activated() ),
78 this, SLOT(slotConfigure() ) ); 78 this, SLOT(slotConfigure() ) );
79 79
80 80
81 /* 81 /*
82 * new Action for new sessions 82 * new Action for new sessions
83 */ 83 */
84 QAction* a = new QAction(tr("New Connection"), 84 QAction* a = new QAction(tr("New Connection"),
85 Resource::loadPixmap( "new" ), 85 Resource::loadPixmap( "new" ),
86 QString::null, 0, this, 0); 86 QString::null, 0, this, 0);
87 a->addTo( m_console ); 87 a->addTo( m_console );
88 a->addTo( m_icons ); 88 a->addTo( m_icons );
89 connect(a, SIGNAL(activated() ), 89 connect(a, SIGNAL(activated() ),
90 this, SLOT(slotNew() ) ); 90 this, SLOT(slotNew() ) );
91 91
92 /* 92 /*
93 * connect action 93 * connect action
94 */ 94 */
95 m_connect = new QAction(); 95 m_connect = new QAction();
96 m_connect->setText( tr("Connect") ); 96 m_connect->setText( tr("Connect") );
97 m_connect->addTo( m_console ); 97 m_connect->addTo( m_console );
98 connect(m_connect, SIGNAL(activated() ), 98 connect(m_connect, SIGNAL(activated() ),
99 this, SLOT(slotConnect() ) ); 99 this, SLOT(slotConnect() ) );
100 100
101 /* 101 /*
102 * disconnect action 102 * disconnect action
103 */ 103 */
104 m_disconnect = new QAction(); 104 m_disconnect = new QAction();
105 m_disconnect->setText( tr("Disconnect") ); 105 m_disconnect->setText( tr("Disconnect") );
106 m_disconnect->addTo( m_console ); 106 m_disconnect->addTo( m_console );
107 connect(m_disconnect, SIGNAL(activated() ), 107 connect(m_disconnect, SIGNAL(activated() ),
108 this, SLOT(slotDisconnect() ) ); 108 this, SLOT(slotDisconnect() ) );
109 109
110 m_transfer = new QAction(); 110 m_transfer = new QAction();
111 m_transfer->setText( tr("Transfer file...") ); 111 m_transfer->setText( tr("Transfer file...") );
112 m_transfer->addTo( m_console ); 112 m_transfer->addTo( m_console );
113 connect(m_transfer, SIGNAL(activated() ), 113 connect(m_transfer, SIGNAL(activated() ),
114 this, SLOT(slotTransfer() ) ); 114 this, SLOT(slotTransfer() ) );
115 115
116 116
117 /* 117 /*
118 * fullscreen 118 * fullscreen
119 */ 119 */
120 m_isFullscreen = false; 120 m_isFullscreen = false;
121 121
122 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 122 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
123 , QString::null, 0, this, 0); 123 , QString::null, 0, this, 0);
124 m_fullscreen->addTo( m_console ); 124 m_fullscreen->addTo( m_console );
125 m_fullscreen->addTo( m_icons ); 125 m_fullscreen->addTo( m_icons );
126 connect( m_fullscreen, SIGNAL( activated() ), 126 connect( m_fullscreen, SIGNAL( activated() ),
127 this, SLOT( slotFullscreen() ) ); 127 this, SLOT( slotFullscreen() ) );
128 128
129 /* 129 /*
130 * terminate action 130 * terminate action
131 */ 131 */
132 m_terminate = new QAction(); 132 m_terminate = new QAction();
133 m_terminate->setText( tr("Terminate") ); 133 m_terminate->setText( tr("Terminate") );
134 m_terminate->addTo( m_console ); 134 m_terminate->addTo( m_console );
135 connect(m_terminate, SIGNAL(activated() ), 135 connect(m_terminate, SIGNAL(activated() ),
136 this, SLOT(slotTerminate() ) ); 136 this, SLOT(slotTerminate() ) );
137 137
138 m_closewindow = new QAction(); 138 m_closewindow = new QAction();
139 m_closewindow->setText( tr("Close Window") ); 139 m_closewindow->setText( tr("Close Window") );
140 m_closewindow->addTo( m_console ); 140 m_closewindow->addTo( m_console );
141 connect( m_closewindow, SIGNAL(activated() ), 141 connect( m_closewindow, SIGNAL(activated() ),
142 this, SLOT(slotClose() ) ); 142 this, SLOT(slotClose() ) );
143 143
144 144
145 /* 145 /*
146 * script actions 146 * script actions
147 */ 147 */
148 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 148 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
149 m_recordScript->addTo(m_scripts); 149 m_recordScript->addTo(m_scripts);
150 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 150 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
151 151
152 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 152 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
153 m_saveScript->addTo(m_scripts); 153 m_saveScript->addTo(m_scripts);
154 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 154 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
155 155
156 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); 156 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0);
157 m_runScript->addTo(m_scripts); 157 m_runScript->addTo(m_scripts);
158 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); 158 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript()));
159 159
160 /* 160 /*
161 * action that open/closes the keyboard 161 * action that open/closes the keyboard
162 */ 162 */
163 m_openKeys = new QAction (tr("Open Keyboard..."), 163 m_openKeys = new QAction (tr("Open Keyboard..."),
164 Resource::loadPixmap( "down" ), 164 Resource::loadPixmap( "console/keyboard_icon.png" ),
165 QString::null, 0, this, 0); 165 QString::null, 0, this, 0);
166 166
167 m_openKeys->setToggleAction(true); 167 m_openKeys->setToggleAction(true);
168 168
169 connect (m_openKeys, SIGNAL(toggled(bool)), 169 connect (m_openKeys, SIGNAL(toggled(bool)),
170 this, SLOT(slotOpenKeb(bool))); 170 this, SLOT(slotOpenKeb(bool)));
171 m_openKeys->addTo(m_icons); 171 m_openKeys->addTo(m_icons);
172 172
173 173
174 /* 174 /*
175 * action that open/closes the keyboard 175 * action that open/closes the keyboard
176 */ 176 */
177 m_openButtons = new QAction ( tr( "Open Buttons..." ), 177 m_openButtons = new QAction ( tr( "Open Buttons..." ),
178 Resource::loadPixmap( "down" ), 178 Resource::loadPixmap( "down" ),
179 QString::null, 0, this, 0 ); 179 QString::null, 0, this, 0 );
180 180
181 m_openButtons->setToggleAction( true ); 181 m_openButtons->setToggleAction( true );
182 182
183 connect ( m_openButtons, SIGNAL( toggled( bool ) ), 183 connect ( m_openButtons, SIGNAL( toggled( bool ) ),
184 this, SLOT( slotOpenButtons( bool ) ) ); 184 this, SLOT( slotOpenButtons( bool ) ) );
185 m_openButtons->addTo( m_icons ); 185 m_openButtons->addTo( m_icons );
186 186
187 187
188 /* insert the submenu */ 188 /* insert the submenu */
189 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 189 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
190 -1, 0); 190 -1, 0);
191 191
192 /* insert the connection menu */ 192 /* insert the connection menu */
193 m_bar->insertItem( tr("Connection"), m_console ); 193 m_bar->insertItem( tr("Connection"), m_console );
194 194
195 /* the scripts menu */ 195 /* the scripts menu */
196 m_bar->insertItem( tr("Scripts"), m_scripts ); 196 m_bar->insertItem( tr("Scripts"), m_scripts );
197 197
198 /* the settings menu */ 198 /* the settings menu */
199 // m_bar->insertItem( tr("Settings"), m_settings ); 199 // m_bar->insertItem( tr("Settings"), m_settings );
200 200
201 /* and the keyboard */ 201 /* and the keyboard */
202 m_keyBar = new QToolBar(this); 202 m_keyBar = new QToolBar(this);
203 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 203 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
204 m_keyBar->setHorizontalStretchable( TRUE ); 204 m_keyBar->setHorizontalStretchable( TRUE );
205 m_keyBar->hide(); 205 m_keyBar->hide();
206 206
207 m_kb = new FunctionKeyboard(m_keyBar); 207 m_kb = new FunctionKeyboard(m_keyBar);
208 connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), 208 connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)),
209 this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); 209 this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool)));
210 210
211 m_buttonBar = new QToolBar( this ); 211 m_buttonBar = new QToolBar( this );
212 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); 212 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE );
213 m_buttonBar->setHorizontalStretchable( TRUE ); 213 m_buttonBar->setHorizontalStretchable( TRUE );
214 m_buttonBar->hide(); 214 m_buttonBar->hide();
215 215
216 m_qb = new QuickButton( m_buttonBar ); 216 m_qb = new QuickButton( m_buttonBar );
217 connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), 217 connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ),
218 this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); 218 this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) );
219 219
220 220
221 m_connect->setEnabled( false ); 221 m_connect->setEnabled( false );
222 m_disconnect->setEnabled( false ); 222 m_disconnect->setEnabled( false );
223 m_terminate->setEnabled( false ); 223 m_terminate->setEnabled( false );
224 m_transfer->setEnabled( false ); 224 m_transfer->setEnabled( false );
225 m_recordScript->setEnabled( false ); 225 m_recordScript->setEnabled( false );
226 m_saveScript->setEnabled( false ); 226 m_saveScript->setEnabled( false );
227 m_runScript->setEnabled( false ); 227 m_runScript->setEnabled( false );
228 m_fullscreen->setEnabled( false ); 228 m_fullscreen->setEnabled( false );
229 m_closewindow->setEnabled( false ); 229 m_closewindow->setEnabled( false );
230 230
231 /* 231 /*
232 * connect to the menu activation 232 * connect to the menu activation
233 */ 233 */
234 connect( m_sessionsPop, SIGNAL(activated( int ) ), 234 connect( m_sessionsPop, SIGNAL(activated( int ) ),
235 this, SLOT(slotProfile( int ) ) ); 235 this, SLOT(slotProfile( int ) ) );
236 236
237 m_consoleWindow = new TabWidget( this, "blah"); 237 m_consoleWindow = new TabWidget( this, "blah");
238 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 238 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
239 this, SLOT(slotSessionChanged(Session*) ) ); 239 this, SLOT(slotSessionChanged(Session*) ) );
240 setCentralWidget( m_consoleWindow ); 240 setCentralWidget( m_consoleWindow );
241 241
242} 242}
243 243
244ProfileManager* MainWindow::manager() { 244ProfileManager* MainWindow::manager() {
245 return m_manager; 245 return m_manager;
246} 246}
247TabWidget* MainWindow::tabWidget() { 247TabWidget* MainWindow::tabWidget() {
248 return m_consoleWindow; 248 return m_consoleWindow;
249} 249}
250void MainWindow::populateProfiles() { 250void MainWindow::populateProfiles() {
251 m_sessionsPop->clear(); 251 m_sessionsPop->clear();
252 Profile::ValueList list = manager()->all(); 252 Profile::ValueList list = manager()->all();
253 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 253 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
254 m_sessionsPop->insertItem( (*it).name() ); 254 m_sessionsPop->insertItem( (*it).name() );
255 } 255 }
256 256
257} 257}
258MainWindow::~MainWindow() { 258MainWindow::~MainWindow() {
259 delete m_factory; 259 delete m_factory;
260 manager()->save(); 260 manager()->save();
261} 261}
262 262
263MetaFactory* MainWindow::factory() { 263MetaFactory* MainWindow::factory() {
264 return m_factory; 264 return m_factory;
265} 265}
266 266
267Session* MainWindow::currentSession() { 267Session* MainWindow::currentSession() {
268 return m_curSession; 268 return m_curSession;
269} 269}
270 270
271QList<Session> MainWindow::sessions() { 271QList<Session> MainWindow::sessions() {
272 return m_sessions; 272 return m_sessions;
273} 273}
274 274
275void MainWindow::slotNew() { 275void MainWindow::slotNew() {
276 ProfileEditorDialog dlg(factory() ); 276 ProfileEditorDialog dlg(factory() );
277 dlg.showMaximized(); 277 dlg.showMaximized();
278 int ret = dlg.exec(); 278 int ret = dlg.exec();
279 279
280 if ( ret == QDialog::Accepted ) { 280 if ( ret == QDialog::Accepted ) {
281 create( dlg.profile() ); 281 create( dlg.profile() );
282 } 282 }
283} 283}
284 284
285void MainWindow::slotRecordScript() { 285void MainWindow::slotRecordScript() {
286/* if (currentSession()) { 286/* if (currentSession()) {
287 currentSession()->emulationLayer()->startRecording(); 287 currentSession()->emulationLayer()->startRecording();
288 } 288 }
289 */ 289 */
290} 290}
291 291
292void MainWindow::slotSaveScript() { 292void MainWindow::slotSaveScript() {