# HG changeset patch # User Jacob Dawid # Date 1336344834 -7200 # Node ID 97cb9286919c1664a83a61ba416c98fd065a064d # Parent fa52c6e84ae0cf4828e4abf1b8f3d6f2c4777f16 Cleaned up code. * .hgsub: Removed IRC Widget. * gui.pro: Removed dependency on IRC Widget and removed files. * class FileEditorMdiSubWindow: Renamed to FileEditor. File editor windows are now independent windows, thus removed the extra close button. * MainWindow: Removed MDI Area and replaced it with the terminal instead. * BrowserWidget: Removed browser widget. * SettingsDialog: Rearranged settings for the editor, removed tab for shortcuts. * OctaveCallbackThread: Raised update intervals from 0,5s to 1s. * OctaveLink: Replaced signals names for triggering updates on the symbol table. * WorkspaceView: Adjusted connect statements to fit the new signal names. diff --git a/.hgsub b/.hgsub --- a/.hgsub +++ b/.hgsub @@ -1,3 +1,2 @@ gnulib = [git]git://git.sv.gnu.org/gnulib gui/qterminal = [git]https://code.google.com/p/qterminal/ -gui/qirc = [git]https://code.google.com/p/qirc diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,3 +1,2 @@ f9813bce2c06a6130a68db4478d1b16ddadaf276 gnulib -34c2a274a1b607d2616d9903099a0905237c8f80 gui/qirc a81f99b9b77d9a402b92463b41c5fdb82324349a gui/qterminal diff --git a/gui/gui.pro b/gui/gui.pro --- a/gui/gui.pro +++ b/gui/gui.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = qterminal qirc src +SUBDIRS = qterminal src diff --git a/gui/src/BrowserWidget.cpp b/gui/src/BrowserWidget.cpp deleted file mode 100644 --- a/gui/src/BrowserWidget.cpp +++ /dev/null @@ -1,105 +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 . - */ - -#include "BrowserWidget.h" -#include -#include -#include -#include - -BrowserWidget::BrowserWidget (QWidget * parent):QWidget (parent) -{ - construct (); -} - -void -BrowserWidget::construct () -{ - QStyle *style = QApplication::style (); - m_navigationToolBar = new QToolBar (this); - m_webView = new QWebView (this); - m_urlLineEdit = new QLineEdit (this); - m_statusBar = new QStatusBar (this); - m_progressBar = new QProgressBar (this); - m_progressBar->setMaximumWidth (150); - - m_webView->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); - QAction *backAction = - new QAction (style->standardIcon (QStyle::SP_ArrowLeft), - "", m_navigationToolBar); - QAction *forwardAction = - new QAction (style->standardIcon (QStyle::SP_ArrowRight), - "", m_navigationToolBar); - - m_navigationToolBar->addAction (backAction); - m_navigationToolBar->addAction (forwardAction); - m_navigationToolBar->addWidget (m_urlLineEdit); - - QVBoxLayout *layout = new QVBoxLayout (); - layout->addWidget (m_navigationToolBar); - layout->addWidget (m_webView); - - QWidget *bottomWidget = new QWidget (this); - QHBoxLayout *bottomLineLayout = new QHBoxLayout (); - bottomLineLayout->addWidget (m_progressBar); - bottomLineLayout->addWidget (m_statusBar); - bottomLineLayout->setMargin (0); - bottomWidget->setLayout (bottomLineLayout); - - layout->addWidget (bottomWidget); - layout->setMargin (2); - setLayout (layout); - - connect (backAction, SIGNAL (triggered ()), m_webView, SLOT (back ())); - connect (forwardAction, SIGNAL (triggered ()), m_webView, - SLOT (forward ())); - connect (m_webView, SIGNAL (urlChanged (QUrl)), this, SLOT (setUrl (QUrl))); - connect (m_urlLineEdit, SIGNAL (returnPressed ()), this, - SLOT (jumpToWebsite ())); - - connect (m_webView, SIGNAL (statusBarMessage(QString)), - m_statusBar, SLOT (showMessage(QString))); - connect (m_webView, SIGNAL (loadProgress(int)), - m_progressBar, SLOT (setValue(int))); -} - -void -BrowserWidget::setUrl (QUrl url) -{ - m_urlLineEdit->setText (url.toString ()); -} - -void -BrowserWidget::jumpToWebsite () -{ - QString url = m_urlLineEdit->text (); - if (!url.startsWith ("http://") && !url.startsWith ("https://")) - url = "http://" + url; - load (url); -} - -void -BrowserWidget::showStatusMessage (QString message) -{ - m_statusBar->showMessage (message, 1000); -} - -void -BrowserWidget::load (QUrl url) -{ - m_webView->load (url); -} diff --git a/gui/src/BrowserWidget.h b/gui/src/BrowserWidget.h deleted file mode 100644 --- a/gui/src/BrowserWidget.h +++ /dev/null @@ -1,50 +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 . - */ - -#ifndef BROWSERMDISUBWINDOW_H -#define BROWSERMDISUBWINDOW_H - -#include -#include -#include -#include -#include -#include - -class BrowserWidget:public QWidget -{ - Q_OBJECT -public: - BrowserWidget (QWidget * parent = 0); - void load (QUrl url); - -public slots: - void setUrl (QUrl url); - void jumpToWebsite (); - void showStatusMessage (QString message); - -private: - void construct (); - - QLineEdit *m_urlLineEdit; - QToolBar *m_navigationToolBar; - QWebView *m_webView; - QStatusBar *m_statusBar; - QProgressBar *m_progressBar; -}; - -#endif // BROWSERMDISUBWINDOW_H diff --git a/gui/src/FileEditorMdiSubWindow.cpp b/gui/src/FileEditor.cpp rename from gui/src/FileEditorMdiSubWindow.cpp rename to gui/src/FileEditor.cpp --- a/gui/src/FileEditorMdiSubWindow.cpp +++ b/gui/src/FileEditor.cpp @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -#include "FileEditorMdiSubWindow.h" +#include "FileEditor.h" #include #include #include @@ -25,18 +25,18 @@ #include #include -FileEditorMdiSubWindow::FileEditorMdiSubWindow (QWidget * parent):QMdiSubWindow - (parent) +FileEditor::FileEditor (QWidget * parent) + : QWidget (parent) { construct (); } -FileEditorMdiSubWindow::~FileEditorMdiSubWindow () +FileEditor::~FileEditor () { } void -FileEditorMdiSubWindow::closeEvent(QCloseEvent *event) +FileEditor::closeEvent(QCloseEvent *event) { if ( m_mainWindow->isCloseApplication() ) { @@ -54,7 +54,7 @@ } void -FileEditorMdiSubWindow::handleMarginClicked(int margin, int line, Qt::KeyboardModifiers state) +FileEditor::handleMarginClicked(int margin, int line, Qt::KeyboardModifiers state) { Q_UNUSED (state); if ( margin == 1 ) // marker margin @@ -68,7 +68,7 @@ } void -FileEditorMdiSubWindow::newWindowTitle(bool modified) +FileEditor::newWindowTitle(bool modified) { QString title(m_fileName); if ( !m_longTitle ) @@ -85,7 +85,7 @@ } void -FileEditorMdiSubWindow::handleCopyAvailable(bool enableCopy) +FileEditor::handleCopyAvailable(bool enableCopy) { m_copyAction->setEnabled(enableCopy); m_cutAction->setEnabled(enableCopy); @@ -93,7 +93,7 @@ void -FileEditorMdiSubWindow::openFile () +FileEditor::openFile () { if (checkFileModified ("Open File",QMessageBox::Cancel)==QMessageBox::Cancel) { @@ -114,14 +114,14 @@ } void -FileEditorMdiSubWindow::loadFile (QString fileName) +FileEditor::loadFile (QString fileName) { QFile file (fileName); if (!file.open (QFile::ReadOnly)) { QMessageBox::warning (this, tr ("File Editor"), - tr ("Cannot read file %1:\n%2.").arg (fileName). - arg (file.errorString ())); + tr ("Cannot read file %1:\n%2.").arg (fileName). + arg (file.errorString ())); return; } @@ -137,12 +137,13 @@ } void -FileEditorMdiSubWindow::newFile () +FileEditor::newFile () { if (checkFileModified ("Create New File",QMessageBox::Cancel)==QMessageBox::Cancel) { return; // existing file not saved and creating new file canceled by user } + m_fileName = UNNAMED_FILE; newWindowTitle (false); // window title (no modification) m_editor->setText (""); @@ -150,7 +151,7 @@ } int -FileEditorMdiSubWindow::checkFileModified (QString msg, int cancelButton) +FileEditor::checkFileModified (QString msg, int cancelButton) { int decision = QMessageBox::Yes; if (m_editor->isModified ()) @@ -182,13 +183,13 @@ } void -FileEditorMdiSubWindow::saveFile () +FileEditor::saveFile () { saveFile(m_fileName); } void -FileEditorMdiSubWindow::saveFile (QString saveFileName) +FileEditor::saveFile (QString saveFileName) { // it is a new file with the name "" -> call saveFielAs if (saveFileName==UNNAMED_FILE || saveFileName.isEmpty ()) @@ -219,7 +220,7 @@ } void -FileEditorMdiSubWindow::saveFileAs () +FileEditor::saveFileAs () { QString saveFileName(m_fileName); QFileDialog dlg(this); @@ -247,7 +248,7 @@ // handle the run command void -FileEditorMdiSubWindow::runFile () +FileEditor::runFile () { if (m_editor->isModified ()) saveFile(m_fileName); @@ -258,17 +259,17 @@ // (un)comment selected text void -FileEditorMdiSubWindow::commentSelectedText () +FileEditor::commentSelectedText () { doCommentSelectedText (true); } void -FileEditorMdiSubWindow::uncommentSelectedText () +FileEditor::uncommentSelectedText () { doCommentSelectedText (false); } void -FileEditorMdiSubWindow::doCommentSelectedText (bool comment) +FileEditor::doCommentSelectedText (bool comment) { if ( m_editor->hasSelectedText() ) { @@ -298,13 +299,13 @@ // remove bookmarks void -FileEditorMdiSubWindow::removeBookmark () +FileEditor::removeBookmark () { m_editor->markerDeleteAll(MARKER_BOOKMARK); } // toggle bookmark void -FileEditorMdiSubWindow::toggleBookmark () +FileEditor::toggleBookmark () { int line,cur; m_editor->getCursorPosition(&line,&cur); @@ -315,7 +316,7 @@ } // goto next bookmark void -FileEditorMdiSubWindow::nextBookmark () +FileEditor::nextBookmark () { int line,cur,nextline; m_editor->getCursorPosition(&line,&cur); @@ -326,7 +327,7 @@ } // goto previous bookmark void -FileEditorMdiSubWindow::prevBookmark () +FileEditor::prevBookmark () { int line,cur,prevline; m_editor->getCursorPosition(&line,&cur); @@ -338,7 +339,7 @@ // function for setting the already existing lexer from MainWindow void -FileEditorMdiSubWindow::initEditor (QTerminal* terminalView, +FileEditor::initEditor (QTerminal* terminalView, LexerOctaveGui* lexer, MainWindow* mainWindow) { @@ -348,56 +349,17 @@ m_mainWindow = mainWindow; // get the MainWindow for chekcing state at subwindow close } -// TODO: Do we still need tool tips in the status bar? Tool tips are now -// shown directly at the theme icons void -FileEditorMdiSubWindow::showToolTipNew () -{ - m_statusBar->showMessage ("Create a new file", 2000); -} - -void -FileEditorMdiSubWindow::showToolTipOpen () -{ - m_statusBar->showMessage ("Open a file", 2000); -} - -void -FileEditorMdiSubWindow::showToolTipSave () -{ - m_statusBar->showMessage ("Save the file", 2000); -} - -void -FileEditorMdiSubWindow::showToolTipSaveAs () -{ - m_statusBar->showMessage ("Save the file as", 2000); -} - -void -FileEditorMdiSubWindow::showToolTipUndo () -{ - m_statusBar->showMessage ("Revert previous changes", 2000); -} - -void -FileEditorMdiSubWindow::showToolTipRedo () -{ - m_statusBar->showMessage ("Append previous changes", 2000); -} - -void -FileEditorMdiSubWindow::registerModified (bool modified) +FileEditor::setModified (bool modified) { m_modified = modified; } void -FileEditorMdiSubWindow::construct () +FileEditor::construct () { QSettings *settings = ResourceManager::instance ()->settings (); QStyle *style = QApplication::style (); - setWidget (new QWidget ()); m_menuBar = new QMenuBar (this); m_toolBar = new QToolBar (this); @@ -449,9 +411,6 @@ // The Actions // Theme icons with QStyle icons as fallback - QAction *closeAction = new QAction ( - QIcon::fromTheme("window-close",style->standardIcon (QStyle::SP_DialogCloseButton)), - tr("&Close File"), m_toolBar); QAction *newAction = new QAction ( QIcon::fromTheme("document-new",style->standardIcon (QStyle::SP_FileIcon)), tr("&New File"), m_toolBar); @@ -506,8 +465,6 @@ uncommentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_T); // toolbar - m_toolBar->setIconSize(QSize(16,16)); // smaller icons (make configurable in user settings?) - m_toolBar->addAction (closeAction); m_toolBar->addAction (newAction); m_toolBar->addAction (openAction); m_toolBar->addAction (saveAction); @@ -528,7 +485,6 @@ fileMenu->addAction(saveAction); fileMenu->addAction(saveAsAction); fileMenu->addSeparator(); - fileMenu->addAction (closeAction); m_menuBar->addMenu(fileMenu); QMenu *editMenu = new QMenu(tr("&Edit"),m_menuBar); editMenu->addAction(undoAction); @@ -557,9 +513,8 @@ layout->addWidget (m_editor); layout->addWidget (m_statusBar); layout->setMargin (2); - widget ()->setLayout (layout); + setLayout (layout); - connect (closeAction, SIGNAL (triggered()), this, SLOT (close())); connect (newAction, SIGNAL (triggered ()), this, SLOT (newFile ())); connect (openAction, SIGNAL (triggered ()), this, SLOT (openFile ())); connect (undoAction, SIGNAL (triggered ()), m_editor, SLOT (undo ())); @@ -577,14 +532,6 @@ connect (commentSelectedAction, SIGNAL (triggered ()), this, SLOT (commentSelectedText ())); connect (uncommentSelectedAction, SIGNAL (triggered ()), this, SLOT (uncommentSelectedText ())); - // TODO: Do we still need tool tips in the status bar? Tool tips are now - // shown directly at the theme icons - connect (newAction, SIGNAL (hovered ()), this, SLOT (showToolTipNew ())); - connect (openAction, SIGNAL (hovered ()), this, SLOT (showToolTipOpen ())); - connect (undoAction, SIGNAL (hovered ()), this, SLOT (showToolTipUndo ())); - connect (redoAction, SIGNAL (hovered ()), this, SLOT (showToolTipRedo ())); - connect (saveAction, SIGNAL (hovered ()), this, SLOT (showToolTipSave ())); - connect (saveAsAction, SIGNAL (hovered ()), this,SLOT (showToolTipSaveAs ())); // connect modified signal connect (m_editor, SIGNAL (modificationChanged(bool)), this, SLOT (newWindowTitle(bool)) ); diff --git a/gui/src/FileEditorMdiSubWindow.h b/gui/src/FileEditor.h rename from gui/src/FileEditorMdiSubWindow.h rename to gui/src/FileEditor.h --- a/gui/src/FileEditorMdiSubWindow.h +++ b/gui/src/FileEditor.h @@ -20,7 +20,7 @@ #include "MainWindow.h" -#include +#include #include #include #include @@ -39,13 +39,13 @@ MARKER_BREAKPOINT }; -class FileEditorMdiSubWindow:public QMdiSubWindow +class FileEditor : public QWidget { Q_OBJECT public: - FileEditorMdiSubWindow (QWidget * parent = 0); - ~FileEditorMdiSubWindow (); + FileEditor (QWidget * parent = 0); + ~FileEditor (); void loadFile (QString fileName); void initEditor (QTerminal *terminalView, LexerOctaveGui *lexer, @@ -59,13 +59,7 @@ void saveFile (QString fileName); void saveFileAs (); - void showToolTipNew (); - void showToolTipOpen (); - void showToolTipSave (); - void showToolTipSaveAs (); - void showToolTipUndo (); - void showToolTipRedo (); - void registerModified (bool modified); + void setModified (bool modified); protected: void closeEvent(QCloseEvent *event); diff --git a/gui/src/MainWindow.cpp b/gui/src/MainWindow.cpp --- a/gui/src/MainWindow.cpp +++ b/gui/src/MainWindow.cpp @@ -23,13 +23,14 @@ #include #include #include "MainWindow.h" -#include "FileEditorMdiSubWindow.h" +#include "FileEditor.h" #include "SettingsDialog.h" #define VERSION_STRING "Octave GUI (0.8.8)" MainWindow::MainWindow (QWidget * parent):QMainWindow (parent) { + // We have to set up all our windows, before we finally launch octave. construct (); OctaveLink::instance ()->launchOctave(); } @@ -39,33 +40,23 @@ } void -MainWindow::handleOpenFileRequest (QString fileName) +MainWindow::openExistingFile (QString fileName) { - reportStatusMessage (tr ("Opening file.")); - QPixmap pixmap; - if (pixmap.load (fileName)) - { -// ImageViewerMdiSubWindow *subWindow = new ImageViewerMdiSubWindow(pixmap, this); -// subWindow->setAttribute(Qt::WA_DeleteOnClose); -// m_centralMdiArea->addSubWindow(subWindow); -// subWindow->setWindowTitle(fileName); - } - else - { - openEditorFile(fileName); - } + reportStatusMessage (tr ("Opening file..")); + newEditorWindow(fileName); } void -MainWindow::openEditor () +MainWindow::newFile () { - openEditorFile(QString()); + newEditorWindow(QString()); } + void -MainWindow::openEditorFile (QString fileName) +MainWindow::newEditorWindow (QString fileName) { - FileEditorMdiSubWindow *subWindow = new FileEditorMdiSubWindow (m_centralMdiArea); - subWindow->setAttribute (Qt::WA_DeleteOnClose); + FileEditor *fileEditor = new FileEditor (); + fileEditor->setAttribute (Qt::WA_DeleteOnClose); // check whether lexer is already prepared and prepare it if not if ( m_lexer == NULL ) { @@ -97,12 +88,12 @@ } m_lexerAPI->prepare(); // prepare API info ... this make take some time } - subWindow->initEditor(m_terminalView, m_lexer, this); // init necessary informations for editor + fileEditor->initEditor(m_terminalView, m_lexer, this); // init necessary informations for editor if ( fileName.isEmpty() ) - subWindow->newFile (); + fileEditor->newFile (); else - subWindow->loadFile (fileName); + fileEditor->loadFile (fileName); } @@ -113,29 +104,6 @@ } void -MainWindow::openWebPage (QString url) -{ - m_documentationWidget->load (QUrl (url)); -} - -void -MainWindow::openChat () -{ - if (!m_ircWidget) - { - m_ircWidget = new QIRCWidget (); - m_ircWidget->setWindowTitle ("Chat"); - m_ircWidget->connectToServer ("irc.freenode.net", "Octave-GUI-User", "#octave"); - } - - if (!m_ircWidget->isVisible ()) - { - m_ircWidget->setVisible (true); - m_ircWidget->raise (); - } -} - -void MainWindow::handleSaveWorkspaceRequest () { QString selectedFile = @@ -170,12 +138,6 @@ } void -MainWindow::alignMdiWindows () -{ - m_centralMdiArea->tileSubWindows (); -} - -void MainWindow::openBugTrackerPage () { QDesktopServices::openUrl (QUrl ("http://savannah.gnu.org/bugs/?group=octave")); @@ -241,20 +203,13 @@ } void -MainWindow::showAboutQt () -{ - QMessageBox::aboutQt (this); -} - -void MainWindow::closeEvent (QCloseEvent * closeEvent) { reportStatusMessage (tr ("Saving data and shutting down.")); writeSettings (); m_closeApplication = true; // inform editor window that whole application is closed OctaveLink::instance ()->terminateOctave(); - m_centralMdiArea->closeAllSubWindows(); // send close events to subwindows - // (editor files can be saved!) + QMainWindow::closeEvent (closeEvent); } @@ -264,7 +219,6 @@ QSettings *settings = ResourceManager::instance ()->settings (); restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ()); restoreState (settings->value ("MainWindow/windowState").toByteArray ()); - m_centralMdiArea->restoreGeometry (settings->value ("MdiArea/geometry").toByteArray ()); emit settingsChanged (); } @@ -274,22 +228,15 @@ QSettings *settings = ResourceManager::instance ()->settings (); settings->setValue ("MainWindow/geometry", saveGeometry ()); settings->setValue ("MainWindow/windowState", saveState ()); - settings->setValue ("MdiArea/geometry", m_centralMdiArea->saveGeometry ()); } void MainWindow::construct () { + // TODO: Check this. m_closeApplication = false; // flag for editor files when closed setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Octave)); - m_ircWidget = 0; - - // Initialize MDI area. - m_centralMdiArea = new QMdiArea (this); - m_centralMdiArea->setObjectName ("CentralMdiArea"); - m_centralMdiArea->setViewMode (QMdiArea::TabbedView); - // Setup dockable widgets and the status bar. m_workspaceView = new WorkspaceView (this); m_workspaceView->setStatusTip (tr ("View the variables in the active workspace.")); @@ -299,33 +246,9 @@ m_filesDockWidget->setStatusTip (tr ("Browse your files.")); m_statusBar = new QStatusBar (this); - // Documentation subwindow. - m_documentationWidget = new BrowserWidget (this); - m_documentationWidgetSubWindow = new NonClosableMdiSubWindow (this); - m_documentationWidgetSubWindow->setWidget (m_documentationWidget); - m_centralMdiArea->addSubWindow (m_documentationWidgetSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); - - m_documentationWidgetSubWindow->setObjectName ("DocumentationWidgetSubWindow"); - m_documentationWidgetSubWindow->setWindowTitle (tr ("Documentation")); - m_documentationWidgetSubWindow - ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Documentation)); - m_documentationWidgetSubWindow->setFocusProxy (m_documentationWidget); - m_documentationWidgetSubWindow->setStatusTip (tr ("Browse the Octave documentation for help.")); - m_documentationWidgetSubWindow->setMinimumSize (300, 300); - // Octave Terminal subwindow. m_terminalView = new QTerminal(this); - m_terminalViewSubWindow = new NonClosableMdiSubWindow (this); - m_terminalViewSubWindow->setWidget (m_terminalView); - m_centralMdiArea->addSubWindow (m_terminalViewSubWindow, Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); - - m_terminalViewSubWindow->setObjectName ("OctaveTerminalSubWindow"); - m_terminalViewSubWindow->setWindowTitle (tr ("Terminal")); - m_terminalViewSubWindow - ->setWindowIcon (ResourceManager::instance ()->icon (ResourceManager::Terminal)); - m_terminalViewSubWindow->setFocusProxy (m_terminalView); - m_terminalViewSubWindow->setStatusTip (tr ("Enter your commands into the Octave terminal.")); - m_terminalViewSubWindow->setMinimumSize (300, 300); + setCentralWidget (m_terminalView); m_lexer = NULL; // initialise the empty lexer for the edtiors @@ -336,8 +259,6 @@ QMenu *interfaceMenu = menuBar ()->addMenu (tr ("Interface")); - QAction *alignWindowsAction = interfaceMenu->addAction (tr ("Align Windows")); - interfaceMenu->addSeparator (); QAction *showWorkspaceAction = interfaceMenu->addAction (tr ("Workspace")); showWorkspaceAction->setCheckable (true); @@ -357,25 +278,19 @@ QAction *clearWorkspaceAction = workspaceMenu->addAction (tr ("Clear")); QMenu *communityMenu = menuBar ()->addMenu (tr ("Community")); - QAction *openChatAction = communityMenu->addAction (tr ("Chat")); - communityMenu->addSeparator(); QAction *reportBugAction = communityMenu->addAction (tr ("Report Bug")); QAction *agoraAction = communityMenu->addAction (tr ("Agora")); QAction *octaveForgeAction = communityMenu->addAction (tr ("Octave Forge")); communityMenu->addSeparator (); QAction *aboutOctaveAction = communityMenu->addAction (tr ("About Octave")); - QAction *aboutQt = communityMenu->addAction (tr ("About Qt")); connect (settingsAction, SIGNAL (triggered ()), this, SLOT (processSettingsDialogRequest ())); connect (exitAction, SIGNAL (triggered ()), this, SLOT (close ())); - connect (alignWindowsAction, SIGNAL (triggered ()), this, SLOT (alignMdiWindows ())); - connect (openEditorAction, SIGNAL (triggered ()), this, SLOT (openEditor ())); - connect (openChatAction, SIGNAL (triggered ()), this, SLOT (openChat ())); + connect (openEditorAction, SIGNAL (triggered ()), this, SLOT (newFile ())); connect (reportBugAction, SIGNAL (triggered ()), this, SLOT (openBugTrackerPage ())); connect (agoraAction, SIGNAL (triggered ()), this, SLOT (openAgoraPage ())); connect (octaveForgeAction, SIGNAL (triggered ()), this, SLOT (openOctaveForgePage ())); connect (aboutOctaveAction, SIGNAL (triggered ()), this, SLOT (showAboutOctave ())); - connect (aboutQt, SIGNAL (triggered ()), this, SLOT (showAboutQt ())); connect (showWorkspaceAction, SIGNAL (toggled (bool)), m_workspaceView, SLOT (setShown (bool))); connect (m_workspaceView, SIGNAL (activeChanged (bool)), showWorkspaceAction, SLOT (setChecked (bool))); @@ -388,7 +303,7 @@ //connect (this, SIGNAL (settingsChanged ()), m_historyDockWidget, SLOT (noticeSettings ())); connect (this, SIGNAL (settingsChanged ()), m_filesDockWidget, SLOT (noticeSettings ())); - connect (m_filesDockWidget, SIGNAL (openFile (QString)), this, SLOT (handleOpenFileRequest (QString))); + connect (m_filesDockWidget, SIGNAL (openFile (QString)), this, SLOT (openExistingFile (QString))); connect (m_historyDockWidget, SIGNAL (information (QString)), this, SLOT (reportStatusMessage (QString))); connect (m_historyDockWidget, SIGNAL (commandDoubleClicked (QString)), this, SLOT (handleCommandDoubleClicked (QString))); connect (saveWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleSaveWorkspaceRequest ())); @@ -397,7 +312,6 @@ setWindowTitle (QString (VERSION_STRING)); - setCentralWidget (m_centralMdiArea); addDockWidget (Qt::LeftDockWidgetArea, m_workspaceView); addDockWidget (Qt::LeftDockWidgetArea, m_historyDockWidget); addDockWidget (Qt::RightDockWidgetArea, m_filesDockWidget); @@ -405,6 +319,5 @@ readSettings (); updateTerminalFont(); - openWebPage ("http://www.gnu.org/software/octave/doc/interpreter/"); } diff --git a/gui/src/MainWindow.h b/gui/src/MainWindow.h --- a/gui/src/MainWindow.h +++ b/gui/src/MainWindow.h @@ -18,6 +18,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H +// Qt includes #include #include #include @@ -25,32 +26,22 @@ #include #include #include -#include #include #include + +// QScintilla includes +#include +#include "lexer/lexeroctavegui.h" + +// QTerminal includes +#include "QTerminal.h" + +// Own includes #include "ResourceManager.h" #include "OctaveLink.h" #include "WorkspaceView.h" #include "HistoryDockWidget.h" #include "FilesDockWidget.h" -#include "BrowserWidget.h" -#include "lexer/lexeroctavegui.h" -#include "QTerminal.h" -#include "QIRCWidget.h" - -class NonClosableMdiSubWindow : public QMdiSubWindow -{ - Q_OBJECT -public: - explicit NonClosableMdiSubWindow (QWidget *parent = 0) - : QMdiSubWindow (parent) { } - virtual ~NonClosableMdiSubWindow () { } -protected: - void closeEvent (QCloseEvent *closeEvent) - { - closeEvent->ignore (); - } -}; /** * \class MainWindow @@ -85,23 +76,19 @@ void settingsChanged (); public slots: - void handleOpenFileRequest (QString fileName); + void openExistingFile (QString fileName); void reportStatusMessage (QString statusMessage); - void openWebPage (QString url); - void openChat (); void handleSaveWorkspaceRequest (); void handleLoadWorkspaceRequest (); void handleClearWorkspaceRequest (); void handleCommandDoubleClicked (QString command); - void alignMdiWindows (); - void openEditor (); - void openEditorFile (QString fileName); + void newFile (); + void newEditorWindow (QString fileName); void openBugTrackerPage (); void openAgoraPage (); void openOctaveForgePage (); void processSettingsDialogRequest (); void showAboutOctave (); - void showAboutQt (); void updateTerminalFont (); protected: @@ -112,15 +99,8 @@ private: void construct (); void establishOctaveLink (); - QMdiArea *m_centralMdiArea; - // Mdi sub windows. QTerminal *m_terminalView; - BrowserWidget *m_documentationWidget; - QIRCWidget *m_ircWidget; - - NonClosableMdiSubWindow *m_terminalViewSubWindow; - NonClosableMdiSubWindow *m_documentationWidgetSubWindow; // Dock widgets. WorkspaceView *m_workspaceView; diff --git a/gui/src/SettingsDialog.cpp b/gui/src/SettingsDialog.cpp --- a/gui/src/SettingsDialog.cpp +++ b/gui/src/SettingsDialog.cpp @@ -56,33 +56,6 @@ ui->proxyPort->setText (settings->value ("proxyPort").toString ()); ui->proxyUserName->setText (settings->value ("proxyUserName").toString ()); ui->proxyPassword->setText (settings->value ("proxyPassword").toString ()); - - // Short cuts - QStringList headerLabels; - headerLabels << "Modifier" << "Key" << "Action"; - ui->shortcutTableWidget->setColumnCount (3); - ui->shortcutTableWidget->setRowCount (10); - ui->shortcutTableWidget->horizontalHeader ()->setStretchLastSection (true); - ui->shortcutTableWidget->setHorizontalHeaderLabels (headerLabels); - ui->shortcutTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - ui->shortcutTableWidget->setSelectionMode(QAbstractItemView::SingleSelection); - - /* - newAction->setShortcut(QKeySequence::New); - openAction->setShortcut(QKeySequence::Open); - saveAction->setShortcut(QKeySequence::Save); - saveAsAction->setShortcut(QKeySequence::SaveAs); - undoAction->setShortcut(QKeySequence::Undo); - redoAction->setShortcut(QKeySequence::Redo); - m_copyAction->setShortcut(QKeySequence::Copy); - m_cutAction->setShortcut(QKeySequence::Cut); - pasteAction->setShortcut(QKeySequence::Paste); - runAction->setShortcut(Qt::Key_F5); - nextBookmarkAction->setShortcut(Qt::Key_F2); - prevBookmarkAction->setShortcut(Qt::SHIFT + Qt::Key_F2); - toggleBookmarkAction->setShortcut(Qt::Key_F7); - commentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_R); - uncommentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_T);*/ } SettingsDialog::~SettingsDialog () diff --git a/gui/src/SettingsDialog.ui b/gui/src/SettingsDialog.ui --- a/gui/src/SettingsDialog.ui +++ b/gui/src/SettingsDialog.ui @@ -34,93 +34,62 @@ 0 - - - Interface - - - - - - Shortcuts: - - - - - - - false - - - - - - - - - false - - - Add - - - - - - - false - - - Remove - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Editor - + - + - + - - - true + + + Font - - Use custom file editor: + + + + + + false - - - false - + - emacs + Font Size + + + + 2 + + + 96 + + + 10 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -172,30 +141,74 @@ - + + + Qt::Vertical + + + + 20 + 40 + + + + + + - + + + true + + + Use custom file editor: + + + + + + + false + + + emacs + + + + + + + + + + Terminal + + + + + + Font - + false - + Font Size - + 2 @@ -208,7 +221,7 @@ - + Qt::Horizontal @@ -223,84 +236,20 @@ - + Qt::Vertical 20 - 40 + 321 - - - Terminal - - - - - 10 - 10 - 436 - 22 - - - - - - - Font - - - - - - - false - - - - - - - Font Size - - - - - - - 2 - - - 96 - - - 10 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - File Browser diff --git a/gui/src/WorkspaceView.cpp b/gui/src/WorkspaceView.cpp --- a/gui/src/WorkspaceView.cpp +++ b/gui/src/WorkspaceView.cpp @@ -59,8 +59,10 @@ m_variablesTreeWidget->setAlternatingRowColors (true); m_variablesTreeWidget->setAnimated (true); - connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handleVisibilityChanged(bool))); - connect (OctaveLink::instance(), SIGNAL (symbolTableChanged()), this, SLOT (fetchSymbolTable())); + connect (this, SIGNAL (visibilityChanged (bool)), + this, SLOT(handleVisibilityChanged (bool))); + connect (OctaveLink::instance(), SIGNAL (updateSymbolTable ()), + this, SLOT (fetchSymbolTable ())); } void @@ -68,7 +70,7 @@ { treeItem->setData (0, 0, QString (symbolRecord.name ().c_str ())); treeItem->setData (1, 0, - QString (symbolRecord.varval ().type_name ().c_str ())); + QString (symbolRecord.varval ().type_name ().c_str ())); treeItem->setData (2, 0, OctaveLink::octaveValueAsQString (symbolRecord. varval ())); diff --git a/gui/src/backend/OctaveCallbackThread.cpp b/gui/src/backend/OctaveCallbackThread.cpp --- a/gui/src/backend/OctaveCallbackThread.cpp +++ b/gui/src/backend/OctaveCallbackThread.cpp @@ -39,9 +39,9 @@ bool running = true; while (running) { - OctaveLink::instance ()->emitSymbolTableChanged(); - OctaveLink::instance ()->updateHistoryModel (); - usleep (500000); + OctaveLink::instance ()->triggerUpdateSymbolTable (); + OctaveLink::instance ()->triggerUpdateHistoryModel (); + usleep (1000000); m_runningSemaphore->acquire (); running = m_running; diff --git a/gui/src/backend/OctaveLink.cpp b/gui/src/backend/OctaveLink.cpp --- a/gui/src/backend/OctaveLink.cpp +++ b/gui/src/backend/OctaveLink.cpp @@ -121,12 +121,15 @@ std::list < SymbolRecord >::iterator iterator; for (iterator = allVariables.begin (); iterator != allVariables.end (); iterator++) - m_symbolTableBuffer.append (iterator->dup()); + { + SymbolRecord s = iterator->dup (); + m_symbolTableBuffer.append (s); + } return m_symbolTableBuffer; } void -OctaveLink::updateHistoryModel () +OctaveLink::triggerUpdateHistoryModel () { // Determine the client's (our) history length and the one of the server. int clientHistoryLength = m_historyModel->rowCount (); diff --git a/gui/src/backend/OctaveLink.h b/gui/src/backend/OctaveLink.h --- a/gui/src/backend/OctaveLink.h +++ b/gui/src/backend/OctaveLink.h @@ -111,12 +111,12 @@ */ QList < SymbolRecord > copyCurrentSymbolTable (); - void updateHistoryModel (); + void triggerUpdateHistoryModel (); QStringListModel *historyModel (); - void emitSymbolTableChanged() { emit symbolTableChanged(); } + void triggerUpdateSymbolTable() { emit updateSymbolTable(); } signals: - void symbolTableChanged (); + void updateSymbolTable (); private: OctaveLink (); diff --git a/gui/src/src.pro b/gui/src/src.pro --- a/gui/src/src.pro +++ b/gui/src/src.pro @@ -31,7 +31,6 @@ win32-msvc*: include(msvc.pri) LIBS += -lqscintilla2 \ - -L../qirc/libqirc/$$LIBDIR_SUFFIX -lqirc \ -L../qterminal/libqterminal/$$LIBDIR_SUFFIX -lqterminal \ $$system(mkoctfile -p LIBS) \ $$system(mkoctfile -p OCTAVE_LIBS) @@ -41,7 +40,7 @@ } # Includepaths and libraries to link against: -INCLUDEPATH += . backend ../qterminal/libqterminal ../qirc/libqirc \ +INCLUDEPATH += . backend ../qterminal/libqterminal \ $$system(mkoctfile -p INCFLAGS) INCFLAGS += $$system(mkoctfile -p INCFLAGS) mac { @@ -80,8 +79,6 @@ WorkspaceView.cpp \ HistoryDockWidget.cpp \ FilesDockWidget.cpp \ - FileEditorMdiSubWindow.cpp \ - BrowserWidget.cpp \ SettingsDialog.cpp \ OctaveGUI.cpp \ ResourceManager.cpp \ @@ -90,7 +87,8 @@ backend/OctaveLink.cpp \ backend/OctaveMainThread.cpp \ backend/ReadlineAdapter.cpp \ - WelcomeWizard.cpp + WelcomeWizard.cpp \ + FileEditor.cpp HEADERS += \ lexer/lexeroctavegui.h \ @@ -98,8 +96,6 @@ WorkspaceView.h \ HistoryDockWidget.h \ FilesDockWidget.h \ - FileEditorMdiSubWindow.h \ - BrowserWidget.h \ SettingsDialog.h \ ResourceManager.h \ CommandLineParser.h \ @@ -107,7 +103,8 @@ backend/OctaveLink.h \ backend/OctaveMainThread.h \ backend/ReadlineAdapter.h \ - WelcomeWizard.h + WelcomeWizard.h \ + FileEditor.h FORMS += \ SettingsDialog.ui \