comparison gui/src/main-window.cc @ 15055:48ae6a7c69c1 gui

Integrated texinfo browser from QtOctave. * documentation-dockwidget.cc: Added new dock widget for the documentation. * documentation-dockwidget.h: Added new dock widget for the documentation. * bookmark.png: New icon file. * question.png: New icon file. * star.png: New icon file. * stop.png: New icon file. * zoom-in.png: New icon file. * zoom-out.png: New icon file. * parser.cc: Added file from QtOctave, refactored code. * parser.h: Added file from QtOctave, refactored code. * webinfo.cc: Added file from QtOctave, refactored code. * webinfo.h: Added file from QtOctave, refactored code. * main-window.cc: Added menu entries to handle documentation and integrated new documentation dock widget. * main-window.h: Including header for documentation dock widget and added member variable. * resource.qrc: Added icon entries for new icon files. * src.pro: Added file entries for new file added to the project.
author Jacob Dawid <jacob.dawid@gmail.com>
date Mon, 30 Jul 2012 19:27:14 +0200
parents 1ffaad442161
children d02b229ce693
comparison
equal deleted inserted replaced
15053:6889217b9d78 15055:48ae6a7c69c1
308 _file_editor->activateWindow (); 308 _file_editor->activateWindow ();
309 _file_editor->raise (); 309 _file_editor->raise ();
310 } 310 }
311 311
312 void 312 void
313 main_window::focus_documentation ()
314 {
315 if (!_documentation_dock_widget->isVisible ())
316 {
317 _documentation_dock_widget->setVisible (true);
318 }
319
320 _documentation_dock_widget->setFocus ();
321 _documentation_dock_widget->activateWindow ();
322 _documentation_dock_widget->raise ();
323 }
324
325 void
313 main_window::handle_entered_debug_mode () 326 main_window::handle_entered_debug_mode ()
314 { 327 {
315 setWindowTitle ("Octave (Debugging)"); 328 setWindowTitle ("Octave (Debugging)");
316 _debug_continue->setEnabled (true); 329 _debug_continue->setEnabled (true);
317 _debug_step_into->setEnabled (true); 330 _debug_step_into->setEnabled (true);
427 _workspace_view->setStatusTip (tr ("View the variables in the active workspace.")); 440 _workspace_view->setStatusTip (tr ("View the variables in the active workspace."));
428 _history_dock_widget = new history_dock_widget (this); 441 _history_dock_widget = new history_dock_widget (this);
429 _history_dock_widget->setStatusTip (tr ("Browse and search the command history.")); 442 _history_dock_widget->setStatusTip (tr ("Browse and search the command history."));
430 _files_dock_widget = new files_dock_widget (this); 443 _files_dock_widget = new files_dock_widget (this);
431 _files_dock_widget->setStatusTip (tr ("Browse your files.")); 444 _files_dock_widget->setStatusTip (tr ("Browse your files."));
445 _documentation_dock_widget= new documentation_dock_widget (this);
446 _documentation_dock_widget->setStatusTip (tr ("See the documentation for help."));
432 _status_bar = new QStatusBar (this); 447 _status_bar = new QStatusBar (this);
433 448
434 _current_directory_combo_box = new QComboBox (this); 449 _current_directory_combo_box = new QComboBox (this);
435 _current_directory_combo_box->setFixedWidth (300); 450 _current_directory_combo_box->setFixedWidth (300);
436 _current_directory_combo_box->setEditable (true); 451 _current_directory_combo_box->setEditable (true);
637 652
638 QAction * show_editor_action = window_menu->addAction (tr ("Show Editor")); 653 QAction * show_editor_action = window_menu->addAction (tr ("Show Editor"));
639 show_editor_action->setCheckable (true); 654 show_editor_action->setCheckable (true);
640 show_editor_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier 655 show_editor_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier
641 + Qt::Key_4); 656 + Qt::Key_4);
657
658 QAction * show_documentation_action = window_menu->addAction (tr ("Show Documentation"));
659 show_documentation_action->setCheckable (true);
660 show_documentation_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier
661 + Qt::Key_5);
642 window_menu->addSeparator (); 662 window_menu->addSeparator ();
643 663
644 QAction * command_window_action 664 QAction * command_window_action
645 = window_menu->addAction (tr ("Command Window")); 665 = window_menu->addAction (tr ("Command Window"));
646 command_window_action->setShortcut (Qt::ControlModifier + Qt::Key_0); 666 command_window_action->setShortcut (Qt::ControlModifier + Qt::Key_0);
658 workspace_action->setShortcut (Qt::ControlModifier + Qt::Key_3); 678 workspace_action->setShortcut (Qt::ControlModifier + Qt::Key_3);
659 679
660 QAction * editor_action 680 QAction * editor_action
661 = window_menu->addAction (tr ("Editor")); 681 = window_menu->addAction (tr ("Editor"));
662 editor_action->setShortcut (Qt::ControlModifier + Qt::Key_4); 682 editor_action->setShortcut (Qt::ControlModifier + Qt::Key_4);
683
684 QAction * documentation_action
685 = window_menu->addAction (tr ("Documentation"));
686 documentation_action->setShortcut (Qt::ControlModifier + Qt::Key_5);
663 687
664 window_menu->addSeparator (); 688 window_menu->addSeparator ();
665 QAction * reset_windows_action 689 QAction * reset_windows_action
666 = window_menu->addAction (tr ("Reset Windows")); 690 = window_menu->addAction (tr ("Reset Windows"));
667 reset_windows_action->setEnabled (false); // TODO: Make this work. 691 reset_windows_action->setEnabled (false); // TODO: Make this work.
731 show_file_browser_action, SLOT (setChecked (bool))); 755 show_file_browser_action, SLOT (setChecked (bool)));
732 connect (show_editor_action, SIGNAL (toggled (bool)), 756 connect (show_editor_action, SIGNAL (toggled (bool)),
733 _file_editor, SLOT (setVisible (bool))); 757 _file_editor, SLOT (setVisible (bool)));
734 connect (_file_editor, SIGNAL (active_changed (bool)), 758 connect (_file_editor, SIGNAL (active_changed (bool)),
735 show_editor_action, SLOT (setChecked (bool))); 759 show_editor_action, SLOT (setChecked (bool)));
760 connect (show_documentation_action, SIGNAL (toggled (bool)),
761 _documentation_dock_widget, SLOT (setVisible (bool)));
762 connect (_documentation_dock_widget, SIGNAL (active_changed (bool)),
763 show_documentation_action, SLOT (setChecked (bool)));
736 764
737 connect (command_window_action, SIGNAL (triggered ()), 765 connect (command_window_action, SIGNAL (triggered ()),
738 this, SLOT (focus_command_window ())); 766 this, SLOT (focus_command_window ()));
739 connect (workspace_action, SIGNAL (triggered ()), 767 connect (workspace_action, SIGNAL (triggered ()),
740 this, SLOT (focus_workspace ())); 768 this, SLOT (focus_workspace ()));
742 this, SLOT (focus_command_history ())); 770 this, SLOT (focus_command_history ()));
743 connect (file_browser_action, SIGNAL (triggered ()), 771 connect (file_browser_action, SIGNAL (triggered ()),
744 this, SLOT (focus_current_directory ())); 772 this, SLOT (focus_current_directory ()));
745 connect (editor_action, SIGNAL (triggered ()), 773 connect (editor_action, SIGNAL (triggered ()),
746 this, SLOT (focus_editor ())); 774 this, SLOT (focus_editor ()));
775 connect (documentation_action, SIGNAL (triggered ()),
776 this, SLOT (focus_documentation ()));
747 777
748 connect (reset_windows_action, SIGNAL (triggered ()), 778 connect (reset_windows_action, SIGNAL (triggered ()),
749 this, SLOT (reset_windows ())); 779 this, SLOT (reset_windows ()));
750 connect (this, SIGNAL (settings_changed ()), 780 connect (this, SIGNAL (settings_changed ()),
751 _files_dock_widget, SLOT (notice_settings ())); 781 _files_dock_widget, SLOT (notice_settings ()));
794 addDockWidget (Qt::LeftDockWidgetArea, _workspace_view); 824 addDockWidget (Qt::LeftDockWidgetArea, _workspace_view);
795 addDockWidget (Qt::LeftDockWidgetArea, _history_dock_widget); 825 addDockWidget (Qt::LeftDockWidgetArea, _history_dock_widget);
796 addDockWidget (Qt::RightDockWidgetArea, _files_dock_widget); 826 addDockWidget (Qt::RightDockWidgetArea, _files_dock_widget);
797 addDockWidget (Qt::RightDockWidgetArea, _file_editor); 827 addDockWidget (Qt::RightDockWidgetArea, _file_editor);
798 addDockWidget (Qt::BottomDockWidgetArea, _terminal_dock_widget); 828 addDockWidget (Qt::BottomDockWidgetArea, _terminal_dock_widget);
829 addDockWidget (Qt::RightDockWidgetArea, _documentation_dock_widget);
799 setStatusBar (_status_bar); 830 setStatusBar (_status_bar);
800 read_settings (); 831 read_settings ();
801 832
802 _octave_qt_event_listener = new octave_qt_event_listener (); 833 _octave_qt_event_listener = new octave_qt_event_listener ();
803 octave_link::instance ()->register_event_listener (_octave_qt_event_listener); 834 octave_link::instance ()->register_event_listener (_octave_qt_event_listener);