summaryrefslogtreecommitdiff
authoribotty <ibotty>2002-10-14 08:54:34 (UTC)
committer ibotty <ibotty>2002-10-14 08:54:34 (UTC)
commit59d6018e53537e15d27cd0174adefba2ec8b8f6e (patch) (unidiff)
tree5f55e9c314b7918b1abf92d2a98561039a499084
parent2c2d282f3d665035300873bddab6e64c843ebc0e (diff)
downloadopie-59d6018e53537e15d27cd0174adefba2ec8b8f6e.zip
opie-59d6018e53537e15d27cd0174adefba2ec8b8f6e.tar.gz
opie-59d6018e53537e15d27cd0174adefba2ec8b8f6e.tar.bz2
added sizeHint method, hopefully (dont really think so) fixes size problem
VS: ----------------------------------------------------------------------
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp9
-rw-r--r--noncore/apps/opie-console/emulation_widget.h2
-rw-r--r--noncore/apps/opie-console/widget_layer.cpp6
-rw-r--r--noncore/apps/opie-console/widget_layer.h5
4 files changed, 21 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index e11c5e4..40199fa 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -81,24 +81,31 @@ static QChar vt100extended(QChar c)
81 case 0x2502 : return 25; 81 case 0x2502 : return 25;
82 case 0x2264 : return 26; 82 case 0x2264 : return 26;
83 case 0x2265 : return 27; 83 case 0x2265 : return 27;
84 case 0x03c0 : return 28; 84 case 0x03c0 : return 28;
85 case 0x2260 : return 29; 85 case 0x2260 : return 29;
86 case 0x00a3 : return 30; 86 case 0x00a3 : return 30;
87 case 0x00b7 : return 31; 87 case 0x00b7 : return 31;
88 } 88 }
89 return c; 89 return c;
90} 90}
91 91
92 92
93QSize EmulationWidget::calcSize( int cols, int lins ) const
94{
95 int frw = width() - contentsRect().width();
96 int frh = height() - contentsRect().height();
97 int scw = (scrollLoc == SCRNONE? 0 : m_scrollbar->width() );
98 return QSize( f_width * cols + 2 * rimX + frw + scw, f_height * lins + 2 * rimY + frh );
99}
93 100
94void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns ) 101void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns )
95{ 102{
96 const QPixmap* pm = backgroundPixmap(); 103 const QPixmap* pm = backgroundPixmap();
97 QPainter paint; 104 QPainter paint;
98 105
99 // dont allow updates, while drawing 106 // dont allow updates, while drawing
100 setUpdatesEnabled( false ); 107 setUpdatesEnabled( false );
101 108
102 paint.begin( this ); 109 paint.begin( this );
103 110
104 QPoint tL = contentsRect().topLeft(); 111 QPoint tL = contentsRect().topLeft();
@@ -108,25 +115,25 @@ void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int c
108 115
109 int cf = -1; 116 int cf = -1;
110 int cb = -1; 117 int cb = -1;
111 int cr = -1; 118 int cr = -1;
112 119
113 int lins = QMIN( m_lines, QMAX( 0, lines ) ); 120 int lins = QMIN( m_lines, QMAX( 0, lines ) );
114 int cols = QMIN( m_columns, QMAX( 0, columns ) ); 121 int cols = QMIN( m_columns, QMAX( 0, columns ) );
115 QArray<QChar> disstrU = QArray<QChar>( cols ); 122 QArray<QChar> disstrU = QArray<QChar>( cols );
116 123
117 for ( int y = 0; y < lins; ++y ) 124 for ( int y = 0; y < lins; ++y )
118 {int len; 125 {int len;
119 const Character* lcl = &m_image[y * m_columns]; 126 const Character* lcl = &m_image[y * m_columns];
120 const Character* ext = &newimg[y * columns]; 127 const Character* ext = &newimg[y * m_columns];
121 if ( ! m_resizing ) 128 if ( ! m_resizing )
122 for ( int x = 0; x < cols; ++x ) 129 for ( int x = 0; x < cols; ++x )
123 { 130 {
124 // disable, till widget works, WITHOUT blinking 131 // disable, till widget works, WITHOUT blinking
125 //hasBlinker |= ( ext[x].r & RE_BLINK ); 132 //hasBlinker |= ( ext[x].r & RE_BLINK );
126 133
127 if ( ext[x] != lcl[x] ) 134 if ( ext[x] != lcl[x] )
128 { 135 {
129 cr = ext[x].r; 136 cr = ext[x].r;
130 cb = ext[x].b; 137 cb = ext[x].b;
131 if ( ext[x].f != cf ) cf = ext[x].f; 138 if ( ext[x].f != cf ) cf = ext[x].f;
132 int lln = cols - x; 139 int lln = cols - x;
diff --git a/noncore/apps/opie-console/emulation_widget.h b/noncore/apps/opie-console/emulation_widget.h
index e185534..5e20dc4 100644
--- a/noncore/apps/opie-console/emulation_widget.h
+++ b/noncore/apps/opie-console/emulation_widget.h
@@ -51,24 +51,26 @@ public:
51 51
52 /** 52 /**
53 * sets the scrollbar (not yet implemented) 53 * sets the scrollbar (not yet implemented)
54 */ 54 */
55 virtual void setScroll( int cursor, int slines ); 55 virtual void setScroll( int cursor, int slines );
56 56
57 /** 57 /**
58 * scrolls (not yet implemented) 58 * scrolls (not yet implemented)
59 * @param int value, scroll by this value 59 * @param int value, scroll by this value
60 */ 60 */
61 virtual void scroll( int value ); 61 virtual void scroll( int value );
62 62
63 virtual QSize calcSize( int cols, int lins ) const;
64
63protected: 65protected:
64 66
65 /** 67 /**
66 * calculates current image bounds 68 * calculates current image bounds
67 */ 69 */
68 virtual void calcGeometry(); 70 virtual void calcGeometry();
69 71
70 72
71 /** 73 /**
72 * @param const ColorEntry* table, the new color table 74 * @param const ColorEntry* table, the new color table
73 */ 75 */
74 void setColorTable( const ColorEntry table[] ); 76 void setColorTable( const ColorEntry table[] );
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp
index e4b0ede..ac84f8b 100644
--- a/noncore/apps/opie-console/widget_layer.cpp
+++ b/noncore/apps/opie-console/widget_layer.cpp
@@ -44,24 +44,30 @@ WidgetLayer::WidgetLayer( const Profile &config, QWidget *parent, const char *na
44 qApp->installEventFilter( this ); 44 qApp->installEventFilter( this );
45 45
46} 46}
47 47
48 48
49WidgetLayer::~WidgetLayer() 49WidgetLayer::~WidgetLayer()
50{ 50{
51 // clean up 51 // clean up
52 delete m_image; 52 delete m_image;
53} 53}
54 54
55 55
56QSize WidgetLayer::sizeHint()
57{
58 return size();
59}
60
61
56/* --------------------------------- audio ---------------------------------- */ 62/* --------------------------------- audio ---------------------------------- */
57 63
58void WidgetLayer::bell() 64void WidgetLayer::bell()
59{ 65{
60 QApplication::beep(); 66 QApplication::beep();
61} 67}
62 68
63bool WidgetLayer::eventFilter( QObject *obj, QEvent *e ) 69bool WidgetLayer::eventFilter( QObject *obj, QEvent *e )
64{ 70{
65 if ( (e->type() == QEvent::Accel || 71 if ( (e->type() == QEvent::Accel ||
66 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { 72 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
67 static_cast<QKeyEvent *>( e )->ignore(); 73 static_cast<QKeyEvent *>( e )->ignore();
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h
index 0c290f3..6812711 100644
--- a/noncore/apps/opie-console/widget_layer.h
+++ b/noncore/apps/opie-console/widget_layer.h
@@ -114,24 +114,29 @@ public:
114 * sets the scrollbar (if implemented by successor of this class) 114 * sets the scrollbar (if implemented by successor of this class)
115 */ 115 */
116 virtual void setScroll( int cursor, int slines ) = 0; 116 virtual void setScroll( int cursor, int slines ) = 0;
117 117
118 /** 118 /**
119 * scrolls (if implemented, by successor of this class) 119 * scrolls (if implemented, by successor of this class)
120 * @param int value, how much the widget should scroll up (positive value) or down (negative value) 120 * @param int value, how much the widget should scroll up (positive value) or down (negative value)
121 */ 121 */
122 virtual void scroll( int value ) = 0; 122 virtual void scroll( int value ) = 0;
123 123
124 124
125 virtual bool eventFilter( QObject *obj, QEvent *event ); 125 virtual bool eventFilter( QObject *obj, QEvent *event );
126
127
128 QSize sizeHint();
129
130 virtual QSize calcSize( int cols, int lins ) const = 0;
126signals: 131signals:
127 132
128 /** 133 /**
129 * key was pressed 134 * key was pressed
130 */ 135 */
131 void keyPressed( QKeyEvent *e ); 136 void keyPressed( QKeyEvent *e );
132 137
133 /** 138 /**
134 * whenever Mouse selects something 139 * whenever Mouse selects something
135 * @param int button, the button that us pressed : 140 * @param int button, the button that us pressed :
136 * 0left Button 141 * 0left Button
137 * 3Button released 142 * 3Button released