Mercurial > octave-nkf
diff libgui/src/octave-gui.cc @ 19984:857a8f018f53
set up octave_link when running with --no-gui option (bug #44116)
* main-window.h, main-window.cc (main_window::_start_gui): New member
variable.
(main_window::main_window): New argument, start_gui.
Skip most initialization if start_gui is false.
(main_window::confirm_shutdown_octave): Skip interactive confirmation
if _start_gui is false.
(main_window::connect_uiwidget_links, main_window::construct,
main_window::construct_octave_qt_link): Skip most initialization if
_start_gui is false.
(main_window::handle_octave_ready): Handle non-gui case.
* octave-gui.cc (octave_start_gui): Unify gui/non-gui options.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 17 Mar 2015 10:13:58 -0400 |
parents | c7c50030e76c |
children | 7aaf756b1532 |
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc Sun Mar 15 17:03:16 2015 +0000 +++ b/libgui/src/octave-gui.cc Tue Mar 17 10:13:58 2015 -0400 @@ -114,16 +114,16 @@ Fregister_graphics_toolkit (ovl ("qt")); + QApplication application (argc, argv); + QTranslator gui_tr, qt_tr, qsci_tr; + + // Set the codec for all strings (before wizard) +#if not defined (Q_OS_WIN32) + QTextCodec::setCodecForCStrings (QTextCodec::codecForName ("UTF-8")); +#endif + if (start_gui) { - QApplication application (argc, argv); - QTranslator gui_tr, qt_tr, qsci_tr; - - // Set the codec for all strings (before wizard) -#if not defined (Q_OS_WIN32) - QTextCodec::setCodecForCStrings (QTextCodec::codecForName ("UTF-8")); -#endif - // show wizard if this is the first run if (resource_manager::is_first_run ()) { @@ -172,13 +172,16 @@ // shortcut manager shortcut_manager::init_data (); + } - // Create and show main window. + // Create and show main window. - main_window w; + main_window w (0, start_gui); - w.read_settings (); + w.read_settings (); + if (start_gui) + { w.init_terminal_size (); // Connect signals for changes in visibility not before w @@ -187,19 +190,9 @@ w.connect_visibility_changed (); w.focus_command_window (); - - return application.exec (); } else - { - QApplication application (argc, argv); - - octave_cli_thread main_thread (argc, argv); + application.setQuitOnLastWindowClosed (false); - application.setQuitOnLastWindowClosed (false); - - main_thread.start (); - - return application.exec (); - } + return application.exec (); }