Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerCoreCommandOptions.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerCoreCommandOptions_h
22 #define __qSlicerCoreCommandOptions_h
23 
24 // CTK includes
25 #include <ctkCommandLineParser.h>
26 
27 #include "qSlicerBaseQTCoreExport.h"
28 #include "vtkSlicerConfigure.h" // For Slicer_USE_PYTHONQT
29 
30 class QSettings;
31 class qSlicerCoreCommandOptionsPrivate;
32 
33 class Q_SLICER_BASE_QTCORE_EXPORT qSlicerCoreCommandOptions : public ctkCommandLineParser
34 {
35  Q_OBJECT
36  Q_PROPERTY(bool displayHelpAndExit READ displayHelpAndExit CONSTANT)
37  Q_PROPERTY(bool ignoreSlicerRC READ ignoreSlicerRC CONSTANT)
38  Q_PROPERTY(QString pythonScript READ pythonScript CONSTANT)
39  Q_PROPERTY(QString extraPythonScript READ extraPythonScript CONSTANT)
40  Q_PROPERTY(QString pythonCode READ pythonCode CONSTANT)
41  Q_PROPERTY(bool runPythonAndExit READ runPythonAndExit WRITE setRunPythonAndExit)
42  Q_PROPERTY(bool disableCLIModules READ disableCLIModules CONSTANT)
43  Q_PROPERTY(bool disableLoadableModules READ disableLoadableModules CONSTANT)
44  Q_PROPERTY(bool disableScriptedLoadableModules READ disableScriptedLoadableModules CONSTANT)
45  Q_PROPERTY(bool disableBuiltInCLIModules READ disableBuiltInCLIModules CONSTANT)
46  Q_PROPERTY(bool disableBuiltInLoadableModules READ disableBuiltInLoadableModules CONSTANT)
47  Q_PROPERTY(bool disableBuiltInScriptedLoadableModules READ disableBuiltInScriptedLoadableModules CONSTANT)
48  Q_PROPERTY(bool displayApplicationInformation READ displayApplicationInformation CONSTANT)
49  Q_PROPERTY(bool displayVersionAndExit READ displayVersionAndExit CONSTANT)
50  Q_PROPERTY(bool displayProgramPathAndExit READ displayProgramPathAndExit CONSTANT)
51  Q_PROPERTY(bool displayHomePathAndExit READ displayHomePathAndExit CONSTANT)
52  Q_PROPERTY(bool displaySettingsPathAndExit READ displaySettingsPathAndExit CONSTANT)
53  Q_PROPERTY(bool displayTemporaryPathAndExit READ displayTemporaryPathAndExit CONSTANT)
54  Q_PROPERTY(bool displayMessageAndExit READ displayMessageAndExit STORED false CONSTANT)
55  Q_PROPERTY(bool verboseModuleDiscovery READ verboseModuleDiscovery CONSTANT)
56  Q_PROPERTY(bool disableMessageHandlers READ disableMessageHandlers CONSTANT)
57  Q_PROPERTY(bool testingEnabled READ isTestingEnabled CONSTANT)
58 #ifdef Slicer_USE_PYTHONQT
59  Q_PROPERTY(bool pythonDisabled READ isPythonDisabled CONSTANT)
60 #endif
61  Q_PROPERTY(QStringList additionalModulePaths READ additionalModulePaths CONSTANT)
62  Q_PROPERTY(QStringList modulesToIgnore READ modulesToIgnore CONSTANT)
63 public:
64  typedef ctkCommandLineParser Superclass;
66  ~qSlicerCoreCommandOptions() override;
67 
69  bool parse(const QStringList& arguments);
70 
72  bool displayHelpAndExit()const;
73 
75  bool ignoreRest() const;
76 
78  bool ignoreSlicerRC()const;
79 
81  QString pythonScript()const;
82 
84  QString extraPythonScript()const;
85 
87  void setExtraPythonScript(const QString& newExtraPythonScript);
88 
90  QString pythonCode()const;
91 
93  bool runPythonAndExit()const;
94 
96  void setRunPythonAndExit(bool value);
97 
99  QStringList additionalModulePaths()const;
100 
102  QStringList modulesToIgnore()const;
103 
105  bool disableModules()const;
106 
108  bool disableBuiltInModules()const;
109 
111  bool disableCLIModules()const;
112 
114  bool disableBuiltInCLIModules()const;
115 
117  bool disableLoadableModules()const;
118 
120  bool disableBuiltInLoadableModules()const;
121 
123  bool disableScriptedLoadableModules()const;
124 
126  bool disableBuiltInScriptedLoadableModules()const;
127 
129  bool displayVersionAndExit()const;
130 
132  bool displayProgramPathAndExit()const;
133 
135  bool displayHomePathAndExit()const;
136 
138  bool displaySettingsPathAndExit()const;
139 
141  bool displayTemporaryPathAndExit()const;
142 
152  virtual bool displayMessageAndExit() const;
153 
155  bool displayApplicationInformation() const;
156 
158  bool verboseModuleDiscovery()const;
159 
161  bool verbose()const;
162 
164  bool disableMessageHandlers()const;
165 
171  bool disableTerminalOutputs()const;
172 
179  bool settingsDisabled() const;
180 
185  bool keepTemporarySettings() const;
186 
192  bool isTestingEnabled()const;
193 
194 #ifdef Slicer_USE_PYTHONQT
195  bool isPythonDisabled()const;
199 #endif
200 
201 
202 protected:
205  virtual void addArguments();
206 
209  QHash<QString, QVariant> parsedArgs() const;
210 
211 protected:
212  QScopedPointer<qSlicerCoreCommandOptionsPrivate> d_ptr;
213 
214 private:
215  Q_DECLARE_PRIVATE(qSlicerCoreCommandOptions);
216  Q_DISABLE_COPY(qSlicerCoreCommandOptions);
217 
218 };
219 
220 #endif
QScopedPointer< qSlicerCoreCommandOptionsPrivate > d_ptr