Mercurial > hg > octave-nkf
changeset 13648:da69cec2459f
Renamed OctaveTerminal to TerminalView.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Tue, 23 Aug 2011 20:31:51 +0200 |
parents | ac3d9480292d |
children | 0a19410e88c0 bfac3c49cfd0 |
files | gui/octave-gui.pro gui/src/FileEditorMdiSubWindow.cpp gui/src/FileEditorMdiSubWindow.h gui/src/MainWindow.cpp gui/src/MainWindow.h gui/src/OctaveTerminal.cpp gui/src/OctaveTerminal.h gui/src/TerminalView.cpp gui/src/TerminalView.h |
diffstat | 7 files changed, 50 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/octave-gui.pro +++ b/gui/octave-gui.pro @@ -59,7 +59,6 @@ SOURCES +=\ src/lexer/lexeroctavegui.cpp \ src/MainWindow.cpp \ - src/OctaveTerminal.cpp \ src/VariablesDockWidget.cpp \ src/HistoryDockWidget.cpp \ src/FilesDockWidget.cpp \ @@ -79,12 +78,12 @@ src/terminal/LinuxTerminalEmulation.cpp \ src/backend/ReadlineAdapter.cpp \ src/terminal/KPty.cpp \ - src/terminal/KPtyDevice.cpp + src/terminal/KPtyDevice.cpp \ + src/TerminalView.cpp HEADERS += \ src/lexer/lexeroctavegui.h \ src/MainWindow.h \ - src/OctaveTerminal.h \ src/VariablesDockWidget.h \ src/HistoryDockWidget.h \ src/FilesDockWidget.h \ @@ -104,7 +103,8 @@ src/terminal/LinuxTerminalEmulation.h \ src/backend/ReadlineAdapter.h \ src/terminal/KPtyDevice.h \ - src/terminal/KPty.h + src/terminal/KPty.h \ + src/TerminalView.h FORMS += \ src/SettingsDialog.ui
--- a/gui/src/FileEditorMdiSubWindow.cpp +++ b/gui/src/FileEditorMdiSubWindow.cpp @@ -242,8 +242,8 @@ { if (m_editor->isModified ()) saveFile(m_fileName); - m_octave->sendText (QString ("run \'%1\'\n").arg (m_fileName)); - m_octave->setFocus (); + m_terminalEmulation->transmitText (QString ("run \'%1\'\n").arg (m_fileName)); + //m_terminalEmulation->setFocus (); } // toggle bookmark @@ -282,11 +282,11 @@ // function for setting the already existing lexer from MainWindow void -FileEditorMdiSubWindow::initEditor (OctaveTerminal* terminal, +FileEditorMdiSubWindow::initEditor (TerminalEmulation* terminalEmulation, LexerOctaveGui* lexer) { m_editor->setLexer(lexer); - m_octave = terminal; // for sending commands to octave + m_terminalEmulation = terminalEmulation; // for sending commands to octave // TODO: make a global commandOctave function? }
--- a/gui/src/FileEditorMdiSubWindow.h +++ b/gui/src/FileEditorMdiSubWindow.h @@ -19,7 +19,7 @@ #ifndef FILEEDITORMDISUBWINDOW_H #define FILEEDITORMDISUBWINDOW_H -#include "OctaveTerminal.h" +#include "TerminalEmulation.h" #include <QMdiSubWindow> #include <QToolBar> #include <QAction> @@ -45,7 +45,7 @@ FileEditorMdiSubWindow (QWidget * parent = 0); ~FileEditorMdiSubWindow (); void loadFile (QString fileName); - void initEditor (OctaveTerminal *terminal, LexerOctaveGui *lexer); + void initEditor (TerminalEmulation *terminalEmulation, LexerOctaveGui *lexer); public slots: @@ -74,7 +74,7 @@ QsciScintilla *m_editor; QStatusBar *m_statusBar; QString m_fileName; - OctaveTerminal* m_octave; + TerminalEmulation* m_terminalEmulation; QAction* m_copyAction; QAction* m_cutAction; int m_markerBookmark;
--- a/gui/src/MainWindow.cpp +++ b/gui/src/MainWindow.cpp @@ -96,7 +96,7 @@ } m_lexerAPI->prepare(); // prepare API info ... this make take some time } - subWindow->initEditor(m_octaveTerminal,m_lexer); // init necessary informations for editor + subWindow->initEditor(m_terminalView->terminalEmulation(), m_lexer); // init necessary informations for editor if ( fileName.isEmpty() ) subWindow->newFile (); @@ -123,8 +123,8 @@ QString selectedFile = QFileDialog::getSaveFileName (this, tr ("Save Workspace"), ResourceManager::instance ()->homePath ()); - m_octaveTerminal->sendText (QString ("save \'%1\'\n").arg (selectedFile)); - m_octaveTerminal->setFocus (); + m_terminalView->sendText (QString ("save \'%1\'\n").arg (selectedFile)); + m_terminalView->setFocus (); } void @@ -133,22 +133,22 @@ QString selectedFile = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ResourceManager::instance ()->homePath ()); - m_octaveTerminal->sendText (QString ("load \'%1\'\n").arg (selectedFile)); - m_octaveTerminal->setFocus (); + m_terminalView->sendText (QString ("load \'%1\'\n").arg (selectedFile)); + m_terminalView->setFocus (); } void MainWindow::handleClearWorkspaceRequest () { - m_octaveTerminal->sendText ("clear\n"); - m_octaveTerminal->setFocus (); + m_terminalView->sendText ("clear\n"); + m_terminalView->setFocus (); } void MainWindow::handleCommandDoubleClicked (QString command) { - m_octaveTerminal->sendText (command); - m_octaveTerminal->setFocus (); + m_terminalView->sendText (command); + m_terminalView->setFocus (); } void @@ -281,22 +281,22 @@ m_statusBar = new QStatusBar (this); // Setup essential MDI Windows. - m_octaveTerminal = new OctaveTerminal (this); + m_terminalView = new TerminalView (this); m_documentationWidget = new BrowserWidget (this); m_ircWidget = new IRCWidget (this); // Octave Terminal subwindow. - m_octaveTerminalSubWindow = new NonClosableMdiSubWindow (this); - m_octaveTerminalSubWindow->setWidget (m_octaveTerminal); - m_centralMdiArea->addSubWindow (m_octaveTerminalSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); + m_terminalViewSubWindow = new NonClosableMdiSubWindow (this); + m_terminalViewSubWindow->setWidget (m_terminalView); + m_centralMdiArea->addSubWindow (m_terminalViewSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); - m_octaveTerminalSubWindow->setObjectName ("OctaveTerminalSubWindow"); - m_octaveTerminalSubWindow->setWindowTitle (tr ("Terminal")); - m_octaveTerminalSubWindow + m_terminalViewSubWindow->setObjectName ("OctaveTerminalSubWindow"); + m_terminalViewSubWindow->setWindowTitle (tr ("Terminal")); + m_terminalViewSubWindow ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Terminal)); - m_octaveTerminalSubWindow->setFocusProxy (m_octaveTerminal); - m_octaveTerminalSubWindow->setStatusTip (tr ("Enter your commands into the Octave terminal.")); - m_octaveTerminalSubWindow->setMinimumSize (300, 300); + m_terminalViewSubWindow->setFocusProxy (m_terminalView); + m_terminalViewSubWindow->setStatusTip (tr ("Enter your commands into the Octave terminal.")); + m_terminalViewSubWindow->setMinimumSize (300, 300); // Documentation subwindow. m_documentationWidgetSubWindow = new NonClosableMdiSubWindow (this);
--- a/gui/src/MainWindow.h +++ b/gui/src/MainWindow.h @@ -29,7 +29,7 @@ #include <Qsci/qsciapis.h> #include <QMdiSubWindow> #include "ResourceManager.h" -#include "OctaveTerminal.h" +#include "TerminalView.h" #include "OctaveLink.h" #include "VariablesDockWidget.h" #include "HistoryDockWidget.h" @@ -63,9 +63,9 @@ MainWindow (QWidget * parent = 0); ~MainWindow (); - OctaveTerminal *octaveTerminal () + TerminalView *terminalView () { - return m_octaveTerminal; + return m_terminalView; } VariablesDockWidget *variablesDockWidget () { @@ -112,11 +112,11 @@ QMdiArea *m_centralMdiArea; // Mdi sub windows. - OctaveTerminal *m_octaveTerminal; + TerminalView *m_terminalView; BrowserWidget *m_documentationWidget; IRCWidget *m_ircWidget; - NonClosableMdiSubWindow *m_octaveTerminalSubWindow; + NonClosableMdiSubWindow *m_terminalViewSubWindow; NonClosableMdiSubWindow *m_documentationWidgetSubWindow; NonClosableMdiSubWindow *m_ircWidgetSubWindow;
rename from gui/src/OctaveTerminal.cpp rename to gui/src/TerminalView.cpp --- a/gui/src/OctaveTerminal.cpp +++ b/gui/src/TerminalView.cpp @@ -16,44 +16,44 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "OctaveTerminal.h" +#include "TerminalView.h" #include <QHBoxLayout> #include <QVBoxLayout> #include <QStringListModel> #include <QStringList> #include <QScrollBar> -OctaveTerminal::OctaveTerminal (QWidget * parent) +TerminalView::TerminalView (QWidget * parent) : QPlainTextEdit (parent), Terminal () { setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); m_terminalEmulation = TerminalEmulation::newTerminalEmulation (this); } -OctaveTerminal::~OctaveTerminal () +TerminalView::~TerminalView () { } QTextCursor -OctaveTerminal::textCursor () +TerminalView::textCursor () { return QPlainTextEdit::textCursor(); } void -OctaveTerminal::setTextCursor (const QTextCursor &cursor) +TerminalView::setTextCursor (const QTextCursor &cursor) { QPlainTextEdit::setTextCursor (cursor); } void -OctaveTerminal::bell () +TerminalView::bell () { } void -OctaveTerminal::keyPressEvent (QKeyEvent * keyEvent) +TerminalView::keyPressEvent (QKeyEvent * keyEvent) { m_terminalEmulation->processKeyEvent (keyEvent); }
rename from gui/src/OctaveTerminal.h rename to gui/src/TerminalView.h --- a/gui/src/OctaveTerminal.h +++ b/gui/src/TerminalView.h @@ -21,12 +21,17 @@ #include <QPlainTextEdit> #include "TerminalEmulation.h" -class OctaveTerminal:public QPlainTextEdit, Terminal +class TerminalView:public QPlainTextEdit, Terminal { Q_OBJECT public: - OctaveTerminal (QWidget * parent = 0); - ~OctaveTerminal (); + TerminalView (QWidget * parent = 0); + ~TerminalView (); + + TerminalEmulation *terminalEmulation () + { + return m_terminalEmulation; + } void sendText (QString text) { m_terminalEmulation->transmitText(text); }