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 9 files changed, 143 insertions(+), 138 deletions(-) [+]
line wrap: on
line diff
--- a/gui/octave-gui.pro	Tue Aug 23 18:22:27 2011 +0200
+++ b/gui/octave-gui.pro	Tue Aug 23 20:31:51 2011 +0200
@@ -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	Tue Aug 23 18:22:27 2011 +0200
+++ b/gui/src/FileEditorMdiSubWindow.cpp	Tue Aug 23 20:31:51 2011 +0200
@@ -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	Tue Aug 23 18:22:27 2011 +0200
+++ b/gui/src/FileEditorMdiSubWindow.h	Tue Aug 23 20:31:51 2011 +0200
@@ -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	Tue Aug 23 18:22:27 2011 +0200
+++ b/gui/src/MainWindow.cpp	Tue Aug 23 20:31:51 2011 +0200
@@ -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	Tue Aug 23 18:22:27 2011 +0200
+++ b/gui/src/MainWindow.h	Tue Aug 23 20:31:51 2011 +0200
@@ -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;
 
--- a/gui/src/OctaveTerminal.cpp	Tue Aug 23 18:22:27 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "OctaveTerminal.h"
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QStringListModel>
-#include <QStringList>
-#include <QScrollBar>
-
-OctaveTerminal::OctaveTerminal (QWidget * parent)
-  : QPlainTextEdit (parent), Terminal ()
-{
-    setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
-    m_terminalEmulation = TerminalEmulation::newTerminalEmulation (this);
-}
-
-OctaveTerminal::~OctaveTerminal ()
-{
-}
-
-QTextCursor
-OctaveTerminal::textCursor ()
-{
-  return QPlainTextEdit::textCursor();
-}
-
-void
-OctaveTerminal::setTextCursor (const QTextCursor &cursor)
-{
-  QPlainTextEdit::setTextCursor (cursor);
-}
-
-void
-OctaveTerminal::bell ()
-{
-
-}
-
-void
-OctaveTerminal::keyPressEvent (QKeyEvent * keyEvent)
-{
-  m_terminalEmulation->processKeyEvent (keyEvent);
-}
--- a/gui/src/OctaveTerminal.h	Tue Aug 23 18:22:27 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* OctaveGUI - A graphical user interface for Octave
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef OCTAVETERMINAL_H
-#define OCTAVETERMINAL_H
-#include <QPlainTextEdit>
-#include "TerminalEmulation.h"
-
-class OctaveTerminal:public QPlainTextEdit, Terminal
-{
-Q_OBJECT
-public:
-  OctaveTerminal (QWidget * parent = 0);
-  ~OctaveTerminal ();
-
-  void sendText (QString text) { m_terminalEmulation->transmitText(text); }
-
-  // Terminal Interface
-  QTextCursor textCursor();
-  void setTextCursor (const QTextCursor &cursor);
-  void bell ();
-
-protected:
-  void keyPressEvent (QKeyEvent *keyEvent);
-
-private:
-  TerminalEmulation *m_terminalEmulation;
-};
-#endif // OCTAVETERMINAL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/src/TerminalView.cpp	Tue Aug 23 20:31:51 2011 +0200
@@ -0,0 +1,59 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "TerminalView.h"
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QStringListModel>
+#include <QStringList>
+#include <QScrollBar>
+
+TerminalView::TerminalView (QWidget * parent)
+  : QPlainTextEdit (parent), Terminal ()
+{
+    setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
+    m_terminalEmulation = TerminalEmulation::newTerminalEmulation (this);
+}
+
+TerminalView::~TerminalView ()
+{
+}
+
+QTextCursor
+TerminalView::textCursor ()
+{
+  return QPlainTextEdit::textCursor();
+}
+
+void
+TerminalView::setTextCursor (const QTextCursor &cursor)
+{
+  QPlainTextEdit::setTextCursor (cursor);
+}
+
+void
+TerminalView::bell ()
+{
+
+}
+
+void
+TerminalView::keyPressEvent (QKeyEvent * keyEvent)
+{
+  m_terminalEmulation->processKeyEvent (keyEvent);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/src/TerminalView.h	Tue Aug 23 20:31:51 2011 +0200
@@ -0,0 +1,49 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef OCTAVETERMINAL_H
+#define OCTAVETERMINAL_H
+#include <QPlainTextEdit>
+#include "TerminalEmulation.h"
+
+class TerminalView:public QPlainTextEdit, Terminal
+{
+Q_OBJECT
+public:
+  TerminalView (QWidget * parent = 0);
+  ~TerminalView ();
+
+  TerminalEmulation *terminalEmulation ()
+  {
+    return m_terminalEmulation;
+  }
+
+  void sendText (QString text) { m_terminalEmulation->transmitText(text); }
+
+  // Terminal Interface
+  QTextCursor textCursor();
+  void setTextCursor (const QTextCursor &cursor);
+  void bell ();
+
+protected:
+  void keyPressEvent (QKeyEvent *keyEvent);
+
+private:
+  TerminalEmulation *m_terminalEmulation;
+};
+#endif // OCTAVETERMINAL_H