# HG changeset patch # User Jacob Dawid # Date 1342816517 14400 # Node ID aa6cba8ae88bec3a3c833ea1b8b0eed9c83ba5ba # Parent 22bd268429d3fcaee83359c2941885101c3d1c67 Inserted msleep to reduce cpu usage on grabbing data from stdin. diff --git a/libqterminal/unix/SelfListener.cpp b/libqterminal/unix/SelfListener.cpp --- a/libqterminal/unix/SelfListener.cpp +++ b/libqterminal/unix/SelfListener.cpp @@ -1,3 +1,20 @@ +/* qterminal - a terminal widget for Qt + * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "unix/SelfListener.h" SelfListener::SelfListener(int a, QObject *parent) : @@ -6,14 +23,16 @@ } void SelfListener::run() { - char buf[1025]; + char buf[4096]; int len; - - while(1) { - len = ::read(_a, buf, 1024); - if (len > 0) { - buf[len] = 0; // Just in case. - emit recvData(buf, len); - } + bool running = true; + while(running) { + while((len = ::read(_a, buf, 4096)) > 0) { + buf[len] = 0; // Just in case. + emit recvData(buf, len); + msleep(30); + } + if(len < 0) + running = false; } } diff --git a/libqterminal/unix/SelfListener.h b/libqterminal/unix/SelfListener.h --- a/libqterminal/unix/SelfListener.h +++ b/libqterminal/unix/SelfListener.h @@ -1,3 +1,20 @@ +/* qterminal - a terminal widget for Qt + * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef SELFLISTENER_H #define SELFLISTENER_H diff --git a/libqterminal/unix/TerminalView.cpp b/libqterminal/unix/TerminalView.cpp --- a/libqterminal/unix/TerminalView.cpp +++ b/libqterminal/unix/TerminalView.cpp @@ -2422,34 +2422,6 @@ _allowBell = true; } -void TerminalView::bell(const QString&) -{ - if (_bellMode==NoBell) return; - - //limit the rate at which bells can occur - //...mainly for sound effects where rapid bells in sequence - //produce a horrible noise - if ( _allowBell ) - { - _allowBell = false; - QTimer::singleShot(500,this,SLOT(enableBell())); - - if (_bellMode==SystemBeepBell) - { - // KNotification::beep(); - } - else if (_bellMode==NotifyBell) - { - // KNotification::event("BellVisible", message,QPixmap(),this); - } - else if (_bellMode==VisualBell) - { - swapColorTable(); - QTimer::singleShot(200,this,SLOT(swapColorTable())); - } - } -} - void TerminalView::swapColorTable() { ColorEntry color = _colorTable[1]; diff --git a/libqterminal/unix/TerminalView.h b/libqterminal/unix/TerminalView.h --- a/libqterminal/unix/TerminalView.h +++ b/libqterminal/unix/TerminalView.h @@ -442,12 +442,6 @@ /** See setUsesMouse() */ bool usesMouse() const; - /** - * Shows a notification that a bell event has occurred in the terminal. - * TODO: More documentation here - */ - void bell(const QString& message); - signals: /** @@ -456,14 +450,6 @@ void keyPressedSignal(QKeyEvent *e); /** - * Emitted when the user presses the suspend or resume flow control key combinations - * - * @param suspend true if the user pressed Ctrl+S (the suspend output key combination) or - * false if the user pressed Ctrl+Q (the resume output key combination) - */ - void flowControlKeyPressed(bool suspend); - - /** * A mouse event occurred. * @param button The mouse button (0 for left button, 1 for middle button, 2 for right button, 3 for release) * @param column The character column where the event occurred diff --git a/libqterminal/unix/Vt102Emulation.cpp b/libqterminal/unix/Vt102Emulation.cpp --- a/libqterminal/unix/Vt102Emulation.cpp +++ b/libqterminal/unix/Vt102Emulation.cpp @@ -43,10 +43,6 @@ #include #include -// KDE -//#include -//#include - // Konsole #include "unix/KeyboardTranslator.h" #include "unix/Screen.h" @@ -1262,5 +1258,4 @@ #endif } -//#include "moc_Vt102Emulation.cpp"