summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console
authorzecke <zecke>2002-10-20 13:52:13 (UTC)
committer zecke <zecke>2002-10-20 13:52:13 (UTC)
commit89ed0106d3de43c0f39250524bc80de00f2b596c (patch) (unidiff)
tree4354cc80f93f1a76caea30c350e4fc3350c32726 /noncore/apps/opie-console
parent4b27ac49b4027ffd59d2606f1aceea313446aede (diff)
downloadopie-89ed0106d3de43c0f39250524bc80de00f2b596c.zip
opie-89ed0106d3de43c0f39250524bc80de00f2b596c.tar.gz
opie-89ed0106d3de43c0f39250524bc80de00f2b596c.tar.bz2
Enable setSize SIGNAL/SLOT conenction in session
Add some separators to m_console of mainwindow
Diffstat (limited to 'noncore/apps/opie-console') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp1
-rw-r--r--noncore/apps/opie-console/TEmulation.cpp1
-rw-r--r--noncore/apps/opie-console/io_layer.h2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp5
-rw-r--r--noncore/apps/opie-console/session.cpp2
5 files changed, 9 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index a2373bf..6b0d6f2 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -77,48 +77,49 @@
77#include <sys/types.h> 77#include <sys/types.h>
78#include <sys/ioctl.h> 78#include <sys/ioctl.h>
79#include <sys/wait.h> 79#include <sys/wait.h>
80 80
81#ifdef HAVE_OPENPTY 81#ifdef HAVE_OPENPTY
82#include <pty.h> 82#include <pty.h>
83#endif 83#endif
84 84
85#include "procctl.h" 85#include "procctl.h"
86#include "MyPty.h" 86#include "MyPty.h"
87 87
88 88
89#undef VERBOSE_DEBUG 89#undef VERBOSE_DEBUG
90 90
91 91
92/* -------------------------------------------------------------------------- */ 92/* -------------------------------------------------------------------------- */
93 93
94/*! 94/*!
95 Informs the client program about the 95 Informs the client program about the
96 actual size of the window. 96 actual size of the window.
97*/ 97*/
98 98
99void MyPty::setSize(int lines, int columns) 99void MyPty::setSize(int lines, int columns)
100{ 100{
101 qWarning("setting size");
101 struct winsize wsize; 102 struct winsize wsize;
102 wsize.ws_row = (unsigned short)lines; 103 wsize.ws_row = (unsigned short)lines;
103 wsize.ws_col = (unsigned short)columns; 104 wsize.ws_col = (unsigned short)columns;
104 if(m_fd < 0) return; 105 if(m_fd < 0) return;
105 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); 106 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
106} 107}
107 108
108 109
109void MyPty::donePty() 110void MyPty::donePty()
110{ 111{
111 // This is code from the Qt DumbTerminal example 112 // This is code from the Qt DumbTerminal example
112 int status = 0; 113 int status = 0;
113 114
114 ::close(m_fd); 115 ::close(m_fd);
115 116
116 if (m_cpid) { 117 if (m_cpid) {
117 kill(m_cpid, SIGHUP); 118 kill(m_cpid, SIGHUP);
118 //waitpid(m_cpid, &status, 0); 119 //waitpid(m_cpid, &status, 0);
119 delete m_sn_e; 120 delete m_sn_e;
120 delete m_sn_r; 121 delete m_sn_r;
121 m_sn_e = 0l; 122 m_sn_e = 0l;
122 m_sn_r = 0l; 123 m_sn_r = 0l;
123 } 124 }
124 125
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp
index 6f3ad32..7a0c624 100644
--- a/noncore/apps/opie-console/TEmulation.cpp
+++ b/noncore/apps/opie-console/TEmulation.cpp
@@ -186,48 +186,49 @@ void TEmulation::onRcvChar(int c)
186{ 186{
187 c &= 0xff; 187 c &= 0xff;
188 switch (c) 188 switch (c)
189 { 189 {
190 case '\b' : scr->BackSpace(); break; 190 case '\b' : scr->BackSpace(); break;
191 case '\t' : scr->Tabulate(); break; 191 case '\t' : scr->Tabulate(); break;
192 case '\n' : scr->NewLine(); break; 192 case '\n' : scr->NewLine(); break;
193 case '\r' : scr->Return(); break; 193 case '\r' : scr->Return(); break;
194 case 0x07 : gui->Bell(); break; 194 case 0x07 : gui->Bell(); break;
195 default : scr->ShowCharacter(c); break; 195 default : scr->ShowCharacter(c); break;
196 }; 196 };
197} 197}
198 198
199/* ------------------------------------------------------------------------- */ 199/* ------------------------------------------------------------------------- */
200/* */ 200/* */
201/* Keyboard Handling */ 201/* Keyboard Handling */
202/* */ 202/* */
203/* ------------------------------------------------------------------------- */ 203/* ------------------------------------------------------------------------- */
204 204
205/*! 205/*!
206*/ 206*/
207 207
208void TEmulation::onKeyPress( QKeyEvent* ev ) 208void TEmulation::onKeyPress( QKeyEvent* ev )
209{ 209{
210 qWarning("onKeyPress,....");
210 if (!connected) return; // someone else gets the keys 211 if (!connected) return; // someone else gets the keys
211 if (scr->getHistCursor() != scr->getHistLines()); 212 if (scr->getHistCursor() != scr->getHistLines());
212 scr->setHistCursor(scr->getHistLines()); 213 scr->setHistCursor(scr->getHistLines());
213 if (!ev->text().isEmpty()) 214 if (!ev->text().isEmpty())
214 { // A block of text 215 { // A block of text
215 // Note that the text is proper unicode. 216 // Note that the text is proper unicode.
216 // We should do a conversion here, but since this 217 // We should do a conversion here, but since this
217 // routine will never be used, we simply emit plain ascii. 218 // routine will never be used, we simply emit plain ascii.
218 emit sndBlock(ev->text().ascii(),ev->text().length()); 219 emit sndBlock(ev->text().ascii(),ev->text().length());
219 } 220 }
220 else if (ev->ascii()>0) 221 else if (ev->ascii()>0)
221 { unsigned char c[1]; 222 { unsigned char c[1];
222 c[0] = ev->ascii(); 223 c[0] = ev->ascii();
223 emit sndBlock((char*)c,1); 224 emit sndBlock((char*)c,1);
224 } 225 }
225} 226}
226 227
227// Unblocking, Byte to Unicode translation --------------------------------- -- 228// Unblocking, Byte to Unicode translation --------------------------------- --
228 229
229/* 230/*
230 We are doing code conversion from locale to unicode first. 231 We are doing code conversion from locale to unicode first.
231*/ 232*/
232 233
233void TEmulation::onRcvBlock(const char *s, int len) 234void TEmulation::onRcvBlock(const char *s, int len)
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h
index d5f7eab..97a1e1c 100644
--- a/noncore/apps/opie-console/io_layer.h
+++ b/noncore/apps/opie-console/io_layer.h
@@ -99,28 +99,28 @@ public slots:
99 /** 99 /**
100 * send a QCString to the device 100 * send a QCString to the device
101 */ 101 */
102 virtual void send( const QByteArray& ) = 0; 102 virtual void send( const QByteArray& ) = 0;
103 103
104 /** 104 /**
105 * bool open 105 * bool open
106 */ 106 */
107 virtual bool open() = 0; 107 virtual bool open() = 0;
108 108
109 /** 109 /**
110 * close the io 110 * close the io
111 */ 111 */
112 virtual void close() = 0; 112 virtual void close() = 0;
113 113
114 /** 114 /**
115 * closes and reloads the settings 115 * closes and reloads the settings
116 */ 116 */
117 virtual void reload( const Profile& ) = 0; 117 virtual void reload( const Profile& ) = 0;
118 118
119 /** 119 /**
120 * set the size 120 * set the size
121 * needed for pty 121 * needed for pty
122 */ 122 */
123 virtual void setSize(int rows, int cols ); 123 virtual void setSize(int lines, int cols );
124}; 124};
125 125
126#endif 126#endif
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 0c89620..a7541f0 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -56,97 +56,100 @@ void MainWindow::initUI() {
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 m_console->insertSeparator();
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_console->insertSeparator();
111
110 m_transfer = new QAction(); 112 m_transfer = new QAction();
111 m_transfer->setText( tr("Transfer file...") ); 113 m_transfer->setText( tr("Transfer file...") );
112 m_transfer->addTo( m_console ); 114 m_transfer->addTo( m_console );
113 connect(m_transfer, SIGNAL(activated() ), 115 connect(m_transfer, SIGNAL(activated() ),
114 this, SLOT(slotTransfer() ) ); 116 this, SLOT(slotTransfer() ) );
115 117
116 118
117 /* 119 /*
118 * fullscreen 120 * fullscreen
119 */ 121 */
120 m_isFullscreen = false; 122 m_isFullscreen = false;
121 123
122 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 124 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
123 , QString::null, 0, this, 0); 125 , QString::null, 0, this, 0);
124 m_fullscreen->addTo( m_console ); 126 m_fullscreen->addTo( m_console );
125 m_fullscreen->addTo( m_icons ); 127 m_fullscreen->addTo( m_icons );
126 connect( m_fullscreen, SIGNAL( activated() ), 128 connect( m_fullscreen, SIGNAL( activated() ),
127 this, SLOT( slotFullscreen() ) ); 129 this, SLOT( slotFullscreen() ) );
128 130
131 m_console->insertSeparator();
129 /* 132 /*
130 * terminate action 133 * terminate action
131 */ 134 */
132 m_terminate = new QAction(); 135 m_terminate = new QAction();
133 m_terminate->setText( tr("Terminate") ); 136 m_terminate->setText( tr("Terminate") );
134 m_terminate->addTo( m_console ); 137 m_terminate->addTo( m_console );
135 connect(m_terminate, SIGNAL(activated() ), 138 connect(m_terminate, SIGNAL(activated() ),
136 this, SLOT(slotTerminate() ) ); 139 this, SLOT(slotTerminate() ) );
137 140
138 m_closewindow = new QAction(); 141 m_closewindow = new QAction();
139 m_closewindow->setText( tr("Close Window") ); 142 m_closewindow->setText( tr("Close Window") );
140 m_closewindow->addTo( m_console ); 143 m_closewindow->addTo( m_console );
141 connect( m_closewindow, SIGNAL(activated() ), 144 connect( m_closewindow, SIGNAL(activated() ),
142 this, SLOT(slotClose() ) ); 145 this, SLOT(slotClose() ) );
143 146
144 147
145 /* 148 /*
146 * script actions 149 * script actions
147 */ 150 */
148 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 151 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
149 m_recordScript->addTo(m_scripts); 152 m_recordScript->addTo(m_scripts);
150 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 153 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
151 154
152 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 155 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index 2ce6872..03d0fcd 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -34,48 +34,50 @@ IOLayer* Session::layer() {
34 return m_layer; 34 return m_layer;
35} 35}
36EmulationHandler* Session::emulationHandler() { 36EmulationHandler* Session::emulationHandler() {
37 return m_emu; 37 return m_emu;
38} 38}
39QWidget* Session::widget() { 39QWidget* Session::widget() {
40 if (!m_emu ) 40 if (!m_emu )
41 return 0l; 41 return 0l;
42 42
43 return m_emu->widget(); 43 return m_emu->widget();
44} 44}
45/* 45/*
46WidgetLayer* Session::emulationWidget() { 46WidgetLayer* Session::emulationWidget() {
47 return m_widLay; 47 return m_widLay;
48} 48}
49*/ 49*/
50void Session::connect() { 50void Session::connect() {
51 if ( !m_layer || !m_emu ) 51 if ( !m_layer || !m_emu )
52 return; 52 return;
53 53
54 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), 54 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
55 m_emu, SLOT(recv(const QByteArray&) ) ); 55 m_emu, SLOT(recv(const QByteArray&) ) );
56 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), 56 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ),
57 m_layer, SLOT(send(const QByteArray&) ) ); 57 m_layer, SLOT(send(const QByteArray&) ) );
58 QObject::connect(m_emu, SIGNAL(changeSize(int, int) ),
59 m_layer, SLOT(setSize(int, int) ) );
58} 60}
59 61
60void Session::disconnect() { 62void Session::disconnect() {
61 63
62 if ( !m_layer || !m_emu ) 64 if ( !m_layer || !m_emu )
63 return; 65 return;
64 66
65 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), 67 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
66 m_emu, SLOT(recv(const QByteArray&) ) ); 68 m_emu, SLOT(recv(const QByteArray&) ) );
67 QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), 69 QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ),
68 m_layer, SLOT(send(const QByteArray&) ) ); 70 m_layer, SLOT(send(const QByteArray&) ) );
69} 71}
70 72
71void Session::setName( const QString& na){ 73void Session::setName( const QString& na){
72 m_name = na; 74 m_name = na;
73} 75}
74 76
75void Session::setWidgetStack( QWidgetStack* wid ) { 77void Session::setWidgetStack( QWidgetStack* wid ) {
76 delete m_emu; 78 delete m_emu;
77 m_emu = 0l; 79 m_emu = 0l;
78 delete m_widget; 80 delete m_widget;
79 /* the EmulationLayer was destroyed... */ 81 /* the EmulationLayer was destroyed... */
80 82
81 m_widget = wid; 83 m_widget = wid;