author | harlekin <harlekin> | 2004-02-01 12:52:08 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-02-01 12:52:08 (UTC) |
commit | 29220ef88ff2f93cef17695e3733da62c16d89ca (patch) (unidiff) | |
tree | c98007f673dfcf3480ac7e1a61746ce7d68c5b45 | |
parent | da02269f0d59e4cc932b9dbc7294374e3398ecad (diff) | |
download | opie-29220ef88ff2f93cef17695e3733da62c16d89ca.zip opie-29220ef88ff2f93cef17695e3733da62c16d89ca.tar.gz opie-29220ef88ff2f93cef17695e3733da62c16d89ca.tar.bz2 |
less includes
29 files changed, 0 insertions, 102 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index b2f6a74..a37f980 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp | |||
@@ -19,99 +19,97 @@ | |||
19 | problems that you can track down to this file, please have | 19 | problems that you can track down to this file, please have |
20 | a look into ../README.ports, too. | 20 | a look into ../README.ports, too. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | /*! \file | 23 | /*! \file |
24 | */ | 24 | */ |
25 | 25 | ||
26 | /*! \class TEPty | 26 | /*! \class TEPty |
27 | 27 | ||
28 | \brief Ptys provide a pseudo terminal connection to a program. | 28 | \brief Ptys provide a pseudo terminal connection to a program. |
29 | 29 | ||
30 | Although closely related to pipes, these pseudo terminal connections have | 30 | Although closely related to pipes, these pseudo terminal connections have |
31 | some ability, that makes it nessesary to uses them. Most importent, they | 31 | some ability, that makes it nessesary to uses them. Most importent, they |
32 | know about changing screen sizes and UNIX job control. | 32 | know about changing screen sizes and UNIX job control. |
33 | 33 | ||
34 | Within the terminal emulation framework, this class represents the | 34 | Within the terminal emulation framework, this class represents the |
35 | host side of the terminal together with the connecting serial line. | 35 | host side of the terminal together with the connecting serial line. |
36 | 36 | ||
37 | One can create many instances of this class within a program. | 37 | One can create many instances of this class within a program. |
38 | As a side effect of using this class, a signal(2) handler is | 38 | As a side effect of using this class, a signal(2) handler is |
39 | installed on SIGCHLD. | 39 | installed on SIGCHLD. |
40 | 40 | ||
41 | \par FIXME | 41 | \par FIXME |
42 | 42 | ||
43 | [NOTE: much of the technical stuff below will be replaced by forkpty.] | 43 | [NOTE: much of the technical stuff below will be replaced by forkpty.] |
44 | 44 | ||
45 | publish the SIGCHLD signal if not related to an instance. | 45 | publish the SIGCHLD signal if not related to an instance. |
46 | 46 | ||
47 | clearify TEPty::done vs. TEPty::~TEPty semantics. | 47 | clearify TEPty::done vs. TEPty::~TEPty semantics. |
48 | check if pty is restartable via run after done. | 48 | check if pty is restartable via run after done. |
49 | 49 | ||
50 | \par Pseudo terminals | 50 | \par Pseudo terminals |
51 | 51 | ||
52 | Pseudo terminals are a unique feature of UNIX, and always come in form of | 52 | Pseudo terminals are a unique feature of UNIX, and always come in form of |
53 | pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each | 53 | pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each |
54 | other by the operating system. One may think of them as two serial devices | 54 | other by the operating system. One may think of them as two serial devices |
55 | linked by a null-modem cable. Being based on devices the number of | 55 | linked by a null-modem cable. Being based on devices the number of |
56 | simultanous instances of this class is (globally) limited by the number of | 56 | simultanous instances of this class is (globally) limited by the number of |
57 | those device pairs, which is 256. | 57 | those device pairs, which is 256. |
58 | 58 | ||
59 | Another technic are UNIX 98 PTY's. These are supported also, and prefered | 59 | Another technic are UNIX 98 PTY's. These are supported also, and prefered |
60 | over the (obsolete) predecessor. | 60 | over the (obsolete) predecessor. |
61 | 61 | ||
62 | There's a sinister ioctl(2), signal(2) and job control stuff | 62 | There's a sinister ioctl(2), signal(2) and job control stuff |
63 | nessesary to make everything work as it should. | 63 | nessesary to make everything work as it should. |
64 | */ | 64 | */ |
65 | 65 | ||
66 | 66 | ||
67 | #include <qapplication.h> | ||
68 | #include <qsocketnotifier.h> | 67 | #include <qsocketnotifier.h> |
69 | #include <qstring.h> | ||
70 | #include <qfile.h> | 68 | #include <qfile.h> |
71 | 69 | ||
72 | #include <stdlib.h> | 70 | #include <stdlib.h> |
73 | #include <stdio.h> | 71 | #include <stdio.h> |
74 | #include <signal.h> | 72 | #include <signal.h> |
75 | #include <fcntl.h> | 73 | #include <fcntl.h> |
76 | #include <unistd.h> | 74 | #include <unistd.h> |
77 | #include <termios.h> | 75 | #include <termios.h> |
78 | #include <sys/types.h> | 76 | #include <sys/types.h> |
79 | #include <sys/ioctl.h> | 77 | #include <sys/ioctl.h> |
80 | #include <sys/wait.h> | 78 | #include <sys/wait.h> |
81 | 79 | ||
82 | #ifdef HAVE_OPENPTY | 80 | #ifdef HAVE_OPENPTY |
83 | #include <pty.h> | 81 | #include <pty.h> |
84 | #endif | 82 | #endif |
85 | 83 | ||
86 | #include "procctl.h" | 84 | #include "procctl.h" |
87 | #include "MyPty.h" | 85 | #include "MyPty.h" |
88 | 86 | ||
89 | 87 | ||
90 | #undef VERBOSE_DEBUG | 88 | #undef VERBOSE_DEBUG |
91 | 89 | ||
92 | 90 | ||
93 | /* -------------------------------------------------------------------------- */ | 91 | /* -------------------------------------------------------------------------- */ |
94 | 92 | ||
95 | /*! | 93 | /*! |
96 | Informs the client program about the | 94 | Informs the client program about the |
97 | actual size of the window. | 95 | actual size of the window. |
98 | */ | 96 | */ |
99 | 97 | ||
100 | void MyPty::setSize(int lines, int columns) | 98 | void MyPty::setSize(int lines, int columns) |
101 | { | 99 | { |
102 | qWarning("setting size"); | 100 | qWarning("setting size"); |
103 | struct winsize wsize; | 101 | struct winsize wsize; |
104 | wsize.ws_row = (unsigned short)lines; | 102 | wsize.ws_row = (unsigned short)lines; |
105 | wsize.ws_col = (unsigned short)columns; | 103 | wsize.ws_col = (unsigned short)columns; |
106 | if(m_fd < 0) return; | 104 | if(m_fd < 0) return; |
107 | ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); | 105 | ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); |
108 | } | 106 | } |
109 | 107 | ||
110 | 108 | ||
111 | void MyPty::donePty() | 109 | void MyPty::donePty() |
112 | { | 110 | { |
113 | // This is code from the Qt DumbTerminal example | 111 | // This is code from the Qt DumbTerminal example |
114 | 112 | ||
115 | ::close(m_fd); | 113 | ::close(m_fd); |
116 | 114 | ||
117 | if (m_cpid) { | 115 | if (m_cpid) { |
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp index 444924b..e535296 100644 --- a/noncore/apps/opie-console/TEWidget.cpp +++ b/noncore/apps/opie-console/TEWidget.cpp | |||
@@ -4,108 +4,100 @@ | |||
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------ */ | 5 | /* ------------------------------------------------------------------------ */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole - an X terminal for KDE */ | 9 | /* This file is part of Konsole - an X terminal for KDE */ |
10 | /* */ | 10 | /* */ |
11 | /* ------------------------------------------------------------------------ */ | 11 | /* ------------------------------------------------------------------------ */ |
12 | /* */ | 12 | /* */ |
13 | /* Ported Konsole to Qt/Embedded */ | 13 | /* Ported Konsole to Qt/Embedded */ |
14 | /* */ | 14 | /* */ |
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
16 | /* */ | 16 | /* */ |
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
18 | /*! \class TEWidget | 18 | /*! \class TEWidget |
19 | 19 | ||
20 | \brief Visible screen contents | 20 | \brief Visible screen contents |
21 | 21 | ||
22 | This class is responsible to map the `image' of a terminal emulation to the | 22 | This class is responsible to map the `image' of a terminal emulation to the |
23 | display. All the dependency of the emulation to a specific GUI or toolkit is | 23 | display. All the dependency of the emulation to a specific GUI or toolkit is |
24 | localized here. Further, this widget has no knowledge about being part of an | 24 | localized here. Further, this widget has no knowledge about being part of an |
25 | emulation, it simply work within the terminal emulation framework by exposing | 25 | emulation, it simply work within the terminal emulation framework by exposing |
26 | size and key events and by being ordered to show a new image. | 26 | size and key events and by being ordered to show a new image. |
27 | 27 | ||
28 | <ul> | 28 | <ul> |
29 | <li> The internal image has the size of the widget (evtl. rounded up) | 29 | <li> The internal image has the size of the widget (evtl. rounded up) |
30 | <li> The external image used in setImage can have any size. | 30 | <li> The external image used in setImage can have any size. |
31 | <li> (internally) the external image is simply copied to the internal | 31 | <li> (internally) the external image is simply copied to the internal |
32 | when a setImage happens. During a resizeEvent no painting is done | 32 | when a setImage happens. During a resizeEvent no painting is done |
33 | a paintEvent is expected to follow anyway. | 33 | a paintEvent is expected to follow anyway. |
34 | </ul> | 34 | </ul> |
35 | 35 | ||
36 | \sa TEScreen \sa Emulation | 36 | \sa TEScreen \sa Emulation |
37 | */ | 37 | */ |
38 | 38 | ||
39 | /* FIXME: | 39 | /* FIXME: |
40 | - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent | 40 | - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent |
41 | - 'font_a' not used in mouse events | 41 | - 'font_a' not used in mouse events |
42 | - add destructor | 42 | - add destructor |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /* TODO | 45 | /* TODO |
46 | - evtl. be sensitive to `paletteChange' while using default colors. | 46 | - evtl. be sensitive to `paletteChange' while using default colors. |
47 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? | 47 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? |
48 | */ | 48 | */ |
49 | 49 | ||
50 | // #include "config.h" | 50 | // #include "config.h" |
51 | #include "TEWidget.h" | 51 | #include "TEWidget.h" |
52 | #include "session.h" | ||
53 | #include <qpe/config.h> | 52 | #include <qpe/config.h> |
54 | 53 | ||
55 | #include <qapplication.h> | 54 | #include <qapplication.h> |
56 | #include <qcursor.h> | ||
57 | #include <qregexp.h> | ||
58 | #include <qpainter.h> | ||
59 | #include <qclipboard.h> | 55 | #include <qclipboard.h> |
60 | #include <qstyle.h> | ||
61 | #include <qfile.h> | ||
62 | #include <qdragobject.h> | ||
63 | #include <qvbox.h> | ||
64 | 56 | ||
65 | #include <stdio.h> | 57 | #include <stdio.h> |
66 | #include <stdlib.h> | 58 | #include <stdlib.h> |
67 | #include <unistd.h> | 59 | #include <unistd.h> |
68 | #include <ctype.h> | 60 | #include <ctype.h> |
69 | #include <sys/stat.h> | 61 | #include <sys/stat.h> |
70 | #include <sys/types.h> | 62 | #include <sys/types.h> |
71 | #include <signal.h> | 63 | #include <signal.h> |
72 | 64 | ||
73 | #include <assert.h> | 65 | #include <assert.h> |
74 | 66 | ||
75 | 67 | ||
76 | 68 | ||
77 | // #include "TEWidget.moc" | 69 | // #include "TEWidget.moc" |
78 | //#include <kapp.h> | 70 | //#include <kapp.h> |
79 | //#include <kcursor.h> | 71 | //#include <kcursor.h> |
80 | //#include <kurl.h> | 72 | //#include <kurl.h> |
81 | //#include <kdebug.h> | 73 | //#include <kdebug.h> |
82 | //#include <klocale.h> | 74 | //#include <klocale.h> |
83 | 75 | ||
84 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) | 76 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) |
85 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } | 77 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } |
86 | 78 | ||
87 | #define loc(X,Y) ((Y)*columns+(X)) | 79 | #define loc(X,Y) ((Y)*columns+(X)) |
88 | 80 | ||
89 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. | 81 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. |
90 | #define rimX 0 // left/right rim width | 82 | #define rimX 0 // left/right rim width |
91 | #define rimY 0 // top/bottom rim high | 83 | #define rimY 0 // top/bottom rim high |
92 | 84 | ||
93 | #define yMouseScroll 1 | 85 | #define yMouseScroll 1 |
94 | // scroll increment used when dragging selection at top/bottom of window. | 86 | // scroll increment used when dragging selection at top/bottom of window. |
95 | 87 | ||
96 | /* Button XPM */ | 88 | /* Button XPM */ |
97 | namespace { | 89 | namespace { |
98 | static char * menu_xpm[] = { | 90 | static char * menu_xpm[] = { |
99 | "12 12 5 1", | 91 | "12 12 5 1", |
100 | " c None", | 92 | " c None", |
101 | ".c #000000", | 93 | ".c #000000", |
102 | "+c #FFFDAD", | 94 | "+c #FFFDAD", |
103 | "@c #FFFF00", | 95 | "@c #FFFF00", |
104 | "#c #E5E100", | 96 | "#c #E5E100", |
105 | " ", | 97 | " ", |
106 | " ", | 98 | " ", |
107 | " ......... ", | 99 | " ......... ", |
108 | " .+++++++. ", | 100 | " .+++++++. ", |
109 | " .+@@@@#. ", | 101 | " .+@@@@#. ", |
110 | " .+@@@#. ", | 102 | " .+@@@#. ", |
111 | " .+@@#. ", | 103 | " .+@@#. ", |
diff --git a/noncore/apps/opie-console/TEmuVt102.cpp b/noncore/apps/opie-console/TEmuVt102.cpp index 275c18d..0d6aef5 100644 --- a/noncore/apps/opie-console/TEmuVt102.cpp +++ b/noncore/apps/opie-console/TEmuVt102.cpp | |||
@@ -1,82 +1,77 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [TEmuVt102.C] VT102 Terminal Emulation */ | 3 | /* [TEmuVt102.C] VT102 Terminal Emulation */ |
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------- */ | 5 | /* ------------------------------------------------------------------------- */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole - an X terminal for KDE */ | 9 | /* This file is part of Konsole - an X terminal for KDE */ |
10 | /* */ | 10 | /* */ |
11 | /* ------------------------------------------------------------------------- */ | 11 | /* ------------------------------------------------------------------------- */ |
12 | /* */ | 12 | /* */ |
13 | /* Ported Konsole to Qt/Embedded */ | 13 | /* Ported Konsole to Qt/Embedded */ |
14 | /* */ | 14 | /* */ |
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
16 | /* */ | 16 | /* */ |
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
18 | 18 | ||
19 | /*! \class TEmuVt102 | 19 | /*! \class TEmuVt102 |
20 | 20 | ||
21 | \brief Actual Emulation for Konsole | 21 | \brief Actual Emulation for Konsole |
22 | 22 | ||
23 | \sa TEWidget \sa TEScreen | 23 | \sa TEWidget \sa TEScreen |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "TEmuVt102.h" | 26 | #include "TEmuVt102.h" |
27 | #include "TEWidget.h" | ||
28 | #include "TEScreen.h" | ||
29 | #include "keytrans.h" | ||
30 | 27 | ||
31 | #include <stdio.h> | 28 | #include <stdio.h> |
32 | #include <unistd.h> | 29 | #include <unistd.h> |
33 | #include <qkeycode.h> | ||
34 | #include <qtextcodec.h> | ||
35 | 30 | ||
36 | 31 | ||
37 | /* VT102 Terminal Emulation | 32 | /* VT102 Terminal Emulation |
38 | 33 | ||
39 | This class puts together the screens, the pty and the widget to a | 34 | This class puts together the screens, the pty and the widget to a |
40 | complete terminal emulation. Beside combining it's componentes, it | 35 | complete terminal emulation. Beside combining it's componentes, it |
41 | handles the emulations's protocol. | 36 | handles the emulations's protocol. |
42 | 37 | ||
43 | This module consists of the following sections: | 38 | This module consists of the following sections: |
44 | 39 | ||
45 | - Constructor/Destructor | 40 | - Constructor/Destructor |
46 | - Incoming Bytes Event pipeline | 41 | - Incoming Bytes Event pipeline |
47 | - Outgoing Bytes | 42 | - Outgoing Bytes |
48 | - Mouse Events | 43 | - Mouse Events |
49 | - Keyboard Events | 44 | - Keyboard Events |
50 | - Modes and Charset State | 45 | - Modes and Charset State |
51 | - Diagnostics | 46 | - Diagnostics |
52 | */ | 47 | */ |
53 | 48 | ||
54 | 49 | ||
55 | /* ------------------------------------------------------------------------- */ | 50 | /* ------------------------------------------------------------------------- */ |
56 | /* */ | 51 | /* */ |
57 | /* Constructor / Destructor */ | 52 | /* Constructor / Destructor */ |
58 | /* */ | 53 | /* */ |
59 | /* ------------------------------------------------------------------------- */ | 54 | /* ------------------------------------------------------------------------- */ |
60 | 55 | ||
61 | /* | 56 | /* |
62 | Nothing really intesting happens here. | 57 | Nothing really intesting happens here. |
63 | */ | 58 | */ |
64 | 59 | ||
65 | /*! | 60 | /*! |
66 | */ | 61 | */ |
67 | 62 | ||
68 | TEmuVt102::TEmuVt102(TEWidget* gui) : TEmulation(gui) | 63 | TEmuVt102::TEmuVt102(TEWidget* gui) : TEmulation(gui) |
69 | { | 64 | { |
70 | QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), | 65 | QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), |
71 | this,SLOT(onMouse(int,int,int))); | 66 | this,SLOT(onMouse(int,int,int))); |
72 | initTokenizer(); | 67 | initTokenizer(); |
73 | reset(); | 68 | reset(); |
74 | } | 69 | } |
75 | 70 | ||
76 | /*! | 71 | /*! |
77 | */ | 72 | */ |
78 | 73 | ||
79 | TEmuVt102::~TEmuVt102() | 74 | TEmuVt102::~TEmuVt102() |
80 | { | 75 | { |
81 | } | 76 | } |
82 | 77 | ||
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp index 3b1b9e1..d0169d7 100644 --- a/noncore/apps/opie-console/TEmulation.cpp +++ b/noncore/apps/opie-console/TEmulation.cpp | |||
@@ -25,102 +25,99 @@ | |||
25 | Thus this module knows mainly about decoding escapes sequences and | 25 | Thus this module knows mainly about decoding escapes sequences and |
26 | is a stateless device w.r.t. the semantics. | 26 | is a stateless device w.r.t. the semantics. |
27 | 27 | ||
28 | It is also responsible to refresh the TEWidget by certain rules. | 28 | It is also responsible to refresh the TEWidget by certain rules. |
29 | 29 | ||
30 | \sa TEWidget \sa TEScreen | 30 | \sa TEWidget \sa TEScreen |
31 | 31 | ||
32 | \par A note on refreshing | 32 | \par A note on refreshing |
33 | 33 | ||
34 | Although the modifications to the current screen image could immediately | 34 | Although the modifications to the current screen image could immediately |
35 | be propagated via `TEWidget' to the graphical surface, we have chosen | 35 | be propagated via `TEWidget' to the graphical surface, we have chosen |
36 | another way here. | 36 | another way here. |
37 | 37 | ||
38 | The reason for doing so is twofold. | 38 | The reason for doing so is twofold. |
39 | 39 | ||
40 | First, experiments show that directly displaying the operation results | 40 | First, experiments show that directly displaying the operation results |
41 | in slowing down the overall performance of emulations. Displaying | 41 | in slowing down the overall performance of emulations. Displaying |
42 | individual characters using X11 creates a lot of overhead. | 42 | individual characters using X11 creates a lot of overhead. |
43 | 43 | ||
44 | Second, by using the following refreshing method, the screen operations | 44 | Second, by using the following refreshing method, the screen operations |
45 | can be completely separated from the displaying. This greatly simplifies | 45 | can be completely separated from the displaying. This greatly simplifies |
46 | the programmer's task of coding and maintaining the screen operations, | 46 | the programmer's task of coding and maintaining the screen operations, |
47 | since one need not worry about differential modifications on the | 47 | since one need not worry about differential modifications on the |
48 | display affecting the operation of concern. | 48 | display affecting the operation of concern. |
49 | 49 | ||
50 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. | 50 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. |
51 | 51 | ||
52 | By this, refreshing is driven by a timer, which is (re)started whenever | 52 | By this, refreshing is driven by a timer, which is (re)started whenever |
53 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. | 53 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. |
54 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger | 54 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger |
55 | refresh. This rule suits both bulk display operation as done by curses as | 55 | refresh. This rule suits both bulk display operation as done by curses as |
56 | well as individual characters typed. | 56 | well as individual characters typed. |
57 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). | 57 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). |
58 | 58 | ||
59 | Additionally, we trigger refreshing by newlines comming in to make visual | 59 | Additionally, we trigger refreshing by newlines comming in to make visual |
60 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby | 60 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby |
61 | producing the illusion of a permanent and immediate display operation. | 61 | producing the illusion of a permanent and immediate display operation. |
62 | 62 | ||
63 | As a sort of catch-all needed for cases where none of the above | 63 | As a sort of catch-all needed for cases where none of the above |
64 | conditions catch, the screen refresh is also triggered by a count | 64 | conditions catch, the screen refresh is also triggered by a count |
65 | of incoming bulks (`bulk_incnt'). | 65 | of incoming bulks (`bulk_incnt'). |
66 | */ | 66 | */ |
67 | 67 | ||
68 | /* FIXME | 68 | /* FIXME |
69 | - evtl. the bulk operations could be made more transparent. | 69 | - evtl. the bulk operations could be made more transparent. |
70 | */ | 70 | */ |
71 | 71 | ||
72 | #include "TEmulation.h" | 72 | #include "TEmulation.h" |
73 | #include "TEWidget.h" | ||
74 | #include "TEScreen.h" | ||
75 | #include <stdio.h> | 73 | #include <stdio.h> |
76 | #include <stdlib.h> | 74 | #include <stdlib.h> |
77 | #include <unistd.h> | 75 | #include <unistd.h> |
78 | #include <qkeycode.h> | ||
79 | 76 | ||
80 | 77 | ||
81 | /* ------------------------------------------------------------------------- */ | 78 | /* ------------------------------------------------------------------------- */ |
82 | /* */ | 79 | /* */ |
83 | /* TEmulation */ | 80 | /* TEmulation */ |
84 | /* */ | 81 | /* */ |
85 | /* ------------------------------------------------------------------------- */ | 82 | /* ------------------------------------------------------------------------- */ |
86 | 83 | ||
87 | #define CNTL(c) ((c)-'@') | 84 | #define CNTL(c) ((c)-'@') |
88 | 85 | ||
89 | /*! | 86 | /*! |
90 | */ | 87 | */ |
91 | 88 | ||
92 | TEmulation::TEmulation(TEWidget* gui) | 89 | TEmulation::TEmulation(TEWidget* gui) |
93 | : decoder((QTextDecoder*)NULL) | 90 | : decoder((QTextDecoder*)NULL) |
94 | { | 91 | { |
95 | this->gui = gui; | 92 | this->gui = gui; |
96 | 93 | ||
97 | screen[0] = new TEScreen(gui->Lines(),gui->Columns()); | 94 | screen[0] = new TEScreen(gui->Lines(),gui->Columns()); |
98 | screen[1] = new TEScreen(gui->Lines(),gui->Columns()); | 95 | screen[1] = new TEScreen(gui->Lines(),gui->Columns()); |
99 | scr = screen[0]; | 96 | scr = screen[0]; |
100 | 97 | ||
101 | bulk_nlcnt = 0; // reset bulk newline counter | 98 | bulk_nlcnt = 0; // reset bulk newline counter |
102 | bulk_incnt = 0; // reset bulk counter | 99 | bulk_incnt = 0; // reset bulk counter |
103 | connected = FALSE; | 100 | connected = FALSE; |
104 | 101 | ||
105 | QObject::connect(&bulk_timer, SIGNAL(timeout()), this, SLOT(showBulk()) ); | 102 | QObject::connect(&bulk_timer, SIGNAL(timeout()), this, SLOT(showBulk()) ); |
106 | QObject::connect(gui,SIGNAL(changedImageSizeSignal(int,int)), | 103 | QObject::connect(gui,SIGNAL(changedImageSizeSignal(int,int)), |
107 | this,SLOT(onImageSizeChange(int,int))); | 104 | this,SLOT(onImageSizeChange(int,int))); |
108 | QObject::connect(gui,SIGNAL(changedHistoryCursor(int)), | 105 | QObject::connect(gui,SIGNAL(changedHistoryCursor(int)), |
109 | this,SLOT(onHistoryCursorChange(int))); | 106 | this,SLOT(onHistoryCursorChange(int))); |
110 | QObject::connect(gui,SIGNAL(keyPressedSignal(QKeyEvent*)), | 107 | QObject::connect(gui,SIGNAL(keyPressedSignal(QKeyEvent*)), |
111 | this,SLOT(onKeyPress(QKeyEvent*))); | 108 | this,SLOT(onKeyPress(QKeyEvent*))); |
112 | QObject::connect(gui,SIGNAL(beginSelectionSignal(const int,const int)), | 109 | QObject::connect(gui,SIGNAL(beginSelectionSignal(const int,const int)), |
113 | this,SLOT(onSelectionBegin(const int,const int)) ); | 110 | this,SLOT(onSelectionBegin(const int,const int)) ); |
114 | QObject::connect(gui,SIGNAL(extendSelectionSignal(const int,const int)), | 111 | QObject::connect(gui,SIGNAL(extendSelectionSignal(const int,const int)), |
115 | this,SLOT(onSelectionExtend(const int,const int)) ); | 112 | this,SLOT(onSelectionExtend(const int,const int)) ); |
116 | QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)), | 113 | QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)), |
117 | this,SLOT(setSelection(const BOOL)) ); | 114 | this,SLOT(setSelection(const BOOL)) ); |
118 | QObject::connect(gui,SIGNAL(clearSelectionSignal()), | 115 | QObject::connect(gui,SIGNAL(clearSelectionSignal()), |
119 | this,SLOT(clearSelection()) ); | 116 | this,SLOT(clearSelection()) ); |
120 | } | 117 | } |
121 | 118 | ||
122 | /*! | 119 | /*! |
123 | */ | 120 | */ |
124 | 121 | ||
125 | TEmulation::~TEmulation() | 122 | TEmulation::~TEmulation() |
126 | { | 123 | { |
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index 53b3853..b23f4d0 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp | |||
@@ -1,55 +1,52 @@ | |||
1 | #include <qdialog.h> | ||
2 | #include <qlistview.h> | 1 | #include <qlistview.h> |
3 | 2 | ||
4 | 3 | ||
5 | #include "profile.h" | ||
6 | #include "configdialog.h" | 4 | #include "configdialog.h" |
7 | #include "metafactory.h" | ||
8 | #include "profileeditordialog.h" | 5 | #include "profileeditordialog.h" |
9 | 6 | ||
10 | class ConfigListItem : public QListViewItem { | 7 | class ConfigListItem : public QListViewItem { |
11 | public: | 8 | public: |
12 | ConfigListItem( QListView* item, const Profile& ); | 9 | ConfigListItem( QListView* item, const Profile& ); |
13 | ~ConfigListItem(); | 10 | ~ConfigListItem(); |
14 | Profile profile()const; | 11 | Profile profile()const; |
15 | 12 | ||
16 | private: | 13 | private: |
17 | Profile m_prof; | 14 | Profile m_prof; |
18 | }; | 15 | }; |
19 | ConfigListItem::ConfigListItem( QListView* item, const Profile& prof ) | 16 | ConfigListItem::ConfigListItem( QListView* item, const Profile& prof ) |
20 | : QListViewItem( item ), m_prof( prof ) | 17 | : QListViewItem( item ), m_prof( prof ) |
21 | { | 18 | { |
22 | setText(0, prof.name() ); | 19 | setText(0, prof.name() ); |
23 | } | 20 | } |
24 | ConfigListItem::~ConfigListItem() { | 21 | ConfigListItem::~ConfigListItem() { |
25 | 22 | ||
26 | } | 23 | } |
27 | Profile ConfigListItem::profile()const { | 24 | Profile ConfigListItem::profile()const { |
28 | return m_prof; | 25 | return m_prof; |
29 | } | 26 | } |
30 | 27 | ||
31 | /* Dialog */ | 28 | /* Dialog */ |
32 | 29 | ||
33 | ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa, | 30 | ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa, |
34 | QWidget* parent ) | 31 | QWidget* parent ) |
35 | : ConfigureBase( parent, 0, TRUE ), m_fact( fa ) | 32 | : ConfigureBase( parent, 0, TRUE ), m_fact( fa ) |
36 | { | 33 | { |
37 | //init(); | 34 | //init(); |
38 | { | 35 | { |
39 | Profile::ValueList::ConstIterator it; | 36 | Profile::ValueList::ConstIterator it; |
40 | for (it = lis.begin(); it != lis.end(); ++it ) { | 37 | for (it = lis.begin(); it != lis.end(); ++it ) { |
41 | new ConfigListItem( lstView, (*it) ); | 38 | new ConfigListItem( lstView, (*it) ); |
42 | } | 39 | } |
43 | } | 40 | } |
44 | } | 41 | } |
45 | ConfigDialog::~ConfigDialog() { | 42 | ConfigDialog::~ConfigDialog() { |
46 | 43 | ||
47 | } | 44 | } |
48 | Profile::ValueList ConfigDialog::list()const { | 45 | Profile::ValueList ConfigDialog::list()const { |
49 | /* iterate over the list */ | 46 | /* iterate over the list */ |
50 | Profile::ValueList lst; | 47 | Profile::ValueList lst; |
51 | QListViewItemIterator it(lstView); | 48 | QListViewItemIterator it(lstView); |
52 | for ( ; it.current(); ++it ) { | 49 | for ( ; it.current(); ++it ) { |
53 | ConfigListItem* item = (ConfigListItem*)it.current(); | 50 | ConfigListItem* item = (ConfigListItem*)it.current(); |
54 | lst.append( item->profile() ); | 51 | lst.append( item->profile() ); |
55 | } | 52 | } |
diff --git a/noncore/apps/opie-console/consoleconfigwidget.cpp b/noncore/apps/opie-console/consoleconfigwidget.cpp index faedc58..a6ad8d2 100644 --- a/noncore/apps/opie-console/consoleconfigwidget.cpp +++ b/noncore/apps/opie-console/consoleconfigwidget.cpp | |||
@@ -1,56 +1,54 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | ||
4 | #include <qlineedit.h> | 3 | #include <qlineedit.h> |
5 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
6 | #include <qlistview.h> | 5 | #include <qlistview.h> |
7 | #include <qhbox.h> | 6 | #include <qhbox.h> |
8 | #include <qregexp.h> | ||
9 | #include <stdio.h> | 7 | #include <stdio.h> |
10 | 8 | ||
11 | #include <pwd.h> | 9 | #include <pwd.h> |
12 | #include <sys/types.h> | 10 | #include <sys/types.h> |
13 | 11 | ||
14 | 12 | ||
15 | #include "consoleconfigwidget.h" | 13 | #include "consoleconfigwidget.h" |
16 | 14 | ||
17 | ConsoleConfigWidget::ConsoleConfigWidget( const QString& name, QWidget* parent, | 15 | ConsoleConfigWidget::ConsoleConfigWidget( const QString& name, QWidget* parent, |
18 | const char* na ) | 16 | const char* na ) |
19 | : ProfileDialogConnectionWidget( name, parent, na ) { | 17 | : ProfileDialogConnectionWidget( name, parent, na ) { |
20 | m_lay = new QVBoxLayout( this ); | 18 | m_lay = new QVBoxLayout( this ); |
21 | QLabel *label = new QLabel(tr("Command to execute"), this); | 19 | QLabel *label = new QLabel(tr("Command to execute"), this); |
22 | m_lay->addWidget(label); | 20 | m_lay->addWidget(label); |
23 | m_cmd = new QLineEdit(this); | 21 | m_cmd = new QLineEdit(this); |
24 | m_lay->addWidget(m_cmd); | 22 | m_lay->addWidget(m_cmd); |
25 | label = new QLabel(tr("Environment Variables"), this); | 23 | label = new QLabel(tr("Environment Variables"), this); |
26 | m_lay->addWidget(label); | 24 | m_lay->addWidget(label); |
27 | m_env = new QListView(this); | 25 | m_env = new QListView(this); |
28 | m_env->addColumn(tr("Name")); | 26 | m_env->addColumn(tr("Name")); |
29 | m_env->addColumn(tr("Value")); | 27 | m_env->addColumn(tr("Value")); |
30 | m_lay->addWidget(m_env); | 28 | m_lay->addWidget(m_env); |
31 | 29 | ||
32 | QHBox *hbox = new QHBox(this); | 30 | QHBox *hbox = new QHBox(this); |
33 | label = new QLabel(tr("Name :"), hbox); | 31 | label = new QLabel(tr("Name :"), hbox); |
34 | m_name = new QLineEdit(hbox); | 32 | m_name = new QLineEdit(hbox); |
35 | m_lay->addWidget(hbox); | 33 | m_lay->addWidget(hbox); |
36 | 34 | ||
37 | hbox = new QHBox(this); | 35 | hbox = new QHBox(this); |
38 | label = new QLabel(tr("Value :"), hbox); | 36 | label = new QLabel(tr("Value :"), hbox); |
39 | m_value = new QLineEdit(hbox); | 37 | m_value = new QLineEdit(hbox); |
40 | m_lay->addWidget(hbox); | 38 | m_lay->addWidget(hbox); |
41 | 39 | ||
42 | hbox = new QHBox(this); | 40 | hbox = new QHBox(this); |
43 | hbox->setSpacing(10); | 41 | hbox->setSpacing(10); |
44 | m_remove = new QPushButton(tr("Remove"), hbox); | 42 | m_remove = new QPushButton(tr("Remove"), hbox); |
45 | connect(m_remove, SIGNAL(clicked()), this, SLOT(slotRemove())); | 43 | connect(m_remove, SIGNAL(clicked()), this, SLOT(slotRemove())); |
46 | m_add = new QPushButton(tr("Add"), hbox); | 44 | m_add = new QPushButton(tr("Add"), hbox); |
47 | connect(m_add, SIGNAL(clicked()), this, SLOT(slotAdd())); | 45 | connect(m_add, SIGNAL(clicked()), this, SLOT(slotAdd())); |
48 | m_lay->addWidget(hbox); | 46 | m_lay->addWidget(hbox); |
49 | } | 47 | } |
50 | 48 | ||
51 | void ConsoleConfigWidget::slotAdd() { | 49 | void ConsoleConfigWidget::slotAdd() { |
52 | if (!(m_name->text().isEmpty() || m_value->text().isEmpty())) { | 50 | if (!(m_name->text().isEmpty() || m_value->text().isEmpty())) { |
53 | QListViewItem *item = new QListViewItem(m_env); | 51 | QListViewItem *item = new QListViewItem(m_env); |
54 | item->setText(0, m_name->text()); | 52 | item->setText(0, m_name->text()); |
55 | item->setText(1, m_value->text()); | 53 | item->setText(1, m_value->text()); |
56 | m_env->insertItem(item); | 54 | m_env->insertItem(item); |
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp index b060139..c237575 100644 --- a/noncore/apps/opie-console/default.cpp +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -1,49 +1,48 @@ | |||
1 | #include "io_serial.h" | ||
2 | #include "io_irda.h" | 1 | #include "io_irda.h" |
3 | #include "io_bt.h" | 2 | #include "io_bt.h" |
4 | #include "io_modem.h" | 3 | #include "io_modem.h" |
5 | #include "filetransfer.h" | 4 | #include "filetransfer.h" |
6 | #include "filereceive.h" | 5 | #include "filereceive.h" |
7 | #include "serialconfigwidget.h" | 6 | #include "serialconfigwidget.h" |
8 | #include "irdaconfigwidget.h" | 7 | #include "irdaconfigwidget.h" |
9 | #include "btconfigwidget.h" | 8 | #include "btconfigwidget.h" |
10 | #include "modemconfigwidget.h" | 9 | #include "modemconfigwidget.h" |
11 | #include "terminalwidget.h" | 10 | #include "terminalwidget.h" |
12 | #include "function_keyboard.h" | 11 | #include "function_keyboard.h" |
13 | #include "consoleconfigwidget.h" | 12 | #include "consoleconfigwidget.h" |
14 | #include "MyPty.h" | 13 | #include "MyPty.h" |
15 | 14 | ||
16 | #include "default.h" | 15 | #include "default.h" |
17 | 16 | ||
18 | extern "C" { | 17 | extern "C" { |
19 | // FILE Transfer Stuff | 18 | // FILE Transfer Stuff |
20 | FileTransferLayer* newSZTransfer(IOLayer* lay) { | 19 | FileTransferLayer* newSZTransfer(IOLayer* lay) { |
21 | return new FileTransfer( FileTransfer::SZ, lay ); | 20 | return new FileTransfer( FileTransfer::SZ, lay ); |
22 | } | 21 | } |
23 | FileTransferLayer* newSYTransfer(IOLayer* lay) { | 22 | FileTransferLayer* newSYTransfer(IOLayer* lay) { |
24 | return new FileTransfer( FileTransfer::SY, lay ); | 23 | return new FileTransfer( FileTransfer::SY, lay ); |
25 | } | 24 | } |
26 | FileTransferLayer* newSXTransfer(IOLayer* lay) { | 25 | FileTransferLayer* newSXTransfer(IOLayer* lay) { |
27 | return new FileTransfer(FileTransfer ::SX, lay ); | 26 | return new FileTransfer(FileTransfer ::SX, lay ); |
28 | } | 27 | } |
29 | 28 | ||
30 | // FILE Transfer Receive Stuff | 29 | // FILE Transfer Receive Stuff |
31 | ReceiveLayer* newSZReceive(IOLayer* lay) { | 30 | ReceiveLayer* newSZReceive(IOLayer* lay) { |
32 | return new FileReceive( FileReceive::SZ, lay ); | 31 | return new FileReceive( FileReceive::SZ, lay ); |
33 | } | 32 | } |
34 | ReceiveLayer* newSYReceive(IOLayer* lay) { | 33 | ReceiveLayer* newSYReceive(IOLayer* lay) { |
35 | return new FileReceive( FileReceive::SY, lay ); | 34 | return new FileReceive( FileReceive::SY, lay ); |
36 | } | 35 | } |
37 | ReceiveLayer* newSXReceive(IOLayer* lay) { | 36 | ReceiveLayer* newSXReceive(IOLayer* lay) { |
38 | return new FileReceive(FileReceive::SX, lay ); | 37 | return new FileReceive(FileReceive::SX, lay ); |
39 | } | 38 | } |
40 | 39 | ||
41 | // Layer stuff | 40 | // Layer stuff |
42 | IOLayer* newSerialLayer( const Profile& prof) { | 41 | IOLayer* newSerialLayer( const Profile& prof) { |
43 | return new IOSerial( prof ); | 42 | return new IOSerial( prof ); |
44 | } | 43 | } |
45 | IOLayer* newBTLayer( const Profile& prof ) { | 44 | IOLayer* newBTLayer( const Profile& prof ) { |
46 | return new IOBt( prof ); | 45 | return new IOBt( prof ); |
47 | } | 46 | } |
48 | IOLayer* newIrDaLayer( const Profile& prof ) { | 47 | IOLayer* newIrDaLayer( const Profile& prof ) { |
49 | return new IOIrda( prof ); | 48 | return new IOIrda( prof ); |
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index b91727b..6bc1240 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp | |||
@@ -1,56 +1,53 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qcombobox.h> | ||
6 | #include <qscrollview.h> | ||
7 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
8 | #include <qfont.h> | ||
9 | #include <qbuttongroup.h> | 6 | #include <qbuttongroup.h> |
10 | 7 | ||
11 | #include "dialdialog.h" | 8 | #include "dialdialog.h" |
12 | 9 | ||
13 | 10 | ||
14 | 11 | ||
15 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 12 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
16 | : QDialog( parent, name, modal, fl ) { | 13 | : QDialog( parent, name, modal, fl ) { |
17 | 14 | ||
18 | setCaption( tr( "Enter number" ) ); | 15 | setCaption( tr( "Enter number" ) ); |
19 | 16 | ||
20 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 17 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
21 | 18 | ||
22 | QLabel *textLabel = new QLabel( this ); | 19 | QLabel *textLabel = new QLabel( this ); |
23 | textLabel->setTextFormat( QLabel::RichText ); | 20 | textLabel->setTextFormat( QLabel::RichText ); |
24 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); | 21 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); |
25 | 22 | ||
26 | m_dialLine = new QLineEdit( this ); | 23 | m_dialLine = new QLineEdit( this ); |
27 | m_dialLine->setReadOnly( true ); | 24 | m_dialLine->setReadOnly( true ); |
28 | m_dialLine->setFrame( false ); | 25 | m_dialLine->setFrame( false ); |
29 | m_dialLine->setAlignment( Qt::AlignLeft ); | 26 | m_dialLine->setAlignment( Qt::AlignLeft ); |
30 | QFont dialLine_font( m_dialLine->font() ); | 27 | QFont dialLine_font( m_dialLine->font() ); |
31 | dialLine_font.setBold( TRUE ); | 28 | dialLine_font.setBold( TRUE ); |
32 | dialLine_font.setPointSize( 18 ); | 29 | dialLine_font.setPointSize( 18 ); |
33 | m_dialLine->setFont( dialLine_font ); | 30 | m_dialLine->setFont( dialLine_font ); |
34 | 31 | ||
35 | QWidget* dialWidget = new QWidget( this ); | 32 | QWidget* dialWidget = new QWidget( this ); |
36 | QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); | 33 | QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); |
37 | 34 | ||
38 | QButtonGroup *dialButtons = new QButtonGroup( ); | 35 | QButtonGroup *dialButtons = new QButtonGroup( ); |
39 | 36 | ||
40 | QPushButton *number0 = new QPushButton( dialWidget ); | 37 | QPushButton *number0 = new QPushButton( dialWidget ); |
41 | number0->setText( QString( "0" ) ); | 38 | number0->setText( QString( "0" ) ); |
42 | QFont number0_font( number0->font() ); | 39 | QFont number0_font( number0->font() ); |
43 | number0_font.setBold( TRUE ); | 40 | number0_font.setBold( TRUE ); |
44 | number0->setFont( number0_font ); | 41 | number0->setFont( number0_font ); |
45 | layout->addWidget( number0, 4, 1 ); | 42 | layout->addWidget( number0, 4, 1 ); |
46 | dialButtons->insert( number0 ); | 43 | dialButtons->insert( number0 ); |
47 | 44 | ||
48 | int x = 0, y = 0; | 45 | int x = 0, y = 0; |
49 | for ( int i = 0 ; i < 9; i++ ) { | 46 | for ( int i = 0 ; i < 9; i++ ) { |
50 | QPushButton *number = new QPushButton( dialWidget ); | 47 | QPushButton *number = new QPushButton( dialWidget ); |
51 | number->setText( QString( "%1" ).arg( i + 1 ) ); | 48 | number->setText( QString( "%1" ).arg( i + 1 ) ); |
52 | QFont number_font( number->font() ); | 49 | QFont number_font( number->font() ); |
53 | number_font.setBold( TRUE ); | 50 | number_font.setBold( TRUE ); |
54 | number->setFont( number_font ); | 51 | number->setFont( number_font ); |
55 | 52 | ||
56 | dialButtons->insert( number ); | 53 | dialButtons->insert( number ); |
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 235facb..2c1d888 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,52 +1,49 @@ | |||
1 | #include <qwidget.h> | ||
2 | #include <qpushbutton.h> | ||
3 | 1 | ||
4 | #include "TEWidget.h" | ||
5 | #include "TEmuVt102.h" | 2 | #include "TEmuVt102.h" |
6 | 3 | ||
7 | #include "profile.h" | 4 | #include "profile.h" |
8 | #include "emulation_handler.h" | 5 | #include "emulation_handler.h" |
9 | #include "script.h" | 6 | #include "script.h" |
10 | 7 | ||
11 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 8 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
12 | : QObject(0, name ) | 9 | : QObject(0, name ) |
13 | { | 10 | { |
14 | m_teWid = new TEWidget( parent, "TerminalMain"); | 11 | m_teWid = new TEWidget( parent, "TerminalMain"); |
15 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) | 12 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) |
16 | // use setWrapAt(80) for normal console with scrollbar | 13 | // use setWrapAt(80) for normal console with scrollbar |
17 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); | 14 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); |
18 | m_teWid->setMinimumSize(150, 70 ); | 15 | m_teWid->setMinimumSize(150, 70 ); |
19 | m_script = 0; | 16 | m_script = 0; |
20 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 17 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
21 | m_teEmu = new TEmuVt102(m_teWid ); | 18 | m_teEmu = new TEmuVt102(m_teWid ); |
22 | 19 | ||
23 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), | 20 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), |
24 | this, SIGNAL(changeSize(int, int) ) ); | 21 | this, SIGNAL(changeSize(int, int) ) ); |
25 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), | 22 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), |
26 | this, SLOT(recvEmulation(const char*, int) ) ); | 23 | this, SLOT(recvEmulation(const char*, int) ) ); |
27 | m_teEmu->setConnect( true ); | 24 | m_teEmu->setConnect( true ); |
28 | m_teEmu->setHistory( TRUE ); | 25 | m_teEmu->setHistory( TRUE ); |
29 | load( prof ); | 26 | load( prof ); |
30 | 27 | ||
31 | 28 | ||
32 | 29 | ||
33 | } | 30 | } |
34 | TEmulation* EmulationHandler::emulation() { | 31 | TEmulation* EmulationHandler::emulation() { |
35 | return m_teEmu; | 32 | return m_teEmu; |
36 | } | 33 | } |
37 | EmulationHandler::~EmulationHandler() { | 34 | EmulationHandler::~EmulationHandler() { |
38 | if (isRecording()) | 35 | if (isRecording()) |
39 | clearScript(); | 36 | clearScript(); |
40 | delete m_teEmu; | 37 | delete m_teEmu; |
41 | delete m_teWid; | 38 | delete m_teWid; |
42 | } | 39 | } |
43 | 40 | ||
44 | void EmulationHandler::load( const Profile& prof) { | 41 | void EmulationHandler::load( const Profile& prof) { |
45 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 42 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
46 | int num = prof.readNumEntry("Color"); | 43 | int num = prof.readNumEntry("Color"); |
47 | setColor( foreColor(num), backColor(num) ); | 44 | setColor( foreColor(num), backColor(num) ); |
48 | m_teWid->setBackgroundColor(backColor(num) ); | 45 | m_teWid->setBackgroundColor(backColor(num) ); |
49 | 46 | ||
50 | int term = prof.readNumEntry("Terminal", 0) ; | 47 | int term = prof.readNumEntry("Terminal", 0) ; |
51 | switch(term) { | 48 | switch(term) { |
52 | default: | 49 | default: |
diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp index 6a2679e..2bef801 100644 --- a/noncore/apps/opie-console/emulation_layer.cpp +++ b/noncore/apps/opie-console/emulation_layer.cpp | |||
@@ -31,102 +31,99 @@ | |||
31 | Thus this module knows mainly about decoding escapes sequences and | 31 | Thus this module knows mainly about decoding escapes sequences and |
32 | is a stateless device w.r.t. the semantics. | 32 | is a stateless device w.r.t. the semantics. |
33 | 33 | ||
34 | It is also responsible to refresh the Widget by certain rules. | 34 | It is also responsible to refresh the Widget by certain rules. |
35 | 35 | ||
36 | \sa Widget \sa Screen | 36 | \sa Widget \sa Screen |
37 | 37 | ||
38 | \par A note on refreshing | 38 | \par A note on refreshing |
39 | 39 | ||
40 | Although the modifications to the current screen image could immediately | 40 | Although the modifications to the current screen image could immediately |
41 | be propagated via `Widget' to the graphical surface, we have chosen | 41 | be propagated via `Widget' to the graphical surface, we have chosen |
42 | another way here. | 42 | another way here. |
43 | 43 | ||
44 | The reason for doing so is twofold. | 44 | The reason for doing so is twofold. |
45 | 45 | ||
46 | First, experiments show that directly displaying the operation results | 46 | First, experiments show that directly displaying the operation results |
47 | in slowing down the overall performance of emulations. Displaying | 47 | in slowing down the overall performance of emulations. Displaying |
48 | individual characters using X11 creates a lot of overhead. | 48 | individual characters using X11 creates a lot of overhead. |
49 | 49 | ||
50 | Second, by using the following refreshing method, the screen operations | 50 | Second, by using the following refreshing method, the screen operations |
51 | can be completely separated from the displaying. This greatly simplifies | 51 | can be completely separated from the displaying. This greatly simplifies |
52 | the programmer's task of coding and maintaining the screen operations, | 52 | the programmer's task of coding and maintaining the screen operations, |
53 | since one need not worry about differential modifications on the | 53 | since one need not worry about differential modifications on the |
54 | display affecting the operation of concern. | 54 | display affecting the operation of concern. |
55 | 55 | ||
56 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. | 56 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. |
57 | 57 | ||
58 | By this, refreshing is driven by a timer, which is (re)started whenever | 58 | By this, refreshing is driven by a timer, which is (re)started whenever |
59 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. | 59 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. |
60 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger | 60 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger |
61 | refresh. This rule suits both bulk display operation as done by curses as | 61 | refresh. This rule suits both bulk display operation as done by curses as |
62 | well as individual characters typed. | 62 | well as individual characters typed. |
63 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). | 63 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). |
64 | 64 | ||
65 | Additionally, we trigger refreshing by newlines comming in to make visual | 65 | Additionally, we trigger refreshing by newlines comming in to make visual |
66 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby | 66 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby |
67 | producing the illusion of a permanent and immediate display operation. | 67 | producing the illusion of a permanent and immediate display operation. |
68 | 68 | ||
69 | As a sort of catch-all needed for cases where none of the above | 69 | As a sort of catch-all needed for cases where none of the above |
70 | conditions catch, the screen refresh is also triggered by a count | 70 | conditions catch, the screen refresh is also triggered by a count |
71 | of incoming bulks (`bulk_incnt'). | 71 | of incoming bulks (`bulk_incnt'). |
72 | */ | 72 | */ |
73 | 73 | ||
74 | /* FIXME | 74 | /* FIXME |
75 | - evtl. the bulk operations could be made more transparent. | 75 | - evtl. the bulk operations could be made more transparent. |
76 | */ | 76 | */ |
77 | 77 | ||
78 | #include "emulation_layer.h" | 78 | #include "emulation_layer.h" |
79 | #include "widget_layer.h" | ||
80 | #include "screen.h" | ||
81 | #include <stdio.h> | 79 | #include <stdio.h> |
82 | #include <stdlib.h> | 80 | #include <stdlib.h> |
83 | #include <unistd.h> | 81 | #include <unistd.h> |
84 | #include <qkeycode.h> | ||
85 | 82 | ||
86 | 83 | ||
87 | /* ------------------------------------------------------------------------- */ | 84 | /* ------------------------------------------------------------------------- */ |
88 | /* */ | 85 | /* */ |
89 | /* EmulationLayer */ | 86 | /* EmulationLayer */ |
90 | /* */ | 87 | /* */ |
91 | /* ------------------------------------------------------------------------- */ | 88 | /* ------------------------------------------------------------------------- */ |
92 | 89 | ||
93 | #define CNTL(c) ((c)-'@') | 90 | #define CNTL(c) ((c)-'@') |
94 | 91 | ||
95 | /*! | 92 | /*! |
96 | */ | 93 | */ |
97 | 94 | ||
98 | EmulationLayer::EmulationLayer( WidgetLayer* gui ) | 95 | EmulationLayer::EmulationLayer( WidgetLayer* gui ) |
99 | : decoder((QTextDecoder*)NULL) | 96 | : decoder((QTextDecoder*)NULL) |
100 | { | 97 | { |
101 | this->gui = gui; | 98 | this->gui = gui; |
102 | 99 | ||
103 | screen[0] = new Screen(gui->lines(),gui->columns()); | 100 | screen[0] = new Screen(gui->lines(),gui->columns()); |
104 | screen[1] = new Screen(gui->lines(),gui->columns()); | 101 | screen[1] = new Screen(gui->lines(),gui->columns()); |
105 | scr = screen[0]; | 102 | scr = screen[0]; |
106 | 103 | ||
107 | bulk_nlcnt = 0; // reset bulk newline counter | 104 | bulk_nlcnt = 0; // reset bulk newline counter |
108 | bulk_incnt = 0; // reset bulk counter | 105 | bulk_incnt = 0; // reset bulk counter |
109 | connected = FALSE; | 106 | connected = FALSE; |
110 | 107 | ||
111 | QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); | 108 | QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); |
112 | QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), | 109 | QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), |
113 | this,SLOT( onImageSizeChange( int, int ) ) ); | 110 | this,SLOT( onImageSizeChange( int, int ) ) ); |
114 | QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), | 111 | QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), |
115 | this,SLOT( historyCursorChange( int ) ) ); | 112 | this,SLOT( historyCursorChange( int ) ) ); |
116 | QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), | 113 | QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), |
117 | this,SLOT( onKeyPress( QKeyEvent* ) ) ); | 114 | this,SLOT( onKeyPress( QKeyEvent* ) ) ); |
118 | QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), | 115 | QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), |
119 | this,SLOT( onSelectionBegin( const int, const int ) ) ); | 116 | this,SLOT( onSelectionBegin( const int, const int ) ) ); |
120 | QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), | 117 | QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), |
121 | this,SLOT( onSelectionExtend( const int,const int ) ) ); | 118 | this,SLOT( onSelectionExtend( const int,const int ) ) ); |
122 | QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), | 119 | QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), |
123 | this,SLOT( setSelection( const bool ) ) ); | 120 | this,SLOT( setSelection( const bool ) ) ); |
124 | QObject::connect(gui,SIGNAL( selectionCleared() ), | 121 | QObject::connect(gui,SIGNAL( selectionCleared() ), |
125 | this,SLOT( clearSelection() ) ); | 122 | this,SLOT( clearSelection() ) ); |
126 | } | 123 | } |
127 | 124 | ||
128 | /*! | 125 | /*! |
129 | */ | 126 | */ |
130 | 127 | ||
131 | EmulationLayer::~EmulationLayer() | 128 | EmulationLayer::~EmulationLayer() |
132 | { | 129 | { |
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp index 9f95c72..ad8ecba 100644 --- a/noncore/apps/opie-console/emulation_widget.cpp +++ b/noncore/apps/opie-console/emulation_widget.cpp | |||
@@ -1,60 +1,52 @@ | |||
1 | // opie-console includes | 1 | // opie-console includes |
2 | #include "emulation_widget.h" | 2 | #include "emulation_widget.h" |
3 | #include "common.h" | ||
4 | #include "widget_layer.h" | ||
5 | #include "profile.h" | ||
6 | 3 | ||
7 | // qt includes | 4 | // qt includes |
8 | #include <qwidget.h> | ||
9 | #include <qarray.h> | ||
10 | #include <qstring.h> | ||
11 | #include <qpainter.h> | ||
12 | #include <qrect.h> | ||
13 | #include <qscrollbar.h> | 5 | #include <qscrollbar.h> |
14 | 6 | ||
15 | #define rimX 0 // left/right rim width | 7 | #define rimX 0 // left/right rim width |
16 | #define rimY 0 // top/bottom rim high | 8 | #define rimY 0 // top/bottom rim high |
17 | 9 | ||
18 | static const ColorEntry color_table[TABLE_COLORS] = | 10 | static const ColorEntry color_table[TABLE_COLORS] = |
19 | { | 11 | { |
20 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback | 12 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback |
21 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red | 13 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red |
22 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow | 14 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow |
23 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta | 15 | ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta |
24 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White | 16 | ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White |
25 | // intensiv | 17 | // intensiv |
26 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), | 18 | ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), |
27 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), | 19 | ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), |
28 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), | 20 | ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), |
29 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), | 21 | ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), |
30 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) | 22 | ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 ) |
31 | }; | 23 | }; |
32 | 24 | ||
33 | EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) | 25 | EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name ) |
34 | { | 26 | { |
35 | 27 | ||
36 | // initialize font attributes | 28 | // initialize font attributes |
37 | QFontMetrics fm( font() ); | 29 | QFontMetrics fm( font() ); |
38 | f_height = fm.height(); | 30 | f_height = fm.height(); |
39 | f_width = fm.maxWidth(); | 31 | f_width = fm.maxWidth(); |
40 | f_ascent = fm.ascent(); | 32 | f_ascent = fm.ascent(); |
41 | 33 | ||
42 | 34 | ||
43 | // initialize scrollbar related vars | 35 | // initialize scrollbar related vars |
44 | m_scrollbar = new QScrollBar( this ); | 36 | m_scrollbar = new QScrollBar( this ); |
45 | m_scrollbar->setCursor( arrowCursor ); | 37 | m_scrollbar->setCursor( arrowCursor ); |
46 | 38 | ||
47 | // give reasonable defaults to m_columns, m_lines | 39 | // give reasonable defaults to m_columns, m_lines |
48 | calcGeometry(); | 40 | calcGeometry(); |
49 | 41 | ||
50 | // load config | 42 | // load config |
51 | reloadConfig( config ); | 43 | reloadConfig( config ); |
52 | 44 | ||
53 | m_resizing = false; | 45 | m_resizing = false; |
54 | } | 46 | } |
55 | 47 | ||
56 | void EmulationWidget::reloadConfig( const Profile& config ) | 48 | void EmulationWidget::reloadConfig( const Profile& config ) |
57 | { | 49 | { |
58 | 50 | ||
59 | // nothing yet | 51 | // nothing yet |
60 | } | 52 | } |
diff --git a/noncore/apps/opie-console/file_layer.cpp b/noncore/apps/opie-console/file_layer.cpp index 0c83700..9ddef80 100644 --- a/noncore/apps/opie-console/file_layer.cpp +++ b/noncore/apps/opie-console/file_layer.cpp | |||
@@ -1,23 +1,22 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <opie/oprocess.h> | 1 | #include <opie/oprocess.h> |
3 | 2 | ||
4 | #include "file_layer.h" | 3 | #include "file_layer.h" |
5 | 4 | ||
6 | FileTransferLayer::FileTransferLayer(IOLayer *layer) | 5 | FileTransferLayer::FileTransferLayer(IOLayer *layer) |
7 | : QObject(), m_layer( layer ) | 6 | : QObject(), m_layer( layer ) |
8 | { | 7 | { |
9 | } | 8 | } |
10 | 9 | ||
11 | FileTransferLayer::~FileTransferLayer() { | 10 | FileTransferLayer::~FileTransferLayer() { |
12 | } | 11 | } |
13 | 12 | ||
14 | void FileTransferLayer::sendFile(const QFile&) { | 13 | void FileTransferLayer::sendFile(const QFile&) { |
15 | 14 | ||
16 | } | 15 | } |
17 | 16 | ||
18 | void FileTransferLayer::sendFile(const QString&) { | 17 | void FileTransferLayer::sendFile(const QString&) { |
19 | } | 18 | } |
20 | 19 | ||
21 | IOLayer* FileTransferLayer::layer() { | 20 | IOLayer* FileTransferLayer::layer() { |
22 | return m_layer; | 21 | return m_layer; |
23 | } | 22 | } |
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index 5144941..347d6e0 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp | |||
@@ -1,55 +1,54 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <errno.h> | 3 | #include <errno.h> |
4 | #include <fcntl.h> | 4 | #include <fcntl.h> |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | 6 | ||
7 | #include <qcstring.h> | ||
8 | #include <qsocketnotifier.h> | 7 | #include <qsocketnotifier.h> |
9 | 8 | ||
10 | #include <opie/oprocess.h> | 9 | #include <opie/oprocess.h> |
11 | 10 | ||
12 | #include "procctl.h" | 11 | #include "procctl.h" |
13 | #include "filetransfer.h" | 12 | #include "filetransfer.h" |
14 | 13 | ||
15 | 14 | ||
16 | FileTransfer::FileTransfer( Type t, IOLayer* lay ) | 15 | FileTransfer::FileTransfer( Type t, IOLayer* lay ) |
17 | : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) { | 16 | : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) { |
18 | signal(SIGPIPE, SIG_IGN ); | 17 | signal(SIGPIPE, SIG_IGN ); |
19 | 18 | ||
20 | m_pid = 0; | 19 | m_pid = 0; |
21 | m_not = 0l; | 20 | m_not = 0l; |
22 | m_proc = 0l; | 21 | m_proc = 0l; |
23 | } | 22 | } |
24 | FileTransfer::~FileTransfer() { | 23 | FileTransfer::~FileTransfer() { |
25 | } | 24 | } |
26 | 25 | ||
27 | /** | 26 | /** |
28 | * now we will send the file. | 27 | * now we will send the file. |
29 | * | 28 | * |
30 | * we request an fd. The IOLayer should be closed | 29 | * we request an fd. The IOLayer should be closed |
31 | * then we will setup a pipe for progress communication | 30 | * then we will setup a pipe for progress communication |
32 | * then we will dup2 the m_fd in the forked process | 31 | * then we will dup2 the m_fd in the forked process |
33 | * to do direct IO from and to the fd | 32 | * to do direct IO from and to the fd |
34 | */ | 33 | */ |
35 | void FileTransfer::sendFile( const QString& file ) { | 34 | void FileTransfer::sendFile( const QString& file ) { |
36 | m_prog =-1; | 35 | m_prog =-1; |
37 | m_fd = layer()->rawIO(); | 36 | m_fd = layer()->rawIO(); |
38 | // | 37 | // |
39 | // m_fd = ::open("/dev/ttyS0", O_RDWR); | 38 | // m_fd = ::open("/dev/ttyS0", O_RDWR); |
40 | 39 | ||
41 | m_file = file; | 40 | m_file = file; |
42 | if ( pipe( m_comm ) < 0 ) | 41 | if ( pipe( m_comm ) < 0 ) |
43 | m_comm[0] = m_comm[1] = 0; | 42 | m_comm[0] = m_comm[1] = 0; |
44 | if ( pipe( m_info ) < 0 ) | 43 | if ( pipe( m_info ) < 0 ) |
45 | m_info[0] = m_info[1] = 0; | 44 | m_info[0] = m_info[1] = 0; |
46 | 45 | ||
47 | 46 | ||
48 | m_pid = fork(); | 47 | m_pid = fork(); |
49 | switch( m_pid ) { | 48 | switch( m_pid ) { |
50 | case -1: | 49 | case -1: |
51 | emit error( StartError, tr("Was not able to fork") ); | 50 | emit error( StartError, tr("Was not able to fork") ); |
52 | slotExec(); | 51 | slotExec(); |
53 | break; | 52 | break; |
54 | case 0:{ | 53 | case 0:{ |
55 | setupChild(); | 54 | setupChild(); |
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index 0191915..c232d89 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,61 +1,53 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | ||
4 | #include <qpe/qpeapplication.h> | ||
5 | #include <qsizepolicy.h> | ||
6 | #include <qevent.h> | ||
7 | #include <qwindowsystem_qws.h> | ||
8 | #include <qapplication.h> | ||
9 | #include <qlayout.h> | 3 | #include <qlayout.h> |
10 | #include <qspinbox.h> | ||
11 | #include <qlistbox.h> | 4 | #include <qlistbox.h> |
12 | #include <qlabel.h> | 5 | #include <qlabel.h> |
13 | #include <qcombobox.h> | ||
14 | #include <qdir.h> | 6 | #include <qdir.h> |
15 | 7 | ||
16 | #define DEFAULT_ROWS 2 | 8 | #define DEFAULT_ROWS 2 |
17 | #define DEFAULT_COLS 12 | 9 | #define DEFAULT_COLS 12 |
18 | 10 | ||
19 | /* FunctionKeyboard {{{1 */ | 11 | /* FunctionKeyboard {{{1 */ |
20 | 12 | ||
21 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 13 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
22 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), | 14 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), |
23 | pressedRow(0), pressedCol(0) { | 15 | pressedRow(0), pressedCol(0) { |
24 | 16 | ||
25 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 17 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
26 | 18 | ||
27 | /* | 19 | /* |
28 | * all the saving/loading is now done in a profile. downside is that you cant modify | 20 | * all the saving/loading is now done in a profile. downside is that you cant modify |
29 | * the keyboard for all profiles, but must do it on a profile-basis | 21 | * the keyboard for all profiles, but must do it on a profile-basis |
30 | * | 22 | * |
31 | 23 | ||
32 | Config conf("opie-console-keys"); | 24 | Config conf("opie-console-keys"); |
33 | conf.setGroup("keys"); | 25 | conf.setGroup("keys"); |
34 | for (uint r = 0; r < numRows; r++) | 26 | for (uint r = 0; r < numRows; r++) |
35 | for (uint c = 0; c < numCols; c++) { | 27 | for (uint c = 0; c < numCols; c++) { |
36 | 28 | ||
37 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 29 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
38 | QStringList value_list = conf.readListEntry( handle, '|'); | 30 | QStringList value_list = conf.readListEntry( handle, '|'); |
39 | 31 | ||
40 | if (value_list.isEmpty()) continue; | 32 | if (value_list.isEmpty()) continue; |
41 | 33 | ||
42 | keys.insert( | 34 | keys.insert( |
43 | 35 | ||
44 | handle, | 36 | handle, |
45 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) | 37 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) |
46 | ); | 38 | ); |
47 | } | 39 | } |
48 | //qWarning("loaded %d keys", keys.count()); | 40 | //qWarning("loaded %d keys", keys.count()); |
49 | */ | 41 | */ |
50 | if (keys.isEmpty()) loadDefaults(); | 42 | if (keys.isEmpty()) loadDefaults(); |
51 | 43 | ||
52 | 44 | ||
53 | 45 | ||
54 | } | 46 | } |
55 | 47 | ||
56 | FunctionKeyboard::~FunctionKeyboard() {} | 48 | FunctionKeyboard::~FunctionKeyboard() {} |
57 | 49 | ||
58 | void FunctionKeyboard::changeRows(int r) { | 50 | void FunctionKeyboard::changeRows(int r) { |
59 | 51 | ||
60 | numRows = r; | 52 | numRows = r; |
61 | 53 | ||
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index ba7c86e..b434e66 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp | |||
@@ -1,55 +1,53 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qbuttongroup.h> | ||
5 | #include <qhbuttongroup.h> | 4 | #include <qhbuttongroup.h> |
6 | #include <qradiobutton.h> | 5 | #include <qradiobutton.h> |
7 | #include <qhbox.h> | ||
8 | 6 | ||
9 | #include "iolayerbase.h" | 7 | #include "iolayerbase.h" |
10 | 8 | ||
11 | namespace { | 9 | namespace { |
12 | enum ParityIds { | 10 | enum ParityIds { |
13 | id_parity_none, | 11 | id_parity_none, |
14 | id_parity_odd, | 12 | id_parity_odd, |
15 | id_parity_even | 13 | id_parity_even |
16 | }; | 14 | }; |
17 | 15 | ||
18 | enum FlowIds { | 16 | enum FlowIds { |
19 | id_flow_hw, | 17 | id_flow_hw, |
20 | id_flow_sw, | 18 | id_flow_sw, |
21 | id_flow_none, | 19 | id_flow_none, |
22 | }; | 20 | }; |
23 | 21 | ||
24 | enum SpeedIds { | 22 | enum SpeedIds { |
25 | id_baud_115200, | 23 | id_baud_115200, |
26 | id_baud_57600, | 24 | id_baud_57600, |
27 | id_baud_38400, | 25 | id_baud_38400, |
28 | id_baud_19200, | 26 | id_baud_19200, |
29 | id_baud_9600 | 27 | id_baud_9600 |
30 | }; | 28 | }; |
31 | 29 | ||
32 | enum DataIds { | 30 | enum DataIds { |
33 | id_data_5, | 31 | id_data_5, |
34 | id_data_6, | 32 | id_data_6, |
35 | id_data_7, | 33 | id_data_7, |
36 | id_data_8 | 34 | id_data_8 |
37 | }; | 35 | }; |
38 | 36 | ||
39 | enum StopIds { | 37 | enum StopIds { |
40 | id_stop_1, | 38 | id_stop_1, |
41 | id_stop_1_5, | 39 | id_stop_1_5, |
42 | id_stop_2 | 40 | id_stop_2 |
43 | }; | 41 | }; |
44 | 42 | ||
45 | } | 43 | } |
46 | 44 | ||
47 | 45 | ||
48 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) | 46 | IOLayerBase::IOLayerBase( QWidget* par, const char* name ) |
49 | : QWidget( par, name ) | 47 | : QWidget( par, name ) |
50 | { | 48 | { |
51 | m_speedLabel = new QLabel(tr("Speed"), this ); | 49 | m_speedLabel = new QLabel(tr("Speed"), this ); |
52 | m_speedBox = new QComboBox(this ); | 50 | m_speedBox = new QComboBox(this ); |
53 | 51 | ||
54 | m_groupFlow = new QHButtonGroup(tr("Flow control"),this ); | 52 | m_groupFlow = new QHButtonGroup(tr("Flow control"),this ); |
55 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); | 53 | m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); |
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index 228db57..dfb2f83 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp | |||
@@ -1,55 +1,54 @@ | |||
1 | #include <sys/types.h> | 1 | #include <sys/types.h> |
2 | 2 | ||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <signal.h> | 5 | #include <signal.h> |
6 | 6 | ||
7 | #include <qfile.h> | ||
8 | 7 | ||
9 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
10 | 9 | ||
11 | #include "mainwindow.h" | 10 | #include "mainwindow.h" |
12 | 11 | ||
13 | //#define FSCKED_DISTRIBUTION 1 | 12 | //#define FSCKED_DISTRIBUTION 1 |
14 | #ifdef FSCKED_DISTRIBUTION | 13 | #ifdef FSCKED_DISTRIBUTION |
15 | /* | 14 | /* |
16 | * The Zaurus rom | 15 | * The Zaurus rom |
17 | */ | 16 | */ |
18 | class FixIt { | 17 | class FixIt { |
19 | public: | 18 | public: |
20 | FixIt(); | 19 | FixIt(); |
21 | ~FixIt(); | 20 | ~FixIt(); |
22 | void fixIt(); | 21 | void fixIt(); |
23 | /* no real interested in implementing it */ | 22 | /* no real interested in implementing it */ |
24 | void breakIt() { | 23 | void breakIt() { |
25 | 24 | ||
26 | }; | 25 | }; |
27 | char* m_file; | 26 | char* m_file; |
28 | }; | 27 | }; |
29 | 28 | ||
30 | FixIt::FixIt() { | 29 | FixIt::FixIt() { |
31 | /* the new inittab */ | 30 | /* the new inittab */ |
32 | m_file = "#\n# /etc/inittab" | 31 | m_file = "#\n# /etc/inittab" |
33 | "#" | 32 | "#" |
34 | "" | 33 | "" |
35 | "# 0 - halt (Do NOT set initdefault to this)" | 34 | "# 0 - halt (Do NOT set initdefault to this)" |
36 | "# 1 - Single user mode" | 35 | "# 1 - Single user mode" |
37 | "# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" | 36 | "# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" |
38 | "# 3 - Full multiuser mode" | 37 | "# 3 - Full multiuser mode" |
39 | "# 4 - JavaVM(Intent) developer mode" | 38 | "# 4 - JavaVM(Intent) developer mode" |
40 | "# 5 - JavaVM(Intent)" | 39 | "# 5 - JavaVM(Intent)" |
41 | "# 6 - reboot (Do NOT set initdefault to this)" | 40 | "# 6 - reboot (Do NOT set initdefault to this)" |
42 | "#" | 41 | "#" |
43 | "id:5:initdefault:" | 42 | "id:5:initdefault:" |
44 | "" | 43 | "" |
45 | "# Specify things to do when starting" | 44 | "# Specify things to do when starting" |
46 | "si::sysinit:/etc/rc.d/rc.sysinit" | 45 | "si::sysinit:/etc/rc.d/rc.sysinit" |
47 | "" | 46 | "" |
48 | "l0:0:wait:/root/etc/rc.d/rc 0" | 47 | "l0:0:wait:/root/etc/rc.d/rc 0" |
49 | "l1:1:wait:/etc/rc.d/rc 1" | 48 | "l1:1:wait:/etc/rc.d/rc 1" |
50 | "l2:2:wait:/etc/rc.d/rc 2" | 49 | "l2:2:wait:/etc/rc.d/rc 2" |
51 | "l3:3:wait:/etc/rc.d/rc 3" | 50 | "l3:3:wait:/etc/rc.d/rc 3" |
52 | "l4:4:wait:/etc/rc.d/rc 4" | 51 | "l4:4:wait:/etc/rc.d/rc 4" |
53 | "l5:5:wait:/etc/rc.d/rc 5" | 52 | "l5:5:wait:/etc/rc.d/rc 5" |
54 | "l6:6:wait:/root/etc/rc.d/rc 6" | 53 | "l6:6:wait:/root/etc/rc.d/rc 6" |
55 | "" | 54 | "" |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 3c9603c..2673335 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,75 +1,65 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qlabel.h> | ||
6 | #include <qpopupmenu.h> | ||
7 | #include <qtoolbar.h> | 5 | #include <qtoolbar.h> |
8 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
9 | #include <qpushbutton.h> | ||
10 | #include <qwhatsthis.h> | 7 | #include <qwhatsthis.h> |
11 | #include <qfileinfo.h> | 8 | #include <qfileinfo.h> |
12 | #include <qtextstream.h> | ||
13 | 9 | ||
14 | #include <qpe/resource.h> | ||
15 | #include <qpe/qpeapplication.h> | ||
16 | #include <qpe/filemanager.h> | 10 | #include <qpe/filemanager.h> |
17 | #include <qpe/mimetype.h> | ||
18 | 11 | ||
19 | #include <opie/ofiledialog.h> | 12 | #include <opie/ofiledialog.h> |
20 | 13 | ||
21 | #include "TEmulation.h" | 14 | #include "TEmulation.h" |
22 | #include "keytrans.h" | ||
23 | #include "profileeditordialog.h" | 15 | #include "profileeditordialog.h" |
24 | #include "configdialog.h" | 16 | #include "configdialog.h" |
25 | #include "default.h" | 17 | #include "default.h" |
26 | #include "metafactory.h" | ||
27 | #include "profile.h" | ||
28 | #include "profilemanager.h" | 18 | #include "profilemanager.h" |
29 | #include "mainwindow.h" | 19 | #include "mainwindow.h" |
30 | #include "tabwidget.h" | 20 | #include "tabwidget.h" |
31 | #include "transferdialog.h" | 21 | #include "transferdialog.h" |
32 | #include "function_keyboard.h" | 22 | #include "function_keyboard.h" |
33 | #include "emulation_handler.h" | 23 | #include "emulation_handler.h" |
34 | #include "script.h" | 24 | #include "script.h" |
35 | 25 | ||
36 | 26 | ||
37 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 27 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
38 | KeyTrans::loadAll(); | 28 | KeyTrans::loadAll(); |
39 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 29 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
40 | KeyTrans* s = KeyTrans::find(i ); | 30 | KeyTrans* s = KeyTrans::find(i ); |
41 | assert( s ); | 31 | assert( s ); |
42 | } | 32 | } |
43 | m_factory = new MetaFactory(); | 33 | m_factory = new MetaFactory(); |
44 | Default def(m_factory); | 34 | Default def(m_factory); |
45 | m_sessions.setAutoDelete( TRUE ); | 35 | m_sessions.setAutoDelete( TRUE ); |
46 | m_curSession = 0; | 36 | m_curSession = 0; |
47 | m_manager = new ProfileManager( m_factory ); | 37 | m_manager = new ProfileManager( m_factory ); |
48 | m_manager->load(); | 38 | m_manager->load(); |
49 | m_scriptsData.setAutoDelete(TRUE); | 39 | m_scriptsData.setAutoDelete(TRUE); |
50 | 40 | ||
51 | initUI(); | 41 | initUI(); |
52 | populateProfiles(); | 42 | populateProfiles(); |
53 | populateScripts(); | 43 | populateScripts(); |
54 | } | 44 | } |
55 | 45 | ||
56 | void MainWindow::initUI() { | 46 | void MainWindow::initUI() { |
57 | 47 | ||
58 | setToolBarsMovable( FALSE ); | 48 | setToolBarsMovable( FALSE ); |
59 | 49 | ||
60 | /* tool bar for the menu */ | 50 | /* tool bar for the menu */ |
61 | m_tool = new QToolBar( this ); | 51 | m_tool = new QToolBar( this ); |
62 | m_tool->setHorizontalStretchable( TRUE ); | 52 | m_tool->setHorizontalStretchable( TRUE ); |
63 | 53 | ||
64 | m_bar = new QMenuBar( m_tool ); | 54 | m_bar = new QMenuBar( m_tool ); |
65 | m_console = new QPopupMenu( this ); | 55 | m_console = new QPopupMenu( this ); |
66 | m_scripts = new QPopupMenu( this ); | 56 | m_scripts = new QPopupMenu( this ); |
67 | m_sessionsPop= new QPopupMenu( this ); | 57 | m_sessionsPop= new QPopupMenu( this ); |
68 | m_scriptsPop = new QPopupMenu( this ); | 58 | m_scriptsPop = new QPopupMenu( this ); |
69 | 59 | ||
70 | /* add a toolbar for icons */ | 60 | /* add a toolbar for icons */ |
71 | m_icons = new QToolBar(this); | 61 | m_icons = new QToolBar(this); |
72 | 62 | ||
73 | /* | 63 | /* |
74 | * the settings action | 64 | * the settings action |
75 | */ | 65 | */ |
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 24928e7..32e93ce 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -1,49 +1,48 @@ | |||
1 | #include <qpe/config.h> | ||
2 | #include "metafactory.h" | 1 | #include "metafactory.h" |
3 | 2 | ||
4 | MetaFactory::MetaFactory() { | 3 | MetaFactory::MetaFactory() { |
5 | } | 4 | } |
6 | MetaFactory::~MetaFactory() { | 5 | MetaFactory::~MetaFactory() { |
7 | 6 | ||
8 | } | 7 | } |
9 | void MetaFactory::addConnectionWidgetFactory( const QCString& name, | 8 | void MetaFactory::addConnectionWidgetFactory( const QCString& name, |
10 | const QString& str, | 9 | const QString& str, |
11 | configWidget wid) { | 10 | configWidget wid) { |
12 | m_strings.insert( str, name ); | 11 | m_strings.insert( str, name ); |
13 | m_conFact.insert( str, wid ); | 12 | m_conFact.insert( str, wid ); |
14 | } | 13 | } |
15 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, | 14 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, |
16 | const QString& str, | 15 | const QString& str, |
17 | configWidget wid ) { | 16 | configWidget wid ) { |
18 | m_strings.insert( str, name ); | 17 | m_strings.insert( str, name ); |
19 | m_termFact.insert( str, wid ); | 18 | m_termFact.insert( str, wid ); |
20 | } | 19 | } |
21 | void MetaFactory::addKeyboardWidgetFactory( const QCString& name, | 20 | void MetaFactory::addKeyboardWidgetFactory( const QCString& name, |
22 | const QString & str, | 21 | const QString & str, |
23 | configWidget wid) { | 22 | configWidget wid) { |
24 | m_strings.insert( str, name ); | 23 | m_strings.insert( str, name ); |
25 | m_keyFact.insert( str, wid ); | 24 | m_keyFact.insert( str, wid ); |
26 | 25 | ||
27 | } | 26 | } |
28 | void MetaFactory::addIOLayerFactory( const QCString& name, | 27 | void MetaFactory::addIOLayerFactory( const QCString& name, |
29 | const QString& str, | 28 | const QString& str, |
30 | iolayer lay) { | 29 | iolayer lay) { |
31 | m_strings.insert( str, name ); | 30 | m_strings.insert( str, name ); |
32 | m_layerFact.insert( str, lay ); | 31 | m_layerFact.insert( str, lay ); |
33 | } | 32 | } |
34 | void MetaFactory::addFileTransferLayer( const QCString& name, | 33 | void MetaFactory::addFileTransferLayer( const QCString& name, |
35 | const QString& str, | 34 | const QString& str, |
36 | filelayer lay) { | 35 | filelayer lay) { |
37 | m_strings.insert(str, name ); | 36 | m_strings.insert(str, name ); |
38 | m_fileFact.insert( str, lay ); | 37 | m_fileFact.insert( str, lay ); |
39 | } | 38 | } |
40 | void MetaFactory::addReceiveLayer( const QCString& name, | 39 | void MetaFactory::addReceiveLayer( const QCString& name, |
41 | const QString& str, | 40 | const QString& str, |
42 | receivelayer lay) { | 41 | receivelayer lay) { |
43 | m_strings.insert(str, name ); | 42 | m_strings.insert(str, name ); |
44 | m_receiveFact.insert( str, lay ); | 43 | m_receiveFact.insert( str, lay ); |
45 | } | 44 | } |
46 | QStringList MetaFactory::ioLayers()const { | 45 | QStringList MetaFactory::ioLayers()const { |
47 | QStringList list; | 46 | QStringList list; |
48 | QMap<QString, iolayer>::ConstIterator it; | 47 | QMap<QString, iolayer>::ConstIterator it; |
49 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { | 48 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index f7fb6f3..e552990 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -1,55 +1,53 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlineedit.h> | ||
5 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
6 | #include <qhbox.h> | 5 | #include <qhbox.h> |
7 | #include <qregexp.h> | ||
8 | 6 | ||
9 | #include "modemconfigwidget.h" | 7 | #include "modemconfigwidget.h" |
10 | #include "dialdialog.h" | 8 | #include "dialdialog.h" |
11 | 9 | ||
12 | namespace { | 10 | namespace { |
13 | void setCurrent( const QString& str, QComboBox* bo ) { | 11 | void setCurrent( const QString& str, QComboBox* bo ) { |
14 | uint b = bo->count(); | 12 | uint b = bo->count(); |
15 | for (int i = 0; i < bo->count(); i++ ) { | 13 | for (int i = 0; i < bo->count(); i++ ) { |
16 | if ( bo->text(i) == str ) { | 14 | if ( bo->text(i) == str ) { |
17 | bo->setCurrentItem( i ); | 15 | bo->setCurrentItem( i ); |
18 | return; | 16 | return; |
19 | } | 17 | } |
20 | } | 18 | } |
21 | bo->insertItem( str ); | 19 | bo->insertItem( str ); |
22 | bo->setCurrentItem( b ); | 20 | bo->setCurrentItem( b ); |
23 | } | 21 | } |
24 | } | 22 | } |
25 | 23 | ||
26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | 24 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, |
27 | const char* na ) | 25 | const char* na ) |
28 | : ProfileDialogConnectionWidget( name, parent, na ) { | 26 | : ProfileDialogConnectionWidget( name, parent, na ) { |
29 | 27 | ||
30 | m_lay = new QVBoxLayout( this ); | 28 | m_lay = new QVBoxLayout( this ); |
31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); | 29 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); |
32 | m_deviceCmb = new QComboBox(this ); | 30 | m_deviceCmb = new QComboBox(this ); |
33 | m_deviceCmb->setEditable( TRUE ); | 31 | m_deviceCmb->setEditable( TRUE ); |
34 | 32 | ||
35 | QLabel* telLabel = new QLabel( this ); | 33 | QLabel* telLabel = new QLabel( this ); |
36 | telLabel->setText( tr( "Enter telefon number here:" ) ); | 34 | telLabel->setText( tr( "Enter telefon number here:" ) ); |
37 | QHBox *buttonBox = new QHBox( this ); | 35 | QHBox *buttonBox = new QHBox( this ); |
38 | m_telNumber = new QLineEdit( buttonBox ); | 36 | m_telNumber = new QLineEdit( buttonBox ); |
39 | QPushButton *atButton = new QPushButton( buttonBox ); | 37 | QPushButton *atButton = new QPushButton( buttonBox ); |
40 | atButton->setText( tr( "AT commands" ) ); | 38 | atButton->setText( tr( "AT commands" ) ); |
41 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); | 39 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); |
42 | 40 | ||
43 | QPushButton *dialButton = new QPushButton( buttonBox ); | 41 | QPushButton *dialButton = new QPushButton( buttonBox ); |
44 | dialButton->setText( tr( "Enter number" ) ); | 42 | dialButton->setText( tr( "Enter number" ) ); |
45 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); | 43 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); |
46 | 44 | ||
47 | m_base = new IOLayerBase( this, "base" ); | 45 | m_base = new IOLayerBase( this, "base" ); |
48 | 46 | ||
49 | m_lay->addWidget( m_device ); | 47 | m_lay->addWidget( m_device ); |
50 | m_lay->addWidget( m_deviceCmb ); | 48 | m_lay->addWidget( m_deviceCmb ); |
51 | m_lay->addWidget( telLabel ); | 49 | m_lay->addWidget( telLabel ); |
52 | m_lay->addWidget( buttonBox ); | 50 | m_lay->addWidget( buttonBox ); |
53 | m_lay->addWidget( m_base ); | 51 | m_lay->addWidget( m_base ); |
54 | m_lay->addStretch( 0 ); | 52 | m_lay->addStretch( 0 ); |
55 | 53 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index e2501a6..979e89d 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,53 +1,52 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qlineedit.h> | 2 | #include <qlineedit.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qstringlist.h> | ||
6 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
7 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
8 | #include <qscrollview.h> | 7 | #include <qscrollview.h> |
9 | 8 | ||
10 | #include "metafactory.h" | 9 | #include "metafactory.h" |
11 | #include "profileeditordialog.h" | 10 | #include "profileeditordialog.h" |
12 | 11 | ||
13 | namespace { | 12 | namespace { |
14 | void setCurrent( const QString& str, QComboBox* bo ) { | 13 | void setCurrent( const QString& str, QComboBox* bo ) { |
15 | for (int i = 0; i < bo->count(); i++ ) { | 14 | for (int i = 0; i < bo->count(); i++ ) { |
16 | if ( bo->text(i) == str ) { | 15 | if ( bo->text(i) == str ) { |
17 | bo->setCurrentItem( i ); | 16 | bo->setCurrentItem( i ); |
18 | } | 17 | } |
19 | } | 18 | } |
20 | }; | 19 | }; |
21 | } | 20 | } |
22 | 21 | ||
23 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, | 22 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, |
24 | const Profile& prof ) | 23 | const Profile& prof ) |
25 | : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) | 24 | : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) |
26 | { | 25 | { |
27 | initUI(); | 26 | initUI(); |
28 | 27 | ||
29 | // Apply current profile | 28 | // Apply current profile |
30 | // plugin_plugin->load(profile); | 29 | // plugin_plugin->load(profile); |
31 | // ... (reset profile name line edit etc.) | 30 | // ... (reset profile name line edit etc.) |
32 | } | 31 | } |
33 | 32 | ||
34 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | 33 | ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) |
35 | : QDialog(0, 0, TRUE), m_fact( fact ) | 34 | : QDialog(0, 0, TRUE), m_fact( fact ) |
36 | { | 35 | { |
37 | // Default profile | 36 | // Default profile |
38 | m_prof = Profile(tr("New Profile"), "serial", "default", Profile::Black, Profile::White, Profile::VT102); | 37 | m_prof = Profile(tr("New Profile"), "serial", "default", Profile::Black, Profile::White, Profile::VT102); |
39 | 38 | ||
40 | initUI(); | 39 | initUI(); |
41 | 40 | ||
42 | // Apply current profile | 41 | // Apply current profile |
43 | // plugin_plugin->load(profile); | 42 | // plugin_plugin->load(profile); |
44 | } | 43 | } |
45 | 44 | ||
46 | Profile ProfileEditorDialog::profile() const | 45 | Profile ProfileEditorDialog::profile() const |
47 | { | 46 | { |
48 | return m_prof; | 47 | return m_prof; |
49 | } | 48 | } |
50 | 49 | ||
51 | void ProfileEditorDialog::initUI() | 50 | void ProfileEditorDialog::initUI() |
52 | { | 51 | { |
53 | m_con = m_term = m_key = 0l; | 52 | m_con = m_term = m_key = 0l; |
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index cad2567..71188d1 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -1,61 +1,56 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qhbox.h> | 5 | #include <qhbox.h> |
6 | #include <qlayout.h> | ||
7 | #include <qwidgetstack.h> | ||
8 | 6 | ||
9 | #include <qpe/config.h> | ||
10 | 7 | ||
11 | #include "emulation_handler.h" | 8 | #include "emulation_handler.h" |
12 | #include "widget_layer.h" | ||
13 | #include "emulation_widget.h" | ||
14 | #include "metafactory.h" | 9 | #include "metafactory.h" |
15 | #include "profileconfig.h" | 10 | #include "profileconfig.h" |
16 | #include "profilemanager.h" | 11 | #include "profilemanager.h" |
17 | 12 | ||
18 | ProfileManager::ProfileManager( MetaFactory* fact ) | 13 | ProfileManager::ProfileManager( MetaFactory* fact ) |
19 | : m_fact( fact ) | 14 | : m_fact( fact ) |
20 | { | 15 | { |
21 | 16 | ||
22 | } | 17 | } |
23 | ProfileManager::~ProfileManager() { | 18 | ProfileManager::~ProfileManager() { |
24 | 19 | ||
25 | } | 20 | } |
26 | void ProfileManager::load() { | 21 | void ProfileManager::load() { |
27 | m_list.clear(); | 22 | m_list.clear(); |
28 | ProfileConfig conf("opie-console-profiles"); | 23 | ProfileConfig conf("opie-console-profiles"); |
29 | QStringList groups = conf.groups(); | 24 | QStringList groups = conf.groups(); |
30 | QStringList::Iterator it; | 25 | QStringList::Iterator it; |
31 | 26 | ||
32 | /* | 27 | /* |
33 | * for each profile | 28 | * for each profile |
34 | */ | 29 | */ |
35 | for ( it = groups.begin(); it != groups.end(); ++it ) { | 30 | for ( it = groups.begin(); it != groups.end(); ++it ) { |
36 | conf.setGroup( (*it) ); | 31 | conf.setGroup( (*it) ); |
37 | Profile prof; | 32 | Profile prof; |
38 | prof.setName( conf.readEntry("name") ); | 33 | prof.setName( conf.readEntry("name") ); |
39 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); | 34 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); |
40 | prof.setTerminalName( conf.readEntry("term").utf8() ); | 35 | prof.setTerminalName( conf.readEntry("term").utf8() ); |
41 | prof.setAutoConnect( conf.readBoolEntry("autoConnect") ); | 36 | prof.setAutoConnect( conf.readBoolEntry("autoConnect") ); |
42 | prof.setBackground( conf.readNumEntry("back") ); | 37 | prof.setBackground( conf.readNumEntry("back") ); |
43 | prof.setForeground( conf.readNumEntry("fore") ); | 38 | prof.setForeground( conf.readNumEntry("fore") ); |
44 | prof.setTerminal( conf.readNumEntry("terminal") ); | 39 | prof.setTerminal( conf.readNumEntry("terminal") ); |
45 | 40 | ||
46 | // THIS is evil because all data get's reset | 41 | // THIS is evil because all data get's reset |
47 | prof.setConf( conf.items( (*it) ) ); | 42 | prof.setConf( conf.items( (*it) ) ); |
48 | 43 | ||
49 | /* now add it */ | 44 | /* now add it */ |
50 | m_list.append( prof ); | 45 | m_list.append( prof ); |
51 | } | 46 | } |
52 | 47 | ||
53 | } | 48 | } |
54 | void ProfileManager::clear() { | 49 | void ProfileManager::clear() { |
55 | m_list.clear(); | 50 | m_list.clear(); |
56 | } | 51 | } |
57 | Profile::ValueList ProfileManager::all()const { | 52 | Profile::ValueList ProfileManager::all()const { |
58 | return m_list; | 53 | return m_list; |
59 | } | 54 | } |
60 | /* | 55 | /* |
61 | * Our goal is to create a Session | 56 | * Our goal is to create a Session |
diff --git a/noncore/apps/opie-console/receive_layer.cpp b/noncore/apps/opie-console/receive_layer.cpp index bbde339..b255452 100644 --- a/noncore/apps/opie-console/receive_layer.cpp +++ b/noncore/apps/opie-console/receive_layer.cpp | |||
@@ -1,34 +1,31 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | 2 | ||
3 | #include <qdir.h> | 3 | #include <qdir.h> |
4 | #include <qstring.h> | ||
5 | #include <qfile.h> | ||
6 | 4 | ||
7 | #include "io_layer.h" | ||
8 | #include "receive_layer.h" | 5 | #include "receive_layer.h" |
9 | 6 | ||
10 | ReceiveLayer::ReceiveLayer( IOLayer* lay, const QString& startDir ) | 7 | ReceiveLayer::ReceiveLayer( IOLayer* lay, const QString& startDir ) |
11 | : QObject(), m_curDir( startDir ), m_layer(lay ) | 8 | : QObject(), m_curDir( startDir ), m_layer(lay ) |
12 | { | 9 | { |
13 | 10 | ||
14 | } | 11 | } |
15 | ReceiveLayer::~ReceiveLayer() { | 12 | ReceiveLayer::~ReceiveLayer() { |
16 | 13 | ||
17 | } | 14 | } |
18 | IOLayer* ReceiveLayer::layer() { | 15 | IOLayer* ReceiveLayer::layer() { |
19 | return m_layer; | 16 | return m_layer; |
20 | } | 17 | } |
21 | QString ReceiveLayer::currentDir()const{ | 18 | QString ReceiveLayer::currentDir()const{ |
22 | if (m_curDir.isEmpty() ) | 19 | if (m_curDir.isEmpty() ) |
23 | return QDir::currentDirPath(); | 20 | return QDir::currentDirPath(); |
24 | return m_curDir; | 21 | return m_curDir; |
25 | } | 22 | } |
26 | void ReceiveLayer::changeDir( const QString& str) { | 23 | void ReceiveLayer::changeDir( const QString& str) { |
27 | ::chdir( str.latin1() ); | 24 | ::chdir( str.latin1() ); |
28 | } | 25 | } |
29 | void ReceiveLayer::receive( const QString& dir, Mode, Features ) { | 26 | void ReceiveLayer::receive( const QString& dir, Mode, Features ) { |
30 | receive( dir ); | 27 | receive( dir ); |
31 | } | 28 | } |
32 | void ReceiveLayer::cancel() { | 29 | void ReceiveLayer::cancel() { |
33 | 30 | ||
34 | } | 31 | } |
diff --git a/noncore/apps/opie-console/script.cpp b/noncore/apps/opie-console/script.cpp index e6e9d6d..faea412 100644 --- a/noncore/apps/opie-console/script.cpp +++ b/noncore/apps/opie-console/script.cpp | |||
@@ -1,30 +1,29 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qtextstream.h> | ||
3 | #include "script.h" | 2 | #include "script.h" |
4 | 3 | ||
5 | Script::Script() { | 4 | Script::Script() { |
6 | } | 5 | } |
7 | 6 | ||
8 | Script::Script(const QString fileName) { | 7 | Script::Script(const QString fileName) { |
9 | QFile file(fileName); | 8 | QFile file(fileName); |
10 | file.open(IO_ReadOnly ); | 9 | file.open(IO_ReadOnly ); |
11 | m_script = file.readAll(); | 10 | m_script = file.readAll(); |
12 | } | 11 | } |
13 | 12 | ||
14 | void Script::saveTo(const QString fileName) const { | 13 | void Script::saveTo(const QString fileName) const { |
15 | QFile file(fileName); | 14 | QFile file(fileName); |
16 | file.open(IO_WriteOnly); | 15 | file.open(IO_WriteOnly); |
17 | file.writeBlock(m_script); | 16 | file.writeBlock(m_script); |
18 | file.close(); | 17 | file.close(); |
19 | } | 18 | } |
20 | 19 | ||
21 | 20 | ||
22 | void Script::append(const QByteArray &data) { | 21 | void Script::append(const QByteArray &data) { |
23 | int size = m_script.size(); | 22 | int size = m_script.size(); |
24 | m_script.resize(size + data.size()); | 23 | m_script.resize(size + data.size()); |
25 | memcpy(m_script.data() + size, data.data(), data.size()); | 24 | memcpy(m_script.data() + size, data.data(), data.size()); |
26 | } | 25 | } |
27 | 26 | ||
28 | QByteArray Script::script() const { | 27 | QByteArray Script::script() const { |
29 | return m_script; | 28 | return m_script; |
30 | } | 29 | } |
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index 4f52584..1034ede 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp | |||
@@ -1,52 +1,50 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include "profile.h" | ||
4 | #include "io_layer.h" | ||
5 | #include "file_layer.h" | 3 | #include "file_layer.h" |
6 | #include "emulation_handler.h" | 4 | #include "emulation_handler.h" |
7 | #include "session.h" | 5 | #include "session.h" |
8 | 6 | ||
9 | 7 | ||
10 | Session::Session() { | 8 | Session::Session() { |
11 | m_widget = 0l; | 9 | m_widget = 0l; |
12 | m_layer = 0l; | 10 | m_layer = 0l; |
13 | m_emu = 0l; | 11 | m_emu = 0l; |
14 | m_transfer = 0l; | 12 | m_transfer = 0l; |
15 | } | 13 | } |
16 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) | 14 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) |
17 | : m_name( na ), m_widget( widget ), m_layer( lay ) | 15 | : m_name( na ), m_widget( widget ), m_layer( lay ) |
18 | { | 16 | { |
19 | // m_widLay = 0l; | 17 | // m_widLay = 0l; |
20 | // m_emLay = 0l; | 18 | // m_emLay = 0l; |
21 | m_emu = 0l; | 19 | m_emu = 0l; |
22 | } | 20 | } |
23 | Session::~Session() { | 21 | Session::~Session() { |
24 | delete m_layer; | 22 | delete m_layer; |
25 | delete m_emu; | 23 | delete m_emu; |
26 | delete m_widget; | 24 | delete m_widget; |
27 | /* the widget layer should be deleted by the m_widget */ | 25 | /* the widget layer should be deleted by the m_widget */ |
28 | } | 26 | } |
29 | QString Session::name()const { | 27 | QString Session::name()const { |
30 | return m_name; | 28 | return m_name; |
31 | } | 29 | } |
32 | QWidgetStack* Session::widgetStack() { | 30 | QWidgetStack* Session::widgetStack() { |
33 | return m_widget; | 31 | return m_widget; |
34 | } | 32 | } |
35 | IOLayer* Session::layer() { | 33 | IOLayer* Session::layer() { |
36 | return m_layer; | 34 | return m_layer; |
37 | } | 35 | } |
38 | EmulationHandler* Session::emulationHandler() { | 36 | EmulationHandler* Session::emulationHandler() { |
39 | return m_emu; | 37 | return m_emu; |
40 | } | 38 | } |
41 | QWidget* Session::widget() { | 39 | QWidget* Session::widget() { |
42 | if (!m_emu ) | 40 | if (!m_emu ) |
43 | return 0l; | 41 | return 0l; |
44 | 42 | ||
45 | return m_emu->widget(); | 43 | return m_emu->widget(); |
46 | } | 44 | } |
47 | Profile Session::profile()const { | 45 | Profile Session::profile()const { |
48 | return m_prof; | 46 | return m_prof; |
49 | } | 47 | } |
50 | /* | 48 | /* |
51 | WidgetLayer* Session::emulationWidget() { | 49 | WidgetLayer* Session::emulationWidget() { |
52 | return m_widLay; | 50 | return m_widLay; |
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index 70f7c9b..6870487 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp | |||
@@ -1,59 +1,55 @@ | |||
1 | #include <qbuttongroup.h> | ||
2 | #include <qlabel.h> | 1 | #include <qlabel.h> |
3 | #include <qcheckbox.h> | 2 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
5 | #include <qradiobutton.h> | 4 | #include <qradiobutton.h> |
6 | #include <qgroupbox.h> | ||
7 | #include <qvbox.h> | ||
8 | #include <qhgroupbox.h> | 5 | #include <qhgroupbox.h> |
9 | #include <qhbuttongroup.h> | 6 | #include <qhbuttongroup.h> |
10 | #include <qlayout.h> | 7 | #include <qlayout.h> |
11 | #include <qhbox.h> | ||
12 | 8 | ||
13 | #include "terminalwidget.h" | 9 | #include "terminalwidget.h" |
14 | 10 | ||
15 | namespace { | 11 | namespace { |
16 | enum TermIds { | 12 | enum TermIds { |
17 | id_term_vt100 = 0, | 13 | id_term_vt100 = 0, |
18 | id_term_vt102, | 14 | id_term_vt102, |
19 | id_term_linux, | 15 | id_term_linux, |
20 | id_term_xterm | 16 | id_term_xterm |
21 | }; | 17 | }; |
22 | 18 | ||
23 | enum ColourIds { | 19 | enum ColourIds { |
24 | id_term_black, | 20 | id_term_black, |
25 | id_term_white, | 21 | id_term_white, |
26 | id_term_green, | 22 | id_term_green, |
27 | id_term_orange | 23 | id_term_orange |
28 | }; | 24 | }; |
29 | 25 | ||
30 | enum FontIds { | 26 | enum FontIds { |
31 | id_size_small, | 27 | id_size_small, |
32 | id_size_medium, | 28 | id_size_medium, |
33 | id_size_large | 29 | id_size_large |
34 | }; | 30 | }; |
35 | }; | 31 | }; |
36 | 32 | ||
37 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | 33 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, |
38 | const char* na ) | 34 | const char* na ) |
39 | : ProfileDialogTerminalWidget( name, parent, na ) { | 35 | : ProfileDialogTerminalWidget( name, parent, na ) { |
40 | 36 | ||
41 | m_terminal = new QLabel(tr("Terminal Type"), this ); | 37 | m_terminal = new QLabel(tr("Terminal Type"), this ); |
42 | m_terminalBox = new QComboBox(this); | 38 | m_terminalBox = new QComboBox(this); |
43 | m_colorLabel = new QLabel(tr("Color scheme"), this); | 39 | m_colorLabel = new QLabel(tr("Color scheme"), this); |
44 | m_colorCmb = new QComboBox(this ); | 40 | m_colorCmb = new QComboBox(this ); |
45 | 41 | ||
46 | m_groupSize = new QHButtonGroup(tr("Font size"), this ); | 42 | m_groupSize = new QHButtonGroup(tr("Font size"), this ); |
47 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); | 43 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); |
48 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); | 44 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); |
49 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); | 45 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); |
50 | 46 | ||
51 | m_groupConv = new QHGroupBox( tr("Line-break conversions"), this ); | 47 | m_groupConv = new QHGroupBox( tr("Line-break conversions"), this ); |
52 | m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv ); | 48 | m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv ); |
53 | m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv ); | 49 | m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv ); |
54 | 50 | ||
55 | m_groupOptions = new QHGroupBox( tr("Options"), this ); | 51 | m_groupOptions = new QHGroupBox( tr("Options"), this ); |
56 | m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions ); | 52 | m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions ); |
57 | m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions ); | 53 | m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions ); |
58 | 54 | ||
59 | m_lroot = new QVBoxLayout( this ); | 55 | m_lroot = new QVBoxLayout( this ); |
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index 0af1911..55dd748 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp | |||
@@ -1,62 +1,60 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qcombobox.h> | 2 | #include <qcombobox.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qprogressbar.h> | 7 | #include <qprogressbar.h> |
8 | #include <qradiobutton.h> | 8 | #include <qradiobutton.h> |
9 | #include <qbuttongroup.h> | 9 | #include <qbuttongroup.h> |
10 | 10 | ||
11 | #include <opie/ofiledialog.h> | 11 | #include <opie/ofiledialog.h> |
12 | 12 | ||
13 | #include "file_layer.h" | ||
14 | #include "receive_layer.h" | ||
15 | #include "metafactory.h" | 13 | #include "metafactory.h" |
16 | #include "mainwindow.h" | 14 | #include "mainwindow.h" |
17 | 15 | ||
18 | #include "transferdialog.h" | 16 | #include "transferdialog.h" |
19 | 17 | ||
20 | TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) | 18 | TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) |
21 | : QDialog(parent, 0l, false), m_win(mainwindow) | 19 | : QDialog(parent, 0l, false), m_win(mainwindow) |
22 | { | 20 | { |
23 | m_lay = 0l; | 21 | m_lay = 0l; |
24 | m_recvlay = 0l; | 22 | m_recvlay = 0l; |
25 | QVBoxLayout *vbox, *vbox2; | 23 | QVBoxLayout *vbox, *vbox2; |
26 | QHBoxLayout *hbox, *hbox2, *hbox3; | 24 | QHBoxLayout *hbox, *hbox2, *hbox3; |
27 | QLabel *file, *mode, *progress, *status; | 25 | QLabel *file, *mode, *progress, *status; |
28 | QButtonGroup *group; | 26 | QButtonGroup *group; |
29 | QRadioButton *mode_send, *mode_receive; | 27 | QRadioButton *mode_send, *mode_receive; |
30 | 28 | ||
31 | m_autocleanup = 0; | 29 | m_autocleanup = 0; |
32 | m_running = true; | 30 | m_running = true; |
33 | 31 | ||
34 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); | 32 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); |
35 | mode_send = new QRadioButton(QObject::tr("Send"), group); | 33 | mode_send = new QRadioButton(QObject::tr("Send"), group); |
36 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); | 34 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); |
37 | group->insert(mode_send, id_send); | 35 | group->insert(mode_send, id_send); |
38 | group->insert(mode_receive, id_receive); | 36 | group->insert(mode_receive, id_receive); |
39 | vbox2 = new QVBoxLayout(group, 2); | 37 | vbox2 = new QVBoxLayout(group, 2); |
40 | vbox2->addSpacing(10); | 38 | vbox2->addSpacing(10); |
41 | hbox3 = new QHBoxLayout(vbox2, 2); | 39 | hbox3 = new QHBoxLayout(vbox2, 2); |
42 | hbox3->add(mode_send); | 40 | hbox3->add(mode_send); |
43 | hbox3->add(mode_receive); | 41 | hbox3->add(mode_receive); |
44 | mode_send->setChecked(true); | 42 | mode_send->setChecked(true); |
45 | m_transfermode = id_send; | 43 | m_transfermode = id_send; |
46 | 44 | ||
47 | file = new QLabel(QObject::tr("Send file"), this); | 45 | file = new QLabel(QObject::tr("Send file"), this); |
48 | mode = new QLabel(QObject::tr("Transfer protocol"), this); | 46 | mode = new QLabel(QObject::tr("Transfer protocol"), this); |
49 | progress = new QLabel(QObject::tr("Progress"), this); | 47 | progress = new QLabel(QObject::tr("Progress"), this); |
50 | status = new QLabel(QObject::tr("Status"), this); | 48 | status = new QLabel(QObject::tr("Status"), this); |
51 | 49 | ||
52 | statusbar = new QLabel(QObject::tr("Ready"), this); | 50 | statusbar = new QLabel(QObject::tr("Ready"), this); |
53 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 51 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
54 | 52 | ||
55 | protocol = new QComboBox(this); | 53 | protocol = new QComboBox(this); |
56 | QStringList list = m_win->factory()->fileTransferLayers(); | 54 | QStringList list = m_win->factory()->fileTransferLayers(); |
57 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) | 55 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) |
58 | protocol->insertItem((*it)); | 56 | protocol->insertItem((*it)); |
59 | 57 | ||
60 | filename = new QLineEdit(this); | 58 | filename = new QLineEdit(this); |
61 | 59 | ||
62 | progressbar = new QProgressBar(this); | 60 | progressbar = new QProgressBar(this); |
diff --git a/noncore/apps/opie-console/vt102emulation.cpp b/noncore/apps/opie-console/vt102emulation.cpp index 0ebefa0..35b789c 100644 --- a/noncore/apps/opie-console/vt102emulation.cpp +++ b/noncore/apps/opie-console/vt102emulation.cpp | |||
@@ -1,82 +1,77 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [vt102emulation.cpp] VT102 Terminal Emulation */ | 3 | /* [vt102emulation.cpp] VT102 Terminal Emulation */ |
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------- */ | 5 | /* ------------------------------------------------------------------------- */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole - an X terminal for KDE */ | 9 | /* This file is part of Konsole - an X terminal for KDE */ |
10 | /* */ | 10 | /* */ |
11 | /* ------------------------------------------------------------------------- */ | 11 | /* ------------------------------------------------------------------------- */ |
12 | /* */ | 12 | /* */ |
13 | /* Ported Konsole to Qt/Embedded */ | 13 | /* Ported Konsole to Qt/Embedded */ |
14 | /* */ | 14 | /* */ |
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
16 | /* */ | 16 | /* */ |
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
18 | 18 | ||
19 | /*! \class Vt102Emulation | 19 | /*! \class Vt102Emulation |
20 | 20 | ||
21 | \brief Actual Emulation for Konsole | 21 | \brief Actual Emulation for Konsole |
22 | 22 | ||
23 | \sa Widget \sa Screen \sa EmulationLayer | 23 | \sa Widget \sa Screen \sa EmulationLayer |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "vt102emulation.h" | 26 | #include "vt102emulation.h" |
27 | #include "widget_layer.h" | ||
28 | #include "screen.h" | ||
29 | #include "keytrans.h" | ||
30 | 27 | ||
31 | #include <stdio.h> | 28 | #include <stdio.h> |
32 | #include <unistd.h> | 29 | #include <unistd.h> |
33 | #include <qkeycode.h> | ||
34 | #include <qtextcodec.h> | ||
35 | 30 | ||
36 | 31 | ||
37 | /* VT102 Terminal Emulation | 32 | /* VT102 Terminal Emulation |
38 | 33 | ||
39 | This class puts together the screens, the pty and the widget to a | 34 | This class puts together the screens, the pty and the widget to a |
40 | complete terminal emulation. Beside combining it's componentes, it | 35 | complete terminal emulation. Beside combining it's componentes, it |
41 | handles the emulations's protocol. | 36 | handles the emulations's protocol. |
42 | 37 | ||
43 | This module consists of the following sections: | 38 | This module consists of the following sections: |
44 | 39 | ||
45 | - Constructor/Destructor | 40 | - Constructor/Destructor |
46 | - Incoming Bytes Event pipeline | 41 | - Incoming Bytes Event pipeline |
47 | - Outgoing Bytes | 42 | - Outgoing Bytes |
48 | - Mouse Events | 43 | - Mouse Events |
49 | - Keyboard Events | 44 | - Keyboard Events |
50 | - Modes and Charset State | 45 | - Modes and Charset State |
51 | - Diagnostics | 46 | - Diagnostics |
52 | */ | 47 | */ |
53 | 48 | ||
54 | 49 | ||
55 | /* ------------------------------------------------------------------------- */ | 50 | /* ------------------------------------------------------------------------- */ |
56 | /* */ | 51 | /* */ |
57 | /* Constructor / Destructor */ | 52 | /* Constructor / Destructor */ |
58 | /* */ | 53 | /* */ |
59 | /* ------------------------------------------------------------------------- */ | 54 | /* ------------------------------------------------------------------------- */ |
60 | 55 | ||
61 | /* | 56 | /* |
62 | Nothing really intesting happens here. | 57 | Nothing really intesting happens here. |
63 | */ | 58 | */ |
64 | 59 | ||
65 | /*! | 60 | /*! |
66 | */ | 61 | */ |
67 | 62 | ||
68 | Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui) | 63 | Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui) |
69 | { | 64 | { |
70 | QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), | 65 | QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), |
71 | this,SLOT(onMouse(int,int,int))); | 66 | this,SLOT(onMouse(int,int,int))); |
72 | initTokenizer(); | 67 | initTokenizer(); |
73 | reset(); | 68 | reset(); |
74 | } | 69 | } |
75 | 70 | ||
76 | /*! | 71 | /*! |
77 | */ | 72 | */ |
78 | 73 | ||
79 | Vt102Emulation::~Vt102Emulation() | 74 | Vt102Emulation::~Vt102Emulation() |
80 | { | 75 | { |
81 | } | 76 | } |
82 | 77 | ||
diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp index 10045c6..e17dfd4 100644 --- a/noncore/apps/opie-console/widget.cpp +++ b/noncore/apps/opie-console/widget.cpp | |||
@@ -19,107 +19,99 @@ | |||
19 | /* ibot: | 19 | /* ibot: |
20 | i changed | 20 | i changed |
21 | "currentSession->getEmulation()->sendString()" to | 21 | "currentSession->getEmulation()->sendString()" to |
22 | "currentSession->layer()->send()" | 22 | "currentSession->layer()->send()" |
23 | # this is not right! EmulationLayer should send it... | 23 | # this is not right! EmulationLayer should send it... |
24 | i changed all those to use emulationLayer()->send() instead | 24 | i changed all those to use emulationLayer()->send() instead |
25 | i had to create a QByteArray before... | 25 | i had to create a QByteArray before... |
26 | 26 | ||
27 | TODO: | 27 | TODO: |
28 | alter Widget to use only QByteArray, where applicable. | 28 | alter Widget to use only QByteArray, where applicable. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | /*! \class Widget | 33 | /*! \class Widget |
34 | 34 | ||
35 | \brief Visible screen contents | 35 | \brief Visible screen contents |
36 | 36 | ||
37 | This class is responsible to map the `image' of a terminal emulation to the | 37 | This class is responsible to map the `image' of a terminal emulation to the |
38 | display. All the dependency of the emulation to a specific GUI or toolkit is | 38 | display. All the dependency of the emulation to a specific GUI or toolkit is |
39 | localized here. Further, this widget has no knowledge about being part of an | 39 | localized here. Further, this widget has no knowledge about being part of an |
40 | emulation, it simply work within the terminal emulation framework by exposing | 40 | emulation, it simply work within the terminal emulation framework by exposing |
41 | size and key events and by being ordered to show a new image. | 41 | size and key events and by being ordered to show a new image. |
42 | 42 | ||
43 | <ul> | 43 | <ul> |
44 | <li> The internal image has the size of the widget (evtl. rounded up) | 44 | <li> The internal image has the size of the widget (evtl. rounded up) |
45 | <li> The external image used in setImage can have any size. | 45 | <li> The external image used in setImage can have any size. |
46 | <li> (internally) the external image is simply copied to the internal | 46 | <li> (internally) the external image is simply copied to the internal |
47 | when a setImage happens. During a resizeEvent no painting is done | 47 | when a setImage happens. During a resizeEvent no painting is done |
48 | a paintEvent is expected to follow anyway. | 48 | a paintEvent is expected to follow anyway. |
49 | </ul> | 49 | </ul> |
50 | 50 | ||
51 | \sa TEScreen \sa Emulation | 51 | \sa TEScreen \sa Emulation |
52 | */ | 52 | */ |
53 | 53 | ||
54 | /* FIXME: | 54 | /* FIXME: |
55 | - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent | 55 | - 'image' may also be used uninitialized (it isn't in fact) in resizeEvent |
56 | - 'font_a' not used in mouse events | 56 | - 'font_a' not used in mouse events |
57 | - add destructor | 57 | - add destructor |
58 | */ | 58 | */ |
59 | 59 | ||
60 | /* TODO | 60 | /* TODO |
61 | - evtl. be sensitive to `paletteChange' while using default colors. | 61 | - evtl. be sensitive to `paletteChange' while using default colors. |
62 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? | 62 | - set different 'rounding' styles? I.e. have a mode to show clipped chars? |
63 | */ | 63 | */ |
64 | 64 | ||
65 | // #include "config.h" | 65 | // #include "config.h" |
66 | #include "widget.h" | 66 | #include "widget.h" |
67 | #include "session.h" | ||
68 | #include <qpe/config.h> | 67 | #include <qpe/config.h> |
69 | #include <qapplication.h> | ||
70 | 68 | ||
71 | #include <qcursor.h> | ||
72 | #include <qregexp.h> | ||
73 | #include <qpainter.h> | ||
74 | #include <qclipboard.h> | 69 | #include <qclipboard.h> |
75 | #include <qstyle.h> | ||
76 | #include <qfile.h> | ||
77 | #include <qdragobject.h> | ||
78 | 70 | ||
79 | #include <stdio.h> | 71 | #include <stdio.h> |
80 | #include <stdlib.h> | 72 | #include <stdlib.h> |
81 | #include <unistd.h> | 73 | #include <unistd.h> |
82 | #include <ctype.h> | 74 | #include <ctype.h> |
83 | #include <sys/stat.h> | 75 | #include <sys/stat.h> |
84 | #include <sys/types.h> | 76 | #include <sys/types.h> |
85 | #include <signal.h> | 77 | #include <signal.h> |
86 | 78 | ||
87 | #include <assert.h> | 79 | #include <assert.h> |
88 | 80 | ||
89 | // #include "widget.moc" | 81 | // #include "widget.moc" |
90 | //#include <kapp.h> | 82 | //#include <kapp.h> |
91 | //#include <kcursor.h> | 83 | //#include <kcursor.h> |
92 | //#include <kurl.h> | 84 | //#include <kurl.h> |
93 | //#include <kdebug.h> | 85 | //#include <kdebug.h> |
94 | //#include <klocale.h> | 86 | //#include <klocale.h> |
95 | 87 | ||
96 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) | 88 | #define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) |
97 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } | 89 | #define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } |
98 | 90 | ||
99 | #define loc(X,Y) ((Y)*columns+(X)) | 91 | #define loc(X,Y) ((Y)*columns+(X)) |
100 | 92 | ||
101 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. | 93 | //FIXME: the rim should normally be 1, 0 only when running in full screen mode. |
102 | #define rimX 0 // left/right rim width | 94 | #define rimX 0 // left/right rim width |
103 | #define rimY 0 // top/bottom rim high | 95 | #define rimY 0 // top/bottom rim high |
104 | 96 | ||
105 | #define yMouseScroll 1 | 97 | #define yMouseScroll 1 |
106 | // scroll increment used when dragging selection at top/bottom of window. | 98 | // scroll increment used when dragging selection at top/bottom of window. |
107 | 99 | ||
108 | /* ------------------------------------------------------------------------- */ | 100 | /* ------------------------------------------------------------------------- */ |
109 | /* */ | 101 | /* */ |
110 | /* Colors */ | 102 | /* Colors */ |
111 | /* */ | 103 | /* */ |
112 | /* ------------------------------------------------------------------------- */ | 104 | /* ------------------------------------------------------------------------- */ |
113 | 105 | ||
114 | //FIXME: the default color table is in session.C now. | 106 | //FIXME: the default color table is in session.C now. |
115 | // We need a way to get rid of this one, here. | 107 | // We need a way to get rid of this one, here. |
116 | static const ColorEntry base_color_table[TABLE_COLORS] = | 108 | static const ColorEntry base_color_table[TABLE_COLORS] = |
117 | // The following are almost IBM standard color codes, with some slight | 109 | // The following are almost IBM standard color codes, with some slight |
118 | // gamma correction for the dim colors to compensate for bright X screens. | 110 | // gamma correction for the dim colors to compensate for bright X screens. |
119 | // It contains the 8 ansiterm/xterm colors in 2 intensities. | 111 | // It contains the 8 ansiterm/xterm colors in 2 intensities. |
120 | { | 112 | { |
121 | // Fixme: could add faint colors here, also. | 113 | // Fixme: could add faint colors here, also. |
122 | // normal | 114 | // normal |
123 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback | 115 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback |
124 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red | 116 | ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red |
125 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow | 117 | ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow |
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp index ac84f8b..96dda1c 100644 --- a/noncore/apps/opie-console/widget_layer.cpp +++ b/noncore/apps/opie-console/widget_layer.cpp | |||
@@ -1,68 +1,64 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* widget_layer.cpp Widget Layer */ | 3 | /* widget_layer.cpp Widget Layer */ |
4 | /* */ | 4 | /* */ |
5 | /* opie developers <opie@handhelds.org> */ | 5 | /* opie developers <opie@handhelds.org> */ |
6 | /* */ | 6 | /* */ |
7 | /* ------------------------------------------------------------------------- */ | 7 | /* ------------------------------------------------------------------------- */ |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | #include "widget_layer.h" | 11 | #include "widget_layer.h" |
12 | 12 | ||
13 | #include <qclipboard.h> | ||
14 | #include <qregexp.h> | ||
15 | #include <qglobal.h> | ||
16 | 13 | ||
17 | #include <string.h> | 14 | #include <string.h> |
18 | //#include < | 15 | //#include < |
19 | 16 | ||
20 | #include "common.h" | ||
21 | 17 | ||
22 | 18 | ||
23 | 19 | ||
24 | WidgetLayer::WidgetLayer( const Profile &config, QWidget *parent, const char *name ) : QFrame( parent, name ) | 20 | WidgetLayer::WidgetLayer( const Profile &config, QWidget *parent, const char *name ) : QFrame( parent, name ) |
25 | { | 21 | { |
26 | // get the clipboard | 22 | // get the clipboard |
27 | m_clipboard = QApplication::clipboard(); | 23 | m_clipboard = QApplication::clipboard(); |
28 | 24 | ||
29 | // when data on clipboard changes, clear selection | 25 | // when data on clipboard changes, clear selection |
30 | QObject::connect( (QObject*) m_clipboard, SIGNAL( dataChanged() ), | 26 | QObject::connect( (QObject*) m_clipboard, SIGNAL( dataChanged() ), |
31 | (QObject*)this, SLOT( onClearSelection() ) ); | 27 | (QObject*)this, SLOT( onClearSelection() ) ); |
32 | 28 | ||
33 | // initialize vars: | 29 | // initialize vars: |
34 | m_lines = 1; | 30 | m_lines = 1; |
35 | m_columns = 1; | 31 | m_columns = 1; |
36 | m_resizing = false; | 32 | m_resizing = false; |
37 | 33 | ||
38 | // just for demonstrating | 34 | // just for demonstrating |
39 | //m_image = QArray<Character>( m_lines * m_columns ); | 35 | //m_image = QArray<Character>( m_lines * m_columns ); |
40 | m_image = QArray<Character>( 1 ); | 36 | m_image = QArray<Character>( 1 ); |
41 | 37 | ||
42 | // we need to install an event filter, | 38 | // we need to install an event filter, |
43 | // to emit keypresses. | 39 | // to emit keypresses. |
44 | qApp->installEventFilter( this ); | 40 | qApp->installEventFilter( this ); |
45 | 41 | ||
46 | } | 42 | } |
47 | 43 | ||
48 | 44 | ||
49 | WidgetLayer::~WidgetLayer() | 45 | WidgetLayer::~WidgetLayer() |
50 | { | 46 | { |
51 | // clean up | 47 | // clean up |
52 | delete m_image; | 48 | delete m_image; |
53 | } | 49 | } |
54 | 50 | ||
55 | 51 | ||
56 | QSize WidgetLayer::sizeHint() | 52 | QSize WidgetLayer::sizeHint() |
57 | { | 53 | { |
58 | return size(); | 54 | return size(); |
59 | } | 55 | } |
60 | 56 | ||
61 | 57 | ||
62 | /* --------------------------------- audio ---------------------------------- */ | 58 | /* --------------------------------- audio ---------------------------------- */ |
63 | 59 | ||
64 | void WidgetLayer::bell() | 60 | void WidgetLayer::bell() |
65 | { | 61 | { |
66 | QApplication::beep(); | 62 | QApplication::beep(); |
67 | } | 63 | } |
68 | 64 | ||