-rw-r--r-- | noncore/apps/opie-console/TEScreen.h | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 31 | ||||
-rw-r--r-- | noncore/apps/opie-console/profile.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.cpp | 18 |
7 files changed, 77 insertions, 16 deletions
diff --git a/noncore/apps/opie-console/TEScreen.h b/noncore/apps/opie-console/TEScreen.h index ba47ee5..473ce79 100644 --- a/noncore/apps/opie-console/TEScreen.h +++ b/noncore/apps/opie-console/TEScreen.h | |||
@@ -12,248 +12,248 @@ | |||
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 | #ifndef TESCREEN_H | 19 | #ifndef TESCREEN_H |
20 | #define TESCREEN_H | 20 | #define TESCREEN_H |
21 | 21 | ||
22 | /*! \file | 22 | /*! \file |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "TECommon.h" | 25 | #include "TECommon.h" |
26 | #include "TEHistory.h" | 26 | #include "TEHistory.h" |
27 | 27 | ||
28 | #define MODE_Origin 0 | 28 | #define MODE_Origin 0 |
29 | #define MODE_Wrap 1 | 29 | #define MODE_Wrap 1 |
30 | #define MODE_Insert 2 | 30 | #define MODE_Insert 2 |
31 | #define MODE_Screen 3 | 31 | #define MODE_Screen 3 |
32 | #define MODE_Cursor 4 | 32 | #define MODE_Cursor 4 |
33 | #define MODE_NewLine 5 | 33 | #define MODE_NewLine 5 |
34 | #define MODES_SCREEN 6 | 34 | #define MODES_SCREEN 6 |
35 | 35 | ||
36 | /*! | 36 | /*! |
37 | */ | 37 | */ |
38 | struct ScreenParm | 38 | struct ScreenParm |
39 | { | 39 | { |
40 | int mode[MODES_SCREEN]; | 40 | int mode[MODES_SCREEN]; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | 43 | ||
44 | class TEScreen | 44 | class TEScreen |
45 | { | 45 | { |
46 | public: | 46 | public: |
47 | TEScreen(int lines, int columns); | 47 | TEScreen(int lines, int columns); |
48 | ~TEScreen(); | 48 | ~TEScreen(); |
49 | 49 | ||
50 | public: // these are all `Screen' operations | 50 | public: // these are all `Screen' operations |
51 | // | 51 | // |
52 | // VT100/2 Operations ------------------ | 52 | // VT100/2 Operations ------------------ |
53 | // | 53 | // |
54 | // Cursor Movement | 54 | // Cursor Movement |
55 | // | 55 | // |
56 | void cursorUp (int n); | 56 | void cursorUp (int n); |
57 | void cursorDown (int n); | 57 | void cursorDown (int n); |
58 | void cursorLeft (int n); | 58 | void cursorLeft (int n); |
59 | void cursorRight (int n); | 59 | void cursorRight (int n); |
60 | void setCursorY (int y); | 60 | void setCursorY (int y); |
61 | void setCursorX (int x); | 61 | void setCursorX (int x); |
62 | void setCursorYX (int y, int x); | 62 | void setCursorYX (int y, int x); |
63 | void setMargins (int t, int b); | 63 | void setMargins (int t, int b); |
64 | // | 64 | // |
65 | // Cursor Movement with Scrolling | 65 | // Cursor Movement with Scrolling |
66 | // | 66 | // |
67 | void NewLine (); | 67 | void NewLine (); |
68 | void NextLine (); | 68 | void NextLine (); |
69 | void index (); | 69 | void index (); |
70 | void reverseIndex(); | 70 | void reverseIndex(); |
71 | // | 71 | // |
72 | void Return (); | 72 | void Return (); |
73 | void BackSpace (); | 73 | void BackSpace (); |
74 | void Tabulate (); | 74 | void Tabulate (); |
75 | // | 75 | // |
76 | // Editing | 76 | // Editing |
77 | // | 77 | // |
78 | void eraseChars (int n); | 78 | void eraseChars (int n); |
79 | void deleteChars (int n); | 79 | void deleteChars (int n); |
80 | void insertChars (int n); | 80 | void insertChars (int n); |
81 | void deleteLines (int n); | 81 | void deleteLines (int n); |
82 | void insertLines (int n); | 82 | void insertLines (int n); |
83 | // | 83 | // |
84 | // ------------------------------------- | 84 | // ------------------------------------- |
85 | // | 85 | // |
86 | void clearTabStops(); | 86 | void clearTabStops(); |
87 | void changeTabStop(bool set); | 87 | void changeTabStop(bool set); |
88 | // | 88 | // |
89 | void resetMode (int n); | 89 | void resetMode (int n); |
90 | void setMode (int n); | 90 | void setMode (int n); |
91 | void saveMode (int n); | 91 | void saveMode (int n); |
92 | void restoreMode (int n); | 92 | void restoreMode (int n); |
93 | // | 93 | // |
94 | void saveCursor (); | 94 | void saveCursor (); |
95 | void restoreCursor(); | 95 | void restoreCursor(); |
96 | // | 96 | // |
97 | // ------------------------------------- | 97 | // ------------------------------------- |
98 | // | 98 | // |
99 | void clearEntireScreen(); | 99 | void clearEntireScreen(); |
100 | void clearToEndOfScreen(); | 100 | void clearToEndOfScreen(); |
101 | void clearToBeginOfScreen(); | 101 | void clearToBeginOfScreen(); |
102 | // | 102 | // |
103 | void clearEntireLine(); | 103 | void clearEntireLine(); |
104 | void clearToEndOfLine(); | 104 | void clearToEndOfLine(); |
105 | void clearToBeginOfLine(); | 105 | void clearToBeginOfLine(); |
106 | // | 106 | // |
107 | void helpAlign (); | 107 | void helpAlign (); |
108 | // | 108 | // |
109 | // ------------------------------------- | 109 | // ------------------------------------- |
110 | // | 110 | // |
111 | void setRendition (int rendition); | 111 | void setRendition (int rendition); |
112 | void resetRendition(int rendition); | 112 | void resetRendition(int rendition); |
113 | void setForeColor (int fgcolor); | 113 | void setForeColor (int fgcolor); |
114 | void setBackColor (int bgcolor); | 114 | void setBackColor (int bgcolor); |
115 | // | 115 | // |
116 | void setDefaultRendition(); | 116 | void setDefaultRendition(); |
117 | void setForeColorToDefault(); | 117 | void setForeColorToDefault(); |
118 | void setBackColorToDefault(); | 118 | void setBackColorToDefault(); |
119 | // | 119 | // |
120 | // ------------------------------------- | 120 | // ------------------------------------- |
121 | // | 121 | // |
122 | BOOL getMode (int n); | 122 | BOOL getMode (int n); |
123 | // | 123 | // |
124 | // only for report cursor position | 124 | // only for report cursor position |
125 | // | 125 | // |
126 | int getCursorX(); | 126 | int getCursorX(); |
127 | int getCursorY(); | 127 | int getCursorY(); |
128 | // | 128 | // |
129 | // ------------------------------------- | 129 | // ------------------------------------- |
130 | // | 130 | // |
131 | void clear(); | 131 | void clear(); |
132 | void home(); | 132 | void home(); |
133 | void reset(); | 133 | void reset(); |
134 | // | 134 | // |
135 | void ShowCharacter(unsigned short c); | 135 | void ShowCharacter(unsigned short c); |
136 | // | 136 | // |
137 | void resizeImage(int new_lines, int new_columns); | 137 | void resizeImage(int new_lines, int new_columns); |
138 | // | 138 | // |
139 | ca* getCookedImage(); | 139 | ca* getCookedImage(); |
140 | 140 | ||
141 | /*! return the number of lines. */ | 141 | /*! return the number of lines. */ |
142 | int getLines() { return lines; } | 142 | int getLines() { return lines; } |
143 | /*! return the number of columns. */ | 143 | /*! return the number of columns. */ |
144 | int getColumns() { return columns; } | 144 | int getColumns() { return columns; } |
145 | 145 | ||
146 | /*! set the position of the history cursor. */ | 146 | /*! set the position of the history cursor. */ |
147 | void setHistCursor(int cursor); | 147 | void setHistCursor(int cursor); |
148 | /*! return the position of the history cursor. */ | 148 | /*! return the position of the history cursor. */ |
149 | int getHistCursor(); | 149 | int getHistCursor(); |
150 | 150 | ||
151 | int getHistLines (); | 151 | int getHistLines (); |
152 | void setScroll(bool on); | 152 | void setScroll(bool on); |
153 | bool hasScroll(); | 153 | bool hasScroll(); |
154 | 154 | ||
155 | // | 155 | // |
156 | // Selection | 156 | // Selection |
157 | // | 157 | // |
158 | void setSelBeginXY(const int x, const int y); | 158 | void setSelBeginXY(const int x, const int y); |
159 | void setSelExtentXY(const int x, const int y); | 159 | void setSelExtentXY(const int x, const int y); |
160 | void clearSelection(); | 160 | void clearSelection(); |
161 | QString getSelText(const BOOL preserve_line_breaks); | 161 | QString getSelText(const BOOL preserve_line_breaks); |
162 | 162 | ||
163 | void checkSelection(int from, int to); | 163 | void checkSelection(int from, int to); |
164 | 164 | ||
165 | private: // helper | 165 | private: // helper |
166 | 166 | ||
167 | void clearImage(int loca, int loce, char c); | 167 | void clearImage(int loca, int loce, char c); |
168 | void moveImage(int dst, int loca, int loce); | 168 | void moveImage(int dst, int loca, int loce); |
169 | 169 | ||
170 | void scrollUp(int from, int i); | 170 | void scrollUp(int from, int i); |
171 | void scrollDown(int from, int i); | 171 | void scrollDown(int from, int i); |
172 | 172 | ||
173 | void addHistLine(); | 173 | void addHistLine(); |
174 | 174 | ||
175 | void initTabStops(); | 175 | void initTabStops(); |
176 | 176 | ||
177 | void effectiveRendition(); | 177 | void effectiveRendition(); |
178 | void reverseRendition(ca* p); | 178 | void reverseRendition(ca* p); |
179 | 179 | ||
180 | private: | 180 | private: |
181 | 181 | ||
182 | /* | 182 | /* |
183 | The state of the screen is more complex as one would | 183 | The state of the screen is more complex as one would |
184 | expect first. The screem does really do part of the | 184 | expect first. The screem does really do part of the |
185 | emulation providing state informations in form of modes, | 185 | emulation providing state informations in form of modes, |
186 | margins, tabulators, cursor etc. | 186 | margins, tabulators, cursor etc. |
187 | 187 | ||
188 | Even more unexpected are variables to save and restore | 188 | Even more unexpected are variables to save and restore |
189 | parts of the state. | 189 | parts of the state. |
190 | */ | 190 | */ |
191 | 191 | ||
192 | // screen image ---------------- | 192 | // screen image ---------------- |
193 | 193 | ||
194 | int lines; | 194 | int lines; |
195 | int columns; | 195 | int columns; |
196 | ca *image; // [lines][columns] | 196 | ca *image; // [lines][columns] |
197 | 197 | ||
198 | // history buffer --------------- | 198 | // history buffer --------------- |
199 | 199 | ||
200 | int histCursor; // display position relative to start of the history buffer | 200 | int histCursor; // display position relative to start of the history buffer |
201 | HistoryScroll hist; | 201 | HistoryScroll hist; |
202 | 202 | ||
203 | // cursor location | 203 | // cursor location |
204 | 204 | ||
205 | int cuX; | 205 | int cuX; |
206 | int cuY; | 206 | int cuY; |
207 | 207 | ||
208 | // cursor color and rendition info | 208 | // cursor color and rendition info |
209 | 209 | ||
210 | UINT8 cu_fg; // foreground | 210 | UINT8 cu_fg; // foreground |
211 | UINT8 cu_bg; // background | 211 | UINT8 cu_bg; // background |
212 | UINT8 cu_re; // rendition | 212 | UINT8 cu_re; // rendition |
213 | 213 | ||
214 | // margins ---------------- | 214 | // margins ---------------- |
215 | 215 | ||
216 | int tmargin; // top margin | 216 | int tmargin; // top margin |
217 | int bmargin; // bottom margin | 217 | int bmargin; // bottom margin |
218 | 218 | ||
219 | // states ---------------- | 219 | // states ---------------- |
220 | 220 | ||
221 | ScreenParm currParm; | 221 | ScreenParm currParm; |
222 | 222 | ||
223 | // ---------------------------- | 223 | // ---------------------------- |
224 | 224 | ||
225 | bool* tabstops; | 225 | bool* tabstops; |
226 | 226 | ||
227 | // selection ------------------- | 227 | // selection ------------------- |
228 | 228 | ||
229 | int sel_begin; // The first location selected. | 229 | int sel_begin; // The first location selected. |
230 | int sel_TL; // TopLeft Location. | 230 | int sel_TL; // TopLeft Location. |
231 | int sel_BR; // Bottom Right Location. | 231 | int sel_BR; // Bottom Right Location. |
232 | 232 | ||
233 | // effective colors and rendition ------------ | 233 | // effective colors and rendition ------------ |
234 | 234 | ||
235 | UINT8 ef_fg; // These are derived from | 235 | UINT8 ef_fg; // These are derived from |
236 | UINT8 ef_bg; // the cu_* variables above | 236 | UINT8 ef_bg; // the cu_* variables above |
237 | UINT8 ef_re; // to speed up operation | 237 | UINT8 ef_re; // to speed up operation |
238 | 238 | ||
239 | // | 239 | // |
240 | // save cursor, rendition & states ------------ | 240 | // save cursor, rendition & states ------------ |
241 | // | 241 | // |
242 | 242 | ||
243 | // cursor location | 243 | // cursor location |
244 | 244 | ||
245 | int sa_cuX; | 245 | int sa_cuX; |
246 | int sa_cuY; | 246 | int sa_cuY; |
247 | 247 | ||
248 | // rendition info | 248 | // rendition info |
249 | 249 | ||
250 | UINT8 sa_cu_re; | 250 | UINT8 sa_cu_re; |
251 | UINT8 sa_cu_fg; | 251 | UINT8 sa_cu_fg; |
252 | UINT8 sa_cu_bg; | 252 | UINT8 sa_cu_bg; |
253 | 253 | ||
254 | // modes | 254 | // modes |
255 | 255 | ||
256 | ScreenParm saveParm; | 256 | ScreenParm saveParm; |
257 | }; | 257 | }; |
258 | 258 | ||
259 | #endif // TESCREEN_H | 259 | #endif // TESCREEN_H |
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 9f34d2c..836a05b 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,131 +1,148 @@ | |||
1 | #include <qwidget.h> | 1 | #include <qwidget.h> |
2 | 2 | ||
3 | #include "TEWidget.h" | 3 | #include "TEWidget.h" |
4 | #include "TEmuVt102.h" | 4 | #include "TEmuVt102.h" |
5 | 5 | ||
6 | #include "profile.h" | 6 | #include "profile.h" |
7 | #include "emulation_handler.h" | 7 | #include "emulation_handler.h" |
8 | 8 | ||
9 | 9 | ||
10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
11 | : QObject(0, name ) | 11 | : QObject(0, name ) |
12 | { | 12 | { |
13 | m_teWid = new TEWidget( parent, "TerminalMain"); | 13 | m_teWid = new TEWidget( parent, "TerminalMain"); |
14 | m_teWid->setMinimumSize(150, 70 ); | 14 | m_teWid->setMinimumSize(150, 70 ); |
15 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 15 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
16 | m_teEmu = new TEmuVt102(m_teWid ); | 16 | m_teEmu = new TEmuVt102(m_teWid ); |
17 | 17 | ||
18 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), | 18 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), |
19 | this, SIGNAL(changeSize(int, int) ) ); | 19 | this, SIGNAL(changeSize(int, int) ) ); |
20 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), | 20 | connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), |
21 | this, SLOT(recvEmulation(const char*, int) ) ); | 21 | this, SLOT(recvEmulation(const char*, int) ) ); |
22 | m_teEmu->setConnect( true ); | 22 | m_teEmu->setConnect( true ); |
23 | m_teEmu->setHistory( TRUE ); | 23 | m_teEmu->setHistory( TRUE ); |
24 | load( prof ); | 24 | load( prof ); |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | } | 28 | } |
29 | EmulationHandler::~EmulationHandler() { | 29 | EmulationHandler::~EmulationHandler() { |
30 | delete m_teEmu; | 30 | delete m_teEmu; |
31 | delete m_teWid; | 31 | delete m_teWid; |
32 | } | 32 | } |
33 | void EmulationHandler::load( const Profile& prof) { | 33 | void EmulationHandler::load( const Profile& prof) { |
34 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); | 34 | m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); |
35 | int num = prof.readNumEntry("Color"); | 35 | int num = prof.readNumEntry("Color"); |
36 | setColor( foreColor(num), backColor(num) ); | 36 | setColor( foreColor(num), backColor(num) ); |
37 | m_teWid->setBackgroundColor(backColor(num) ); | 37 | m_teWid->setBackgroundColor(backColor(num) ); |
38 | } | 38 | } |
39 | void EmulationHandler::recv( const QByteArray& ar) { | 39 | void EmulationHandler::recv( const QByteArray& ar) { |
40 | qWarning("received in EmulationHandler!"); | 40 | qWarning("received in EmulationHandler!"); |
41 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); | 41 | m_teEmu->onRcvBlock(ar.data(), ar.count() ); |
42 | } | 42 | } |
43 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 43 | void EmulationHandler::recvEmulation(const char* src, int len ) { |
44 | qWarning("received from te "); | 44 | qWarning("received from te "); |
45 | QByteArray ar(len); | 45 | QByteArray ar(len); |
46 | 46 | ||
47 | memcpy(ar.data(), src, sizeof(char) * len ); | 47 | memcpy(ar.data(), src, sizeof(char) * len ); |
48 | 48 | ||
49 | emit send(ar); | 49 | emit send(ar); |
50 | } | 50 | } |
51 | QWidget* EmulationHandler::widget() { | 51 | QWidget* EmulationHandler::widget() { |
52 | return m_teWid; | 52 | return m_teWid; |
53 | } | 53 | } |
54 | /* | 54 | /* |
55 | * allocate a new table of colors | 55 | * allocate a new table of colors |
56 | */ | 56 | */ |
57 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { | 57 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { |
58 | ColorEntry table[TABLE_COLORS]; | 58 | ColorEntry table[TABLE_COLORS]; |
59 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); | 59 | const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); |
60 | 60 | ||
61 | for (int i = 0; i < TABLE_COLORS; i++ ) { | 61 | for (int i = 0; i < TABLE_COLORS; i++ ) { |
62 | if ( i == 0 || i == 10 ) { | 62 | if ( i == 0 || i == 10 ) { |
63 | table[i].color = fore; | 63 | table[i].color = fore; |
64 | }else if ( i == 1 || i == 11 ) { | 64 | }else if ( i == 1 || i == 11 ) { |
65 | table[i].color = back; | 65 | table[i].color = back; |
66 | table[i].transparent = 0; | 66 | table[i].transparent = 0; |
67 | }else { | 67 | }else { |
68 | table[i].color = defaultCt[i].color; | 68 | table[i].color = defaultCt[i].color; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | m_teWid->setColorTable(table ); | 71 | m_teWid->setColorTable(table ); |
72 | m_teWid->update(); | 72 | m_teWid->update(); |
73 | } | 73 | } |
74 | QFont EmulationHandler::font( int id ) { | 74 | QFont EmulationHandler::font( int id ) { |
75 | QString name; | 75 | QString name; |
76 | int size = 0; | 76 | int size = 0; |
77 | switch(id ) { | 77 | switch(id ) { |
78 | default: // fall through | 78 | default: // fall through |
79 | case 0: | 79 | case 0: |
80 | name = QString::fromLatin1("Micro"); | 80 | name = QString::fromLatin1("Micro"); |
81 | size = 4; | 81 | size = 4; |
82 | break; | 82 | break; |
83 | case 1: | 83 | case 1: |
84 | name = QString::fromLatin1("Fixed"); | 84 | name = QString::fromLatin1("Fixed"); |
85 | size = 7; | 85 | size = 7; |
86 | break; | 86 | break; |
87 | case 2: | 87 | case 2: |
88 | name = QString::fromLatin1("Fixed"); | 88 | name = QString::fromLatin1("Fixed"); |
89 | size = 12; | 89 | size = 12; |
90 | break; | 90 | break; |
91 | } | 91 | } |
92 | QFont font(name, size, QFont::Normal ); | 92 | QFont font(name, size, QFont::Normal ); |
93 | font.setFixedPitch(TRUE ); | 93 | font.setFixedPitch(TRUE ); |
94 | return font; | 94 | return font; |
95 | } | 95 | } |
96 | QColor EmulationHandler::foreColor(int col) { | 96 | QColor EmulationHandler::foreColor(int col) { |
97 | QColor co; | 97 | QColor co; |
98 | /* we need to switch it */ | 98 | /* we need to switch it */ |
99 | switch( col ) { | 99 | switch( col ) { |
100 | default: | 100 | default: |
101 | case Profile::White: | 101 | case Profile::White: |
102 | qWarning("Foreground black"); | 102 | qWarning("Foreground black"); |
103 | /* color is black */ | 103 | /* color is black */ |
104 | co = Qt::white; | 104 | co = Qt::white; |
105 | break; | 105 | break; |
106 | case Profile::Black: | 106 | case Profile::Black: |
107 | qWarning("Foreground white"); | 107 | qWarning("Foreground white"); |
108 | co = Qt::black; | 108 | co = Qt::black; |
109 | break; | 109 | break; |
110 | case Profile::Green: | ||
111 | qWarning("Foreground green"); | ||
112 | co = Qt::green; | ||
113 | break; | ||
114 | case Profile::Orange: | ||
115 | qWarning("Foreground orange"); | ||
116 | // FIXME needs better color here | ||
117 | co = Qt::darkYellow; | ||
118 | break; | ||
110 | } | 119 | } |
111 | 120 | ||
112 | return co; | 121 | return co; |
113 | } | 122 | } |
114 | QColor EmulationHandler::backColor(int col ) { | 123 | QColor EmulationHandler::backColor(int col ) { |
115 | QColor co; | 124 | QColor co; |
116 | /* we need to switch it */ | 125 | /* we need to switch it */ |
117 | switch( col ) { | 126 | switch( col ) { |
118 | default: | 127 | default: |
119 | case Profile::White: | 128 | case Profile::White: |
120 | qWarning("Background white"); | 129 | qWarning("Background white"); |
121 | /* color is white */ | 130 | /* color is white */ |
122 | co = Qt::black; | 131 | co = Qt::black; |
123 | break; | 132 | break; |
124 | case Profile::Black: | 133 | case Profile::Black: |
125 | qWarning("Background black"); | 134 | qWarning("Background black"); |
126 | co = Qt::white; | 135 | co = Qt::white; |
127 | break; | 136 | break; |
137 | case Profile::Green: | ||
138 | qWarning("Background black"); | ||
139 | co = Qt::black; | ||
140 | break; | ||
141 | case Profile::Orange: | ||
142 | qWarning("Background black"); | ||
143 | co = Qt::black; | ||
144 | break; | ||
128 | } | 145 | } |
129 | 146 | ||
130 | return co; | 147 | return co; |
131 | } | 148 | } |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 6dc9e6e..b770551 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -189,280 +189,293 @@ void MainWindow::initUI() { | |||
189 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 189 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
190 | -1, 0); | 190 | -1, 0); |
191 | 191 | ||
192 | /* insert the connection menu */ | 192 | /* insert the connection menu */ |
193 | m_bar->insertItem( tr("Connection"), m_console ); | 193 | m_bar->insertItem( tr("Connection"), m_console ); |
194 | 194 | ||
195 | /* the scripts menu */ | 195 | /* the scripts menu */ |
196 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 196 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
197 | 197 | ||
198 | /* the settings menu */ | 198 | /* the settings menu */ |
199 | m_bar->insertItem( tr("Settings"), m_settings ); | 199 | m_bar->insertItem( tr("Settings"), m_settings ); |
200 | 200 | ||
201 | /* and the keyboard */ | 201 | /* and the keyboard */ |
202 | m_keyBar = new QToolBar(this); | 202 | m_keyBar = new QToolBar(this); |
203 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 203 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
204 | m_keyBar->setHorizontalStretchable( TRUE ); | 204 | m_keyBar->setHorizontalStretchable( TRUE ); |
205 | m_keyBar->hide(); | 205 | m_keyBar->hide(); |
206 | 206 | ||
207 | m_kb = new FunctionKeyboard(m_keyBar); | 207 | m_kb = new FunctionKeyboard(m_keyBar); |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | m_connect->setEnabled( false ); | 211 | m_connect->setEnabled( false ); |
212 | m_disconnect->setEnabled( false ); | 212 | m_disconnect->setEnabled( false ); |
213 | m_terminate->setEnabled( false ); | 213 | m_terminate->setEnabled( false ); |
214 | m_transfer->setEnabled( false ); | 214 | m_transfer->setEnabled( false ); |
215 | m_recordScript->setEnabled( false ); | 215 | m_recordScript->setEnabled( false ); |
216 | m_saveScript->setEnabled( false ); | 216 | m_saveScript->setEnabled( false ); |
217 | m_runScript->setEnabled( false ); | 217 | m_runScript->setEnabled( false ); |
218 | m_fullscreen->setEnabled( false ); | 218 | m_fullscreen->setEnabled( false ); |
219 | m_closewindow->setEnabled( false ); | 219 | m_closewindow->setEnabled( false ); |
220 | 220 | ||
221 | /* | 221 | /* |
222 | * connect to the menu activation | 222 | * connect to the menu activation |
223 | */ | 223 | */ |
224 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 224 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
225 | this, SLOT(slotProfile( int ) ) ); | 225 | this, SLOT(slotProfile( int ) ) ); |
226 | 226 | ||
227 | m_consoleWindow = new TabWidget( this, "blah"); | 227 | m_consoleWindow = new TabWidget( this, "blah"); |
228 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 228 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
229 | this, SLOT(slotSessionChanged(Session*) ) ); | 229 | this, SLOT(slotSessionChanged(Session*) ) ); |
230 | setCentralWidget( m_consoleWindow ); | 230 | setCentralWidget( m_consoleWindow ); |
231 | 231 | ||
232 | } | 232 | } |
233 | 233 | ||
234 | ProfileManager* MainWindow::manager() { | 234 | ProfileManager* MainWindow::manager() { |
235 | return m_manager; | 235 | return m_manager; |
236 | } | 236 | } |
237 | TabWidget* MainWindow::tabWidget() { | 237 | TabWidget* MainWindow::tabWidget() { |
238 | return m_consoleWindow; | 238 | return m_consoleWindow; |
239 | } | 239 | } |
240 | void MainWindow::populateProfiles() { | 240 | void MainWindow::populateProfiles() { |
241 | m_sessionsPop->clear(); | 241 | m_sessionsPop->clear(); |
242 | Profile::ValueList list = manager()->all(); | 242 | Profile::ValueList list = manager()->all(); |
243 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 243 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
244 | m_sessionsPop->insertItem( (*it).name() ); | 244 | m_sessionsPop->insertItem( (*it).name() ); |
245 | } | 245 | } |
246 | 246 | ||
247 | } | 247 | } |
248 | MainWindow::~MainWindow() { | 248 | MainWindow::~MainWindow() { |
249 | delete m_factory; | 249 | delete m_factory; |
250 | manager()->save(); | 250 | manager()->save(); |
251 | } | 251 | } |
252 | 252 | ||
253 | MetaFactory* MainWindow::factory() { | 253 | MetaFactory* MainWindow::factory() { |
254 | return m_factory; | 254 | return m_factory; |
255 | } | 255 | } |
256 | 256 | ||
257 | Session* MainWindow::currentSession() { | 257 | Session* MainWindow::currentSession() { |
258 | return m_curSession; | 258 | return m_curSession; |
259 | } | 259 | } |
260 | 260 | ||
261 | QList<Session> MainWindow::sessions() { | 261 | QList<Session> MainWindow::sessions() { |
262 | return m_sessions; | 262 | return m_sessions; |
263 | } | 263 | } |
264 | 264 | ||
265 | void MainWindow::slotNew() { | 265 | void MainWindow::slotNew() { |
266 | qWarning("New Connection"); | 266 | qWarning("New Connection"); |
267 | ProfileEditorDialog dlg(factory() ); | 267 | ProfileEditorDialog dlg(factory() ); |
268 | dlg.showMaximized(); | 268 | dlg.showMaximized(); |
269 | int ret = dlg.exec(); | 269 | int ret = dlg.exec(); |
270 | 270 | ||
271 | if ( ret == QDialog::Accepted ) { | 271 | if ( ret == QDialog::Accepted ) { |
272 | create( dlg.profile() ); | 272 | create( dlg.profile() ); |
273 | } | 273 | } |
274 | } | 274 | } |
275 | 275 | ||
276 | void MainWindow::slotRecordScript() { | 276 | void MainWindow::slotRecordScript() { |
277 | /* if (currentSession()) { | 277 | /* if (currentSession()) { |
278 | currentSession()->emulationLayer()->startRecording(); | 278 | currentSession()->emulationLayer()->startRecording(); |
279 | } | 279 | } |
280 | */ | 280 | */ |
281 | } | 281 | } |
282 | 282 | ||
283 | void MainWindow::slotSaveScript() { | 283 | void MainWindow::slotSaveScript() { |
284 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 284 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
285 | MimeTypes types; | 285 | MimeTypes types; |
286 | QStringList script; | 286 | QStringList script; |
287 | script << "text/plain"; | 287 | script << "text/plain"; |
288 | types.insert("Script", script); | 288 | types.insert("Script", script); |
289 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 289 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
290 | if (!filename.isEmpty()) { | 290 | if (!filename.isEmpty()) { |
291 | currentSession()->emulationLayer()->script()->saveTo(filename); | 291 | currentSession()->emulationLayer()->script()->saveTo(filename); |
292 | currentSession()->emulationLayer()->clearScript(); | 292 | currentSession()->emulationLayer()->clearScript(); |
293 | } | 293 | } |
294 | } | 294 | } |
295 | */ | 295 | */ |
296 | } | 296 | } |
297 | 297 | ||
298 | void MainWindow::slotRunScript() { | 298 | void MainWindow::slotRunScript() { |
299 | /* | 299 | /* |
300 | if (currentSession()) { | 300 | if (currentSession()) { |
301 | MimeTypes types; | 301 | MimeTypes types; |
302 | QStringList script; | 302 | QStringList script; |
303 | script << "text/plain"; | 303 | script << "text/plain"; |
304 | types.insert("Script", script); | 304 | types.insert("Script", script); |
305 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 305 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
306 | if (!filename.isEmpty()) { | 306 | if (!filename.isEmpty()) { |
307 | Script script(DocLnk(filename).file()); | 307 | Script script(DocLnk(filename).file()); |
308 | currentSession()->emulationLayer()->runScript(&script); | 308 | currentSession()->emulationLayer()->runScript(&script); |
309 | } | 309 | } |
310 | } | 310 | } |
311 | */ | 311 | */ |
312 | } | 312 | } |
313 | 313 | ||
314 | void MainWindow::slotConnect() { | 314 | void MainWindow::slotConnect() { |
315 | if ( currentSession() ) { | 315 | if ( currentSession() ) { |
316 | bool ret = currentSession()->layer()->open(); | 316 | bool ret = currentSession()->layer()->open(); |
317 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 317 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
318 | QObject::tr("Failed"), | 318 | QObject::tr("Failed"), |
319 | QObject::tr("Connecting failed for this session.")); | 319 | QObject::tr("Connecting failed for this session.")); |
320 | } | 320 | m_connect->setEnabled( false ); |
321 | m_disconnect->setEnabled( true ); | ||
322 | } | ||
321 | } | 323 | } |
322 | 324 | ||
323 | void MainWindow::slotDisconnect() { | 325 | void MainWindow::slotDisconnect() { |
324 | if ( currentSession() ) | 326 | if ( currentSession() ) { |
325 | currentSession()->layer()->close(); | 327 | currentSession()->layer()->close(); |
328 | m_connect->setEnabled( true ); | ||
329 | m_disconnect->setEnabled( false ); | ||
330 | } | ||
326 | } | 331 | } |
327 | 332 | ||
328 | void MainWindow::slotTerminate() { | 333 | void MainWindow::slotTerminate() { |
329 | if ( currentSession() ) | 334 | if ( currentSession() ) |
330 | currentSession()->layer()->close(); | 335 | currentSession()->layer()->close(); |
331 | 336 | ||
332 | slotClose(); | 337 | slotClose(); |
333 | /* FIXME move to the next session */ | 338 | /* FIXME move to the next session */ |
334 | } | 339 | } |
335 | 340 | ||
336 | void MainWindow::slotConfigure() { | 341 | void MainWindow::slotConfigure() { |
337 | qWarning("configure"); | 342 | qWarning("configure"); |
338 | ConfigDialog conf( manager()->all(), factory() ); | 343 | ConfigDialog conf( manager()->all(), factory() ); |
339 | conf.showMaximized(); | 344 | conf.showMaximized(); |
340 | 345 | ||
341 | int ret = conf.exec(); | 346 | int ret = conf.exec(); |
342 | 347 | ||
343 | if ( QDialog::Accepted == ret ) { | 348 | if ( QDialog::Accepted == ret ) { |
344 | qWarning("conf %d", conf.list().count() ); | 349 | qWarning("conf %d", conf.list().count() ); |
345 | manager()->setProfiles( conf.list() ); | 350 | manager()->setProfiles( conf.list() ); |
346 | manager()->save(); | 351 | manager()->save(); |
347 | populateProfiles(); | 352 | populateProfiles(); |
348 | } | 353 | } |
349 | } | 354 | } |
350 | /* | 355 | /* |
351 | * we will remove | 356 | * we will remove |
352 | * this window from the tabwidget | 357 | * this window from the tabwidget |
353 | * remove it from the list | 358 | * remove it from the list |
354 | * delete it | 359 | * delete it |
355 | * and set the currentSession() | 360 | * and set the currentSession() |
356 | */ | 361 | */ |
357 | void MainWindow::slotClose() { | 362 | void MainWindow::slotClose() { |
358 | qWarning("close"); | 363 | qWarning("close"); |
359 | if (!currentSession() ) | 364 | if (!currentSession() ) |
360 | return; | 365 | return; |
361 | 366 | ||
362 | tabWidget()->remove( currentSession() ); | 367 | tabWidget()->remove( currentSession() ); |
363 | /*it's autodelete */ | 368 | /*it's autodelete */ |
364 | m_sessions.remove( m_curSession ); | 369 | m_sessions.remove( m_curSession ); |
365 | m_curSession = m_sessions.first(); | 370 | m_curSession = m_sessions.first(); |
366 | tabWidget()->setCurrent( m_curSession ); | 371 | tabWidget()->setCurrent( m_curSession ); |
367 | 372 | ||
368 | if (!currentSession() ) { | 373 | if (!currentSession() ) { |
369 | m_connect->setEnabled( false ); | 374 | m_connect->setEnabled( false ); |
370 | m_disconnect->setEnabled( false ); | 375 | m_disconnect->setEnabled( false ); |
371 | m_terminate->setEnabled( false ); | 376 | m_terminate->setEnabled( false ); |
372 | m_transfer->setEnabled( false ); | 377 | m_transfer->setEnabled( false ); |
373 | m_recordScript->setEnabled( false ); | 378 | m_recordScript->setEnabled( false ); |
374 | m_saveScript->setEnabled( false ); | 379 | m_saveScript->setEnabled( false ); |
375 | m_runScript->setEnabled( false ); | 380 | m_runScript->setEnabled( false ); |
376 | m_fullscreen->setEnabled( false ); | 381 | m_fullscreen->setEnabled( false ); |
377 | m_closewindow->setEnabled( false ); | 382 | m_closewindow->setEnabled( false ); |
378 | } | 383 | } |
379 | } | 384 | } |
380 | 385 | ||
381 | /* | 386 | /* |
382 | * We will get the name | 387 | * We will get the name |
383 | * Then the profile | 388 | * Then the profile |
384 | * and then we will make a profile | 389 | * and then we will make a profile |
385 | */ | 390 | */ |
386 | void MainWindow::slotProfile( int id) { | 391 | void MainWindow::slotProfile( int id) { |
387 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 392 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
388 | create( prof ); | 393 | create( prof ); |
389 | } | 394 | } |
390 | void MainWindow::create( const Profile& prof ) { | 395 | void MainWindow::create( const Profile& prof ) { |
391 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 396 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
392 | 397 | ||
393 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 398 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
394 | { | 399 | { |
395 | QMessageBox::warning(this, | 400 | QMessageBox::warning(this, |
396 | QObject::tr("Session failed"), | 401 | QObject::tr("Session failed"), |
397 | QObject::tr("Cannot open session: Not all components were found.")); | 402 | QObject::tr("Cannot open session: Not all components were found.")); |
398 | //if(ses) delete ses; | 403 | //if(ses) delete ses; |
399 | return; | 404 | return; |
400 | } | 405 | } |
401 | 406 | ||
402 | m_sessions.append( ses ); | 407 | m_sessions.append( ses ); |
403 | tabWidget()->add( ses ); | 408 | tabWidget()->add( ses ); |
404 | m_curSession = ses; | 409 | m_curSession = ses; |
405 | 410 | ||
406 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 411 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
407 | m_connect->setEnabled( true ); | 412 | m_connect->setEnabled( true ); |
408 | m_disconnect->setEnabled( true ); | 413 | m_disconnect->setEnabled( false ); |
409 | m_terminate->setEnabled( true ); | 414 | m_terminate->setEnabled( true ); |
410 | m_transfer->setEnabled( true ); | 415 | m_transfer->setEnabled( true ); |
411 | m_recordScript->setEnabled( true ); | 416 | m_recordScript->setEnabled( true ); |
412 | m_saveScript->setEnabled( true ); | 417 | m_saveScript->setEnabled( true ); |
413 | m_runScript->setEnabled( true ); | 418 | m_runScript->setEnabled( true ); |
414 | m_fullscreen->setEnabled( true ); | 419 | m_fullscreen->setEnabled( true ); |
415 | m_closewindow->setEnabled( true ); | 420 | m_closewindow->setEnabled( true ); |
416 | } | 421 | } |
417 | 422 | ||
418 | void MainWindow::slotTransfer() | 423 | void MainWindow::slotTransfer() |
419 | { | 424 | { |
420 | // if ( currentSession() ) { | 425 | if ( currentSession() ) { |
421 | TransferDialog dlg(this); | 426 | TransferDialog dlg(this); |
422 | dlg.showMaximized(); | 427 | dlg.showMaximized(); |
423 | dlg.exec(); | 428 | dlg.exec(); |
424 | // } | 429 | } |
425 | } | 430 | } |
426 | 431 | ||
427 | 432 | ||
428 | void MainWindow::slotOpenKeb(bool state) { | 433 | void MainWindow::slotOpenKeb(bool state) { |
429 | 434 | ||
430 | if (state) m_keyBar->show(); | 435 | if (state) m_keyBar->show(); |
431 | else m_keyBar->hide(); | 436 | else m_keyBar->hide(); |
432 | 437 | ||
433 | } | 438 | } |
434 | void MainWindow::slotSessionChanged( Session* ses ) { | 439 | void MainWindow::slotSessionChanged( Session* ses ) { |
435 | if ( ses ) { | 440 | if ( ses ) { |
436 | qWarning("changing %s", ses->name().latin1() ); | 441 | qWarning("changing %s", ses->name().latin1() ); |
437 | m_curSession = ses; | 442 | m_curSession = ses; |
443 | |||
444 | if ( m_curSession->isConnected() ) { | ||
445 | m_connect->setEnabled( false ); | ||
446 | m_disconnect->setEnabled( true ); | ||
447 | } else { | ||
448 | m_connect->setEnabled( true ); | ||
449 | m_disconnect->setEnabled( false ); | ||
450 | } | ||
438 | } | 451 | } |
439 | } | 452 | } |
440 | 453 | ||
441 | void MainWindow::slotFullscreen() { | 454 | void MainWindow::slotFullscreen() { |
442 | 455 | ||
443 | if ( m_isFullscreen ) { | 456 | if ( m_isFullscreen ) { |
444 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); | 457 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); |
445 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 458 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
446 | setCentralWidget( m_consoleWindow ); | 459 | setCentralWidget( m_consoleWindow ); |
447 | ( m_curSession->widgetStack() )->show(); | 460 | ( m_curSession->widgetStack() )->show(); |
448 | m_fullscreen->setText( tr("Full screen") ); | 461 | m_fullscreen->setText( tr("Full screen") ); |
449 | 462 | ||
450 | } else { | 463 | } else { |
451 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 464 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
452 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, | 465 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, |
453 | QPoint(0,0), false); | 466 | QPoint(0,0), false); |
454 | ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 467 | ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
455 | ( m_curSession->widgetStack() )->setFocus(); | 468 | ( m_curSession->widgetStack() )->setFocus(); |
456 | ( m_curSession->widgetStack() )->show(); | 469 | ( m_curSession->widgetStack() )->show(); |
457 | 470 | ||
458 | // QPushButton *cornerButton = new QPushButton( this ); | 471 | //QPushButton *cornerButton = new QPushButton( ); |
459 | //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); | 472 | //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); |
460 | //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 473 | //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
461 | // need teh scrollbar | 474 | // need teh scrollbar |
462 | // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton ); | 475 | // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton ); |
463 | m_fullscreen->setText( tr("Stop full screen") ); | 476 | m_fullscreen->setText( tr("Stop full screen") ); |
464 | } | 477 | } |
465 | 478 | ||
466 | m_isFullscreen = !m_isFullscreen; | 479 | m_isFullscreen = !m_isFullscreen; |
467 | 480 | ||
468 | } | 481 | } |
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h index 1b71cda..64eb022 100644 --- a/noncore/apps/opie-console/profile.h +++ b/noncore/apps/opie-console/profile.h | |||
@@ -1,71 +1,73 @@ | |||
1 | #ifndef OPIE_PROFILE_H | 1 | #ifndef OPIE_PROFILE_H |
2 | #define OPIE_PROFILE_H | 2 | #define OPIE_PROFILE_H |
3 | 3 | ||
4 | #include <qmap.h> | 4 | #include <qmap.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | #include <qvaluelist.h> | 7 | #include <qvaluelist.h> |
8 | /** | 8 | /** |
9 | * A session will be generated from a saved | 9 | * A session will be generated from a saved |
10 | * profile. A profile contains the iolayername | 10 | * profile. A profile contains the iolayername |
11 | * a name. | 11 | * a name. |
12 | * We can generate a Session from a Profile | 12 | * We can generate a Session from a Profile |
13 | * Configuration is contained here too | 13 | * Configuration is contained here too |
14 | */ | 14 | */ |
15 | class Profile { | 15 | class Profile { |
16 | public: | 16 | public: |
17 | typedef QValueList<Profile> ValueList; | 17 | typedef QValueList<Profile> ValueList; |
18 | enum Color { Black = 0, | 18 | enum Color { Black = 0, |
19 | White, | 19 | White, |
20 | Gray }; | 20 | Gray, |
21 | Green, | ||
22 | Orange}; | ||
21 | enum Terminal {VT102 = 0, VT100 }; | 23 | enum Terminal {VT102 = 0, VT100 }; |
22 | enum Font { Micro = 0, Small, Medium }; | 24 | enum Font { Micro = 0, Small, Medium }; |
23 | Profile(); | 25 | Profile(); |
24 | Profile( const QString& name, | 26 | Profile( const QString& name, |
25 | const QCString& iolayerName, | 27 | const QCString& iolayerName, |
26 | const QCString& termName, | 28 | const QCString& termName, |
27 | int background, | 29 | int background, |
28 | int foreground, | 30 | int foreground, |
29 | int terminal); | 31 | int terminal); |
30 | Profile( const Profile& ); | 32 | Profile( const Profile& ); |
31 | Profile &operator=( const Profile& ); | 33 | Profile &operator=( const Profile& ); |
32 | bool operator==( const Profile& prof ); | 34 | bool operator==( const Profile& prof ); |
33 | 35 | ||
34 | ~Profile(); | 36 | ~Profile(); |
35 | QString name()const; | 37 | QString name()const; |
36 | QCString ioLayerName()const; | 38 | QCString ioLayerName()const; |
37 | QCString terminalName()const; | 39 | QCString terminalName()const; |
38 | int foreground()const; | 40 | int foreground()const; |
39 | int background()const; | 41 | int background()const; |
40 | int terminal()const; | 42 | int terminal()const; |
41 | 43 | ||
42 | /* | 44 | /* |
43 | * config stuff | 45 | * config stuff |
44 | */ | 46 | */ |
45 | QMap<QString, QString> conf()const; | 47 | QMap<QString, QString> conf()const; |
46 | void clearConf(); | 48 | void clearConf(); |
47 | void writeEntry( const QString& key, const QString& value ); | 49 | void writeEntry( const QString& key, const QString& value ); |
48 | void writeEntry( const QString& key, int num ); | 50 | void writeEntry( const QString& key, int num ); |
49 | void writeEntry( const QString& key, bool b ); | 51 | void writeEntry( const QString& key, bool b ); |
50 | void writeEntry( const QString& key, const QStringList&, const QChar& ); | 52 | void writeEntry( const QString& key, const QStringList&, const QChar& ); |
51 | QString readEntry( const QString& key, const QString& deflt = QString::null)const; | 53 | QString readEntry( const QString& key, const QString& deflt = QString::null)const; |
52 | int readNumEntry( const QString& key, int = -1 )const; | 54 | int readNumEntry( const QString& key, int = -1 )const; |
53 | bool readBoolEntry( const QString& key, bool = FALSE )const; | 55 | bool readBoolEntry( const QString& key, bool = FALSE )const; |
54 | 56 | ||
55 | void setName( const QString& ); | 57 | void setName( const QString& ); |
56 | void setIOLayer( const QCString& ); | 58 | void setIOLayer( const QCString& ); |
57 | void setTerminalName( const QCString& ); | 59 | void setTerminalName( const QCString& ); |
58 | void setBackground( int back ); | 60 | void setBackground( int back ); |
59 | void setForeground( int fore ); | 61 | void setForeground( int fore ); |
60 | void setTerminal( int term ); | 62 | void setTerminal( int term ); |
61 | void setConf( const QMap<QString, QString>& ); | 63 | void setConf( const QMap<QString, QString>& ); |
62 | private: | 64 | private: |
63 | QMap<QString, QString> m_conf; | 65 | QMap<QString, QString> m_conf; |
64 | QString m_name; | 66 | QString m_name; |
65 | QCString m_ioLayer, m_term; | 67 | QCString m_ioLayer, m_term; |
66 | int m_back; | 68 | int m_back; |
67 | int m_fore; | 69 | int m_fore; |
68 | int m_terminal; | 70 | int m_terminal; |
69 | }; | 71 | }; |
70 | 72 | ||
71 | #endif | 73 | #endif |
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index f4fbcf2..d0ace6c 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp | |||
@@ -1,90 +1,100 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include "io_layer.h" | 3 | #include "io_layer.h" |
4 | #include "file_layer.h" | 4 | #include "file_layer.h" |
5 | #include "emulation_handler.h" | 5 | #include "emulation_handler.h" |
6 | #include "session.h" | 6 | #include "session.h" |
7 | 7 | ||
8 | 8 | ||
9 | Session::Session() { | 9 | Session::Session() { |
10 | m_widget = 0l; | 10 | m_widget = 0l; |
11 | m_layer = 0l; | 11 | m_layer = 0l; |
12 | m_emu = 0l; | 12 | m_emu = 0l; |
13 | } | 13 | } |
14 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) | 14 | Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) |
15 | : m_name( na ), m_widget( widget ), m_layer( lay ) | 15 | : m_name( na ), m_widget( widget ), m_layer( lay ) |
16 | { | 16 | { |
17 | // m_widLay = 0l; | 17 | // m_widLay = 0l; |
18 | // m_emLay = 0l; | 18 | // m_emLay = 0l; |
19 | m_emu = 0l; | 19 | m_emu = 0l; |
20 | } | 20 | } |
21 | Session::~Session() { | 21 | Session::~Session() { |
22 | delete m_layer; | 22 | delete m_layer; |
23 | delete m_emu; | 23 | delete m_emu; |
24 | delete m_widget; | 24 | delete m_widget; |
25 | /* the widget layer should be deleted by the m_widget */ | 25 | /* the widget layer should be deleted by the m_widget */ |
26 | } | 26 | } |
27 | QString Session::name()const { | 27 | QString Session::name()const { |
28 | return m_name; | 28 | return m_name; |
29 | } | 29 | } |
30 | QWidgetStack* Session::widgetStack() { | 30 | QWidgetStack* Session::widgetStack() { |
31 | return m_widget; | 31 | return m_widget; |
32 | } | 32 | } |
33 | IOLayer* Session::layer() { | 33 | IOLayer* Session::layer() { |
34 | return m_layer; | 34 | return m_layer; |
35 | } | 35 | } |
36 | EmulationHandler* Session::emulationHandler() { | 36 | EmulationHandler* Session::emulationHandler() { |
37 | return m_emu; | 37 | return m_emu; |
38 | } | 38 | } |
39 | /* | 39 | /* |
40 | WidgetLayer* Session::emulationWidget() { | 40 | WidgetLayer* Session::emulationWidget() { |
41 | return m_widLay; | 41 | return m_widLay; |
42 | } | 42 | } |
43 | */ | 43 | */ |
44 | void Session::connect() { | 44 | void Session::connect() { |
45 | if ( !m_layer || !m_emu ) | 45 | if ( !m_layer || !m_emu ) |
46 | return; | 46 | return; |
47 | 47 | ||
48 | m_connected = true; | ||
49 | |||
48 | qWarning("connection in session"); | 50 | qWarning("connection in session"); |
49 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), | 51 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), |
50 | m_emu, SLOT(recv(const QByteArray&) ) ); | 52 | m_emu, SLOT(recv(const QByteArray&) ) ); |
51 | QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), | 53 | QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), |
52 | m_layer, SLOT(send(const QByteArray&) ) ); | 54 | m_layer, SLOT(send(const QByteArray&) ) ); |
53 | |||
54 | } | 55 | } |
56 | |||
55 | void Session::disconnect() { | 57 | void Session::disconnect() { |
56 | 58 | ||
57 | if ( !m_layer || !m_emu ) | 59 | if ( !m_layer || !m_emu ) |
58 | return; | 60 | return; |
59 | 61 | ||
62 | m_connected = false; | ||
63 | |||
60 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), | 64 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), |
61 | m_emu, SLOT(recv(const QByteArray&) ) ); | 65 | m_emu, SLOT(recv(const QByteArray&) ) ); |
62 | QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), | 66 | QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), |
63 | m_layer, SLOT(send(const QByteArray&) ) ); | 67 | m_layer, SLOT(send(const QByteArray&) ) ); |
64 | } | 68 | } |
69 | |||
65 | void Session::setName( const QString& na){ | 70 | void Session::setName( const QString& na){ |
66 | m_name = na; | 71 | m_name = na; |
67 | } | 72 | } |
73 | |||
68 | void Session::setWidgetStack( QWidgetStack* wid ) { | 74 | void Session::setWidgetStack( QWidgetStack* wid ) { |
69 | delete m_emu; | 75 | delete m_emu; |
70 | m_emu = 0l; | 76 | m_emu = 0l; |
71 | delete m_widget; | 77 | delete m_widget; |
72 | /* the EmulationLayer was destroyed... */ | 78 | /* the EmulationLayer was destroyed... */ |
73 | 79 | ||
74 | m_widget = wid; | 80 | m_widget = wid; |
75 | } | 81 | } |
76 | void Session::setIOLayer( IOLayer* lay ) { | 82 | void Session::setIOLayer( IOLayer* lay ) { |
77 | delete m_layer; | 83 | delete m_layer; |
78 | m_layer = lay; | 84 | m_layer = lay; |
79 | } | 85 | } |
80 | 86 | ||
81 | void Session::setEmulationHandler( EmulationHandler* lay ) { | 87 | void Session::setEmulationHandler( EmulationHandler* lay ) { |
82 | delete m_emu; | 88 | delete m_emu; |
83 | m_emu = lay; | 89 | m_emu = lay; |
84 | } | 90 | } |
85 | /* | 91 | /* |
86 | void Session::setEmulationWidget( WidgetLayer* lay ) { | 92 | void Session::setEmulationWidget( WidgetLayer* lay ) { |
87 | delete m_widLay; | 93 | delete m_widLay; |
88 | m_widLay = lay; | 94 | m_widLay = lay; |
89 | } | 95 | } |
90 | */ | 96 | */ |
97 | |||
98 | bool Session::isConnected() { | ||
99 | return m_connected; | ||
100 | } | ||
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h index c3f3661..a1121d3 100644 --- a/noncore/apps/opie-console/session.h +++ b/noncore/apps/opie-console/session.h | |||
@@ -1,70 +1,73 @@ | |||
1 | #ifndef OPIE_SESSION_H | 1 | #ifndef OPIE_SESSION_H |
2 | #define OPIE_SESSION_H | 2 | #define OPIE_SESSION_H |
3 | 3 | ||
4 | #include <qwidgetstack.h> | 4 | #include <qwidgetstack.h> |
5 | 5 | ||
6 | class IOLayer; | 6 | class IOLayer; |
7 | class EmulationHandler; | 7 | class EmulationHandler; |
8 | /** | 8 | /** |
9 | * This is a Session. A session contains | 9 | * This is a Session. A session contains |
10 | * a QWidget pointer and a IOLayer | 10 | * a QWidget pointer and a IOLayer |
11 | * Imagine a session like a collection of what | 11 | * Imagine a session like a collection of what |
12 | * is needed to show your widget in a tab ;) | 12 | * is needed to show your widget in a tab ;) |
13 | */ | 13 | */ |
14 | class Session { | 14 | class Session { |
15 | public: | 15 | public: |
16 | /** | 16 | /** |
17 | * c'tor with widget and layer | 17 | * c'tor with widget and layer |
18 | * ownership get's transfered | 18 | * ownership get's transfered |
19 | */ | 19 | */ |
20 | Session(); | 20 | Session(); |
21 | Session( const QString&, QWidgetStack* widget, IOLayer* ); | 21 | Session( const QString&, QWidgetStack* widget, IOLayer* ); |
22 | ~Session(); | 22 | ~Session(); |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * return the name of the session | 25 | * return the name of the session |
26 | */ | 26 | */ |
27 | QString name()const; | 27 | QString name()const; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * return the widgetstack | 30 | * return the widgetstack |
31 | * this is used to be semi modal | 31 | * this is used to be semi modal |
32 | * for FileTransfer | 32 | * for FileTransfer |
33 | * | 33 | * |
34 | * semi modal == SessionModal | 34 | * semi modal == SessionModal |
35 | */ | 35 | */ |
36 | QWidgetStack* widgetStack(); | 36 | QWidgetStack* widgetStack(); |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * return the layer | 39 | * return the layer |
40 | */ | 40 | */ |
41 | IOLayer* layer(); | 41 | IOLayer* layer(); |
42 | 42 | ||
43 | EmulationHandler* emulationHandler(); | 43 | EmulationHandler* emulationHandler(); |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * connects the data flow from | 46 | * connects the data flow from |
47 | * the IOLayer to the EmulationLayer | 47 | * the IOLayer to the EmulationLayer |
48 | */ | 48 | */ |
49 | void connect(); | 49 | void connect(); |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * disconnect the dataflow | 52 | * disconnect the dataflow |
53 | * this will be done for ft | 53 | * this will be done for ft |
54 | */ | 54 | */ |
55 | void disconnect(); | 55 | void disconnect(); |
56 | 56 | ||
57 | void setWidgetStack( QWidgetStack* widget ); | 57 | void setWidgetStack( QWidgetStack* widget ); |
58 | void setEmulationHandler( EmulationHandler* lay ); | 58 | void setEmulationHandler( EmulationHandler* lay ); |
59 | void setIOLayer( IOLayer* ); | 59 | void setIOLayer( IOLayer* ); |
60 | void setName( const QString& ); | 60 | void setName( const QString& ); |
61 | 61 | ||
62 | bool isConnected(); | ||
63 | |||
62 | private: | 64 | private: |
63 | QString m_name; | 65 | QString m_name; |
64 | QWidgetStack* m_widget; | 66 | QWidgetStack* m_widget; |
65 | IOLayer* m_layer; | 67 | IOLayer* m_layer; |
66 | EmulationHandler* m_emu; | 68 | EmulationHandler* m_emu; |
69 | bool m_connected; | ||
67 | 70 | ||
68 | }; | 71 | }; |
69 | 72 | ||
70 | #endif | 73 | #endif |
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index 2d37be2..8badf96 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp | |||
@@ -1,194 +1,210 @@ | |||
1 | #include <qbuttongroup.h> | 1 | #include <qbuttongroup.h> |
2 | #include <qlabel.h> | 2 | #include <qlabel.h> |
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qradiobutton.h> | 5 | #include <qradiobutton.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qvbox.h> | 7 | #include <qvbox.h> |
8 | #include <qhgroupbox.h> | 8 | #include <qhgroupbox.h> |
9 | #include <qlayout.h> | 9 | #include <qlayout.h> |
10 | 10 | ||
11 | #include "terminalwidget.h" | 11 | #include "terminalwidget.h" |
12 | 12 | ||
13 | namespace { | 13 | namespace { |
14 | enum TermIds { | 14 | enum TermIds { |
15 | id_term_vt100, | 15 | id_term_vt100, |
16 | id_term_vt102, | 16 | id_term_vt102, |
17 | id_term_ansi | 17 | id_term_ansi |
18 | }; | 18 | }; |
19 | 19 | ||
20 | enum ColourIds { | 20 | enum ColourIds { |
21 | id_term_black, | 21 | id_term_black, |
22 | id_term_white | 22 | id_term_white, |
23 | id_term_green, | ||
24 | id_term_orange | ||
23 | }; | 25 | }; |
24 | 26 | ||
25 | enum FontIds { | 27 | enum FontIds { |
26 | id_size_small, | 28 | id_size_small, |
27 | id_size_medium, | 29 | id_size_medium, |
28 | id_size_large | 30 | id_size_large |
29 | }; | 31 | }; |
30 | }; | 32 | }; |
31 | 33 | ||
32 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | 34 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, |
33 | const char* na ) | 35 | const char* na ) |
34 | : ProfileDialogTerminalWidget( name, parent, na ) { | 36 | : ProfileDialogTerminalWidget( name, parent, na ) { |
35 | 37 | ||
36 | m_terminal = new QLabel(tr("Terminal Type"), this ); | 38 | m_terminal = new QLabel(tr("Terminal Type"), this ); |
37 | m_terminalBox = new QComboBox(this); | 39 | m_terminalBox = new QComboBox(this); |
38 | m_colorLabel = new QLabel(tr("Color scheme"), this); | 40 | m_colorLabel = new QLabel(tr("Color scheme"), this); |
39 | m_colorCmb = new QComboBox(this ); | 41 | m_colorCmb = new QComboBox(this ); |
40 | 42 | ||
41 | m_groupSize = new QButtonGroup(tr("Font size"), this ); | 43 | m_groupSize = new QButtonGroup(tr("Font size"), this ); |
42 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); | 44 | m_sizeSmall = new QRadioButton(tr("small"), m_groupSize ); |
43 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); | 45 | m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize ); |
44 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); | 46 | m_sizeLarge = new QRadioButton(tr("large"), m_groupSize ); |
45 | 47 | ||
46 | m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); | 48 | m_groupConv = new QHGroupBox(tr("Line-break conversions"), this ); |
47 | m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); | 49 | m_convInbound = new QCheckBox(tr("Inbound"), m_groupConv ); |
48 | m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); | 50 | m_convOutbound = new QCheckBox(tr("Outbound"), m_groupConv ); |
49 | 51 | ||
50 | m_groupOptions = new QHGroupBox( tr("Options"), this ); | 52 | m_groupOptions = new QHGroupBox( tr("Options"), this ); |
51 | m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); | 53 | m_optionEcho = new QCheckBox(tr("Local echo"), m_groupOptions ); |
52 | m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); | 54 | m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); |
53 | 55 | ||
54 | m_lroot = new QVBoxLayout(this, 2 ); | 56 | m_lroot = new QVBoxLayout(this, 2 ); |
55 | m_typeBox = new QVBoxLayout( m_lroot ); | 57 | m_typeBox = new QVBoxLayout( m_lroot ); |
56 | m_hbox = new QHBoxLayout( m_groupSize, 2 ); | 58 | m_hbox = new QHBoxLayout( m_groupSize, 2 ); |
57 | m_colorBox = new QVBoxLayout( m_lroot ); | 59 | m_colorBox = new QVBoxLayout( m_lroot ); |
58 | 60 | ||
59 | // Layout | 61 | // Layout |
60 | m_typeBox->add(m_terminal ); | 62 | m_typeBox->add(m_terminal ); |
61 | m_typeBox->add(m_terminalBox ); | 63 | m_typeBox->add(m_terminalBox ); |
62 | 64 | ||
63 | m_hbox->add(m_sizeSmall ); | 65 | m_hbox->add(m_sizeSmall ); |
64 | m_hbox->add(m_sizeMedium ); | 66 | m_hbox->add(m_sizeMedium ); |
65 | m_hbox->add(m_sizeLarge ); | 67 | m_hbox->add(m_sizeLarge ); |
66 | m_lroot->add(m_groupSize ); | 68 | m_lroot->add(m_groupSize ); |
67 | 69 | ||
68 | m_colorBox->add( m_colorLabel ); | 70 | m_colorBox->add( m_colorLabel ); |
69 | m_colorBox->add( m_colorCmb ); | 71 | m_colorBox->add( m_colorCmb ); |
70 | 72 | ||
71 | m_lroot->add(m_groupConv ); | 73 | m_lroot->add(m_groupConv ); |
72 | m_lroot->add(m_groupOptions ); | 74 | m_lroot->add(m_groupOptions ); |
73 | 75 | ||
74 | // Fill in some options | 76 | // Fill in some options |
75 | m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 ); | 77 | m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 ); |
76 | m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 ); | 78 | m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 ); |
77 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); | 79 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); |
78 | 80 | ||
79 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); | 81 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); |
80 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); | 82 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); |
83 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); | ||
84 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); | ||
81 | 85 | ||
82 | // signals + slots | 86 | // signals + slots |
83 | /* | 87 | /* |
84 | connect(m_terminalBox, SIGNAL(activated(int) ), | 88 | connect(m_terminalBox, SIGNAL(activated(int) ), |
85 | this, SLOT(slotTermTerm(int) ) ); | 89 | this, SLOT(slotTermTerm(int) ) ); |
86 | connect(m_colorBox, SIGNAL(activated(int) ), | 90 | connect(m_colorBox, SIGNAL(activated(int) ), |
87 | tis, SLOT(slotTermColor(int) ) ); | 91 | tis, SLOT(slotTermColor(int) ) ); |
88 | connect(m_groupSize, SIGNAL(activated(int) ), | 92 | connect(m_groupSize, SIGNAL(activated(int) ), |
89 | this, SLOT(slotTermFont(int) ) ); | 93 | this, SLOT(slotTermFont(int) ) ); |
90 | 94 | ||
91 | connect(m_optionEcho, SIGNAL(toggled(bool) ), | 95 | connect(m_optionEcho, SIGNAL(toggled(bool) ), |
92 | this, SLOT(slotTermEcho(bool) ) ); | 96 | this, SLOT(slotTermEcho(bool) ) ); |
93 | connect(m_optionWrap, SIGNAL(toggled(bool) ), | 97 | connect(m_optionWrap, SIGNAL(toggled(bool) ), |
94 | this, SLOT(slotTermWrap(bool) ) ); | 98 | this, SLOT(slotTermWrap(bool) ) ); |
95 | connect(m_convInbound, SIGNAL(toggled(bool) ), | 99 | connect(m_convInbound, SIGNAL(toggled(bool) ), |
96 | this, SLOT(slotTermInbound(bool) ) ); | 100 | this, SLOT(slotTermInbound(bool) ) ); |
97 | connect(m_convOutbound, SIGNAL(toggled(bool) ), | 101 | connect(m_convOutbound, SIGNAL(toggled(bool) ), |
98 | this, SLOT(slotTermOutbound(bool) ) ); | 102 | this, SLOT(slotTermOutbound(bool) ) ); |
99 | */ | 103 | */ |
100 | } | 104 | } |
101 | TerminalWidget::~TerminalWidget() { | 105 | TerminalWidget::~TerminalWidget() { |
102 | } | 106 | } |
103 | void TerminalWidget::load( const Profile& prof ) { | 107 | void TerminalWidget::load( const Profile& prof ) { |
104 | int term = prof.readNumEntry("Terminal"); | 108 | int term = prof.readNumEntry("Terminal"); |
105 | int color = prof.readNumEntry("Color"); | 109 | int color = prof.readNumEntry("Color"); |
106 | int fontsize = prof.readNumEntry("Font"); | 110 | int fontsize = prof.readNumEntry("Font"); |
107 | int opt_echo = prof.readNumEntry("Echo"); | 111 | int opt_echo = prof.readNumEntry("Echo"); |
108 | int opt_wrap = prof.readNumEntry("Wrap"); | 112 | int opt_wrap = prof.readNumEntry("Wrap"); |
109 | int opt_inbound = prof.readNumEntry("Inbound"); | 113 | int opt_inbound = prof.readNumEntry("Inbound"); |
110 | int opt_outbound = prof.readNumEntry("Outbound"); | 114 | int opt_outbound = prof.readNumEntry("Outbound"); |
111 | 115 | ||
112 | switch( term ) { | 116 | switch( term ) { |
113 | case Profile::VT100: | 117 | case Profile::VT100: |
114 | m_terminalBox->setCurrentItem(id_term_vt100 ); | 118 | m_terminalBox->setCurrentItem(id_term_vt100 ); |
115 | break; | 119 | break; |
116 | case Profile::VT102: | 120 | case Profile::VT102: |
117 | m_terminalBox->setCurrentItem(id_term_vt102 ); | 121 | m_terminalBox->setCurrentItem(id_term_vt102 ); |
118 | break; | 122 | break; |
119 | default: | 123 | default: |
120 | break; | 124 | break; |
121 | }; | 125 | }; |
122 | 126 | ||
123 | switch( color ) { | 127 | switch( color ) { |
124 | case Profile::Black: | 128 | case Profile::Black: |
125 | m_colorCmb->setCurrentItem(id_term_black ); | 129 | m_colorCmb->setCurrentItem(id_term_black ); |
126 | break; | 130 | break; |
127 | case Profile::White: | 131 | case Profile::White: |
128 | m_colorCmb->setCurrentItem(id_term_white ); | 132 | m_colorCmb->setCurrentItem(id_term_white ); |
129 | break; | 133 | break; |
134 | case Profile::Green: | ||
135 | m_colorCmb->setCurrentItem(id_term_green ); | ||
136 | break; | ||
137 | case Profile::Orange: | ||
138 | m_colorCmb->setCurrentItem(id_term_orange ); | ||
139 | break; | ||
130 | default: | 140 | default: |
131 | break; | 141 | break; |
132 | }; | 142 | }; |
133 | 143 | ||
134 | switch( fontsize ) { | 144 | switch( fontsize ) { |
135 | case Profile::Micro: | 145 | case Profile::Micro: |
136 | m_sizeSmall->setChecked(true ); | 146 | m_sizeSmall->setChecked(true ); |
137 | break; | 147 | break; |
138 | case Profile::Small: | 148 | case Profile::Small: |
139 | m_sizeMedium->setChecked(true ); | 149 | m_sizeMedium->setChecked(true ); |
140 | break; | 150 | break; |
141 | case Profile::Medium: | 151 | case Profile::Medium: |
142 | m_sizeLarge->setChecked( true ); | 152 | m_sizeLarge->setChecked( true ); |
143 | break; | 153 | break; |
144 | m_sizeSmall->setChecked(true); | 154 | m_sizeSmall->setChecked(true); |
145 | default: | 155 | default: |
146 | break; | 156 | break; |
147 | }; | 157 | }; |
148 | 158 | ||
149 | if (opt_echo) m_optionEcho->setChecked( true ); | 159 | if (opt_echo) m_optionEcho->setChecked( true ); |
150 | if (opt_wrap) m_optionWrap->setChecked( true ); | 160 | if (opt_wrap) m_optionWrap->setChecked( true ); |
151 | if (opt_inbound) m_convInbound->setChecked( true ); | 161 | if (opt_inbound) m_convInbound->setChecked( true ); |
152 | if (opt_outbound) m_convOutbound->setChecked( true ); | 162 | if (opt_outbound) m_convOutbound->setChecked( true ); |
153 | 163 | ||
154 | } | 164 | } |
155 | void TerminalWidget::save( Profile& profile ) { | 165 | void TerminalWidget::save( Profile& profile ) { |
156 | switch(m_terminalBox->currentItem() ) { | 166 | switch(m_terminalBox->currentItem() ) { |
157 | case id_term_vt100: | 167 | case id_term_vt100: |
158 | profile.writeEntry("Terminal", Profile::VT100 ); | 168 | profile.writeEntry("Terminal", Profile::VT100 ); |
159 | break; | 169 | break; |
160 | case id_term_vt102: | 170 | case id_term_vt102: |
161 | profile.writeEntry("Terminal", Profile::VT102 ); | 171 | profile.writeEntry("Terminal", Profile::VT102 ); |
162 | break; | 172 | break; |
163 | //case id_term_ansi: | 173 | //case id_term_ansi: |
164 | // profile.writeEntry("Terminal", Profile::VT102 ); | 174 | // profile.writeEntry("Terminal", Profile::VT102 ); |
165 | // break; | 175 | // break; |
166 | default: | 176 | default: |
167 | break; | 177 | break; |
168 | }; | 178 | }; |
169 | 179 | ||
170 | // color | 180 | // color |
171 | switch(m_colorCmb->currentItem() ) { | 181 | switch(m_colorCmb->currentItem() ) { |
172 | case id_term_black: | 182 | case id_term_black: |
173 | profile.writeEntry("Color", Profile::Black ); | 183 | profile.writeEntry("Color", Profile::Black ); |
174 | break; | 184 | break; |
175 | case id_term_white: | 185 | case id_term_white: |
176 | profile.writeEntry("Color", Profile::White ); | 186 | profile.writeEntry("Color", Profile::White ); |
177 | break; | 187 | break; |
188 | case id_term_green: | ||
189 | profile.writeEntry("Color", Profile::Green ); | ||
190 | break; | ||
191 | case id_term_orange: | ||
192 | profile.writeEntry("Color", Profile::Orange ); | ||
193 | break; | ||
178 | default: | 194 | default: |
179 | break; | 195 | break; |
180 | }; | 196 | }; |
181 | 197 | ||
182 | if (m_sizeSmall->isChecked() ) { | 198 | if (m_sizeSmall->isChecked() ) { |
183 | profile.writeEntry("Font", Profile::Micro ); | 199 | profile.writeEntry("Font", Profile::Micro ); |
184 | }else if (m_sizeMedium->isChecked() ) { | 200 | }else if (m_sizeMedium->isChecked() ) { |
185 | profile.writeEntry("Font", Profile::Small ); | 201 | profile.writeEntry("Font", Profile::Small ); |
186 | }else { | 202 | }else { |
187 | profile.writeEntry("Font", Profile::Medium ); | 203 | profile.writeEntry("Font", Profile::Medium ); |
188 | } | 204 | } |
189 | 205 | ||
190 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); | 206 | profile.writeEntry("Echo", m_optionEcho->isChecked() ); |
191 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); | 207 | profile.writeEntry("Wrap", m_optionWrap->isChecked() ); |
192 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); | 208 | profile.writeEntry("Inbound", m_convInbound->isChecked() ); |
193 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); | 209 | profile.writeEntry("Outbound",m_convOutbound->isChecked() ); |
194 | } | 210 | } |