Isis Developer Reference
UserInterface.h
Go to the documentation of this file.
1 #ifndef UserInterface_h
2 #define UserInterface_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include "FileName.h"
10 #include "Gui.h"
11 #include "IsisAml.h"
12 #include "PvlTokenizer.h"
13 
14 class Gui;
15 
16 namespace Isis {
140  class UserInterface : public IsisAml {
141  public:
142  UserInterface(const QString &xmlfile, int &argc, char *argv[]);
143  UserInterface(const QString &xmlfile, QVector<QString> &args);
144  ~UserInterface();
145 
152  bool AbortOnError() {
153  return p_abortOnError;
154  };
155 
163  return p_batchList.size();
164  };
165 
171  bool IsInteractive() {
172  return p_gui != NULL;
173  };
174 
180  int ParentId() {
181  return p_parentId;
182  };
183 
187  Gui *TheGui() {
188  return p_gui;
189  };
190 
191  QString GetInfoFileName();
192  bool GetInfoFlag();
193 
194  void SetBatchList(int i);
195  void SetErrorList(int i);
196 
197  void SaveHistory();
198 
199  private:
200  void loadBatchList(const QString file);
201  void loadCommandLine(QVector<QString> &args, bool ignoreAppName=true);
202 
203  void loadCommandLine(int argc, char *argv[]);
204  void loadHistory(const QString file);
205 
206  void evaluateOption(const QString name, const QString value);
207  void getNextParameter(unsigned int &curPos,
208  QString &unresolvedParam,
209  std::vector<QString> &value);
210  void preProcess(QString fullReservedName, std::vector<QString> &reservedParams);
211  std::vector<QString> readArray(QString arrayString);
212  QString resolveParameter(QString &name,
213  std::vector<QString> &reservedParams,
214  bool handleNoMatches = true);
215 
217  bool p_abortOnError;
219  std::vector<std::vector<QString> > p_batchList;
221  std::vector<char *> p_cmdline;
223  QString p_errList;
225  Gui *p_gui;
227  bool p_info;
229  QString p_infoFileName;
231  bool p_interactive;
233  int p_parentId;
235  QString p_progName;
237  QString p_saveFile;
238  };
239 };
240 
241 #endif
Isis::UserInterface::IsInteractive
bool IsInteractive()
Indicates if the Isis Graphical User Interface is operating.
Definition: UserInterface.h:171
Isis::UserInterface::GetInfoFileName
QString GetInfoFileName()
This method returns the filename where the debugging info is stored when the "-info" tag is used.
Definition: UserInterface.cpp:119
FileName.h
IsisAml::PutAsString
void PutAsString(const QString &paramName, const QString &value)
Allows the insertion of a value for any parameter.
Definition: IsisAml.cpp:65
IsisAml::ParamListSize
int ParamListSize(const int &group, const int &param) const
Returns the number of options in the specified parameter's list.
Definition: IsisAml.cpp:1601
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::PvlObject::group
PvlGroup & group(const int index)
Return the group at the specified index.
Definition: PvlObject.cpp:452
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::ProgramLauncher::RunSystemCommand
static void RunSystemCommand(QString commandLine)
This runs arbitrary system commands.
Definition: ProgramLauncher.cpp:207
IsisAml::ParamListValue
QString ParamListValue(const int &group, const int &param, const int &option) const
Returns the option value for a specific option to a parameter.
Definition: IsisAml.cpp:1615
IsisAml::NumGroups
int NumGroups() const
Returns the number of groups found in the XML.
Definition: IsisAml.cpp:1087
IsisAml::ParamMinimumInclusive
QString ParamMinimumInclusive(const int &group, const int &param) const
Returns whether the minimum value is inclusive or not.
Definition: IsisAml.cpp:1284
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::UserInterface::SetErrorList
void SetErrorList(int i)
This method adds the line specified in the BatchList that the error occured on.
Definition: UserInterface.cpp:234
Isis::PvlObject::groups
int groups() const
Returns the number of groups contained.
Definition: PvlObject.h:75
Isis::FileName::fileExists
bool fileExists() const
Returns true if the file exists; false otherwise.
Definition: FileName.cpp:449
IsisAml::ParamBrief
QString ParamBrief(const int &group, const int &param) const
Returns the brief description of a parameter in a specified group.
Definition: IsisAml.cpp:1232
IsisAml::ParamGreaterThanOrEqual
QString ParamGreaterThanOrEqual(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThanOrEqual parameter.
Definition: IsisAml.cpp:1402
IsisParameterData
Definition: IsisAmlData.h:53
Isis::UserInterface::ParentId
int ParentId()
Returns the parent id.
Definition: UserInterface.h:180
Isis::TextFile
Provides access to sequential ASCII stream I/O.
Definition: TextFile.h:38
PvlTokenizer.h
IsisAml::ParamMaximum
QString ParamMaximum(const int &group, const int &param) const
Returns the maximum value of a parameter in a specified group.
Definition: IsisAml.cpp:1271
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::TextFile::GetLine
bool GetLine(QString &line, const bool skipComments=true)
Gets next line from file.
Definition: TextFile.cpp:411
Isis::Pvl::write
void write(const QString &file)
Opens and writes PVL information to a file and handles the end of line sequence.
Definition: Pvl.cpp:130
Isis::UserInterface::GetInfoFlag
bool GetInfoFlag()
This method returns the flag state of info.
Definition: UserInterface.cpp:130
IsisAml::ParamGreaterThan
QString ParamGreaterThan(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThan parameter.
Definition: IsisAml.cpp:1387
Isis::Gui
Gui for Isis Applications.
Definition: Gui.h:73
Isis::PvlObject::object
PvlObject & object(const int index)
Return the object at the specified index.
Definition: PvlObject.cpp:489
IsisAml::ParamDefault
QString ParamDefault(const int &group, const int &param) const
Returns the default for a parameter in a specified group.
Definition: IsisAml.cpp:1505
QStringList
Preference.h
IsisAml::ParamListBrief
QString ParamListBrief(const int &group, const int &param, const int &option) const
Returns the brief description for a specific option to a parameter.
Definition: IsisAml.cpp:1630
IsisAml::ParamIncludeSize
int ParamIncludeSize(const int &group, const int &param) const
Returns the number of parameters included in this parameter's inclusions.
Definition: IsisAml.cpp:1731
IString.h
IsisAml::ParamType
QString ParamType(const int &group, const int &param) const
Returns the parameter type of a parameter in a specified group.
Definition: IsisAml.cpp:1492
Isis::UserInterface::BatchListSize
int BatchListSize()
Returns the size of the batchlist.
Definition: UserInterface.h:162
IsisAml::ParamInternalDefault
QString ParamInternalDefault(const int &group, const int &param) const
Returns the internal default for a parameter in a specified group.
Definition: IsisAml.cpp:1524
IsisAml::ParamListExcludeSize
int ParamListExcludeSize(const int &group, const int &param, const int &option) const
Returns the number of items in a parameters list exclude section.
Definition: IsisAml.cpp:1660
Isis::UserInterface::~UserInterface
~UserInterface()
Destroys the UserInterface object.
Definition: UserInterface.cpp:105
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::TextFile::Open
void Open(const QString &filename, const char *openmode="input", const char *extension="")
Opens a text file.
Definition: TextFile.cpp:217
IsisAml::VerifyAll
void VerifyAll()
Verify all parameters.
Definition: IsisAml.cpp:2387
Isis::TextFile::LineCount
int LineCount(const int &maxLinesToRead=0)
Counts number of lines in file.
Definition: TextFile.cpp:607
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
IsisAml::ParamNotEqualSize
int ParamNotEqualSize(const int &group, const int &param) const
Returns the number of values in the not equal list.
Definition: IsisAml.cpp:1374
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::FileName::dir
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
Definition: FileName.cpp:465
Isis::Pvl::read
void read(const QString &file)
Loads PVL information from a stream.
Definition: Pvl.cpp:90
IsisParameterData::defaultValues
std::vector< QString > defaultValues
Definition: IsisAmlData.h:60
Isis::PvlContainer::isNamed
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
Definition: PvlContainer.h:72
Isis::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
IsisAml
Application program XML file parameter manager.
Definition: IsisAml.h:138
Isis::UserInterface::SetBatchList
void SetBatchList(int i)
Clears the gui parameters and sets the batch list information at line i as the new parameters.
Definition: UserInterface.cpp:143
TextFile.h
Application.h
IsisAmlData::name
QString name
Definition: IsisAmlData.h:126
IsisAml::ParamExclude
QString ParamExclude(const int &group, const int &param, const int &exclude) const
Returns the name of the specified excluded parameter.
Definition: IsisAml.cpp:1462
IsisAml::ParamNotEqual
QString ParamNotEqual(const int &group, const int &param, const int &notEq) const
Returns the name of the specified notEqual parameter.
Definition: IsisAml.cpp:1447
IsisAml::ParamListInclude
QString ParamListInclude(const int &group, const int &param, const int &option, const int &include) const
Returns the parameter name to be included if this option is selected.
Definition: IsisAml.cpp:1705
IsisAml::ParamMinimum
QString ParamMinimum(const int &group, const int &param) const
Returns the minimum value of a parameter in a specified group.
Definition: IsisAml.cpp:1258
IsisAml::ParamExcludeSize
int ParamExcludeSize(const int &group, const int &param) const
Returns the number of parameters excluded in this parameter's exclusions.
Definition: IsisAml.cpp:1719
IsisAml::ParamListExclude
QString ParamListExclude(const int &group, const int &param, const int &option, const int &exclude) const
Returns the parameter name to be excluded if this option is selected.
Definition: IsisAml.cpp:1675
Isis::UserInterface::AbortOnError
bool AbortOnError()
Returns true if the program should abort on error, and false if it should continue.
Definition: UserInterface.h:152
Isis::Preference
Reads user preferences from a data file.
Definition: Preference.h:60
IsisAml::ParamInclude
QString ParamInclude(const int &group, const int &param, const int &include) const
Returns the name of the specified included parameter.
Definition: IsisAml.cpp:1477
IsisAml.h
IsisAml::ReturnParam
const IsisParameterData * ReturnParam(const QString &paramName) const
Returns a pointer to a parameter whose name starts with paramName.
Definition: IsisAml.cpp:1965
Isis::PvlContainer::name
QString name() const
Returns the container name.
Definition: PvlContainer.h:63
Isis::IException
Isis exception class.
Definition: IException.h:91
IsisAml::PixelType
QString PixelType(const int &group, const int &param) const
Returns the default pixel type from the XML.
Definition: IsisAml.cpp:1743
IsisAml::ParamGreaterThanOrEqualSize
int ParamGreaterThanOrEqualSize(const int &group, const int &param) const
Returns the number of values in the parameters greater than or equal list.
Definition: IsisAml.cpp:1336
IsisAml::ParamGreaterThanSize
int ParamGreaterThanSize(const int &group, const int &param) const
Returns the number of values in the parameters greater than list.
Definition: IsisAml.cpp:1324
IsisAml::ParamLessThan
QString ParamLessThan(const int &group, const int &param, const int &great) const
Returns the name of the specified lessThan parameter.
Definition: IsisAml.cpp:1417
Isis::PvlObject::addGroup
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
Definition: PvlObject.h:186
IsisAml::ParamListIncludeSize
int ParamListIncludeSize(const int &group, const int &param, const int &option) const
Returns the number of items in a parameters list include section.
Definition: IsisAml.cpp:1690
IsisAml::Clear
void Clear(const QString &paramName)
Clears the value(s) in the named parameter.
Definition: IsisAml.cpp:1852
Isis::UserInterface::TheGui
Gui * TheGui()
Definition: UserInterface.h:187
IsisAml::ParamLessThanSize
int ParamLessThanSize(const int &group, const int &param) const
Returns the number of values in the parameters less than list.
Definition: IsisAml.cpp:1349
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
std
Namespace for the standard library.
ProgramLauncher.h
Isis::UserInterface::SaveHistory
void SaveHistory()
Saves the user parameter information in the history of the program for later use.
Definition: UserInterface.cpp:261
IsisAml::ParamLessThanOrEqualSize
int ParamLessThanOrEqualSize(const int &group, const int &param) const
Returns the number of values in the parameters less than or equal list.
Definition: IsisAml.cpp:1361
Isis::UserInterface
Command Line and Xml loader, validation, and access.
Definition: UserInterface.h:140
IsisAml::CommandLine
void CommandLine(Isis::Pvl &lab) const
Creates a QString which could be used as a command line.
Definition: IsisAml.cpp:2910
IsisParameterData::internalDefault
QString internalDefault
Definition: IsisAmlData.h:61
Isis::IString::Token
IString Token(const IString &separator)
Returns the first token in the IString.
Definition: IString.cpp:897
IsisAml::ParamLessThanOrEqual
QString ParamLessThanOrEqual(const int &group, const int &param, const int &les) const
Returns the name of the specified lessThanOrEqual parameter.
Definition: IsisAml.cpp:1432
Isis::Gui::checkX11
static void checkX11()
check to see if X is available
Definition: Gui.cpp:55
Gui.h
Isis::PvlContainer::keywords
int keywords() const
Returns the number of keywords contained in the PvlContainer.
Definition: PvlContainer.h:86
Isis::UserInterface::UserInterface
UserInterface(const QString &xmlfile, int &argc, char *argv[])
Constructs an UserInterface object.
Definition: UserInterface.cpp:71
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis::Preference::Preferences
static Preference & Preferences(bool unitTest=false)
Definition: Preference.cpp:86
QVector< QString >
IsisAml::ParamMaximumInclusive
QString ParamMaximumInclusive(const int &group, const int &param) const
Returns whether the maximum value is inclusive or not.
Definition: IsisAml.cpp:1297
Isis::PvlObject::deleteGroup
void deleteGroup(const QString &name)
Remove a group from the current PvlObject.
Definition: PvlObject.cpp:408
IsisAml::ProgramName
QString ProgramName() const
Returns the Program name.
Definition: IsisAml.cpp:1057
IsisAml::ParamOdd
QString ParamOdd(const int &group, const int &param) const
Returns whether the selected parameter has a restriction on odd values or not.
Definition: IsisAml.cpp:1311
IsisAml::ParamName
QString ParamName(const int &group, const int &param) const
Returns the parameter name.
Definition: IsisAml.cpp:1219
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IString::ToQt
QString ToQt() const
Retuns the object string as a QString.
Definition: IString.cpp:869
Message.h
Isis::Gui::Create
static Gui * Create(Isis::UserInterface &ui, int &argc, char *argv[])
Definition: Gui.cpp:84
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
IsisAml::NumParams
int NumParams(const int &) const
Returns the number of parameters in a group.
Definition: IsisAml.cpp:1207