summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-17 17:19:20 (UTC)
committer harlekin <harlekin>2002-10-17 17:19:20 (UTC)
commitdf5a8d26c398ad65f09bd26c492c08f6c0ee22e0 (patch) (unidiff)
treee1fcefde6e4942f65fa2b5ad253f40a190caa78a
parentcedc9eed0c0b8d1685c3ca745eafd77988d394dc (diff)
downloadopie-df5a8d26c398ad65f09bd26c492c08f6c0ee22e0.zip
opie-df5a8d26c398ad65f09bd26c492c08f6c0ee22e0.tar.gz
opie-df5a8d26c398ad65f09bd26c492c08f6c0ee22e0.tar.bz2
fullscreen mode ready
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp20
-rw-r--r--noncore/apps/opie-console/TEWidget.h30
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp5
-rw-r--r--noncore/apps/opie-console/emulation_handler.h3
-rw-r--r--noncore/apps/opie-console/io_bt.cpp1
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp40
6 files changed, 62 insertions, 37 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index 75c438c..f3f462f 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -39,59 +39,62 @@
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" 52#include "session.h"
53#include <qpe/config.h> 53#include <qpe/config.h>
54 54
55#include <qapplication.h> 55#include <qapplication.h>
56#include <qcursor.h> 56#include <qcursor.h>
57#include <qregexp.h> 57#include <qregexp.h>
58#include <qpainter.h> 58#include <qpainter.h>
59#include <qclipboard.h> 59#include <qclipboard.h>
60#include <qstyle.h> 60#include <qstyle.h>
61#include <qfile.h> 61#include <qfile.h>
62#include <qdragobject.h> 62#include <qdragobject.h>
63#include <qvbox.h>
63 64
64#include <stdio.h> 65#include <stdio.h>
65#include <stdlib.h> 66#include <stdlib.h>
66#include <unistd.h> 67#include <unistd.h>
67#include <ctype.h> 68#include <ctype.h>
68#include <sys/stat.h> 69#include <sys/stat.h>
69#include <sys/types.h> 70#include <sys/types.h>
70#include <signal.h> 71#include <signal.h>
71 72
72#include <assert.h> 73#include <assert.h>
73 74
75
76
74// #include "TEWidget.moc" 77// #include "TEWidget.moc"
75//#include <kapp.h> 78//#include <kapp.h>
76//#include <kcursor.h> 79//#include <kcursor.h>
77//#include <kurl.h> 80//#include <kurl.h>
78//#include <kdebug.h> 81//#include <kdebug.h>
79//#include <klocale.h> 82//#include <klocale.h>
80 83
81#define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) 84#define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__)
82#define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } 85#define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); }
83 86
84#define loc(X,Y) ((Y)*columns+(X)) 87#define loc(X,Y) ((Y)*columns+(X))
85 88
86//FIXME: the rim should normally be 1, 0 only when running in full screen mode. 89//FIXME: the rim should normally be 1, 0 only when running in full screen mode.
87#define rimX 0 // left/right rim width 90#define rimX 0 // left/right rim width
88#define rimY 0 // top/bottom rim high 91#define rimY 0 // top/bottom rim high
89 92
90#define SCRWIDTH 16 // width of the scrollbar 93#define SCRWIDTH 16 // width of the scrollbar
91 94
92#define yMouseScroll 1 95#define yMouseScroll 1
93// scroll increment used when dragging selection at top/bottom of window. 96// scroll increment used when dragging selection at top/bottom of window.
94 97
95/* ------------------------------------------------------------------------- */ 98/* ------------------------------------------------------------------------- */
96/* */ 99/* */
97/* Colors */ 100/* Colors */
@@ -253,62 +256,70 @@ void TEWidget::fontChange(const QFont &)
253#endif 256#endif
254 identicalMap; 257 identicalMap;
255 propagateSize(); 258 propagateSize();
256 update(); 259 update();
257} 260}
258 261
259void TEWidget::setVTFont(const QFont& f) 262void TEWidget::setVTFont(const QFont& f)
260{ 263{
261 QFrame::setFont(f); 264 QFrame::setFont(f);
262} 265}
263 266
264QFont TEWidget::getVTFont() { 267QFont TEWidget::getVTFont() {
265 return font(); 268 return font();
266} 269}
267 270
268void TEWidget::setFont(const QFont &) 271void TEWidget::setFont(const QFont &)
269{ 272{
270 // ignore font change request if not coming from konsole itself 273 // ignore font change request if not coming from konsole itself
271} 274}
272 275
273/* ------------------------------------------------------------------------- */ 276/* ------------------------------------------------------------------------- */
274/* */ 277/* */
275/* Constructor / Destructor */ 278/* Constructor / Destructor */
276/* */ 279/* */
277/* ------------------------------------------------------------------------- */ 280/* ----------------------------------------------------------------------- */
281
282
278 283
279TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) 284TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
280{ 285{
281#ifndef QT_NO_CLIPBOARD 286#ifndef QT_NO_CLIPBOARD
282 cb = QApplication::clipboard(); 287 cb = QApplication::clipboard();
283 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 288 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
284 this, SLOT(onClearSelection()) ); 289 this, SLOT(onClearSelection()) );
285#endif 290#endif
286 291
287 scrollbar = new QScrollBar(this); 292
293 scrollbar = new QScrollBar( this );
288 scrollbar->setCursor( arrowCursor ); 294 scrollbar->setCursor( arrowCursor );
289 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 295 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
290 296
297 m_cornerButton = new QPushButton( this );
298 m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
299 m_cornerButton->setMaximumSize( 14, 14 );
300 m_cornerButton->hide();
301
291 Config cfg("Konsole"); 302 Config cfg("Konsole");
292 cfg.setGroup("ScrollBar"); 303 cfg.setGroup("ScrollBar");
293 switch( cfg.readNumEntry("Position",2)){ 304 switch( cfg.readNumEntry("Position",2)){
294 case 0: 305 case 0:
295 scrollLoc = SCRNONE; 306 scrollLoc = SCRNONE;
296 break; 307 break;
297 case 1: 308 case 1:
298 scrollLoc = SCRLEFT; 309 scrollLoc = SCRLEFT;
299 break; 310 break;
300 case 2: 311 case 2:
301 scrollLoc = SCRRIGHT; 312 scrollLoc = SCRRIGHT;
302 break; 313 break;
303 }; 314 };
304 315
305 blinkT = new QTimer(this); 316 blinkT = new QTimer(this);
306 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); 317 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent()));
307 // blinking = FALSE; 318 // blinking = FALSE;
308 blinking = TRUE; 319 blinking = TRUE;
309 320
310 resizing = FALSE; 321 resizing = FALSE;
311 actSel = 0; 322 actSel = 0;
312 image = 0; 323 image = 0;
313 lines = 1; 324 lines = 1;
314 columns = 1; 325 columns = 1;
@@ -833,49 +844,49 @@ void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev)
833 int selClass = charClass(image[i].c); 844 int selClass = charClass(image[i].c);
834 { 845 {
835 // set the start... 846 // set the start...
836 int x = bgnSel.x(); 847 int x = bgnSel.x();
837 while ( x > 0 && charClass(image[i-1].c) == selClass ) 848 while ( x > 0 && charClass(image[i-1].c) == selClass )
838 { i--; x--; } 849 { i--; x--; }
839 bgnSel.setX(x); 850 bgnSel.setX(x);
840 emit beginSelectionSignal( bgnSel.x(), bgnSel.y() ); 851 emit beginSelectionSignal( bgnSel.x(), bgnSel.y() );
841 852
842 // set the end... 853 // set the end...
843 i = loc( endSel.x(), endSel.y() ); 854 i = loc( endSel.x(), endSel.y() );
844 x = endSel.x(); 855 x = endSel.x();
845 while( x < columns-1 && charClass(image[i+1].c) == selClass ) 856 while( x < columns-1 && charClass(image[i+1].c) == selClass )
846 { i++; x++ ; } 857 { i++; x++ ; }
847 endSel.setX(x); 858 endSel.setX(x);
848 actSel = 2; // within selection 859 actSel = 2; // within selection
849 emit extendSelectionSignal( endSel.x(), endSel.y() ); 860 emit extendSelectionSignal( endSel.x(), endSel.y() );
850 emit endSelectionSignal(preserve_line_breaks); 861 emit endSelectionSignal(preserve_line_breaks);
851 preserve_line_breaks = TRUE; 862 preserve_line_breaks = TRUE;
852 } 863 }
853} 864}
854 865
855void TEWidget::focusInEvent( QFocusEvent * ) 866void TEWidget::focusInEvent( QFocusEvent * )
856{ 867{
857 868
858 // do nothing, to prevent repainting 869 // do nothing, to prevent repainting
859} 870}
860 871
861 872
862void TEWidget::focusOutEvent( QFocusEvent * ) 873void TEWidget::focusOutEvent( QFocusEvent * )
863{ 874{
864 // do nothing, to prevent repainting 875 // do nothing, to prevent repainting
865} 876}
866 877
867bool TEWidget::focusNextPrevChild( bool next ) 878bool TEWidget::focusNextPrevChild( bool next )
868{ 879{
869 if (next) 880 if (next)
870 return false; // This disables changing the active part in konqueror 881 return false; // This disables changing the active part in konqueror
871 // when pressing Tab 882 // when pressing Tab
872 return QFrame::focusNextPrevChild( next ); 883 return QFrame::focusNextPrevChild( next );
873} 884}
874 885
875 886
876int TEWidget::charClass(char ch) const 887int TEWidget::charClass(char ch) const
877{ 888{
878 // This might seem like overkill, but imagine if ch was a Unicode 889 // This might seem like overkill, but imagine if ch was a Unicode
879 // character (Qt 2.0 QChar) - it might then be sensible to separate 890 // character (Qt 2.0 QChar) - it might then be sensible to separate
880 // the different language ranges, etc. 891 // the different language ranges, etc.
881 892
@@ -1241,24 +1252,27 @@ void TEWidget::drop_menu_activated(int item)
1241 break; 1252 break;
1242 case 1: // cd ... 1253 case 1: // cd ...
1243 currentSession->getEmulation()->sendString("cd "); 1254 currentSession->getEmulation()->sendString("cd ");
1244 struct stat statbuf; 1255 struct stat statbuf;
1245 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) 1256 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 )
1246 { 1257 {
1247 if ( !S_ISDIR(statbuf.st_mode) ) 1258 if ( !S_ISDIR(statbuf.st_mode) )
1248 { 1259 {
1249/* 1260/*
1250 KURL url; 1261 KURL url;
1251 url.setPath( dropText ); 1262 url.setPath( dropText );
1252 dropText = url.directory( true, false ); // remove filename 1263 dropText = url.directory( true, false ); // remove filename
1253*/ 1264*/
1254 } 1265 }
1255 } 1266 }
1256 dropText.replace(QRegExp(" "), "\\ "); // escape spaces 1267 dropText.replace(QRegExp(" "), "\\ "); // escape spaces
1257 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1268 currentSession->getEmulation()->sendString(dropText.local8Bit());
1258 currentSession->getEmulation()->sendString("\n"); 1269 currentSession->getEmulation()->sendString("\n");
1259// KWM::activate((Window)this->winId()); 1270// KWM::activate((Window)this->winId());
1260 break; 1271 break;
1261 } 1272 }
1262#endif 1273#endif
1263} 1274}
1264 1275
1276QPushButton* TEWidget::cornerButton() {
1277 return m_cornerButton;
1278}
diff --git a/noncore/apps/opie-console/TEWidget.h b/noncore/apps/opie-console/TEWidget.h
index 40e1aea..1b5300f 100644
--- a/noncore/apps/opie-console/TEWidget.h
+++ b/noncore/apps/opie-console/TEWidget.h
@@ -5,71 +5,96 @@
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#ifndef TE_WIDGET_H 18#ifndef TE_WIDGET_H
19#define TE_WIDGET_H 19#define TE_WIDGET_H
20 20
21#include <qwidget.h> 21#include <qwidget.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qcolor.h> 24#include <qcolor.h>
25#include <qkeycode.h> 25#include <qkeycode.h>
26#include <qscrollbar.h> 26#include <qscrollbar.h>
27 27
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qpushbutton.h>
29 30
30#include "TECommon.h" 31#include "TECommon.h"
31 32
32extern unsigned short vt100_graphics[32]; 33extern unsigned short vt100_graphics[32];
33 34
35
36
37static char * menu_xpm[] = {
38"12 12 5 1",
39 " c None",
40 ".c #000000",
41 "+c #FFFDAD",
42 "@c #FFFF00",
43 "#c #E5E100",
44" ",
45" ",
46" ......... ",
47" .+++++++. ",
48" .+@@@@#. ",
49" .+@@@#. ",
50" .+@@#. ",
51" .+@#. ",
52" .+#. ",
53" .+. ",
54" .. ",
55" "};
56
34class TESession; 57class TESession;
35 58
36// class Konsole; 59// class Konsole;
37 60
38class TEWidget : public QFrame 61class TEWidget : public QFrame
39// a widget representing attributed text 62// a widget representing attributed text
40{ Q_OBJECT 63{
64 Q_OBJECT
41 65
42// friend class Konsole; 66// friend class Konsole;
43 67
44public: 68public:
45 69
46 TEWidget(QWidget *parent=0, const char *name=0); 70 TEWidget(QWidget *parent=0, const char *name=0);
47 virtual ~TEWidget(); 71 virtual ~TEWidget();
48 72
49public: 73public:
50 74
51 QColor getDefaultBackColor(); 75 QColor getDefaultBackColor();
76 QPushButton *cornerButton();
52 77
53 const ColorEntry* getColorTable() const; 78 const ColorEntry* getColorTable() const;
54 const ColorEntry* getdefaultColorTable() const; 79 const ColorEntry* getdefaultColorTable() const;
55 void setColorTable(const ColorEntry table[]); 80 void setColorTable(const ColorEntry table[]);
56 81
57 void setScrollbarLocation(int loc); 82 void setScrollbarLocation(int loc);
58 enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 }; 83 enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 };
59 84
60 void setScroll(int cursor, int lines); 85 void setScroll(int cursor, int lines);
61 void doScroll(int lines); 86 void doScroll(int lines);
62 87
63 void emitSelection(); 88 void emitSelection();
64 89
65public: 90public:
66 91
67 void setImage(const ca* const newimg, int lines, int columns); 92 void setImage(const ca* const newimg, int lines, int columns);
68 93
69 int Lines() { return lines; } 94 int Lines() { return lines; }
70 int Columns() { return columns; } 95 int Columns() { return columns; }
71 96
72 void calcGeometry(); 97 void calcGeometry();
73 void propagateSize(); 98 void propagateSize();
74 QSize calcSize(int cols, int lins) const; 99 QSize calcSize(int cols, int lins) const;
75 100
@@ -110,93 +135,94 @@ protected:
110 void fontChange(const QFont &font); 135 void fontChange(const QFont &font);
111 void frameChanged(); 136 void frameChanged();
112 137
113 void mouseDoubleClickEvent(QMouseEvent* ev); 138 void mouseDoubleClickEvent(QMouseEvent* ev);
114 void mousePressEvent( QMouseEvent* ); 139 void mousePressEvent( QMouseEvent* );
115 void mouseReleaseEvent( QMouseEvent* ); 140 void mouseReleaseEvent( QMouseEvent* );
116 void mouseMoveEvent( QMouseEvent* ); 141 void mouseMoveEvent( QMouseEvent* );
117 142
118 void focusInEvent( QFocusEvent * ); 143 void focusInEvent( QFocusEvent * );
119 void focusOutEvent( QFocusEvent * ); 144 void focusOutEvent( QFocusEvent * );
120 bool focusNextPrevChild( bool next ); 145 bool focusNextPrevChild( bool next );
121 146
122#ifndef QT_NO_DRAGANDDROP 147#ifndef QT_NO_DRAGANDDROP
123 // Dnd 148 // Dnd
124 void dragEnterEvent(QDragEnterEvent* event); 149 void dragEnterEvent(QDragEnterEvent* event);
125 void dropEvent(QDropEvent* event); 150 void dropEvent(QDropEvent* event);
126#endif 151#endif
127 152
128 virtual int charClass(char) const; 153 virtual int charClass(char) const;
129 154
130 void clearImage(); 155 void clearImage();
131 156
132public: 157public:
133 const QPixmap *backgroundPixmap(); 158 const QPixmap *backgroundPixmap();
134 159
135 void setSelection(const QString &t); 160 void setSelection(const QString &t);
136 161
137 virtual void setFont(const QFont &); 162 virtual void setFont(const QFont &);
138 void setVTFont(const QFont &); 163 void setVTFont(const QFont &);
139 QFont getVTFont(); 164 QFont getVTFont();
140 165
141 void setMouseMarks(bool on); 166 void setMouseMarks(bool on);
142 167
143public slots: 168public slots:
144 169
145 void onClearSelection(); 170 void onClearSelection();
146 171
147protected slots: 172protected slots:
148 173
149 void scrollChanged(int value); 174 void scrollChanged(int value);
150 void blinkEvent(); 175 void blinkEvent();
151 176
152private: 177private:
153 178
154 QChar (*fontMap)(QChar); // possible vt100 font extention 179 QChar (*fontMap)(QChar); // possible vt100 font extention
155 180
156 bool fixed_font; // has fixed pitch 181 bool fixed_font; // has fixed pitch
157 int font_h; // height 182 int font_h; // height
158 int font_w; // width 183 int font_w; // width
159 int font_a; // ascend 184 int font_a; // ascend
160 185
161 int blX; // actual offset (left) 186 int blX; // actual offset (left)
162 int brX; // actual offset (right) 187 int brX; // actual offset (right)
163 int bY; // actual offset 188 int bY; // actual offset
164 189
165 int lines; 190 int lines;
166 int columns; 191 int columns;
167 ca *image; // [lines][columns] 192 ca *image; // [lines][columns]
168 193
169 ColorEntry color_table[TABLE_COLORS]; 194 ColorEntry color_table[TABLE_COLORS];
170 195
171 BOOL resizing; 196 BOOL resizing;
172 bool mouse_marks; 197 bool mouse_marks;
173 198
174 void makeImage(); 199 void makeImage();
175 200
176 QPoint iPntSel; // initial selection point 201 QPoint iPntSel; // initial selection point
177 QPoint pntSel; // current selection point 202 QPoint pntSel; // current selection point
178 int actSel; // selection state 203 int actSel; // selection state
179 BOOL word_selection_mode; 204 BOOL word_selection_mode;
180 BOOL preserve_line_breaks; 205 BOOL preserve_line_breaks;
181 206
207 QPushButton *m_cornerButton;
182 QClipboard* cb; 208 QClipboard* cb;
183 QScrollBar* scrollbar; 209 QScrollBar* scrollbar;
184 int scrollLoc; 210 int scrollLoc;
185 211
186//#define SCRNONE 0 212//#define SCRNONE 0
187//#define SCRLEFT 1 213//#define SCRLEFT 1
188//#define SCRRIGHT 2 214//#define SCRRIGHT 2
189 215
190 BOOL blinking; // hide text in paintEvent 216 BOOL blinking; // hide text in paintEvent
191 BOOL hasBlinker; // has characters to blink 217 BOOL hasBlinker; // has characters to blink
192 QTimer* blinkT; // active when hasBlinker 218 QTimer* blinkT; // active when hasBlinker
193 QPopupMenu* m_drop; 219 QPopupMenu* m_drop;
194 QString dropText; 220 QString dropText;
195 public: 221 public:
196 // current session in this widget 222 // current session in this widget
197 TESession *currentSession; 223 TESession *currentSession;
198private slots: 224private slots:
199 void drop_menu_activated(int item); 225 void drop_menu_activated(int item);
200}; 226};
201 227
202#endif // TE_WIDGET_H 228#endif // TE_WIDGET_H
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index b2cd348..8846959 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -1,25 +1,26 @@
1#include <qwidget.h> 1#include <qwidget.h>
2#include <qpushbutton.h>
2 3
3#include "TEWidget.h" 4#include "TEWidget.h"
4#include "TEmuVt102.h" 5#include "TEmuVt102.h"
5 6
6#include "profile.h" 7#include "profile.h"
7#include "emulation_handler.h" 8#include "emulation_handler.h"
8 9
9 10
10EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) 11EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
11 : QObject(0, name ) 12 : QObject(0, name )
12{ 13{
13 m_teWid = new TEWidget( parent, "TerminalMain"); 14 m_teWid = new TEWidget( parent, "TerminalMain");
14 m_teWid->setMinimumSize(150, 70 ); 15 m_teWid->setMinimumSize(150, 70 );
15 parent->resize( m_teWid->calcSize(80, 24 ) ); 16 parent->resize( m_teWid->calcSize(80, 24 ) );
16 m_teEmu = new TEmuVt102(m_teWid ); 17 m_teEmu = new TEmuVt102(m_teWid );
17 18
18 connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), 19 connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ),
19 this, SIGNAL(changeSize(int, int) ) ); 20 this, SIGNAL(changeSize(int, int) ) );
20 connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), 21 connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ),
21 this, SLOT(recvEmulation(const char*, int) ) ); 22 this, SLOT(recvEmulation(const char*, int) ) );
22 m_teEmu->setConnect( true ); 23 m_teEmu->setConnect( true );
23 m_teEmu->setHistory( TRUE ); 24 m_teEmu->setHistory( TRUE );
24 load( prof ); 25 load( prof );
25 26
@@ -119,24 +120,28 @@ QColor EmulationHandler::foreColor(int col) {
119QColor EmulationHandler::backColor(int col ) { 120QColor EmulationHandler::backColor(int col ) {
120 QColor co; 121 QColor co;
121 /* we need to switch it */ 122 /* we need to switch it */
122 switch( col ) { 123 switch( col ) {
123 default: 124 default:
124 case Profile::White: 125 case Profile::White:
125 /* color is white */ 126 /* color is white */
126 co = Qt::black; 127 co = Qt::black;
127 break; 128 break;
128 case Profile::Black: 129 case Profile::Black:
129 co = Qt::white; 130 co = Qt::white;
130 break; 131 break;
131 case Profile::Green: 132 case Profile::Green:
132 qWarning("Background black"); 133 qWarning("Background black");
133 co = Qt::black; 134 co = Qt::black;
134 break; 135 break;
135 case Profile::Orange: 136 case Profile::Orange:
136 qWarning("Background black"); 137 qWarning("Background black");
137 co = Qt::black; 138 co = Qt::black;
138 break; 139 break;
139 } 140 }
140 141
141 return co; 142 return co;
142} 143}
144
145QPushButton* EmulationHandler::cornerButton() {
146 return m_teWid->cornerButton();
147}
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h
index 9af7680..9ceafc6 100644
--- a/noncore/apps/opie-console/emulation_handler.h
+++ b/noncore/apps/opie-console/emulation_handler.h
@@ -4,67 +4,70 @@
4#include <qobject.h> 4#include <qobject.h>
5#include <qcolor.h> 5#include <qcolor.h>
6#include <qcstring.h> 6#include <qcstring.h>
7 7
8/* 8/*
9 * Badly ibotty lacks the time to finish 9 * Badly ibotty lacks the time to finish
10 * his widget in time.. 10 * his widget in time..
11 * Never the less we've to have an EmulationWidget 11 * Never the less we've to have an EmulationWidget
12 * This is why I'm taking the inferior not cleaned 12 * This is why I'm taking the inferior not cleaned
13 * up TE* KDE STUFF 13 * up TE* KDE STUFF
14 */ 14 */
15 15
16/** 16/**
17 * This is the layer above the IOLayer* 17 * This is the layer above the IOLayer*
18 * This nice QObject here will get stuff from 18 * This nice QObject here will get stuff from
19 * got a slot and a signal 19 * got a slot and a signal
20 * the signal for data 20 * the signal for data
21 * the slot for receiving 21 * the slot for receiving
22 * it'll set up the widget internally 22 * it'll set up the widget internally
23 * and manage the communication between 23 * and manage the communication between
24 * the pre QByteArray world! 24 * the pre QByteArray world!
25 */ 25 */
26class Profile; 26class Profile;
27class QWidget; 27class QWidget;
28class QPushButton;
28class TEWidget; 29class TEWidget;
29class TEmulation; 30class TEmulation;
30class QFont; 31class QFont;
31class EmulationHandler : public QObject { 32class EmulationHandler : public QObject {
32 Q_OBJECT 33 Q_OBJECT
33public: 34public:
34 /** 35 /**
35 * simple c'tor the parent of the TEWdiget 36 * simple c'tor the parent of the TEWdiget
36 * and a name 37 * and a name
37 * and a Profile 38 * and a Profile
38 */ 39 */
39 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l ); 40 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l );
40 41
41 /** 42 /**
42 * delete all components 43 * delete all components
43 */ 44 */
44 ~EmulationHandler(); 45 ~EmulationHandler();
45 46
46 void load( const Profile& ); 47 void load( const Profile& );
47 QWidget* widget(); 48 QWidget* widget();
48 void setColor( const QColor& fore, const QColor& back ); 49 void setColor( const QColor& fore, const QColor& back );
50 QPushButton* cornerButton();
51
49signals: 52signals:
50 void send( const QByteArray& ); 53 void send( const QByteArray& );
51 void changeSize(int rows, int cols ); 54 void changeSize(int rows, int cols );
52 55
53 56
54public slots: 57public slots:
55 void recv( const QByteArray& ); 58 void recv( const QByteArray& );
56 59
57private slots: 60private slots:
58 void recvEmulation( const char*, int len ); 61 void recvEmulation( const char*, int len );
59private: 62private:
60 QFont font( int ); 63 QFont font( int );
61 QColor foreColor(int ); 64 QColor foreColor(int );
62 QColor backColor(int ); 65 QColor backColor(int );
63 66
64private: 67private:
65 TEWidget* m_teWid; 68 TEWidget* m_teWid;
66 TEmulation* m_teEmu; 69 TEmulation* m_teEmu;
67 70
68}; 71};
69 72
70#endif 73#endif
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index d71aacc..4486eea 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -8,49 +8,48 @@ IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
8 8
9IOBt::~IOBt() { 9IOBt::~IOBt() {
10 if ( m_attach ) { 10 if ( m_attach ) {
11 delete m_attach; 11 delete m_attach;
12 } 12 }
13} 13}
14 14
15 15
16void IOBt::close() { 16void IOBt::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 // still need error handling 19 // still need error handling
20 if ( m_attach ) { 20 if ( m_attach ) {
21 delete m_attach; 21 delete m_attach;
22 m_attach = 0; 22 m_attach = 0;
23 } 23 }
24} 24}
25 25
26bool IOBt::open() { 26bool IOBt::open() {
27 27
28 // only set up bt stuff if mac address was set, otherwise use the device set 28 // only set up bt stuff if mac address was set, otherwise use the device set
29 if ( !m_mac.isEmpty() ) { 29 if ( !m_mac.isEmpty() ) {
30 30
31 // now it should also be checked, if there is a connection to the device with that mac allready 31 // now it should also be checked, if there is a connection to the device with that mac allready
32
33 // hciattach here 32 // hciattach here
34 m_attach = new OProcess(); 33 m_attach = new OProcess();
35 *m_attach << "hciattach /dev/ttyS2 any 57600"; 34 *m_attach << "hciattach /dev/ttyS2 any 57600";
36 35
37 // then start hcid, then rcfomm handling (m_mac) 36 // then start hcid, then rcfomm handling (m_mac)
38 37
39 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 38 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
40 this, SLOT( slotExited( OProcess* ) ) ); 39 this, SLOT( slotExited( OProcess* ) ) );
41 40
42 if ( m_attach->start() ) { 41 if ( m_attach->start() ) {
43 IOSerial::open(); 42 IOSerial::open();
44 } else { 43 } else {
45 qWarning("could not attach to device"); 44 qWarning("could not attach to device");
46 delete m_attach; 45 delete m_attach;
47 m_attach = 0; 46 m_attach = 0;
48 } 47 }
49 } else { 48 } else {
50 // directly to the normal serial 49 // directly to the normal serial
51 // TODO: look first if the connection really exists. ( is set up ) 50 // TODO: look first if the connection really exists. ( is set up )
52 51
53 IOSerial::open(); 52 IOSerial::open();
54 } 53 }
55} 54}
56 55
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 5295600..408d3dd 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -5,73 +5,53 @@
5#include <qaction.h> 5#include <qaction.h>
6#include <qmenubar.h> 6#include <qmenubar.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qpopupmenu.h> 8#include <qpopupmenu.h>
9#include <qtoolbar.h> 9#include <qtoolbar.h>
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11#include <qpushbutton.h> 11#include <qpushbutton.h>
12#include <qwhatsthis.h> 12#include <qwhatsthis.h>
13 13
14#include <qpe/resource.h> 14#include <qpe/resource.h>
15#include <opie/ofiledialog.h> 15#include <opie/ofiledialog.h>
16 16
17 17
18#include "keytrans.h" 18#include "keytrans.h"
19#include "profileeditordialog.h" 19#include "profileeditordialog.h"
20#include "configdialog.h" 20#include "configdialog.h"
21#include "default.h" 21#include "default.h"
22#include "metafactory.h" 22#include "metafactory.h"
23#include "profile.h" 23#include "profile.h"
24#include "profilemanager.h" 24#include "profilemanager.h"
25#include "mainwindow.h" 25#include "mainwindow.h"
26#include "tabwidget.h" 26#include "tabwidget.h"
27#include "transferdialog.h" 27#include "transferdialog.h"
28#include "function_keyboard.h" 28#include "function_keyboard.h"
29#include "emulation_handler.h"
29#include "script.h" 30#include "script.h"
30 31
31 32
32 33
33static char * menu_xpm[] = {
34"12 12 5 1",
35 " c None",
36 ".c #000000",
37 "+c #FFFDAD",
38 "@c #FFFF00",
39 "#c #E5E100",
40" ",
41" ",
42" ......... ",
43" .+++++++. ",
44" .+@@@@#. ",
45" .+@@@#. ",
46" .+@@#. ",
47" .+@#. ",
48" .+#. ",
49" .+. ",
50" .. ",
51" "};
52
53
54MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 34MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
55 KeyTrans::loadAll(); 35 KeyTrans::loadAll();
56 for (int i = 0; i < KeyTrans::count(); i++ ) { 36 for (int i = 0; i < KeyTrans::count(); i++ ) {
57 KeyTrans* s = KeyTrans::find(i ); 37 KeyTrans* s = KeyTrans::find(i );
58 assert( s ); 38 assert( s );
59 } 39 }
60 m_factory = new MetaFactory(); 40 m_factory = new MetaFactory();
61 Default def(m_factory); 41 Default def(m_factory);
62 m_sessions.setAutoDelete( TRUE ); 42 m_sessions.setAutoDelete( TRUE );
63 m_curSession = 0; 43 m_curSession = 0;
64 m_manager = new ProfileManager( m_factory ); 44 m_manager = new ProfileManager( m_factory );
65 m_manager->load(); 45 m_manager->load();
66 46
67 initUI(); 47 initUI();
68 populateProfiles(); 48 populateProfiles();
69} 49}
70void MainWindow::initUI() { 50void MainWindow::initUI() {
71 setToolBarsMovable( FALSE ); 51 setToolBarsMovable( FALSE );
72 52
73 /* tool bar for the menu */ 53 /* tool bar for the menu */
74 m_tool = new QToolBar( this ); 54 m_tool = new QToolBar( this );
75 m_tool->setHorizontalStretchable( TRUE ); 55 m_tool->setHorizontalStretchable( TRUE );
76 56
77 m_bar = new QMenuBar( m_tool ); 57 m_bar = new QMenuBar( m_tool );
@@ -441,58 +421,56 @@ void MainWindow::slotOpenKeb(bool state) {
441 421
442} 422}
443void MainWindow::slotSessionChanged( Session* ses ) { 423void MainWindow::slotSessionChanged( Session* ses ) {
444 qWarning("changed!"); 424 qWarning("changed!");
445 if ( ses ) { 425 if ( ses ) {
446 m_curSession = ses; 426 m_curSession = ses;
447 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 427 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
448 if ( m_curSession->layer()->isConnected() ) { 428 if ( m_curSession->layer()->isConnected() ) {
449 m_connect->setEnabled( false ); 429 m_connect->setEnabled( false );
450 m_disconnect->setEnabled( true ); 430 m_disconnect->setEnabled( true );
451 } else { 431 } else {
452 m_connect->setEnabled( true ); 432 m_connect->setEnabled( true );
453 m_disconnect->setEnabled( false ); 433 m_disconnect->setEnabled( false );
454 } 434 }
455 } 435 }
456} 436}
457 437
458void MainWindow::slotFullscreen() { 438void MainWindow::slotFullscreen() {
459 439
460 if ( m_isFullscreen ) { 440 if ( m_isFullscreen ) {
461 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); 441 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false );
462 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 442 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
463 setCentralWidget( m_consoleWindow ); 443 setCentralWidget( m_consoleWindow );
464 ( m_curSession->widgetStack() )->show(); 444 ( m_curSession->widgetStack() )->show();
465 m_fullscreen->setText( tr("Full screen") ); 445 ( m_curSession->emulationHandler() )->cornerButton()->hide();
446 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
466 447
467 } else { 448 } else {
468 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 449 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
469 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 450 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
470 , QPoint(0,0), false); 451 , QPoint(0,0), false );
471 ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); 452 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
472 ( m_curSession->widgetStack() )->setFocus(); 453 ( m_curSession->widgetStack() )->setFocus();
473 ( m_curSession->widgetStack() )->show(); 454 ( m_curSession->widgetStack() )->show();
474 455
475 QPushButton *cornerButton = new QPushButton( m_curSession->widgetStack() ); 456 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
476 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 457
477 connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 458 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
478 // would need a scrollview
479 // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton );
480 m_fullscreen->setText( tr("Stop full screen") );
481 } 459 }
482 m_isFullscreen = !m_isFullscreen;
483 460
461 m_isFullscreen = !m_isFullscreen;
484} 462}
485 463
486 464
487void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) { 465void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) {
488 466
489 qWarning("received key event! relay to TE widget"); 467 qWarning("received key event! relay to TE widget");
490 468
491 if ( m_curSession ) { 469 if ( m_curSession ) {
492 QKeyEvent ke(QEvent::KeyPress, q, u, 0); 470 QKeyEvent ke(QEvent::KeyPress, q, u, 0);
493 471
494 ke.ignore(); 472 ke.ignore();
495 // where should i send this event? doesnt work sending it here 473 // where should i send this event? doesnt work sending it here
496 QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke); 474 QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke);
497 } 475 }
498} 476}