00001 /* Copyright (C) 2006 P.L. Lucas 00002 * 00003 * This program is free software; you can redistribute it and/or modify 00004 * it under the terms of the GNU General Public License as published by 00005 * the Free Software Foundation; either version 2 of the License, or 00006 * (at your option) any later version. 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program; if not, write to the Free Software 00015 * Foundation, Inc., 59 Temple Place, Suite 330, 00016 * Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef __TERMINAL_H__ 00020 #define __TERMINAL_H__ 00021 00022 #include <QTextEdit> 00023 #include <QComboBox> 00024 #include <QPushButton> 00025 #include <QWorkspace> 00026 #include "basewidget.h" 00027 #include "octave_connection.h" 00028 #include "dynamic_help.h" 00029 00030 /** Builds windows with QtextEdit and QLineEdit. QTextEdit shows OctaveConnection output. 00031 * QLineEdit is used to write commands. 00032 * 00033 */ 00034 00035 class Terminal:public BaseWidget 00036 { 00037 Q_OBJECT 00038 public: 00039 Terminal( QWidget * parent = 0 ); 00040 QTextEdit *getTextEdit(); 00041 void setOctaveConnection(OctaveConnection *octave_connection); 00042 OctaveConnection *getOctaveConnection(); 00043 void command_enter(const QString &text); 00044 QWorkspace *work_space; 00045 private: 00046 QTextEdit *text; 00047 QComboBox *combo_box; 00048 //QPushButton *completion_matches_button, *dynamic_help_button, *stop_process_button, *clear_button; 00049 OctaveConnection *octave_connection; 00050 Dynamic_help *dynamic_help; 00051 int lines_in_terminal; 00052 int cols_in_terminal; 00053 void remove_lines(QTextCursor &cursor); 00054 public slots: 00055 void return_pressed(); 00056 void write_output(QString output); 00057 void write_error(QString error); 00058 void write_command(QString command); 00059 void completion_matches_callback(); 00060 void dynamic_help_callback(); 00061 void stop_process_callback(); 00062 void clear_callback(); 00063 }; 00064 00065 00066 #endif