Mercurial > octave-nkf
changeset 16460:4d4e7c6f839d
use consistent names for dock-widget files
* documentation-dock-widget.cc: Rename from
documentation-dockwidget.cc. Change all uses.
* documentation-dock-widget.h: Rename from
documentation-dockwidget.h. Change all uses.
* files-dock-widget.cc: Rename from files-dockwidget.cc.
Change all uses.
* files-dock-widget.h: Rename from files-dockwidget.h.
Change all uses.
* history-dock-widget.cc: Rename from history-dockwidget.cc.
Change all uses.
* history-dock-widget.h: Rename from history-dockwidget.h.
Change all uses.
* terminal-dock-widget.cc: Rename from terminal-dockwidget.cc.
Change all uses.
* terminal-dock-widget.h: Rename from terminal-dockwidget.h.
Change all uses.
* libgui/src/module.mk: Update lists.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 07 Apr 2013 12:07:10 -0400 |
parents | cbc39a3d0c42 |
children | 094bd3627ead |
files | libgui/src/documentation-dock-widget.cc libgui/src/documentation-dock-widget.h libgui/src/documentation-dockwidget.cc libgui/src/documentation-dockwidget.h libgui/src/files-dock-widget.cc libgui/src/files-dock-widget.h libgui/src/files-dockwidget.cc libgui/src/files-dockwidget.h libgui/src/history-dock-widget.cc libgui/src/history-dock-widget.h libgui/src/history-dockwidget.cc libgui/src/history-dockwidget.h libgui/src/main-window.cc libgui/src/main-window.h libgui/src/module.mk libgui/src/terminal-dock-widget.cc libgui/src/terminal-dock-widget.h libgui/src/terminal-dockwidget.cc libgui/src/terminal-dockwidget.h |
diffstat | 19 files changed, 947 insertions(+), 947 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/documentation-dock-widget.cc Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,64 @@ +/* + +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "documentation-dock-widget.h" + +documentation_dock_widget::documentation_dock_widget (QWidget *p) + : octave_dock_widget (p) +{ + setObjectName ("DocumentationDockWidget"); + setWindowIcon (QIcon (":/actions/icons/logo.png")); + setWindowTitle (tr ("Documentation")); + setStatusTip (tr ("See the documentation for help.")); + + _webinfo = new webinfo (this); + setWidget (_webinfo); +} + +void +documentation_dock_widget::connect_visibility_changed (void) +{ + connect (this, SIGNAL (visibilityChanged (bool)), + this, SLOT (handle_visibility (bool))); +} + +void +documentation_dock_widget::focus (void) +{ + if (! isVisible ()) + setVisible (true); + + setFocus (); + activateWindow (); + raise (); +} + +void +documentation_dock_widget::handle_visibility (bool visible) +{ + if (visible && ! isFloating ()) + focus (); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/documentation-dock-widget.h Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,51 @@ +/* + +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifndef DOCUMENTATIONDOCKWIDGET_H +#define DOCUMENTATIONDOCKWIDGET_H + +#include "octave-dock-widget.h" + +#include "webinfo.h" + +class documentation_dock_widget : public octave_dock_widget +{ + Q_OBJECT + +public: + + documentation_dock_widget (QWidget *parent = 0); + + void connect_visibility_changed (void); + +public slots: + + void focus (void); + + void handle_visibility (bool); + +private: + + webinfo *_webinfo; +}; + +#endif // DOCUMENTATIONDOCKWIDGET_H
--- a/libgui/src/documentation-dockwidget.cc Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "documentation-dockwidget.h" - -documentation_dock_widget::documentation_dock_widget (QWidget *p) - : octave_dock_widget (p) -{ - setObjectName ("DocumentationDockWidget"); - setWindowIcon (QIcon (":/actions/icons/logo.png")); - setWindowTitle (tr ("Documentation")); - setStatusTip (tr ("See the documentation for help.")); - - _webinfo = new webinfo (this); - setWidget (_webinfo); -} - -void -documentation_dock_widget::connect_visibility_changed (void) -{ - connect (this, SIGNAL (visibilityChanged (bool)), - this, SLOT (handle_visibility (bool))); -} - -void -documentation_dock_widget::focus (void) -{ - if (! isVisible ()) - setVisible (true); - - setFocus (); - activateWindow (); - raise (); -} - -void -documentation_dock_widget::handle_visibility (bool visible) -{ - if (visible && ! isFloating ()) - focus (); -}
--- a/libgui/src/documentation-dockwidget.h Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifndef DOCUMENTATIONDOCKWIDGET_H -#define DOCUMENTATIONDOCKWIDGET_H - -#include "octave-dock-widget.h" - -#include "webinfo.h" - -class documentation_dock_widget : public octave_dock_widget -{ - Q_OBJECT - -public: - - documentation_dock_widget (QWidget *parent = 0); - - void connect_visibility_changed (void); - -public slots: - - void focus (void); - - void handle_visibility (bool); - -private: - - webinfo *_webinfo; -}; - -#endif // DOCUMENTATIONDOCKWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/files-dock-widget.cc Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,232 @@ +/* + +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "resource-manager.h" +#include "files-dock-widget.h" + +#include <QApplication> +#include <QFileInfo> +#include <QCompleter> +#include <QSettings> +#include <QProcess> +#include <QDebug> +#include <QHeaderView> + +files_dock_widget::files_dock_widget (QWidget *p) + : octave_dock_widget (p) +{ + setObjectName ("FilesDockWidget"); + setWindowIcon (QIcon(":/actions/icons/logo.png")); + setWindowTitle (tr ("File Browser")); + setStatusTip (tr ("Browse your files.")); + + QWidget *container = new QWidget (this); + + setWidget (container); + + connect (this, SIGNAL (open_file (const QString&)), + parent (), SLOT (open_file (const QString&))); + + connect (this, SIGNAL (displayed_directory_changed (const QString&)), + parent (), SLOT (set_current_working_directory (const QString&))); + + // Create a toolbar + _navigation_tool_bar = new QToolBar ("", container); + _navigation_tool_bar->setAllowedAreas (Qt::TopToolBarArea); + _navigation_tool_bar->setMovable (false); + _navigation_tool_bar->setIconSize (QSize (20, 20)); + + _directory_icon = QIcon(":/actions/icons/up.png"); + _directory_up_action = new QAction (_directory_icon, "", _navigation_tool_bar); + _directory_up_action->setStatusTip (tr ("Move up one directory.")); + + _current_directory = new QLineEdit (_navigation_tool_bar); + _current_directory->setStatusTip (tr ("Enter the path or filename.")); + + _navigation_tool_bar->addAction (_directory_up_action); + _navigation_tool_bar->addWidget (_current_directory); + connect (_directory_up_action, SIGNAL (triggered ()), this, + SLOT (change_directory_up ())); + + // TODO: Add other buttons for creating directories + + // Create the QFileSystemModel starting in the home directory + QString homePath = QDir::homePath (); + + _file_system_model = new QFileSystemModel (this); + _file_system_model->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries); + QModelIndex rootPathIndex = _file_system_model->setRootPath (homePath); + + // Attach the model to the QTreeView and set the root index + _file_tree_view = new QTreeView (container); + _file_tree_view->setModel (_file_system_model); + _file_tree_view->setRootIndex (rootPathIndex); + _file_tree_view->setSortingEnabled (true); + _file_tree_view->setAlternatingRowColors (true); + _file_tree_view->setAnimated (true); + _file_tree_view->setStatusTip (tr ("Doubleclick a file to open it.")); + + // get sort column and order as well as cloumn state (order and width) + QSettings *settings = resource_manager::get_settings (); + // FIXME -- what should happen if settings is 0? + _file_tree_view->sortByColumn ( + settings->value ("filesdockwidget/sort_files_by_column",0).toInt (), + static_cast<Qt::SortOrder>(settings->value ("filesdockwidget/sort_files_by_order",Qt::AscendingOrder).toUInt ()) + ); + _file_tree_view->header ()->restoreState (settings->value ("filesdockwidget/column_state").toByteArray ()); + + _current_directory->setText(_file_system_model->fileInfo (rootPathIndex). + absoluteFilePath ()); + + connect (_file_tree_view, SIGNAL (doubleClicked (const QModelIndex &)), + this, SLOT (item_double_clicked (const QModelIndex &))); + + // Layout the widgets vertically with the toolbar on top + QVBoxLayout *vbox_layout = new QVBoxLayout (); + vbox_layout->setSpacing (0); + vbox_layout->addWidget (_navigation_tool_bar); + vbox_layout->addWidget (_file_tree_view); + vbox_layout->setMargin (1); + + container->setLayout (vbox_layout); + + // TODO: Add right-click contextual menus for copying, pasting, deleting files (and others) + + connect (_current_directory, SIGNAL (returnPressed ()), + this, SLOT (accept_directory_line_edit ())); + + QCompleter *completer = new QCompleter (_file_system_model, this); + _current_directory->setCompleter (completer); + + setFocusProxy (_current_directory); +} + +files_dock_widget::~files_dock_widget () +{ + QSettings *settings = resource_manager::get_settings (); + int sort_column = _file_tree_view->header ()->sortIndicatorSection (); + Qt::SortOrder sort_order = _file_tree_view->header ()->sortIndicatorOrder (); + settings->setValue ("filesdockwidget/sort_files_by_column", sort_column); + settings->setValue ("filesdockwidget/sort_files_by_order", sort_order); + settings->setValue ("filesdockwidget/column_state", _file_tree_view->header ()->saveState ()); + settings->sync (); +} + +void +files_dock_widget::connect_visibility_changed (void) +{ + connect (this, SIGNAL (visibilityChanged (bool)), + this, SLOT (handle_visibility (bool))); +} + +void +files_dock_widget::item_double_clicked (const QModelIndex& index) +{ + // Retrieve the file info associated with the model index. + QFileInfo fileInfo = _file_system_model->fileInfo (index); + + set_current_directory (fileInfo.absoluteFilePath ()); +} + +void +files_dock_widget::set_current_directory (const QString& dir) +{ + display_directory (dir); + + emit displayed_directory_changed (dir); +} + +void +files_dock_widget::accept_directory_line_edit (void) +{ + display_directory (_current_directory->text ()); +} + +void +files_dock_widget::change_directory_up (void) +{ + QDir dir = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ())); + dir.cdUp (); + display_directory (dir.absolutePath ()); +} + +void +files_dock_widget::display_directory (const QString& dir) +{ + QFileInfo fileInfo (dir); + if (fileInfo.exists ()) + { + if (fileInfo.isDir ()) + { + _file_tree_view->setRootIndex (_file_system_model-> + index (fileInfo.absoluteFilePath ())); + _file_system_model->setRootPath (fileInfo.absoluteFilePath ()); + _file_system_model->sort (0, Qt::AscendingOrder); + _current_directory->setText (fileInfo.absoluteFilePath ()); + } + else + { + if (QFile::exists (fileInfo.absoluteFilePath ())) + emit open_file (fileInfo.absoluteFilePath ()); + } + } +} + +void +files_dock_widget::notice_settings (const QSettings *settings) +{ + // Qsettings pointer is checked before emitting. + + // file names are always shown, other columns can be hidden by settings + _file_tree_view->setColumnHidden (0, false); + _file_tree_view->setColumnHidden (1, !settings->value ("showFileSize",false).toBool ()); + _file_tree_view->setColumnHidden (2, !settings->value ("showFileType",false).toBool ()); + _file_tree_view->setColumnHidden (3, !settings->value ("showLastModified",false).toBool ()); + _file_tree_view->setAlternatingRowColors (settings->value ("useAlternatingRowColors",true).toBool ()); + if (settings->value ("showHiddenFiles",false).toBool ()) + { + // TODO: React on option for hidden files. + } +} + +void +files_dock_widget::focus (void) +{ + if (! isVisible ()) + setVisible (true); + + setFocus (); + activateWindow (); + raise (); +} + +void +files_dock_widget::handle_visibility (bool visible) +{ + if (visible && ! isFloating ()) + focus (); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/files-dock-widget.h Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,109 @@ +/* + +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifndef FILESDOCKWIDGET_H +#define FILESDOCKWIDGET_H + +#include <QListView> +#include <QDate> +#include <QObject> +#include <QWidget> +#include <QListWidget> +#include <QFileSystemModel> +#include <QToolBar> +#include <QToolButton> +#include <QVBoxLayout> +#include <QAction> +#include <QTreeView> +#include <QSettings> + +#include <QLineEdit> +#include "octave-dock-widget.h" + +/** + \class files_dock_widget + \brief Dock widget to display files in the current directory. +*/ +class files_dock_widget : public octave_dock_widget +{ + Q_OBJECT + +public: + + files_dock_widget (QWidget *parent = 0); + + ~files_dock_widget (); + + void connect_visibility_changed (void); + +public slots: + + /** Slot for handling a change in directory via double click. */ + void item_double_clicked (const QModelIndex & index); + + /** Slot for handling the up-directory button in the toolbar. */ + void change_directory_up (); + + /** Sets the current directory being displayed. */ + void set_current_directory (const QString& dir); + + /** Accepts user input a the line edit for the current directory. */ + void accept_directory_line_edit (); + + void display_directory (const QString& dir); + + /** Tells the widget to react on changed settings. */ + void notice_settings (const QSettings *settings); + + void focus (void); + + void handle_visibility (bool visible); + +signals: + /** Emitted, whenever the user requested to open a file. */ + void open_file (const QString& fileName); + + /** Emitted, whenever the currently displayed directory changed. */ + void displayed_directory_changed (const QString& dir); + +protected: + +private: + // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc + + /** Toolbar for file and directory manipulation. */ + QToolBar * _navigation_tool_bar; + + /** Variables for the up-directory action. */ + QIcon _directory_icon; + QAction * _directory_up_action; + QToolButton * _up_directory_button; + + /** The file system model. */ + QFileSystemModel *_file_system_model; + + /** The file system view. */ + QTreeView * _file_tree_view; + QLineEdit * _current_directory; +}; + +#endif // FILESDOCKWIDGET_H
--- a/libgui/src/files-dockwidget.cc Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* - -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "resource-manager.h" -#include "files-dockwidget.h" - -#include <QApplication> -#include <QFileInfo> -#include <QCompleter> -#include <QSettings> -#include <QProcess> -#include <QDebug> -#include <QHeaderView> - -files_dock_widget::files_dock_widget (QWidget *p) - : octave_dock_widget (p) -{ - setObjectName ("FilesDockWidget"); - setWindowIcon (QIcon(":/actions/icons/logo.png")); - setWindowTitle (tr ("File Browser")); - setStatusTip (tr ("Browse your files.")); - - QWidget *container = new QWidget (this); - - setWidget (container); - - connect (this, SIGNAL (open_file (const QString&)), - parent (), SLOT (open_file (const QString&))); - - connect (this, SIGNAL (displayed_directory_changed (const QString&)), - parent (), SLOT (set_current_working_directory (const QString&))); - - // Create a toolbar - _navigation_tool_bar = new QToolBar ("", container); - _navigation_tool_bar->setAllowedAreas (Qt::TopToolBarArea); - _navigation_tool_bar->setMovable (false); - _navigation_tool_bar->setIconSize (QSize (20, 20)); - - _directory_icon = QIcon(":/actions/icons/up.png"); - _directory_up_action = new QAction (_directory_icon, "", _navigation_tool_bar); - _directory_up_action->setStatusTip (tr ("Move up one directory.")); - - _current_directory = new QLineEdit (_navigation_tool_bar); - _current_directory->setStatusTip (tr ("Enter the path or filename.")); - - _navigation_tool_bar->addAction (_directory_up_action); - _navigation_tool_bar->addWidget (_current_directory); - connect (_directory_up_action, SIGNAL (triggered ()), this, - SLOT (change_directory_up ())); - - // TODO: Add other buttons for creating directories - - // Create the QFileSystemModel starting in the home directory - QString homePath = QDir::homePath (); - - _file_system_model = new QFileSystemModel (this); - _file_system_model->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries); - QModelIndex rootPathIndex = _file_system_model->setRootPath (homePath); - - // Attach the model to the QTreeView and set the root index - _file_tree_view = new QTreeView (container); - _file_tree_view->setModel (_file_system_model); - _file_tree_view->setRootIndex (rootPathIndex); - _file_tree_view->setSortingEnabled (true); - _file_tree_view->setAlternatingRowColors (true); - _file_tree_view->setAnimated (true); - _file_tree_view->setStatusTip (tr ("Doubleclick a file to open it.")); - - // get sort column and order as well as cloumn state (order and width) - QSettings *settings = resource_manager::get_settings (); - // FIXME -- what should happen if settings is 0? - _file_tree_view->sortByColumn ( - settings->value ("filesdockwidget/sort_files_by_column",0).toInt (), - static_cast<Qt::SortOrder>(settings->value ("filesdockwidget/sort_files_by_order",Qt::AscendingOrder).toUInt ()) - ); - _file_tree_view->header ()->restoreState (settings->value ("filesdockwidget/column_state").toByteArray ()); - - _current_directory->setText(_file_system_model->fileInfo (rootPathIndex). - absoluteFilePath ()); - - connect (_file_tree_view, SIGNAL (doubleClicked (const QModelIndex &)), - this, SLOT (item_double_clicked (const QModelIndex &))); - - // Layout the widgets vertically with the toolbar on top - QVBoxLayout *vbox_layout = new QVBoxLayout (); - vbox_layout->setSpacing (0); - vbox_layout->addWidget (_navigation_tool_bar); - vbox_layout->addWidget (_file_tree_view); - vbox_layout->setMargin (1); - - container->setLayout (vbox_layout); - - // TODO: Add right-click contextual menus for copying, pasting, deleting files (and others) - - connect (_current_directory, SIGNAL (returnPressed ()), - this, SLOT (accept_directory_line_edit ())); - - QCompleter *completer = new QCompleter (_file_system_model, this); - _current_directory->setCompleter (completer); - - setFocusProxy (_current_directory); -} - -files_dock_widget::~files_dock_widget () -{ - QSettings *settings = resource_manager::get_settings (); - int sort_column = _file_tree_view->header ()->sortIndicatorSection (); - Qt::SortOrder sort_order = _file_tree_view->header ()->sortIndicatorOrder (); - settings->setValue ("filesdockwidget/sort_files_by_column", sort_column); - settings->setValue ("filesdockwidget/sort_files_by_order", sort_order); - settings->setValue ("filesdockwidget/column_state", _file_tree_view->header ()->saveState ()); - settings->sync (); -} - -void -files_dock_widget::connect_visibility_changed (void) -{ - connect (this, SIGNAL (visibilityChanged (bool)), - this, SLOT (handle_visibility (bool))); -} - -void -files_dock_widget::item_double_clicked (const QModelIndex& index) -{ - // Retrieve the file info associated with the model index. - QFileInfo fileInfo = _file_system_model->fileInfo (index); - - set_current_directory (fileInfo.absoluteFilePath ()); -} - -void -files_dock_widget::set_current_directory (const QString& dir) -{ - display_directory (dir); - - emit displayed_directory_changed (dir); -} - -void -files_dock_widget::accept_directory_line_edit (void) -{ - display_directory (_current_directory->text ()); -} - -void -files_dock_widget::change_directory_up (void) -{ - QDir dir = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ())); - dir.cdUp (); - display_directory (dir.absolutePath ()); -} - -void -files_dock_widget::display_directory (const QString& dir) -{ - QFileInfo fileInfo (dir); - if (fileInfo.exists ()) - { - if (fileInfo.isDir ()) - { - _file_tree_view->setRootIndex (_file_system_model-> - index (fileInfo.absoluteFilePath ())); - _file_system_model->setRootPath (fileInfo.absoluteFilePath ()); - _file_system_model->sort (0, Qt::AscendingOrder); - _current_directory->setText (fileInfo.absoluteFilePath ()); - } - else - { - if (QFile::exists (fileInfo.absoluteFilePath ())) - emit open_file (fileInfo.absoluteFilePath ()); - } - } -} - -void -files_dock_widget::notice_settings (const QSettings *settings) -{ - // Qsettings pointer is checked before emitting. - - // file names are always shown, other columns can be hidden by settings - _file_tree_view->setColumnHidden (0, false); - _file_tree_view->setColumnHidden (1, !settings->value ("showFileSize",false).toBool ()); - _file_tree_view->setColumnHidden (2, !settings->value ("showFileType",false).toBool ()); - _file_tree_view->setColumnHidden (3, !settings->value ("showLastModified",false).toBool ()); - _file_tree_view->setAlternatingRowColors (settings->value ("useAlternatingRowColors",true).toBool ()); - if (settings->value ("showHiddenFiles",false).toBool ()) - { - // TODO: React on option for hidden files. - } -} - -void -files_dock_widget::focus (void) -{ - if (! isVisible ()) - setVisible (true); - - setFocus (); - activateWindow (); - raise (); -} - -void -files_dock_widget::handle_visibility (bool visible) -{ - if (visible && ! isFloating ()) - focus (); -} -
--- a/libgui/src/files-dockwidget.h Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* - -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifndef FILESDOCKWIDGET_H -#define FILESDOCKWIDGET_H - -#include <QListView> -#include <QDate> -#include <QObject> -#include <QWidget> -#include <QListWidget> -#include <QFileSystemModel> -#include <QToolBar> -#include <QToolButton> -#include <QVBoxLayout> -#include <QAction> -#include <QTreeView> -#include <QSettings> - -#include <QLineEdit> -#include "octave-dock-widget.h" - -/** - \class files_dock_widget - \brief Dock widget to display files in the current directory. -*/ -class files_dock_widget : public octave_dock_widget -{ - Q_OBJECT - -public: - - files_dock_widget (QWidget *parent = 0); - - ~files_dock_widget (); - - void connect_visibility_changed (void); - -public slots: - - /** Slot for handling a change in directory via double click. */ - void item_double_clicked (const QModelIndex & index); - - /** Slot for handling the up-directory button in the toolbar. */ - void change_directory_up (); - - /** Sets the current directory being displayed. */ - void set_current_directory (const QString& dir); - - /** Accepts user input a the line edit for the current directory. */ - void accept_directory_line_edit (); - - void display_directory (const QString& dir); - - /** Tells the widget to react on changed settings. */ - void notice_settings (const QSettings *settings); - - void focus (void); - - void handle_visibility (bool visible); - -signals: - /** Emitted, whenever the user requested to open a file. */ - void open_file (const QString& fileName); - - /** Emitted, whenever the currently displayed directory changed. */ - void displayed_directory_changed (const QString& dir); - -protected: - -private: - // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc - - /** Toolbar for file and directory manipulation. */ - QToolBar * _navigation_tool_bar; - - /** Variables for the up-directory action. */ - QIcon _directory_icon; - QAction * _directory_up_action; - QToolButton * _up_directory_button; - - /** The file system model. */ - QFileSystemModel *_file_system_model; - - /** The file system view. */ - QTreeView * _file_tree_view; - QLineEdit * _current_directory; -}; - -#endif // FILESDOCKWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/history-dock-widget.cc Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,197 @@ +/* + +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <QApplication> +#include <QClipboard> +#include <QVBoxLayout> +#include <QMenu> + +#include "error.h" + +#include "cmd-hist.h" + +#include "history-dock-widget.h" + +history_dock_widget::history_dock_widget (QWidget *p) + : octave_dock_widget (p) +{ + setObjectName ("HistoryDockWidget"); + setStatusTip (tr ("Browse and search the command history.")); + + connect (this, SIGNAL (command_create_script (const QString&)), + p, SLOT (new_file (const QString&))); + + connect (this, SIGNAL (information (const QString&)), + p, SLOT (report_status_message (const QString&))); + + connect (this, SIGNAL (command_double_clicked (const QString&)), + p, SLOT (handle_command_double_clicked (const QString&))); + + construct (); +} + +void +history_dock_widget::connect_visibility_changed (void) +{ + connect (this, SIGNAL (visibilityChanged (bool)), + this, SLOT (handle_visibility (bool))); +} + +void +history_dock_widget::construct () +{ + _history_model = new QStringListModel (); + _sort_filter_proxy_model.setSourceModel (_history_model); + _history_list_view = new QListView (this); + _history_list_view->setModel (&_sort_filter_proxy_model); + _history_list_view->setAlternatingRowColors (true); + _history_list_view->setEditTriggers (QAbstractItemView::NoEditTriggers); + _history_list_view->setStatusTip (tr ("Doubleclick a command to transfer it to the terminal.")); + _history_list_view->setSelectionMode (QAbstractItemView::ExtendedSelection); + _history_list_view->setContextMenuPolicy(Qt::CustomContextMenu); + connect(_history_list_view, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ctxMenu(const QPoint &))); + + _filter_line_edit = new QLineEdit (this); + _filter_line_edit->setStatusTip (tr ("Enter text to filter the command history.")); + QVBoxLayout *vbox_layout = new QVBoxLayout (); + + setWindowIcon (QIcon(":/actions/icons/logo.png")); + setWindowTitle (tr ("Command History")); + setWidget (new QWidget ()); + + vbox_layout->addWidget (_history_list_view); + vbox_layout->addWidget (_filter_line_edit); + vbox_layout->setMargin (2); + + widget ()->setLayout (vbox_layout); + + connect (_filter_line_edit, SIGNAL (textEdited (QString)), + &_sort_filter_proxy_model, SLOT (setFilterWildcard (QString))); + + connect (_history_list_view, SIGNAL (doubleClicked (QModelIndex)), + this, SLOT (handle_double_click (QModelIndex))); + + setFocusProxy (_filter_line_edit); +} + +void history_dock_widget::ctxMenu(const QPoint &xpos) { + QMenu menu(this); + menu.addAction(tr("Copy"), this, SLOT(handle_contextmenu_copy(bool))); + menu.addAction(tr("Evaluate"), this, SLOT(handle_contextmenu_evaluate(bool))); + menu.addAction(tr("Create script"), this, SLOT(handle_contextmenu_create_script(bool))); + menu.exec(_history_list_view->mapToGlobal(xpos)); +} + +void history_dock_widget::handle_contextmenu_copy(bool) +{ + QString text; + QItemSelectionModel *selectionModel = _history_list_view->selectionModel(); + QModelIndexList rows = selectionModel->selectedRows(); + QModelIndexList::iterator it; + for (it=rows.begin() ; it != rows.end(); it++) { + if ((*it).isValid()) { + text += (*it).data().toString()+"\n"; + } + } + QApplication::clipboard()->setText(text); +} + +void history_dock_widget::handle_contextmenu_evaluate(bool) +{ + QItemSelectionModel *selectionModel = _history_list_view->selectionModel(); + QModelIndexList rows = selectionModel->selectedRows(); + QModelIndexList::iterator it; + for (it=rows.begin() ; it != rows.end(); it++) { + if ((*it).isValid()) { + emit command_double_clicked ((*it).data().toString()+"\n"); + } + } +} + +void +history_dock_widget::handle_contextmenu_create_script (bool) +{ + QString text; + QItemSelectionModel *selectionModel = _history_list_view->selectionModel (); + QModelIndexList rows = selectionModel->selectedRows (); + + for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++) + { + if ((*it).isValid ()) + text += (*it).data().toString() + "\n"; + } + + if (text.length () > 0) + emit command_create_script (text); +} + + +void +history_dock_widget::handle_double_click (QModelIndex modelIndex) +{ + emit command_double_clicked (modelIndex.data().toString()+"\n"); +} + +void +history_dock_widget::set_history (const QStringList& hist) +{ + _history_model->setStringList (hist); + _history_list_view->scrollToBottom (); +} + +void +history_dock_widget::append_history (const QString& hist_entry) +{ + QStringList lst = _history_model->stringList (); + lst.append (hist_entry); + _history_model->setStringList (lst); + _history_list_view->scrollToBottom (); +} + +void +history_dock_widget::clear_history (void) +{ + _history_model->setStringList (QStringList ()); +} + +void +history_dock_widget::focus (void) +{ + if (! isVisible ()) + setVisible (true); + + setFocus (); + activateWindow (); + raise (); +} + +void +history_dock_widget::handle_visibility (bool visible) +{ + if (visible && ! isFloating ()) + focus (); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/history-dock-widget.h Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,81 @@ +/* + +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifndef HISTORYDOCKWIDGET_H +#define HISTORYDOCKWIDGET_H + +#include <QLineEdit> +#include <QListView> +#include <QSortFilterProxyModel> +#include <QStringListModel> +#include "octave-dock-widget.h" + +class history_dock_widget : public octave_dock_widget +{ + Q_OBJECT + +public: + + history_dock_widget (QWidget *parent = 0); + + void connect_visibility_changed (void); + +public slots: + + void set_history (const QStringList& hist); + void append_history (const QString& hist_entry); + void clear_history (void); + + void focus (void); + void handle_visibility (bool); + +signals: + + void information (const QString& message); + + /** Emitted, whenever the user double-clicked a command in the history. */ + void command_double_clicked (const QString& command); + + /** Emitted whenever the user selects command and chooses Create + script from popupmenu. */ + void command_create_script (const QString& commands); + +private slots: + + void handle_double_click (QModelIndex modelIndex); + void handle_contextmenu_copy(bool flag); + void handle_contextmenu_evaluate(bool flag); + void handle_contextmenu_create_script(bool flag); + void ctxMenu(const QPoint &pos); + +private: + + void construct (); + QListView *_history_list_view; + QLineEdit *_filter_line_edit; + QSortFilterProxyModel _sort_filter_proxy_model; + + /** Stores the current history_model. */ + QStringListModel *_history_model; +}; + +#endif // HISTORYDOCKWIDGET_H
--- a/libgui/src/history-dockwidget.cc Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* - -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <QApplication> -#include <QClipboard> -#include <QVBoxLayout> -#include <QMenu> - -#include "error.h" - -#include "cmd-hist.h" - -#include "history-dockwidget.h" - -history_dock_widget::history_dock_widget (QWidget *p) - : octave_dock_widget (p) -{ - setObjectName ("HistoryDockWidget"); - setStatusTip (tr ("Browse and search the command history.")); - - connect (this, SIGNAL (command_create_script (const QString&)), - p, SLOT (new_file (const QString&))); - - connect (this, SIGNAL (information (const QString&)), - p, SLOT (report_status_message (const QString&))); - - connect (this, SIGNAL (command_double_clicked (const QString&)), - p, SLOT (handle_command_double_clicked (const QString&))); - - construct (); -} - -void -history_dock_widget::connect_visibility_changed (void) -{ - connect (this, SIGNAL (visibilityChanged (bool)), - this, SLOT (handle_visibility (bool))); -} - -void -history_dock_widget::construct () -{ - _history_model = new QStringListModel (); - _sort_filter_proxy_model.setSourceModel (_history_model); - _history_list_view = new QListView (this); - _history_list_view->setModel (&_sort_filter_proxy_model); - _history_list_view->setAlternatingRowColors (true); - _history_list_view->setEditTriggers (QAbstractItemView::NoEditTriggers); - _history_list_view->setStatusTip (tr ("Doubleclick a command to transfer it to the terminal.")); - _history_list_view->setSelectionMode (QAbstractItemView::ExtendedSelection); - _history_list_view->setContextMenuPolicy(Qt::CustomContextMenu); - connect(_history_list_view, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ctxMenu(const QPoint &))); - - _filter_line_edit = new QLineEdit (this); - _filter_line_edit->setStatusTip (tr ("Enter text to filter the command history.")); - QVBoxLayout *vbox_layout = new QVBoxLayout (); - - setWindowIcon (QIcon(":/actions/icons/logo.png")); - setWindowTitle (tr ("Command History")); - setWidget (new QWidget ()); - - vbox_layout->addWidget (_history_list_view); - vbox_layout->addWidget (_filter_line_edit); - vbox_layout->setMargin (2); - - widget ()->setLayout (vbox_layout); - - connect (_filter_line_edit, SIGNAL (textEdited (QString)), - &_sort_filter_proxy_model, SLOT (setFilterWildcard (QString))); - - connect (_history_list_view, SIGNAL (doubleClicked (QModelIndex)), - this, SLOT (handle_double_click (QModelIndex))); - - setFocusProxy (_filter_line_edit); -} - -void history_dock_widget::ctxMenu(const QPoint &xpos) { - QMenu menu(this); - menu.addAction(tr("Copy"), this, SLOT(handle_contextmenu_copy(bool))); - menu.addAction(tr("Evaluate"), this, SLOT(handle_contextmenu_evaluate(bool))); - menu.addAction(tr("Create script"), this, SLOT(handle_contextmenu_create_script(bool))); - menu.exec(_history_list_view->mapToGlobal(xpos)); -} - -void history_dock_widget::handle_contextmenu_copy(bool) -{ - QString text; - QItemSelectionModel *selectionModel = _history_list_view->selectionModel(); - QModelIndexList rows = selectionModel->selectedRows(); - QModelIndexList::iterator it; - for (it=rows.begin() ; it != rows.end(); it++) { - if ((*it).isValid()) { - text += (*it).data().toString()+"\n"; - } - } - QApplication::clipboard()->setText(text); -} - -void history_dock_widget::handle_contextmenu_evaluate(bool) -{ - QItemSelectionModel *selectionModel = _history_list_view->selectionModel(); - QModelIndexList rows = selectionModel->selectedRows(); - QModelIndexList::iterator it; - for (it=rows.begin() ; it != rows.end(); it++) { - if ((*it).isValid()) { - emit command_double_clicked ((*it).data().toString()+"\n"); - } - } -} - -void -history_dock_widget::handle_contextmenu_create_script (bool) -{ - QString text; - QItemSelectionModel *selectionModel = _history_list_view->selectionModel (); - QModelIndexList rows = selectionModel->selectedRows (); - - for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++) - { - if ((*it).isValid ()) - text += (*it).data().toString() + "\n"; - } - - if (text.length () > 0) - emit command_create_script (text); -} - - -void -history_dock_widget::handle_double_click (QModelIndex modelIndex) -{ - emit command_double_clicked (modelIndex.data().toString()+"\n"); -} - -void -history_dock_widget::set_history (const QStringList& hist) -{ - _history_model->setStringList (hist); - _history_list_view->scrollToBottom (); -} - -void -history_dock_widget::append_history (const QString& hist_entry) -{ - QStringList lst = _history_model->stringList (); - lst.append (hist_entry); - _history_model->setStringList (lst); - _history_list_view->scrollToBottom (); -} - -void -history_dock_widget::clear_history (void) -{ - _history_model->setStringList (QStringList ()); -} - -void -history_dock_widget::focus (void) -{ - if (! isVisible ()) - setVisible (true); - - setFocus (); - activateWindow (); - raise (); -} - -void -history_dock_widget::handle_visibility (bool visible) -{ - if (visible && ! isFloating ()) - focus (); -} -
--- a/libgui/src/history-dockwidget.h Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifndef HISTORYDOCKWIDGET_H -#define HISTORYDOCKWIDGET_H - -#include <QLineEdit> -#include <QListView> -#include <QSortFilterProxyModel> -#include <QStringListModel> -#include "octave-dock-widget.h" - -class history_dock_widget : public octave_dock_widget -{ - Q_OBJECT - -public: - - history_dock_widget (QWidget *parent = 0); - - void connect_visibility_changed (void); - -public slots: - - void set_history (const QStringList& hist); - void append_history (const QString& hist_entry); - void clear_history (void); - - void focus (void); - void handle_visibility (bool); - -signals: - - void information (const QString& message); - - /** Emitted, whenever the user double-clicked a command in the history. */ - void command_double_clicked (const QString& command); - - /** Emitted whenever the user selects command and chooses Create - script from popupmenu. */ - void command_create_script (const QString& commands); - -private slots: - - void handle_double_click (QModelIndex modelIndex); - void handle_contextmenu_copy(bool flag); - void handle_contextmenu_evaluate(bool flag); - void handle_contextmenu_create_script(bool flag); - void ctxMenu(const QPoint &pos); - -private: - - void construct (); - QListView *_history_list_view; - QLineEdit *_filter_line_edit; - QSortFilterProxyModel _sort_filter_proxy_model; - - /** Stores the current history_model. */ - QStringListModel *_history_model; -}; - -#endif // HISTORYDOCKWIDGET_H
--- a/libgui/src/main-window.cc Sun Apr 07 11:52:09 2013 -0400 +++ b/libgui/src/main-window.cc Sun Apr 07 12:07:10 2013 -0400 @@ -250,7 +250,7 @@ { QString name = obj->objectName (); if (obj->inherits ("QDockWidget") && ! name.isEmpty ()) - { // if children is a dockwidget with a name + { // if children is a dock widget with a name QDockWidget *widget = qobject_cast<QDockWidget *> (obj); icon = widget_icon_data[icon_set_found].path; // prefix or octave-logo if (widget_icon_data[icon_set_found].name != "NONE")
--- a/libgui/src/main-window.h Sun Apr 07 11:52:09 2013 -0400 +++ b/libgui/src/main-window.h Sun Apr 07 12:07:10 2013 -0400 @@ -47,10 +47,10 @@ #include "resource-manager.h" #include "workspace-model.h" #include "workspace-view.h" -#include "history-dockwidget.h" -#include "files-dockwidget.h" -#include "terminal-dockwidget.h" -#include "documentation-dockwidget.h" +#include "history-dock-widget.h" +#include "files-dock-widget.h" +#include "terminal-dock-widget.h" +#include "documentation-dock-widget.h" #include "octave-qt-event-listener.h" #include "octave-qt-link.h"
--- a/libgui/src/module.mk Sun Apr 07 11:52:09 2013 -0400 +++ b/libgui/src/module.mk Sun Apr 07 12:07:10 2013 -0400 @@ -68,14 +68,14 @@ endif octave_gui_MOC += \ - src/moc-documentation-dockwidget.cc \ - src/moc-files-dockwidget.cc \ - src/moc-history-dockwidget.cc \ + src/moc-documentation-dock-widget.cc \ + src/moc-files-dock-widget.cc \ + src/moc-history-dock-widget.cc \ src/moc-main-window.cc \ src/moc-octave-qt-event-listener.cc \ src/moc-octave-qt-link.cc \ src/moc-settings-dialog.cc \ - src/moc-terminal-dockwidget.cc \ + src/moc-terminal-dock-widget.cc \ src/moc-color-picker.cc \ src/moc-welcome-wizard.cc \ src/moc-workspace-model.cc \ @@ -96,9 +96,9 @@ noinst_HEADERS += \ src/octave-dock-widget.h \ - src/documentation-dockwidget.h \ - src/files-dockwidget.h \ - src/history-dockwidget.h \ + src/documentation-dock-widget.h \ + src/files-dock-widget.h \ + src/history-dock-widget.h \ src/m-editor/file-editor-interface.h \ src/m-editor/file-editor-tab.h \ src/m-editor/file-editor.h \ @@ -114,16 +114,16 @@ src/resource-manager.h \ src/settings-dialog.h \ src/symbol-information.h \ - src/terminal-dockwidget.h \ + src/terminal-dock-widget.h \ src/color-picker.h \ src/welcome-wizard.h \ src/workspace-model.h \ src/workspace-view.h src_libgui_src_la_SOURCES = \ - src/documentation-dockwidget.cc \ - src/files-dockwidget.cc \ - src/history-dockwidget.cc \ + src/documentation-dock-widget.cc \ + src/files-dock-widget.cc \ + src/history-dock-widget.cc \ src/m-editor/file-editor-tab.cc \ src/m-editor/file-editor.cc \ src/m-editor/find-dialog.cc \ @@ -138,7 +138,7 @@ src/resource-manager.cc \ src/settings-dialog.cc \ src/symbol-information.cc \ - src/terminal-dockwidget.cc \ + src/terminal-dock-widget.cc \ src/color-picker.cc \ src/welcome-wizard.cc \ src/workspace-model.cc \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/terminal-dock-widget.cc Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,123 @@ +/* + +Copyright (C) 2013 John W. Eaton +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "terminal-dock-widget.h" + +terminal_dock_widget::terminal_dock_widget (QWidget *p) + : octave_dock_widget (p), terminal (p) +{ + terminal.setObjectName ("OctaveTerminal"); + terminal.setFocusPolicy (Qt::StrongFocus); + + setObjectName ("TerminalDockWidget"); + setWindowIcon (QIcon(":/actions/icons/logo.png")); + setWindowTitle (tr ("Command Window")); + setWidget (&terminal); + + connect (parent (), SIGNAL (settings_changed (const QSettings *)), + this, SLOT (notice_settings (const QSettings *))); + + connect (this, SIGNAL (visibilityChanged (bool)), + this, SLOT (handle_visibility (bool))); + + connect (parent (), SIGNAL (relay_command_signal (const QString&)), + this, SLOT (relay_command (const QString&))); + + // topLevelChanged is emitted when floating property changes (floating + // = true) + connect (this, SIGNAL (topLevelChanged (bool)), + this, SLOT (top_level_changed (bool))); + + // Forward signals to QTerminal widget. + + connect (this, SIGNAL (notice_settings_signal (const QSettings *)), + &terminal, SLOT (notice_settings (const QSettings *))); + + connect (this, SIGNAL (relay_command_signal (const QString&)), + &terminal, SLOT (relay_command (const QString&))); + + connect (this, SIGNAL (copyClipboard_signal (void)), + &terminal, SLOT (copyClipboard (void))); + + connect (this, SIGNAL (pasteClipboard_signal (void)), + &terminal, SLOT (pasteClipboard (void))); +} + +void +terminal_dock_widget::connect_visibility_changed (void) +{ + connect (this, SIGNAL (visibilityChanged (bool)), + this, SLOT (handle_visibility_changed (bool))); +} + +void +terminal_dock_widget::focus (void) +{ + if (! isVisible ()) + setVisible (true); + + setFocus (); + activateWindow (); + raise (); + + widget ()->setFocus (); + widget ()->activateWindow (); + widget ()->raise (); +} + +void +terminal_dock_widget::handle_visibility (bool visible) +{ + // if widget is changed to visible and is not floating + + if (visible && ! isFloating ()) + focus (); +} + +void +terminal_dock_widget::notice_settings (const QSettings *settings) +{ + emit notice_settings_signal (settings); +} + +void +terminal_dock_widget::relay_command (const QString& command) +{ + emit relay_command_signal (command); +} + +void +terminal_dock_widget::copyClipboard (void) +{ + emit copyClipboard_signal (); +} + +void +terminal_dock_widget::pasteClipboard (void) +{ + emit pasteClipboard_signal (); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/terminal-dock-widget.h Sun Apr 07 12:07:10 2013 -0400 @@ -0,0 +1,73 @@ +/* + +Copyright (C) 2013 John W. Eaton +Copyright (C) 2011-2012 Jacob Dawid + +This file is part of Octave. + +Octave 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. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifndef TERMINALDOCKWIDGET_H +#define TERMINALDOCKWIDGET_H + +#include <QString> + +#include "QTerminal.h" +#include "octave-dock-widget.h" + +class terminal_dock_widget : public octave_dock_widget +{ + Q_OBJECT + +public: + + terminal_dock_widget (QWidget *parent = 0); + + void connect_visibility_changed (void); + +signals: + +public slots: + + void focus (void); + + void handle_visibility (bool visible); + + void notice_settings (const QSettings *settings); + + void relay_command (const QString& command); + + void copyClipboard (void); + + void pasteClipboard (void); + +signals: + + void notice_settings_signal (const QSettings *settings); + + void relay_command_signal (const QString& command); + + void copyClipboard_signal (void); + + void pasteClipboard_signal (void); + +private: + + QTerminal terminal; +}; + +#endif // TERMINALDOCKWIDGET_H
--- a/libgui/src/terminal-dockwidget.cc Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* - -Copyright (C) 2013 John W. Eaton -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "terminal-dockwidget.h" - -terminal_dock_widget::terminal_dock_widget (QWidget *p) - : octave_dock_widget (p), terminal (p) -{ - terminal.setObjectName ("OctaveTerminal"); - terminal.setFocusPolicy (Qt::StrongFocus); - - setObjectName ("TerminalDockWidget"); - setWindowIcon (QIcon(":/actions/icons/logo.png")); - setWindowTitle (tr ("Command Window")); - setWidget (&terminal); - - connect (parent (), SIGNAL (settings_changed (const QSettings *)), - this, SLOT (notice_settings (const QSettings *))); - - connect (this, SIGNAL (visibilityChanged (bool)), - this, SLOT (handle_visibility (bool))); - - connect (parent (), SIGNAL (relay_command_signal (const QString&)), - this, SLOT (relay_command (const QString&))); - - // topLevelChanged is emitted when floating property changes (floating - // = true) - connect (this, SIGNAL (topLevelChanged (bool)), - this, SLOT (top_level_changed (bool))); - - // Forward signals to QTerminal widget. - - connect (this, SIGNAL (notice_settings_signal (const QSettings *)), - &terminal, SLOT (notice_settings (const QSettings *))); - - connect (this, SIGNAL (relay_command_signal (const QString&)), - &terminal, SLOT (relay_command (const QString&))); - - connect (this, SIGNAL (copyClipboard_signal (void)), - &terminal, SLOT (copyClipboard (void))); - - connect (this, SIGNAL (pasteClipboard_signal (void)), - &terminal, SLOT (pasteClipboard (void))); -} - -void -terminal_dock_widget::connect_visibility_changed (void) -{ - connect (this, SIGNAL (visibilityChanged (bool)), - this, SLOT (handle_visibility_changed (bool))); -} - -void -terminal_dock_widget::focus (void) -{ - if (! isVisible ()) - setVisible (true); - - setFocus (); - activateWindow (); - raise (); - - widget ()->setFocus (); - widget ()->activateWindow (); - widget ()->raise (); -} - -void -terminal_dock_widget::handle_visibility (bool visible) -{ - // if widget is changed to visible and is not floating - - if (visible && ! isFloating ()) - focus (); -} - -void -terminal_dock_widget::notice_settings (const QSettings *settings) -{ - emit notice_settings_signal (settings); -} - -void -terminal_dock_widget::relay_command (const QString& command) -{ - emit relay_command_signal (command); -} - -void -terminal_dock_widget::copyClipboard (void) -{ - emit copyClipboard_signal (); -} - -void -terminal_dock_widget::pasteClipboard (void) -{ - emit pasteClipboard_signal (); -}
--- a/libgui/src/terminal-dockwidget.h Sun Apr 07 11:52:09 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - -Copyright (C) 2013 John W. Eaton -Copyright (C) 2011-2012 Jacob Dawid - -This file is part of Octave. - -Octave 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. - -Octave 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifndef TERMINALDOCKWIDGET_H -#define TERMINALDOCKWIDGET_H - -#include <QString> - -#include "QTerminal.h" -#include "octave-dock-widget.h" - -class terminal_dock_widget : public octave_dock_widget -{ - Q_OBJECT - -public: - - terminal_dock_widget (QWidget *parent = 0); - - void connect_visibility_changed (void); - -signals: - -public slots: - - void focus (void); - - void handle_visibility (bool visible); - - void notice_settings (const QSettings *settings); - - void relay_command (const QString& command); - - void copyClipboard (void); - - void pasteClipboard (void); - -signals: - - void notice_settings_signal (const QSettings *settings); - - void relay_command_signal (const QString& command); - - void copyClipboard_signal (void); - - void pasteClipboard_signal (void); - -private: - - QTerminal terminal; -}; - -#endif // TERMINALDOCKWIDGET_H