author | zecke <zecke> | 2002-10-22 14:25:05 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-22 14:25:05 (UTC) |
commit | 53a21f61d99d62e62412e1b5ca9bde085b25bde5 (patch) (unidiff) | |
tree | 894a1162468586710213945647d835dd94a3f5f1 | |
parent | e006ea7655b455974ae64c30098eeecb7304508b (diff) | |
download | opie-53a21f61d99d62e62412e1b5ca9bde085b25bde5.zip opie-53a21f61d99d62e62412e1b5ca9bde085b25bde5.tar.gz opie-53a21f61d99d62e62412e1b5ca9bde085b25bde5.tar.bz2 |
set $TERM in MyPty according to the terminal type
emulation_handler set the keyfilter right for the right terminal
filetransfer fix warnings
profile add Linux, XTerm as Emulation options
TerminalWidget add Linux,XTerm
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/MyPty.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/filetransfer.h | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/profile.h | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.cpp | 24 |
7 files changed, 61 insertions, 16 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index 6b0d6f2..16bb5ff 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp | |||
@@ -162,33 +162,33 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) | |||
162 | dup2(ttyfd, STDIN_FILENO); | 162 | dup2(ttyfd, STDIN_FILENO); |
163 | dup2(ttyfd, STDOUT_FILENO); | 163 | dup2(ttyfd, STDOUT_FILENO); |
164 | dup2(ttyfd, STDERR_FILENO); | 164 | dup2(ttyfd, STDERR_FILENO); |
165 | // should be done with tty, so close it | 165 | // should be done with tty, so close it |
166 | ::close(ttyfd); | 166 | ::close(ttyfd); |
167 | static struct termios ttmode; | 167 | static struct termios ttmode; |
168 | if ( setsid() < 0 ) | 168 | if ( setsid() < 0 ) |
169 | perror( "failed to set process group" ); | 169 | perror( "failed to set process group" ); |
170 | #if defined (TIOCSCTTY) | 170 | #if defined (TIOCSCTTY) |
171 | // grabbed from APUE by Stevens | 171 | // grabbed from APUE by Stevens |
172 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); | 172 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); |
173 | #endif | 173 | #endif |
174 | tcgetattr( STDIN_FILENO, &ttmode ); | 174 | tcgetattr( STDIN_FILENO, &ttmode ); |
175 | ttmode.c_cc[VINTR] = 3; | 175 | ttmode.c_cc[VINTR] = 3; |
176 | ttmode.c_cc[VERASE] = 8; | 176 | ttmode.c_cc[VERASE] = 8; |
177 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); | 177 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); |
178 | setenv("TERM","vt100",1); | 178 | setenv("TERM",m_term,1); |
179 | setenv("COLORTERM","0",1); | 179 | setenv("COLORTERM","0",1); |
180 | 180 | ||
181 | if (getuid() == 0) { | 181 | if (getuid() == 0) { |
182 | char msg[] = "WARNING: You are running this shell as root!\n"; | 182 | char msg[] = "WARNING: You are running this shell as root!\n"; |
183 | write(ttyfd, msg, sizeof(msg)); | 183 | write(ttyfd, msg, sizeof(msg)); |
184 | } | 184 | } |
185 | execl(cmd, cmd, 0); | 185 | execl(cmd, cmd, 0); |
186 | 186 | ||
187 | donePty(); | 187 | donePty(); |
188 | exit(-1); | 188 | exit(-1); |
189 | } | 189 | } |
190 | 190 | ||
191 | // parent - continue as a widget | 191 | // parent - continue as a widget |
192 | delete m_sn_r; | 192 | delete m_sn_r; |
193 | m_sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); | 193 | m_sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); |
194 | delete m_sn_e; | 194 | delete m_sn_e; |
@@ -223,34 +223,49 @@ int MyPty::openPty() | |||
223 | } | 223 | } |
224 | } | 224 | } |
225 | } | 225 | } |
226 | #endif | 226 | #endif |
227 | 227 | ||
228 | if ( ptyfd < 0 ) { | 228 | if ( ptyfd < 0 ) { |
229 | //qApp->exit(1); | 229 | //qApp->exit(1); |
230 | return -1; | 230 | return -1; |
231 | } | 231 | } |
232 | 232 | ||
233 | return ptyfd; | 233 | return ptyfd; |
234 | } | 234 | } |
235 | 235 | ||
236 | /*! | 236 | /*! |
237 | Create an instance. | 237 | Create an instance. |
238 | */ | 238 | */ |
239 | MyPty::MyPty(const Profile&) : m_cpid(0) | 239 | MyPty::MyPty(const Profile& prof) : m_cpid(0) |
240 | { | 240 | { |
241 | |||
242 | int term = prof.readNumEntry("Terminal", Profile::VT100 ); | ||
243 | switch( term ) { | ||
244 | default: | ||
245 | case Profile::VT100: | ||
246 | case Profile::VT102: | ||
247 | m_term = "vt100"; | ||
248 | break; | ||
249 | case Profile::Linux: | ||
250 | m_term = "linux"; | ||
251 | break; | ||
252 | case Profile::XTerm: | ||
253 | m_term = "xterm"; | ||
254 | break; | ||
255 | } | ||
241 | m_sn_e = 0l; | 256 | m_sn_e = 0l; |
242 | m_sn_r = 0l; | 257 | m_sn_r = 0l; |
243 | m_fd = openPty(); | 258 | m_fd = openPty(); |
244 | ProcCtl* ctl = ProcCtl::self(); | 259 | ProcCtl* ctl = ProcCtl::self(); |
245 | } | 260 | } |
246 | 261 | ||
247 | /*! | 262 | /*! |
248 | Destructor. | 263 | Destructor. |
249 | Note that the related client program is not killed | 264 | Note that the related client program is not killed |
250 | (yet) when a instance is deleted. | 265 | (yet) when a instance is deleted. |
251 | */ | 266 | */ |
252 | MyPty::~MyPty() | 267 | MyPty::~MyPty() |
253 | { | 268 | { |
254 | donePty(); | 269 | donePty(); |
255 | } | 270 | } |
256 | QString MyPty::identifier()const { | 271 | QString MyPty::identifier()const { |
diff --git a/noncore/apps/opie-console/MyPty.h b/noncore/apps/opie-console/MyPty.h index 81abad5..7561ca3 100644 --- a/noncore/apps/opie-console/MyPty.h +++ b/noncore/apps/opie-console/MyPty.h | |||
@@ -81,19 +81,20 @@ private: | |||
81 | 81 | ||
82 | protected slots: | 82 | protected slots: |
83 | void readPty(); | 83 | void readPty(); |
84 | void donePty(); | 84 | void donePty(); |
85 | 85 | ||
86 | private: | 86 | private: |
87 | int openPty(); | 87 | int openPty(); |
88 | 88 | ||
89 | private: | 89 | private: |
90 | 90 | ||
91 | char m_ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx" | 91 | char m_ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx" |
92 | char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." | 92 | char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." |
93 | int m_fd; | 93 | int m_fd; |
94 | int m_cpid; | 94 | int m_cpid; |
95 | QSocketNotifier* m_sn_e; | 95 | QSocketNotifier* m_sn_e; |
96 | QSocketNotifier* m_sn_r; | 96 | QSocketNotifier* m_sn_r; |
97 | char* m_term; | ||
97 | }; | 98 | }; |
98 | 99 | ||
99 | #endif | 100 | #endif |
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index df8e573..bdc8b43 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -26,33 +26,48 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c | |||
26 | load( prof ); | 26 | load( prof ); |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | } | 30 | } |
31 | EmulationHandler::~EmulationHandler() { | 31 | EmulationHandler::~EmulationHandler() { |
32 | if (isRecording()) | 32 | if (isRecording()) |
33 | clearScript(); | 33 | clearScript(); |
34 | delete m_teEmu; | 34 | delete m_teEmu; |
35 | delete m_teWid; | 35 | delete m_teWid; |
36 | } | 36 | } |
37 | 37 | ||
38 | void EmulationHandler::load( const Profile& prof) { | 38 | void EmulationHandler::load( const Profile& prof) { |
39 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 39 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
40 | int num = prof.readNumEntry("Color"); | 40 | int num = prof.readNumEntry("Color"); |
41 | setColor( foreColor(num), backColor(num) ); | 41 | setColor( foreColor(num), backColor(num) ); |
42 | m_teWid->setBackgroundColor(backColor(num) ); | 42 | m_teWid->setBackgroundColor(backColor(num) ); |
43 | |||
44 | int term = prof.readNumEntry("Terminal", 0) ; | ||
45 | switch(term) { | ||
46 | default: | ||
47 | case Profile::VT102: | ||
48 | case Profile::VT100: | ||
49 | m_teEmu->setKeytrans("vt100.keytab"); | ||
50 | break; | ||
51 | case Profile::Linux: | ||
52 | m_teEmu->setKeytrans("linux.keytab"); | ||
53 | break; | ||
54 | case Profile::XTerm: | ||
55 | m_teEmu->setKeytrans("default.Keytab"); | ||
56 | break; | ||
57 | } | ||
43 | } | 58 | } |
44 | void EmulationHandler::recv( const QByteArray& ar) { | 59 | void EmulationHandler::recv( const QByteArray& ar) { |
45 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | 60 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); |
46 | } | 61 | } |
47 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 62 | void EmulationHandler::recvEmulation(const char* src, int len ) { |
48 | QByteArray ar(len); | 63 | QByteArray ar(len); |
49 | 64 | ||
50 | memcpy(ar.data(), src, sizeof(char) * len ); | 65 | memcpy(ar.data(), src, sizeof(char) * len ); |
51 | 66 | ||
52 | if (isRecording()) | 67 | if (isRecording()) |
53 | m_script->append(ar); | 68 | m_script->append(ar); |
54 | emit send(ar); | 69 | emit send(ar); |
55 | } | 70 | } |
56 | QWidget* EmulationHandler::widget() { | 71 | QWidget* EmulationHandler::widget() { |
57 | return m_teWid; | 72 | return m_teWid; |
58 | } | 73 | } |
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index b81c2a2..221838c 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp | |||
@@ -47,32 +47,33 @@ void FileTransfer::sendFile( const QString& file ) { | |||
47 | 47 | ||
48 | m_pid = fork(); | 48 | m_pid = fork(); |
49 | switch( m_pid ) { | 49 | switch( m_pid ) { |
50 | case -1: | 50 | case -1: |
51 | emit error( StartError, tr("Was not able to fork") ); | 51 | emit error( StartError, tr("Was not able to fork") ); |
52 | slotExec(); | 52 | slotExec(); |
53 | break; | 53 | break; |
54 | case 0:{ | 54 | case 0:{ |
55 | setupChild(); | 55 | setupChild(); |
56 | /* exec */ | 56 | /* exec */ |
57 | char* verbose = "-vv"; | 57 | char* verbose = "-vv"; |
58 | char* binray = "-b"; | 58 | char* binray = "-b"; |
59 | 59 | ||
60 | 60 | ||
61 | char* typus; | 61 | char* typus; |
62 | switch(m_type ) { | 62 | switch(m_type ) { |
63 | default: | ||
63 | case SZ: | 64 | case SZ: |
64 | typus = ""; | 65 | typus = ""; |
65 | break; | 66 | break; |
66 | case SX: | 67 | case SX: |
67 | typus = "-X"; | 68 | typus = "-X"; |
68 | break; | 69 | break; |
69 | case SY: | 70 | case SY: |
70 | typus = "--ymodem"; | 71 | typus = "--ymodem"; |
71 | break; | 72 | break; |
72 | } | 73 | } |
73 | 74 | ||
74 | /* we should never return from here */ | 75 | /* we should never return from here */ |
75 | execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL ); | 76 | execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL ); |
76 | 77 | ||
77 | /* communication for error!*/ | 78 | /* communication for error!*/ |
78 | char resultByte =1; | 79 | char resultByte =1; |
@@ -219,32 +220,32 @@ void FileTransfer::slotProgress( const QStringList& list ) { | |||
219 | bps = progi[1].toInt(); | 220 | bps = progi[1].toInt(); |
220 | 221 | ||
221 | // time | 222 | // time |
222 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); | 223 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); |
223 | min = progi[0].toInt(); | 224 | min = progi[0].toInt(); |
224 | sec = progi[1].toInt(); | 225 | sec = progi[1].toInt(); |
225 | 226 | ||
226 | 227 | ||
227 | if ( prog > m_prog ) { | 228 | if ( prog > m_prog ) { |
228 | m_prog = prog; | 229 | m_prog = prog; |
229 | emit progress(m_file, m_prog, bps, -1, min , sec ); | 230 | emit progress(m_file, m_prog, bps, -1, min , sec ); |
230 | } | 231 | } |
231 | 232 | ||
232 | } | 233 | } |
233 | void FileTransfer::cancel() { | 234 | void FileTransfer::cancel() { |
234 | if(m_pid > 0) ::kill(m_pid,9 ); | 235 | if(m_pid > 0) ::kill(m_pid,9 ); |
235 | 236 | ||
236 | } | 237 | } |
237 | void FileTransfer::slotExec() { | 238 | void FileTransfer::slotExec() { |
238 | char buf[2]; | 239 | char buf[2]; |
239 | ::read(m_term[0], buf, 1 ); | 240 | ::read(m_term[0], buf, 1 ); |
240 | delete m_proc; | 241 | delete m_proc; |
241 | delete m_not; | 242 | delete m_not; |
242 | m_proc = m_not = 0l; | 243 | m_proc = m_not = 0l; |
243 | close( m_term[0] ); | 244 | close( m_term[0] ); |
244 | close( m_term[1] ); | 245 | close( m_term[1] ); |
245 | close( m_comm[0] ); | 246 | close( m_comm[0] ); |
246 | close( m_comm[1] ); | 247 | close( m_comm[1] ); |
247 | layer()->closeRawIO( m_fd ); | 248 | layer()->closeRawIO( m_fd ); |
248 | emit sent(); | 249 | emit sent(); |
249 | m_pid = 0; | 250 | m_pid = 0; |
250 | } | 251 | } |
diff --git a/noncore/apps/opie-console/filetransfer.h b/noncore/apps/opie-console/filetransfer.h index 9cc1e8d..8f55041 100644 --- a/noncore/apps/opie-console/filetransfer.h +++ b/noncore/apps/opie-console/filetransfer.h | |||
@@ -20,35 +20,29 @@ public: | |||
20 | SX, | 20 | SX, |
21 | SY | 21 | SY |
22 | }; | 22 | }; |
23 | FileTransfer( Type t, IOLayer* ); | 23 | FileTransfer( Type t, IOLayer* ); |
24 | ~FileTransfer(); | 24 | ~FileTransfer(); |
25 | 25 | ||
26 | void sendFile( const QString& file ); | 26 | void sendFile( const QString& file ); |
27 | void sendFile( const QFile& ); | 27 | void sendFile( const QFile& ); |
28 | void cancel(); | 28 | void cancel(); |
29 | 29 | ||
30 | private slots: | 30 | private slots: |
31 | void setupChild(); | 31 | void setupChild(); |
32 | void slotRead(); | 32 | void slotRead(); |
33 | void slotProgress( const QStringList& ); | 33 | void slotProgress( const QStringList& ); |
34 | void slotExec(); | 34 | void slotExec(); |
35 | private: | 35 | private: |
36 | /* | 36 | Type m_type; |
37 | * FIXME? What does happen if we've | ||
38 | * two FileTransfers at a time? | ||
39 | * Have a procctl which does listen | ||
40 | * for termination and then send a signal | ||
41 | */ | ||
42 | pid_t m_pid; | 37 | pid_t m_pid; |
43 | int m_fd; | 38 | int m_fd; |
44 | int m_prog; | 39 | int m_prog; |
45 | int m_info[2]; | 40 | int m_info[2]; |
46 | int m_comm[2]; | 41 | int m_comm[2]; |
47 | int m_term[2]; | 42 | int m_term[2]; |
48 | QString m_file; | 43 | QString m_file; |
49 | Type m_type; | ||
50 | QSocketNotifier *m_not; | 44 | QSocketNotifier *m_not; |
51 | QSocketNotifier* m_proc; | 45 | QSocketNotifier* m_proc; |
52 | }; | 46 | }; |
53 | 47 | ||
54 | #endif | 48 | #endif |
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h index 4f9e9c2..eeda1b6 100644 --- a/noncore/apps/opie-console/profile.h +++ b/noncore/apps/opie-console/profile.h | |||
@@ -7,33 +7,36 @@ | |||
7 | #include <qvaluelist.h> | 7 | #include <qvaluelist.h> |
8 | /** | 8 | /** |
9 | * A session will be generated from a saved | 9 | * A session will be generated from a saved |
10 | * profile. A profile contains the iolayername | 10 | * profile. A profile contains the iolayername |
11 | * a name. | 11 | * a name. |
12 | * We can generate a Session from a Profile | 12 | * We can generate a Session from a Profile |
13 | * Configuration is contained here too | 13 | * Configuration is contained here too |
14 | */ | 14 | */ |
15 | class Profile { | 15 | class Profile { |
16 | public: | 16 | public: |
17 | typedef QValueList<Profile> ValueList; | 17 | typedef QValueList<Profile> ValueList; |
18 | enum Color { Black = 0, | 18 | enum Color { Black = 0, |
19 | White, | 19 | White, |
20 | Gray, | 20 | Gray, |
21 | Green, | 21 | Green, |
22 | Orange}; | 22 | Orange}; |
23 | enum Terminal {VT102 = 0, VT100 }; | 23 | enum Terminal {VT102 = 0, VT100, |
24 | Ansi, | ||
25 | Linux, | ||
26 | XTerm }; | ||
24 | enum Font { Micro = 0, Small, Medium }; | 27 | enum Font { Micro = 0, Small, Medium }; |
25 | Profile(); | 28 | Profile(); |
26 | Profile( const QString& name, | 29 | Profile( const QString& name, |
27 | const QCString& iolayerName, | 30 | const QCString& iolayerName, |
28 | const QCString& termName, | 31 | const QCString& termName, |
29 | int background, | 32 | int background, |
30 | int foreground, | 33 | int foreground, |
31 | int terminal); | 34 | int terminal); |
32 | Profile( const Profile& ); | 35 | Profile( const Profile& ); |
33 | Profile &operator=( const Profile& ); | 36 | Profile &operator=( const Profile& ); |
34 | bool operator==( const Profile& prof ); | 37 | bool operator==( const Profile& prof ); |
35 | 38 | ||
36 | ~Profile(); | 39 | ~Profile(); |
37 | QString name()const; | 40 | QString name()const; |
38 | QCString ioLayerName()const; | 41 | QCString ioLayerName()const; |
39 | QCString terminalName()const; | 42 | QCString terminalName()const; |
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index 8badf96..eae94c3 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp | |||
@@ -1,33 +1,34 @@ | |||
1 | #include <qbuttongroup.h> | 1 | #include <qbuttongroup.h> |
2 | #include <qlabel.h> | 2 | #include <qlabel.h> |
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qradiobutton.h> | 5 | #include <qradiobutton.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qvbox.h> | 7 | #include <qvbox.h> |
8 | #include <qhgroupbox.h> | 8 | #include <qhgroupbox.h> |
9 | #include <qlayout.h> | 9 | #include <qlayout.h> |
10 | 10 | ||
11 | #include "terminalwidget.h" | 11 | #include "terminalwidget.h" |
12 | 12 | ||
13 | namespace { | 13 | namespace { |
14 | enum TermIds { | 14 | enum TermIds { |
15 | id_term_vt100, | 15 | id_term_vt100 = 0, |
16 | id_term_vt102, | 16 | id_term_vt102, |
17 | id_term_ansi | 17 | id_term_linux, |
18 | id_term_xterm | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | enum ColourIds { | 21 | enum ColourIds { |
21 | id_term_black, | 22 | id_term_black, |
22 | id_term_white, | 23 | id_term_white, |
23 | id_term_green, | 24 | id_term_green, |
24 | id_term_orange | 25 | id_term_orange |
25 | }; | 26 | }; |
26 | 27 | ||
27 | enum FontIds { | 28 | enum FontIds { |
28 | id_size_small, | 29 | id_size_small, |
29 | id_size_medium, | 30 | id_size_medium, |
30 | id_size_large | 31 | id_size_large |
31 | }; | 32 | }; |
32 | }; | 33 | }; |
33 | 34 | ||
@@ -61,34 +62,37 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | |||
61 | // Layout | 62 | // Layout |
62 | m_typeBox->add(m_terminal ); | 63 | m_typeBox->add(m_terminal ); |
63 | m_typeBox->add(m_terminalBox ); | 64 | m_typeBox->add(m_terminalBox ); |
64 | 65 | ||
65 | m_hbox->add(m_sizeSmall ); | 66 | m_hbox->add(m_sizeSmall ); |
66 | m_hbox->add(m_sizeMedium ); | 67 | m_hbox->add(m_sizeMedium ); |
67 | m_hbox->add(m_sizeLarge ); | 68 | m_hbox->add(m_sizeLarge ); |
68 | m_lroot->add(m_groupSize ); | 69 | m_lroot->add(m_groupSize ); |
69 | 70 | ||
70 | m_colorBox->add( m_colorLabel ); | 71 | m_colorBox->add( m_colorLabel ); |
71 | m_colorBox->add( m_colorCmb ); | 72 | m_colorBox->add( m_colorCmb ); |
72 | 73 | ||
73 | m_lroot->add(m_groupConv ); | 74 | m_lroot->add(m_groupConv ); |
74 | m_lroot->add(m_groupOptions ); | 75 | m_lroot->add(m_groupOptions ); |
75 | 76 | ||
76 | // Fill in some options | 77 | // Fill in some options |
77 | m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 ); | 78 | qWarning("Options for terminal box"); |
78 | m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 ); | 79 | m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); |
80 | m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); | ||
81 | m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); | ||
82 | m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); | ||
79 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); | 83 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); |
80 | 84 | ||
81 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); | 85 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); |
82 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); | 86 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); |
83 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); | 87 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); |
84 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); | 88 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); |
85 | 89 | ||
86 | // signals + slots | 90 | // signals + slots |
87 | /* | 91 | /* |
88 | connect(m_terminalBox, SIGNAL(activated(int) ), | 92 | connect(m_terminalBox, SIGNAL(activated(int) ), |
89 | this, SLOT(slotTermTerm(int) ) ); | 93 | this, SLOT(slotTermTerm(int) ) ); |
90 | connect(m_colorBox, SIGNAL(activated(int) ), | 94 | connect(m_colorBox, SIGNAL(activated(int) ), |
91 | tis, SLOT(slotTermColor(int) ) ); | 95 | tis, SLOT(slotTermColor(int) ) ); |
92 | connect(m_groupSize, SIGNAL(activated(int) ), | 96 | connect(m_groupSize, SIGNAL(activated(int) ), |
93 | this, SLOT(slotTermFont(int) ) ); | 97 | this, SLOT(slotTermFont(int) ) ); |
94 | 98 | ||
@@ -107,32 +111,38 @@ TerminalWidget::~TerminalWidget() { | |||
107 | void TerminalWidget::load( const Profile& prof ) { | 111 | void TerminalWidget::load( const Profile& prof ) { |
108 | int term = prof.readNumEntry("Terminal"); | 112 | int term = prof.readNumEntry("Terminal"); |
109 | int color = prof.readNumEntry("Color"); | 113 | int color = prof.readNumEntry("Color"); |
110 | int fontsize = prof.readNumEntry("Font"); | 114 | int fontsize = prof.readNumEntry("Font"); |
111 | int opt_echo = prof.readNumEntry("Echo"); | 115 | int opt_echo = prof.readNumEntry("Echo"); |
112 | int opt_wrap = prof.readNumEntry("Wrap"); | 116 | int opt_wrap = prof.readNumEntry("Wrap"); |
113 | int opt_inbound = prof.readNumEntry("Inbound"); | 117 | int opt_inbound = prof.readNumEntry("Inbound"); |
114 | int opt_outbound = prof.readNumEntry("Outbound"); | 118 | int opt_outbound = prof.readNumEntry("Outbound"); |
115 | 119 | ||
116 | switch( term ) { | 120 | switch( term ) { |
117 | case Profile::VT100: | 121 | case Profile::VT100: |
118 | m_terminalBox->setCurrentItem(id_term_vt100 ); | 122 | m_terminalBox->setCurrentItem(id_term_vt100 ); |
119 | break; | 123 | break; |
120 | case Profile::VT102: | 124 | case Profile::VT102: |
121 | m_terminalBox->setCurrentItem(id_term_vt102 ); | 125 | m_terminalBox->setCurrentItem(id_term_vt102 ); |
122 | break; | 126 | break; |
127 | case Profile::Linux: | ||
128 | m_terminalBox->setCurrentItem(id_term_linux ); | ||
129 | break; | ||
130 | case Profile::XTerm: | ||
131 | m_terminalBox->setCurrentItem(id_term_xterm ); | ||
132 | break; | ||
123 | default: | 133 | default: |
124 | break; | 134 | break; |
125 | }; | 135 | }; |
126 | 136 | ||
127 | switch( color ) { | 137 | switch( color ) { |
128 | case Profile::Black: | 138 | case Profile::Black: |
129 | m_colorCmb->setCurrentItem(id_term_black ); | 139 | m_colorCmb->setCurrentItem(id_term_black ); |
130 | break; | 140 | break; |
131 | case Profile::White: | 141 | case Profile::White: |
132 | m_colorCmb->setCurrentItem(id_term_white ); | 142 | m_colorCmb->setCurrentItem(id_term_white ); |
133 | break; | 143 | break; |
134 | case Profile::Green: | 144 | case Profile::Green: |
135 | m_colorCmb->setCurrentItem(id_term_green ); | 145 | m_colorCmb->setCurrentItem(id_term_green ); |
136 | break; | 146 | break; |
137 | case Profile::Orange: | 147 | case Profile::Orange: |
138 | m_colorCmb->setCurrentItem(id_term_orange ); | 148 | m_colorCmb->setCurrentItem(id_term_orange ); |
@@ -157,32 +167,38 @@ void TerminalWidget::load( const Profile& prof ) { | |||
157 | }; | 167 | }; |
158 | 168 | ||
159 | if (opt_echo) m_optionEcho->setChecked( true ); | 169 | if (opt_echo) m_optionEcho->setChecked( true ); |
160 | if (opt_wrap) m_optionWrap->setChecked( true ); | 170 | if (opt_wrap) m_optionWrap->setChecked( true ); |
161 | if (opt_inbound) m_convInbound->setChecked( true ); | 171 | if (opt_inbound) m_convInbound->setChecked( true ); |
162 | if (opt_outbound) m_convOutbound->setChecked( true ); | 172 | if (opt_outbound) m_convOutbound->setChecked( true ); |
163 | 173 | ||
164 | } | 174 | } |
165 | void TerminalWidget::save( Profile& profile ) { | 175 | void TerminalWidget::save( Profile& profile ) { |
166 | switch(m_terminalBox->currentItem() ) { | 176 | switch(m_terminalBox->currentItem() ) { |
167 | case id_term_vt100: | 177 | case id_term_vt100: |
168 | profile.writeEntry("Terminal", Profile::VT100 ); | 178 | profile.writeEntry("Terminal", Profile::VT100 ); |
169 | break; | 179 | break; |
170 | case id_term_vt102: | 180 | case id_term_vt102: |
171 | profile.writeEntry("Terminal", Profile::VT102 ); | 181 | profile.writeEntry("Terminal", Profile::VT102 ); |
172 | break; | 182 | break; |
183 | case id_term_linux: | ||
184 | profile.writeEntry("Terminal", Profile::Linux ); | ||
185 | break; | ||
186 | case id_term_xterm: | ||
187 | profile.writeEntry("Terminal", Profile::XTerm ); | ||
188 | break; | ||
173 | //case id_term_ansi: | 189 | //case id_term_ansi: |
174 | // profile.writeEntry("Terminal", Profile::VT102 ); | 190 | // profile.writeEntry("Terminal", Profile::VT102 ); |
175 | // break; | 191 | // break; |
176 | default: | 192 | default: |
177 | break; | 193 | break; |
178 | }; | 194 | }; |
179 | 195 | ||
180 | // color | 196 | // color |
181 | switch(m_colorCmb->currentItem() ) { | 197 | switch(m_colorCmb->currentItem() ) { |
182 | case id_term_black: | 198 | case id_term_black: |
183 | profile.writeEntry("Color", Profile::Black ); | 199 | profile.writeEntry("Color", Profile::Black ); |
184 | break; | 200 | break; |
185 | case id_term_white: | 201 | case id_term_white: |
186 | profile.writeEntry("Color", Profile::White ); | 202 | profile.writeEntry("Color", Profile::White ); |
187 | break; | 203 | break; |
188 | case id_term_green: | 204 | case id_term_green: |