1 //////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (C) 2011-2021 The Octave Project Developers 4 // 5 // See the file COPYRIGHT.md in the top-level directory of this 6 // distribution or <https://octave.org/copyright/>. 7 // 8 // This file is part of Octave. 9 // 10 // Octave is free software: you can redistribute it and/or modify it 11 // under the terms of the GNU General Public License as published by 12 // the Free Software Foundation, either version 3 of the License, or 13 // (at your option) any later version. 14 // 15 // Octave is distributed in the hope that it will be useful, but 16 // WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of the GNU General Public License 21 // along with Octave; see the file COPYING. If not, see 22 // <https://www.gnu.org/licenses/>. 23 // 24 //////////////////////////////////////////////////////////////////////// 25 26 #if defined (HAVE_CONFIG_H) 27 # include "config.h" 28 #endif 29 30 #include "main-window.h" 31 #include "octave-qobject.h" 32 #include "qt-application.h" 33 34 #include "lo-utils.h" 35 #include "oct-env.h" 36 #include "oct-syscalls.h" 37 #include "signal-wrappers.h" 38 39 #include "display.h" 40 #include "octave.h" 41 #include "sysdep.h" 42 43 namespace octave 44 { qt_application(int argc,char ** argv)45 qt_application::qt_application (int argc, char **argv) 46 : application (argc, argv) 47 { 48 // This should probably happen early. 49 sysdep_init (); 50 } 51 start_gui_p(void) const52 bool qt_application::start_gui_p (void) const 53 { 54 return m_options.gui (); 55 } 56 execute(void)57 int qt_application::execute (void) 58 { 59 octave_block_interrupt_signal (); 60 61 set_application_id (); 62 63 // Create and show main window. 64 65 if (start_gui_p ()) 66 { 67 gui_qobject gui_interface (*this); 68 return gui_interface.exec (); 69 } 70 else 71 { 72 cli_qobject cli_interface (*this); 73 return cli_interface.exec (); 74 } 75 } 76 } 77