annotate libgui/src/qt-application.h @ 31649:deb553ac2c54

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Dec 2022 15:45:27 -0500
parents 431f80aba37a 29d734430e5f
children 5f11de0e7440
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
3 // Copyright (C) 2012-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
15139
bfc220d1de67 include gui in default Octave binary
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
27413
b67e5dc2e34a use consistent naming pattern for include file guards in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27197
diff changeset
26 #if ! defined (octave_qt_application_h)
b67e5dc2e34a use consistent naming pattern for include file guards in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27197
diff changeset
27 #define octave_qt_application_h 1
15139
bfc220d1de67 include gui in default Octave binary
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
31613
c6683fcc5c33 allow qt_application ctor to set Qt organization, application, and version
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
29 #include <string>
c6683fcc5c33 allow qt_application ctor to set Qt organization, application, and version
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
30
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
31 #include "octave.h"
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
32
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
33 OCTAVE_BEGIN_NAMESPACE(octave)
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
34
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
35 // Programming Note: This file must not include any Qt headers. Any
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
36 // Qt header files required by the qt_application::execute function
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
37 // must be included only in the corresponding .cc file.
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
38
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
39 //! This class inherits from the pure-virtual base class
28857
43ad651cf5a0 eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
40 //! application and provides an implementation of the
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
41 //! application::execute method that starts an interface to Octave
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
42 //! that is based on Qt. It may start a command-line interface that
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
43 //! allows Qt graphics to be used or it may start an interface that
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
44 //! provides the full GUI experience.
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
45
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
46 class OCTGUI_API qt_application : public application
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
47 {
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
48 public:
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
49
31613
c6683fcc5c33 allow qt_application ctor to set Qt organization, application, and version
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
50 qt_application (const std::string& organization_name,
c6683fcc5c33 allow qt_application ctor to set Qt organization, application, and version
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
51 const std::string& application_name,
c6683fcc5c33 allow qt_application ctor to set Qt organization, application, and version
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
52 const std::string& application_version,
c6683fcc5c33 allow qt_application ctor to set Qt organization, application, and version
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
53 int argc, char **argv);
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
54
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
55 qt_application (int argc, char **argv);
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
56
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
57 // No copying, at least not yet.
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
58
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
59 qt_application (const qt_application&) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
60
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
61 qt_application& operator = (const qt_application&) = delete;
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25938
diff changeset
62
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27195
diff changeset
63 ~qt_application (void) = default;
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
64
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
65 // Should we start the GUI or fall back to the CLI?
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
66 bool start_gui_p (void) const;
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
67
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
68 int execute (void);
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
69
25938
6fec0e305268 Backed out changeset 2ab0a9b66388
John W. Eaton <jwe@octave.org>
parents: 25937
diff changeset
70 bool gui_running (void) const { return m_gui_running; }
6fec0e305268 Backed out changeset 2ab0a9b66388
John W. Eaton <jwe@octave.org>
parents: 25937
diff changeset
71 void gui_running (bool arg) { m_gui_running = arg; }
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
72
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
73 private:
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
74
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25938
diff changeset
75 // If TRUE, the GUI should be started.
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25938
diff changeset
76 bool m_gui_running = false;
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
77 };
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
78
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
79 OCTAVE_END_NAMESPACE(octave)
15139
bfc220d1de67 include gui in default Octave binary
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
bfc220d1de67 include gui in default Octave binary
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 #endif