Mercurial > octave
changeset 24109:1d6c940a1b37
doc: Improve Doxygen documentation for some files in libgui.
author | Kai T. Ohlhus <k.ohlhus@gmail.com> |
---|---|
date | Thu, 28 Sep 2017 10:49:39 +0200 |
parents | 1a53f0c855db |
children | 194558542203 |
files | libgui/src/files-dock-widget.h libgui/src/history-dock-widget.h libgui/src/m-editor/file-editor-tab.cc libgui/src/main-window.h libgui/src/octave-cmd.h libgui/src/octave-dock-widget.h libgui/src/qtinfo/texinfo-parser.h libgui/src/workspace-view.h |
diffstat | 8 files changed, 204 insertions(+), 164 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/files-dock-widget.h Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/files-dock-widget.h Thu Sep 28 10:49:39 2017 +0200 @@ -40,10 +40,8 @@ #include <QComboBox> #include "octave-dock-widget.h" -/** - @class files_dock_widget - @brief Dock widget to display files in the current directory. -*/ +//! Dock widget to display files in the current directory. + class files_dock_widget : public octave_dock_widget { Q_OBJECT @@ -56,28 +54,36 @@ public slots: - /** Slot for handling a change in directory via double click. */ + //! 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. */ + //! Slot for handling the up-directory button in the toolbar. + void change_directory_up (void); - /** Slot for handling the sync octave directory button in the toolbar. */ + //! Slot for handling the sync octave directory button in the toolbar. + void do_sync_octave_directory (void); - /** Slot for handling the sync browser directory button in the toolbar. */ + //! Slot for handling the sync browser directory button in the toolbar. + void do_sync_browser_directory (void); - /** Sets the current directory being displayed. */ + //! Sets the current directory being displayed. + void set_current_directory (const QString& dir); - /** Accepts user input a the line edit for the current directory. */ + //! Accepts user input a the line edit for the current directory. + void accept_directory_line_edit (void); - /** set the internal variable that holds the actual octave variable **/ + //! Set the internal variable that holds the actual octave variable. + void update_octave_directory (const QString& dir); - /** Tells the widget to react on changed settings. */ + //! Tells the widget to react on changed settings. + void notice_settings (const QSettings *settings); void save_settings (void); @@ -87,9 +93,12 @@ void headercontextmenu_requested (const QPoint& pos); void toggle_header (int col); - /** context menu wanted */ + //! Context menu wanted. + void contextmenu_requested (const QPoint& pos); - /* context menu actions */ + + //! Context menu actions. + //!@{ void contextmenu_open (bool); void contextmenu_open_in_editor (bool); void contextmenu_open_in_app (bool); @@ -102,71 +111,89 @@ void contextmenu_newdir (bool); void contextmenu_setcurrentdir (bool); void contextmenu_findfiles (bool); + //!@} - /* popdown menu options */ + //! Popdown menu options. + //!@{ void popdownmenu_newfile (bool); void popdownmenu_newdir (bool); void popdownmenu_search_dir (bool); void popdownmenu_findfiles (bool); void popdownmenu_home (bool); + //!@} - /* from octave_doc_widget */ - void copyClipboard (); - void pasteClipboard (); - void selectAll (); + //! Inherited from octave_doc_widget. + //!@{ + void copyClipboard () override; + void pasteClipboard () override; + void selectAll () override; + //!@} signals: - /** Emitted, whenever the user requested to open a file. */ + //! Emitted, whenever the user requested to open a file. + void open_file (const QString& fileName); - /** Emitted, whenever the currently displayed directory changed. */ + //! Emitted, whenever the currently displayed directory changed. + void displayed_directory_changed (const QString& dir); - /** Emitted, whenever the user requested to load a file. */ + //! Emitted, whenever the user requested to load a file. + void load_file_signal (const QString& fileName); - /** Emitted, whenever the user requested to run a file. */ + //! Emitted, whenever the user requested to run a file. + void run_file_signal (const QFileInfo& info); - /** Emitted, whenever wants to search for a file . */ + //! Emitted, whenever wants to search for a file . + void find_files_signal (const QString& startdir); - /** Emitted, whenever the user removes or renames a file. */ + //! Emitted, whenever the user removes or renames a file. + void file_remove_signal (const QString& old_name, const QString& new_name); - /** Emitted, when a file or directory is renamed. */ + //! Emitted, when a file or directory is renamed. + void file_renamed_signal (bool); private: + void process_new_file (const QString& parent_name); void process_new_dir (const QString& parent_name); void process_set_current_dir (const QString& parent_name); void process_find_files (const QString& dir_name); - /** set a new directory or open a file **/ + //! set a new directory or open a file + void display_directory (const QString& dir, bool set_octave_dir = true); void open_item_in_app (const QModelIndex& index); - /** Variables for the actions **/ + //! Variables for the actions + QToolBar *m_navigation_tool_bar; QAction *m_sync_octave_directory_action; QAction *m_sync_browser_directory_action; - /** The file system model. */ + //! The file system model. + QFileSystemModel *m_file_system_model; - /** The file system view. */ + //! The file system view. + //!@{ QTreeView *m_file_tree_view; QComboBox *m_current_directory; + //!@} - /** Internal variables **/ + //! Flag if syncing with Octave. - // flag if syncing with octave bool m_sync_octave_dir; - // the actual octave dir + //! The actual Octave directory. + QString m_octave_dir; enum { MaxMRUDirs = 10 };
--- a/libgui/src/history-dock-widget.h Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/history-dock-widget.h Thu Sep 28 10:49:39 2017 +0200 @@ -53,11 +53,14 @@ void information (const QString& message); - /** Emitted, whenever the user double-clicked a command in the history. */ + //! Signal 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. */ + //! Signale emitted, whenever the user selects commands and chooses + //! "Create script" from the popup menu. + void command_create_script (const QString& commands); private slots: @@ -85,7 +88,8 @@ QListView *m_history_list_view; QSortFilterProxyModel m_sort_filter_proxy_model; - /** Stores the current history_model. */ + //! Stores the current history_model. + QStringListModel *m_history_model; QCheckBox *m_filter_checkbox;
--- a/libgui/src/m-editor/file-editor-tab.cc Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/m-editor/file-editor-tab.cc Thu Sep 28 10:49:39 2017 +0200 @@ -20,10 +20,9 @@ */ -/** - @file A single GUI file tab. - This interfaces QsciScintilla with the rest of Octave. - */ +//! @file A single GUI file tab. +//! +//! This interfaces QsciScintilla with the rest of Octave. #if defined (HAVE_CONFIG_H) # include "config.h" @@ -84,14 +83,13 @@ bool file_editor_tab::_cancelled = false; -/** - A file_editor_tab object consists of a text area and three left margins. - The first holds breakpoints, bookmarks, and the debug program counter. - The second holds line numbers. - The third holds "fold" marks, to hide sections of text. - */ -// Make parent null for the file editor tab so that warning -// WindowModal messages don't affect grandparents. +//! A file_editor_tab object consists of a text area and three left margins. +//! The first holds breakpoints, bookmarks, and the debug program counter. +//! The second holds line numbers. The third holds "fold" marks, to hide +//! sections of text. + +// Make parent null for the file editor tab so that warning WindowModal +// messages don't affect grandparents. file_editor_tab::file_editor_tab (const QString& directory_arg) { _lexer_apis = nullptr;
--- a/libgui/src/main-window.h Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/main-window.h Thu Sep 28 10:49:39 2017 +0200 @@ -64,14 +64,14 @@ class settings_dialog; +//! QObject to manage the Octave interpreter. + class octave_interpreter : public QObject { Q_OBJECT public: - // An object to manage the Octave interpreter. - octave_interpreter (octave::application *app_context); ~octave_interpreter (void) = default; @@ -85,7 +85,7 @@ public slots: - // Initialize and execute the octave interpreter. + //! Initialize and execute the octave interpreter. void execute (void); @@ -96,11 +96,8 @@ octave::application *m_app_context; }; -/** - * @class MainWindow - * - * Represents the main window. - */ +//! Represents the main window. + class main_window : public QMainWindow { Q_OBJECT @@ -249,22 +246,28 @@ void handle_octave_ready (); void handle_octave_finished (int); - // find files dialog + //! Find files dialog. + //!@{ void find_files (const QString& startdir = QDir::currentPath ()); void find_files_finished (int) { } + //!@} - // setting global shortcuts + //! Setting global shortcuts. + void set_global_shortcuts (bool enable); void set_screen_size (int ht, int wd); - // handling the clipboard + //! Handling the clipboard. + //!@{ void clipboard_has_changed (QClipboard::Mode); void clear_clipboard (); + //!@} void interrupt_interpreter (void); - // get the dockwidgets + //! Returns a list of dock widgets. + QList<octave_dock_widget *> get_dock_widget_list (void) { return dock_widget_list (); @@ -277,7 +280,8 @@ void set_file_encoding (const QString& new_encoding); void request_open_files (const QStringList& open_file_names); - // open variable_editor + //! Opens the variable editor for @p name. + void edit_variable (const QString &name); void clear_variable_editor_cache (void); @@ -357,10 +361,12 @@ QHash<QMenu*, QStringList> m_hash_menu_text; - // Toolbars. + //! Toolbar. + QStatusBar *m_status_bar; - // Subwindows. + //! Dock widgets. + //!@{ terminal_dock_widget *m_command_window; history_dock_widget *m_history_window; files_dock_widget *m_file_browser_window; @@ -368,6 +374,7 @@ file_editor_interface *m_editor_window; workspace_view *m_workspace_window; variable_editor *m_variable_editor_window; + //!@} external_editor_interface *m_external_editor; QWidget *m_active_editor; @@ -432,19 +439,24 @@ QAction *m_release_notes_action; QAction *m_current_news_action; - // Toolbars. + //! For Toolbars. + //!@{ QComboBox *m_current_directory_combo_box; static const int current_directory_max_visible = 16; static const int current_directory_max_count = 16; QLineEdit *m_current_directory_line_edit; + //!@} - // settings dialog as guarded pointer (set to 0 when deleted) + //! Settings dialog as guarded pointer (set to 0 when deleted). + QPointer<settings_dialog> m_settings_dlg; - // Find files dialog + //! Find files dialog. + find_files_dialog *m_find_files_dlg; - // release notes window + //! Release notes window. + QWidget *m_release_notes_window; QWidget *m_community_news_window; @@ -453,20 +465,22 @@ QClipboard *m_clipboard; - // Flag for closing whole application. - bool m_closing; + //! Command queue and semaphore to synchronize execution signals and + //! related callbacks. - // command queue and semaphore to synchronize execution signals - // and related callback - - // the queue for the command structures octave_command_queue m_cmd_queue; - // some class global flags + //! Some class global flags. + //!@{ bool m_prevent_readline_conflicts; bool m_suppress_dbg_location; bool m_start_gui; + //! Flag for closing the whole application. + + bool m_closing; + //!@} + QString m_file_encoding; };
--- a/libgui/src/octave-cmd.h Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/octave-cmd.h Thu Sep 28 10:49:39 2017 +0200 @@ -92,13 +92,7 @@ bool m_suppress_dbg_location; }; -/** - * @class octave_command_queue - * - * Queuing commands from the GUI for the worker thread - */ -// --------------------------------------------------------------------- -// class octave_command_queue: queue of octave commands +//! Queuing octave commands from the GUI for the worker thread. class octave_command_queue : QObject { @@ -113,15 +107,14 @@ ~octave_command_queue (void) = default; - /** - * Adds a new octave command to the command queue. - * @param cmd The octave command to be queued - */ + //! Adds a new octave command to the command queue. + //! + //! @param cmd The octave command to be queued. + void add_cmd (octave_cmd *cmd); - /** - * Callback routine for executing the command by the worker thread - */ + //! Callback routine for executing the command by the worker thread. + void execute_command_callback (void); private:
--- a/libgui/src/octave-dock-widget.h Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/octave-dock-widget.h Thu Sep 28 10:49:39 2017 +0200 @@ -49,9 +49,9 @@ signals: - /** Custom signal that tells whether a user has clicked away - * that dock widget, i.e the active dock widget has - * changed. */ + //! Custom signal that tells whether a user has clicked away that dock + //! widget, i.e the active dock widget has changed. + void active_changed (bool active); protected: @@ -90,21 +90,27 @@ protected slots: - /** Slot to steer changing visibility from outside. */ + //! Slot to steer changing visibility from outside. + virtual void handle_visibility_changed (bool visible) { if (visible) emit active_changed (true); } - /** slots to handle copy & paste */ + //! Slots to handle copy & paste. + //!@{ virtual void copyClipboard (void) { } virtual void pasteClipboard (void) { } virtual void selectAll (void) { } - /** slots to handle undo */ + //!@} + + //! Slot to handle undo. + virtual void do_undo (void) { } - // event filter for double clicks into the window decoration elements + //! Event filter for double clicks into the window decoration elements. + bool eventFilter (QObject *obj, QEvent *e); private slots: @@ -117,7 +123,10 @@ void set_style (bool active); void set_focus_predecessor (void); - QMainWindow *m_parent; // store the parent since we are reparenting to 0 + //! Stores the parent, since we are reparenting to 0. + + QMainWindow *m_parent; + bool m_floating; bool m_custom_style; int m_title_3d;
--- a/libgui/src/qtinfo/texinfo-parser.h Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/qtinfo/texinfo-parser.h Thu Sep 28 10:49:39 2017 +0200 @@ -32,77 +32,73 @@ #include <QFileInfoList> #include <QHash> -/** - * @class texinfo_parser - * This class processes Texinfo `*.info`-files and their contained nodes - * for searching and translation to HTML. - * - * Texinfo files are structured by nodes and contain a map with the - * `position` of each node. The nodes themselves hold the actual - * documentation. - * - * If you make a queue with info files, `position` will be the number of - * bytes from begining to a node position. - * - * But is not so easy. There is headers, and qtinfo must not take these - * headers into account. - */ +//! This class processes Texinfo `*.info`-files and their contained nodes +//! for searching and translation to HTML. +//! +//! Texinfo files are structured by nodes and contain a map with the +//! `position` of each node. The nodes themselves hold the actual +//! documentation. +//! +//! If you make a queue with info files, `position` will be the number of +//! bytes from begining to a node position. +//! +//! But is not so easy. There is headers, and qtinfo must not take these +//! headers into account. + class texinfo_parser : public QObject { Q_OBJECT public: - /** - * Ctor. - */ - texinfo_parser (QObject* parent = nullptr); + + //! Ctor. + + texinfo_parser (QObject *parent = nullptr); - /** - * Sets the path of the Texinfo files to \p info_path. - * - * \returns true, if successful, otherwise false. - */ + //! Sets the path of the Texinfo files to @p info_path. + //! + //! @returns true, if successful, otherwise false. + bool set_info_path (const QString& info_path); - /** - * Returns the path of the Texinfo files. - */ + //! Returns the path of the Texinfo files. + QString get_info_path (); - /** - * Search for the text of \p node. - */ + //! Search for the text of @p node. + QString search_node (const QString& node); - /** - * Search for string \p text with \p max_results search results. - */ + //! Search for string @p text with @p max_results search results. + QString global_search (const QString& text, int max_results); - /** - * Find reference \p ref. - * - * \returns A valid XREF-reference, if \p ref exists. - * Otherwise node "Top" is returned. - */ + //! Find reference @p ref. + //! + //! @returns A valid XREF-reference, if @p ref exists. + //! Otherwise node "Top" is returned. + QString find_reference (const QString& ref); - /** - * Checks if \p ref is a XREF-reference. - */ + //! Checks if @p ref is a XREF-reference. + bool is_reference (const QString& ref); - /** - * Get a HTML representation of \p node. - * \param anchor name of the anchor `<a name="anchor">`, if \p node is - * a XREF-reference. - * \returns HTML string. - */ + //! Get a HTML representation of @p node. + //! + //! If @p node is a XREF-reference, an HTML anchor `<a name="anchor">` is + //! inserted at the position of the XREF-reference to navigate to it. + //! + //! @param anchor Name of the anchor. + //! + //! @returns HTML string. + QString node_as_html (const QString& node, const QString& anchor = QString ()); private: + struct node_position { QString _node_name; @@ -126,31 +122,28 @@ QString get_node_next (const QString& text); QString get_node_prev (const QString& text); - /** - * Append \p line to \text. - */ + //! Append @p line to @p text. + void append_line (QString *text, const char *line); - /** - * Parse `*.info` file and generate map of nodes and their positions. - */ + //! Parse `*.info` file and generate map of nodes and their positions. + void parse_info_map (); - /** - * Open compressed `*.info` file \p fileInfo. - */ + //! Open compressed `*.info` file @p fileInfo. + QIODevice* open_file (QFileInfo& fileInfo); - /** Calculates real position of nodes. - * \param pos position from info file. - * \param file_info returns file that contains \p pos. - * \param real_pos returns real position inside \p file_info. - */ + //! Calculates real position of nodes. + //! + //! @param pos Position from info file. + //! @param file_info Returns file that contains @p pos. + //! @param real_pos Returns real position inside @p file_info. + void real_position (int pos, QFileInfo& file_info, int& real_pos); - /** - * Seeks in \p io to position \p pos. - */ + //! Seeks in @p io to position @p pos. + void seek (QIODevice *io, int pos); QString _info_path;
--- a/libgui/src/workspace-view.h Wed Sep 27 15:56:39 2017 -0400 +++ b/libgui/src/workspace-view.h Thu Sep 28 10:49:39 2017 +0200 @@ -55,10 +55,12 @@ signals: - /** signal that user had requested a command on a variable */ + //! Signal that user had requested a command on a variable. + void command_requested (const QString& cmd); - /// signal that user wants to edit a variable + //! Signal that user wants to edit a variable. + void edit_variable_signal (const QString&); protected: