summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TEWidget.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/embeddedkonsole/TEWidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp157
1 files changed, 148 insertions, 9 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index b1ad008..c10c7a8 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -54,2 +54,9 @@
+#include <qpe/resource.h>
+#include <qpe/sound.h>
+
+#ifdef QWS
+#include <qpe/qcopenvelope_qws.h>
+#endif
+
#include <qcursor.h>
@@ -289,2 +296,9 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
+ hScrollbar = new QScrollBar(this);
+ hScrollbar->setCursor( arrowCursor );
+ hScrollbar->setOrientation(QScrollBar::Horizontal);
+ hScrollbar->setMaximumHeight(16);
+
+ connect( hScrollbar, SIGNAL(valueChanged(int)), this, SLOT( hScrollChanged(int)));
+
Config cfg("Konsole");
@@ -303,2 +317,4 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
+ useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
+
blinkT = new QTimer(this);
@@ -317,2 +333,3 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
word_selection_mode = FALSE;
+ hposition = 0;
@@ -412,6 +429,3 @@ HCNT("setImage");
QChar *disstrU = new QChar[cols];
-
-//{ static int cnt = 0; printf("setImage %d\n",cnt++); }
- for (y = 0; y < lins; y++)
- {
+ for (y = 0; y < lins; y++) {
const ca* lcl = &image[y*this->columns];
@@ -590,4 +604,3 @@ void TEWidget::propagateSize()
-void TEWidget::scrollChanged(int)
-{
+void TEWidget::scrollChanged(int) {
emit changedHistoryCursor(scrollbar->value()); //expose
@@ -595,2 +608,10 @@ void TEWidget::scrollChanged(int)
+void TEWidget::hScrollChanged(int loc) {
+ hposition = loc;
+ propagateSize();
+ update();
+
+// emit changedHorzCursor( hScrollbar->value()); //expose
+}
+
void TEWidget::setScroll(int cursor, int slines)
@@ -699,2 +720,3 @@ void TEWidget::mouseMoveEvent(QMouseEvent* ev)
int scroll = scrollbar->value();
+// int hScroll = hScrollbar->value();
@@ -975,2 +997,6 @@ void TEWidget::doScroll(int lines)
+void TEWidget::doHScroll(int lines) {
+ hScrollbar->setValue( hScrollbar->value()+lines);
+}
+
bool TEWidget::eventFilter( QObject *obj, QEvent *e )
@@ -1080,3 +1106,13 @@ void TEWidget::Bell()
{
- QApplication::beep();
+//#ifdef QT_QWS_CUSTOM
+//# ifndef QT_NO_COP
+ QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
+//# endif
+//#else
+//# ifndef QT_NO_SOUND
+// QSound::play(Resource::findSound("alarm"));
+//# endif
+//#endif
+
+// QApplication::beep();
}
@@ -1107,3 +1143,72 @@ void TEWidget::calcGeometry()
{
- //FIXME: set rimX == rimY == 0 when running in full screen mode.
+ int showhscrollbar = 1;
+ int hwidth = 0;
+ int dcolumns;
+ Config cfg("Konsole");
+ cfg.setGroup("ScrollBar");
+ useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
+
+ if(vcolumns == 0) showhscrollbar = 0;
+ if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width();
+
+ scrollbar->resize(QApplication::style().scrollBarExtent().width(),
+ contentsRect().height() - hwidth);
+
+ switch(scrollLoc) {
+ case SCRNONE :
+ columns = ( contentsRect().width() - 2 * rimX ) / font_w;
+ dcolumns = columns;
+ if(vcolumns) columns = vcolumns;
+ blX = (contentsRect().width() - (columns*font_w) ) / 2;
+ if(showhscrollbar)
+ blX = -hposition * font_w;
+ brX = blX;
+ scrollbar->hide();
+ break;
+ case SCRLEFT :
+ columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
+ dcolumns = columns;
+ if(vcolumns) columns = vcolumns;
+ brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
+ if(showhscrollbar)
+ brX = -hposition * font_w;
+ blX = brX + scrollbar->width();
+ scrollbar->move(contentsRect().topLeft());
+ scrollbar->show();
+ break;
+ case SCRRIGHT:
+ columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
+ dcolumns = columns;
+ if(vcolumns) columns = vcolumns;
+ blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
+ if(showhscrollbar)
+ blX = -hposition * font_w;
+ brX = blX;
+ scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
+ scrollbar->show();
+ break;
+ }
+ //FIXME: support 'rounding' styles
+ lines = ( contentsRect().height() - 2 * rimY ) / font_h;
+ bY = (contentsRect().height() - (lines *font_h)) / 2;
+
+ if(showhscrollbar == 1) {
+ hScrollbar->resize(contentsRect().width() - hwidth, hwidth);
+ hScrollbar->setRange(0, vcolumns - dcolumns);
+
+ QPoint p = contentsRect().bottomLeft();
+ hScrollbar->move(QPoint(p.x(), p.y() - hwidth));
+ hScrollbar->show();
+ }
+ else hScrollbar->hide();
+
+ if(showhscrollbar == 1) {
+ lines = lines - (hwidth / font_h) - 1;
+ if(lines < 1) lines = 1;
+ }
+
+ /*//FIXME: set rimX == rimY == 0 when running in full screen mode.
+ Config cfg("Konsole");
+ cfg.setGroup("ScrollBar");
+ useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
@@ -1111,2 +1216,3 @@ void TEWidget::calcGeometry()
contentsRect().height());
+ qDebug("font_w %d", font_w);
switch(scrollLoc)
@@ -1121,2 +1227,3 @@ void TEWidget::calcGeometry()
columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
+ if(useHorzScroll) columns = columns * (font_w/2);
brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
@@ -1128,4 +1235,9 @@ void TEWidget::calcGeometry()
columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
+ if(useHorzScroll) columns = columns * (font_w/2);
blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
+ if(useHorzScroll) {
+ brX = blX =2;
+ } else {
brX = blX;
+ }
scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
@@ -1134,3 +1246,19 @@ void TEWidget::calcGeometry()
}
- //FIXME: support 'rounding' styles
+
+ if( !scrollbar->isHidden())
+ hScrollbar->resize( contentsRect().width()-SCRWIDTH, QApplication::style()
+ .scrollBarExtent().height());
+ else
+ hScrollbar->resize( contentsRect().width(), QApplication::style()
+ .scrollBarExtent().height());
+
+ hScrollbar->move( 0, contentsRect().height() - SCRWIDTH);
+
+
+ if(useHorzScroll) {
+ hScrollbar->show();
+ lines = ( (contentsRect().height() - SCRWIDTH) - 2 * rimY ) / font_h;
+ bY = ((contentsRect().height() - SCRWIDTH) - (lines *font_h)) / 2;
+ } else {
+ hScrollbar->hide();
lines = ( contentsRect().height() - 2 * rimY ) / font_h;
@@ -1138,2 +1266,5 @@ void TEWidget::calcGeometry()
}
+ */
+ //FIXME: support 'rounding' styles
+}
@@ -1268 +1399,9 @@ void TEWidget::drop_menu_activated(int item)
+void TEWidget::setWrapAt(int columns)
+{
+ vcolumns = columns;
+ propagateSize();
+ update();
+}
+
+