Mercurial > octave
diff libgui/src/variable-editor.h @ 24828:0f6a261ab144
move some GUI classes inside octave namespace
* octave-dock-widget.cc, octave-dock-widget.h,
variable-editor-model.cc, variable-editor-model.h, variable-editor.cc,
variable-editor.h: Move classes inside octave namespace.
* settings-dialog.cc: Tag variable_editor with octave:: namespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 02 Mar 2018 15:37:31 -0500 |
parents | ed9ba20d6ed3 |
children | 8ce66fe46f18 |
line wrap: on
line diff
--- a/libgui/src/variable-editor.h Fri Mar 02 13:25:34 2018 -0500 +++ b/libgui/src/variable-editor.h Fri Mar 02 15:37:31 2018 -0500 @@ -39,320 +39,323 @@ class QTextEdit; class QToolBar; -class variable_editor_model; -class variable_editor_view; - -// The individual variable subwindow class - -class variable_dock_widget : public label_dock_widget +namespace octave { - Q_OBJECT + class variable_editor_model; + class variable_editor_view; -public: + // The individual variable subwindow class - variable_dock_widget (QWidget *p = nullptr); + class variable_dock_widget : public label_dock_widget + { + Q_OBJECT -signals: + public: - void variable_focused_signal (const QString& name); + variable_dock_widget (QWidget *p = nullptr); + + signals: -protected: + void variable_focused_signal (const QString& name); - virtual void closeEvent (QCloseEvent *e); + protected: -public slots: + virtual void closeEvent (QCloseEvent *e); - void handle_focus_change (QWidget *old, QWidget *now); + public slots: + + void handle_focus_change (QWidget *old, QWidget *now); -private slots: + private slots: - void change_floating (bool); + void change_floating (bool); - void change_existence (bool); + void change_existence (bool); - void toplevel_change (bool); + void toplevel_change (bool); -protected: + protected: - bool m_initial_float; -}; + bool m_initial_float; + }; -class variable_editor_stack : public QStackedWidget -{ - Q_OBJECT + class variable_editor_stack : public QStackedWidget + { + Q_OBJECT -public: + public: - variable_editor_stack (QWidget *p = nullptr); + variable_editor_stack (QWidget *p = nullptr); - variable_editor_view *edit_view (void) {return m_edit_view;}; + variable_editor_view *edit_view (void) {return m_edit_view;}; - QTextEdit *disp_view (void) {return m_disp_view;}; + QTextEdit *disp_view (void) {return m_disp_view;}; -signals: + signals: - void command_signal (const QString& cmd); + void command_signal (const QString& cmd); - void edit_variable_signal (const QString& name, const octave_value& val); + void edit_variable_signal (const QString& name, const octave_value& val); -public slots: + public slots: - void set_editable (bool editable); + void set_editable (bool editable); - void levelUp (void); + void levelUp (void); - void save (void); + void save (void); -private: + private: - QTextEdit *make_disp_view (QWidget *parent); + QTextEdit *make_disp_view (QWidget *parent); - variable_editor_view *m_edit_view; + variable_editor_view *m_edit_view; - QTextEdit *m_disp_view; -}; + QTextEdit *m_disp_view; + }; -class variable_editor_view : public QTableView -{ - Q_OBJECT + class variable_editor_view : public QTableView + { + Q_OBJECT -public: + public: - variable_editor_view (QWidget *p = nullptr); + variable_editor_view (QWidget *p = nullptr); - void setModel (QAbstractItemModel *model); + void setModel (QAbstractItemModel *model); -signals: + signals: - void command_signal (const QString& cmd); + void command_signal (const QString& cmd); - void add_edit_actions_signal (QMenu *menu, const QString& qualifier_string); + void add_edit_actions_signal (QMenu *menu, const QString& qualifier_string); -public slots: + public slots: - void createVariable (void); + void createVariable (void); - void transposeContent (void); + void transposeContent (void); - QList<int> range_selected (void); + QList<int> range_selected (void); - void delete_selected (void); + void delete_selected (void); - void clearContent (void); + void clearContent (void); - void cutClipboard (void); + void cutClipboard (void); - void copyClipboard (void); + void copyClipboard (void); - void pasteClipboard (void); + void pasteClipboard (void); - void pasteTableClipboard (void); + void pasteTableClipboard (void); - void handle_horizontal_scroll_action (int action); + void handle_horizontal_scroll_action (int action); - void handle_vertical_scroll_action (int action); + void handle_vertical_scroll_action (int action); - void createContextMenu (const QPoint& pt); + void createContextMenu (const QPoint& pt); - void createColumnMenu (const QPoint& pt); + void createColumnMenu (const QPoint& pt); - void createRowMenu (const QPoint& pt); + void createRowMenu (const QPoint& pt); - // Convert selection to an Octave expression. - QString selected_to_octave (void); + // Convert selection to an Octave expression. + QString selected_to_octave (void); - void selected_command_requested (const QString& cmd); + void selected_command_requested (const QString& cmd); -private: + private: - void add_edit_actions (QMenu *menu, const QString& qualifier_string); + void add_edit_actions (QMenu *menu, const QString& qualifier_string); - variable_editor_model *m_var_model; -}; + variable_editor_model *m_var_model; + }; -// Gadgets to keep track and restore what variable window -// was in focus just prior to selecting something on the -// menu bar + // Gadgets to keep track and restore what variable window + // was in focus just prior to selecting something on the + // menu bar -class HoverToolButton : public QToolButton -{ - Q_OBJECT + class HoverToolButton : public QToolButton + { + Q_OBJECT -public: + public: - HoverToolButton (QWidget *parent = nullptr); + HoverToolButton (QWidget *parent = nullptr); -signals: + signals: - void hovered_signal (void); + void hovered_signal (void); - void popup_shown_signal (void); + void popup_shown_signal (void); -protected: + protected: - bool eventFilter (QObject *obj, QEvent *ev); -}; + bool eventFilter (QObject *obj, QEvent *ev); + }; -class ReturnFocusToolButton : public HoverToolButton -{ - Q_OBJECT + class ReturnFocusToolButton : public HoverToolButton + { + Q_OBJECT -public: + public: - ReturnFocusToolButton (QWidget *parent = nullptr); + ReturnFocusToolButton (QWidget *parent = nullptr); -signals: + signals: - void about_to_activate (void); + void about_to_activate (void); -protected: + protected: - bool eventFilter (QObject *obj, QEvent *ev); -}; + bool eventFilter (QObject *obj, QEvent *ev); + }; -class ReturnFocusMenu : public QMenu -{ - Q_OBJECT + class ReturnFocusMenu : public QMenu + { + Q_OBJECT -public: + public: - ReturnFocusMenu (QWidget *parent = nullptr); + ReturnFocusMenu (QWidget *parent = nullptr); -signals: + signals: - void about_to_activate (void); + void about_to_activate (void); -protected: + protected: - bool eventFilter (QObject *obj, QEvent *ev); -}; + bool eventFilter (QObject *obj, QEvent *ev); + }; -// The variable editor class + // The variable editor class -class variable_editor : public octave_dock_widget -{ - Q_OBJECT + class variable_editor : public octave_dock_widget + { + Q_OBJECT -public: + public: - variable_editor (QWidget *parent = nullptr); + variable_editor (QWidget *parent = nullptr); - ~variable_editor (void) = default; + ~variable_editor (void) = default; - // No copying! + // No copying! - variable_editor (const variable_editor&) = delete; + variable_editor (const variable_editor&) = delete; - variable_editor& operator = (const variable_editor&) = delete; + variable_editor& operator = (const variable_editor&) = delete; - void refresh (void); + void refresh (void); - static QList<QColor> default_colors (void); + static QList<QColor> default_colors (void); - static QStringList color_names (void); + static QStringList color_names (void); -public slots: + public slots: - void callUpdate (const QModelIndex&, const QModelIndex&); + void callUpdate (const QModelIndex&, const QModelIndex&); - void notice_settings (const QSettings *); + void notice_settings (const QSettings *); - void edit_variable (const QString& name, const octave_value& val); + void edit_variable (const QString& name, const octave_value& val); - void variable_destroyed (QObject *obj); + void variable_destroyed (QObject *obj); - void variable_focused (const QString& name); + void variable_focused (const QString& name); - void record_hovered_focus_variable (void); + void record_hovered_focus_variable (void); - void restore_hovered_focus_variable (void); + void restore_hovered_focus_variable (void); -protected slots: + protected slots: - void closeEvent (QCloseEvent *); + void closeEvent (QCloseEvent *); - void save (void); + void save (void); - void cutClipboard (void); + void cutClipboard (void); - void copyClipboard (void); + void copyClipboard (void); - void pasteClipboard (void); + void pasteClipboard (void); - void pasteTableClipboard (void); + void pasteTableClipboard (void); - void levelUp (void); + void levelUp (void); - // Send command to Octave interpreter. - // %1 in CMD is replaced with the value of selected_to_octave. - void relay_selected_command (const QString& cmd); + // Send command to Octave interpreter. + // %1 in CMD is replaced with the value of selected_to_octave. + void relay_selected_command (const QString& cmd); -signals: + signals: - void updated (void); + void updated (void); - void finished (void); + void finished (void); - void command_signal (const QString& cmd); + void command_signal (const QString& cmd); - void refresh_signal (void); + void refresh_signal (void); - void clear_content_signal (void); + void clear_content_signal (void); - void copy_clipboard_signal (void); + void copy_clipboard_signal (void); - void paste_clipboard_signal (void); + void paste_clipboard_signal (void); - void paste_table_clipboard_signal (void); + void paste_table_clipboard_signal (void); - void level_up_signal (void); + void level_up_signal (void); - void save_signal (void); + void save_signal (void); + + void delete_selected_signal (void); - void delete_selected_signal (void); + void selected_command_signal (const QString& cmd); - void selected_command_signal (const QString& cmd); + private: -private: + QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text, + const char *member); - QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text, - const char *member); + QMainWindow *m_main; - QMainWindow *m_main; + QToolBar *m_tool_bar; - QToolBar *m_tool_bar; + int m_default_width; - int m_default_width; + int m_default_height; - int m_default_height; + int m_add_font_height; - int m_add_font_height; + bool m_use_terminal_font; - bool m_use_terminal_font; - - bool m_alternate_rows; + bool m_alternate_rows; - QString m_stylesheet; + QString m_stylesheet; - QFont m_font; + QFont m_font; - // If use_terminal_font is true then this will be different since - // "font" will contain the terminal font. - QFont m_sel_font; + // If use_terminal_font is true then this will be different since + // "font" will contain the terminal font. + QFont m_sel_font; - QList<QColor> m_table_colors; + QList<QColor> m_table_colors; - void update_colors (void); + void update_colors (void); - QAction *add_tool_bar_button (const QIcon &icon, const QString &text, - const QObject *receiver, const char *member); + QAction *add_tool_bar_button (const QIcon &icon, const QString &text, + const QObject *receiver, const char *member); - void construct_tool_bar (void); + void construct_tool_bar (void); - QString m_current_focus_vname; + QString m_current_focus_vname; - QString m_hovered_focus_vname; -}; + QString m_hovered_focus_vname; + }; +} #endif