casa  $Rev:20696$
Public Types | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Slots | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
casa::QtParamGUI Class Reference

#include <QtParamGUI.qo.h>

List of all members.

Public Types

enum  Mode {
  PYTHON,
  SIGNAL
}
 STATIC //. More...
enum  ResetMode {
  DEFAULT,
  GLOBAL,
  LAST
}
 Possible reset values. More...

Signals

void runRequested (String taskName, Record parameters)
 In SIGNAL mode, this is emitted when the user clicks "run".
void cancelRequested ()
 In SIGNAL mode, this is emitted when the user clicks "cancel".

Public Member Functions

 QtParamGUI (const Record &tasksRecord, Mode mode=PYTHON, PyObject *ipythonShell=NULL, const Record *globals=NULL, QWidget *parent=NULL)
 NON-STATIC //.
 ~QtParamGUI ()
 Destructor.
String taskName () const
 Returns the name of the currently displayed task.
Record taskParameters () const
 Returns a copy of the parameter attributes record for this task.
Record taskConstraints () const
 Returns a copy of the constraints record for this task.
Record enteredParameters () const
 Returns the currently entered parameter names/values in a Record.

Static Public Member Functions

static DataType type (String typeName)
 Returns the type for the given type name.
static String type (DataType type)
 Returns the name for the given type.
static String recordToString (const Record &record, String separator)
 Converts the given record into a Python-like string representation.
static String pythonCommand (String taskName, const Record &params)
 Converts the task name and parameter record into a Python command.
static void setupDialog (QDialog *dialog, String taskName, String textName, const String &text)
 Sets up the given dialog to have the given name and given text.
static void replaceSlashQuotes (String &string)
 Replaces all instances of \' and " in the given string with ' and ", respectively.

Static Public Attributes

static const String ALLOWED
 String constants used in parsing the parameter records.
static const String ANY
static const String CONSTRAINTS
static const String DEFAULTS
static const String DESCRIPTION
static const String EXAMPLE
static const String KIND
static const String KIND_FILE
static const String KIND_MS
static const String KIND_TABLE
static const String LIMITTYPES
static const String MUSTEXIST
static const String PARAMETERS
static const String PARAMETER_ORDER
static const String RANGE
static const String RANGE_MIN
static const String RANGE_MAX
static const String SHORT_DESCRIPTION
static const String SUBPARAMETERS
static const String TYPE
static const String UNITS
static const String VALUE

Private Slots

void run ()
 When the user clicks "run".
void reset ()
 When the user clicks "reset".
void cancel ()
 When the user clicks "cancel".
void valueChanged (String paramName)
 When the value for the given parameter changes.
void showHideDesc (bool checked)
 Show/hide the description dialog.
void showHideExample (bool checked)
 Show/hide the example dialog.
void descClosed ()
 When the description dialog is closed.
void exampleClosed ()
 When the example dialog is closed.
void taskChosen (QString task)
 When the user chooses a different task.
void resetChanged ()
 When the user changes the reset option.
void loadLast ()
 When the user loads parameters from a .last file.

Private Member Functions

void setRecord (const Record &record, RecordFieldId id=0)
 Sets the tasks record to the given, and then displays the task with the given RecordFieldId.
pair< bool, StringrecordIsValid (const Record &record, RecordFieldId id)
 Checks the value in the record at the given RecordFieldId for validity.
void setupRecord (vector< String > order)
 Once the displayed task has been chosen, set up the panels.
String constraintsString (const String &id)
 Returns the text for the constraints dialog for the given param panel.
void showHideResets (bool globals, bool last)
 Show/hide the frame and radio buttons for the different reset modes.

Static Private Member Functions

static String strTrim (const String &str)
 Trims the given String of leading and trailing whitespace, where whitespace is ' ', '', '
', and ''.
static String strNLtrim (const String &str)
 Trims the given String of leading newlines and trailing whitespace, where newlines are '
' or '' and whitespace is ' ', '', '
', or ''.
static bool valuesEqual (const RecordInterface &r1, RecordFieldId id1, const RecordInterface &r2, RecordFieldId id2, bool allowStrings=false)
 Returns true if the value at r1[id1] is equal to the value at r2[id2].
static bool recordEqual (const RecordInterface &r1, const RecordInterface &r2)
 Returns true if the two records are equal or not.
template<class T >
static bool arrayEqual (const Array< T > &a1, const Array< T > &a2)
 Returns true if the two arrays are equals or not.
static bool readLastFile (Record &rec, QFile &file, stringstream &ss)
 Reads the python commands from the given file into the given record.

Private Attributes

Record m_tasks
 All tasks and their parameters/attributes.
Record m_globals
 Global parameter values.
Record m_last
 Last parameter values.
ResetMode m_resetMode
 When the user clicks "reset", indicates whether to reset to globals or defaults or last.
Mode m_mode
 Mode.
QDialog * m_descDialog
 Description dialog to show/hide.
QDialog * m_exampleDialog
 Example dialog to show/hide.
PythonInterpreter m_python
 Constraints dialog to show/hide.
vector< ParamPanel * > m_panels
 Parameter panels for currently displayed task.
String m_taskName
 Currently displayed task.

Static Private Attributes

static const unsigned int MAX_SHORTDESC_LENGTH
 STATIC.

Detailed Description

Definition at line 49 of file QtParamGUI.qo.h.


Member Enumeration Documentation

STATIC //.

The running mode.

Enumerator:
PYTHON 
SIGNAL 

Definition at line 56 of file QtParamGUI.qo.h.

Possible reset values.

Enumerator:
DEFAULT 
GLOBAL 
LAST 

Definition at line 61 of file QtParamGUI.qo.h.


Constructor & Destructor Documentation

casa::QtParamGUI::QtParamGUI ( const Record tasksRecord,
Mode  mode = PYTHON,
PyObject *  ipythonShell = NULL,
const Record globals = NULL,
QWidget *  parent = NULL 
)

NON-STATIC //.

Constructor that takes the tasksRecord and builds the GUI. Uses the given mode and passes ipythonShell to the PythonInterpreter (see PythonInterpreter constructor). If the given globals record is valid, any relevant values are used. If the given parent is NULL, the GUI is in dialog form whereas if a parent is given, it can be embedded in another widget. If the tasksRecord contains more than one entry, a QComboBox is displayed at the top of the widget to choose between the different possible tasks.

casa::QtParamGUI::~QtParamGUI ( )

Destructor.


Member Function Documentation

template<class T >
static bool casa::QtParamGUI::arrayEqual ( const Array< T > &  a1,
const Array< T > &  a2 
) [static, private]

Returns true if the two arrays are equals or not.

void casa::QtParamGUI::cancel ( ) [private, slot]

When the user clicks "cancel".

void casa::QtParamGUI::cancelRequested ( ) [signal]

In SIGNAL mode, this is emitted when the user clicks "cancel".

It is the responsibility of the parent/caller to close the QtParamGUI widget as desired.

String casa::QtParamGUI::constraintsString ( const String id) [private]

Returns the text for the constraints dialog for the given param panel.

void casa::QtParamGUI::descClosed ( ) [private, slot]

When the description dialog is closed.

Record casa::QtParamGUI::enteredParameters ( ) const

Returns the currently entered parameter names/values in a Record.

void casa::QtParamGUI::exampleClosed ( ) [private, slot]

When the example dialog is closed.

void casa::QtParamGUI::loadLast ( ) [private, slot]

When the user loads parameters from a .last file.

static String casa::QtParamGUI::pythonCommand ( String  taskName,
const Record params 
) [static]

Converts the task name and parameter record into a Python command.

static bool casa::QtParamGUI::readLastFile ( Record rec,
QFile &  file,
stringstream &  ss 
) [static, private]

Reads the python commands from the given file into the given record.

The stringstream is used to note any errors during read.

static bool casa::QtParamGUI::recordEqual ( const RecordInterface r1,
const RecordInterface r2 
) [static, private]

Returns true if the two records are equal or not.

pair<bool, String> casa::QtParamGUI::recordIsValid ( const Record record,
RecordFieldId  id 
) [private]

Checks the value in the record at the given RecordFieldId for validity.

If invalid, the second value in the pair holds the reason(s) why.

static String casa::QtParamGUI::recordToString ( const Record record,
String  separator 
) [static]

Converts the given record into a Python-like string representation.

static void casa::QtParamGUI::replaceSlashQuotes ( String string) [static]

Replaces all instances of \' and " in the given string with ' and ", respectively.

void casa::QtParamGUI::reset ( ) [private, slot]

When the user clicks "reset".

void casa::QtParamGUI::resetChanged ( ) [private, slot]

When the user changes the reset option.

void casa::QtParamGUI::run ( ) [private, slot]

When the user clicks "run".

void casa::QtParamGUI::runRequested ( String  taskName,
Record  parameters 
) [signal]

In SIGNAL mode, this is emitted when the user clicks "run".

The name of the task and a copy of the entered parameter names/values are given. It is the responsibility of the parent/caller to close the QtParamGUI widget as desired.

void casa::QtParamGUI::setRecord ( const Record record,
RecordFieldId  id = 0 
) [private]

Sets the tasks record to the given, and then displays the task with the given RecordFieldId.

static void casa::QtParamGUI::setupDialog ( QDialog *  dialog,
String  taskName,
String  textName,
const String text 
) [static]

Sets up the given dialog to have the given name and given text.

void casa::QtParamGUI::setupRecord ( vector< String order) [private]

Once the displayed task has been chosen, set up the panels.

If an order is given, use that instead of the record's natural order.

void casa::QtParamGUI::showHideDesc ( bool  checked) [private, slot]

Show/hide the description dialog.

void casa::QtParamGUI::showHideExample ( bool  checked) [private, slot]

Show/hide the example dialog.

void casa::QtParamGUI::showHideResets ( bool  globals,
bool  last 
) [private]

Show/hide the frame and radio buttons for the different reset modes.

static String casa::QtParamGUI::strNLtrim ( const String str) [static, private]

Trims the given String of leading newlines and trailing whitespace, where newlines are '
' or '' and whitespace is ' ', '', '
', or ''.

static String casa::QtParamGUI::strTrim ( const String str) [static, private]

Trims the given String of leading and trailing whitespace, where whitespace is ' ', '', '
', and ''.

void casa::QtParamGUI::taskChosen ( QString  task) [private, slot]

When the user chooses a different task.

Record casa::QtParamGUI::taskConstraints ( ) const

Returns a copy of the constraints record for this task.

String casa::QtParamGUI::taskName ( ) const

Returns the name of the currently displayed task.

Record casa::QtParamGUI::taskParameters ( ) const

Returns a copy of the parameter attributes record for this task.

static DataType casa::QtParamGUI::type ( String  typeName) [static]

Returns the type for the given type name.

static String casa::QtParamGUI::type ( DataType  type) [static]

Returns the name for the given type.

void casa::QtParamGUI::valueChanged ( String  paramName) [private, slot]

When the value for the given parameter changes.

If constraints are given, check against those.

static bool casa::QtParamGUI::valuesEqual ( const RecordInterface r1,
RecordFieldId  id1,
const RecordInterface r2,
RecordFieldId  id2,
bool  allowStrings = false 
) [static, private]

Returns true if the value at r1[id1] is equal to the value at r2[id2].

If allowStrings is false, String values can be compared to non-String values.


Member Data Documentation

String constants used in parsing the parameter records.

Definition at line 67 of file QtParamGUI.qo.h.

const String casa::QtParamGUI::ANY [static]

Definition at line 68 of file QtParamGUI.qo.h.

Definition at line 69 of file QtParamGUI.qo.h.

Definition at line 70 of file QtParamGUI.qo.h.

Definition at line 71 of file QtParamGUI.qo.h.

Definition at line 72 of file QtParamGUI.qo.h.

Definition at line 73 of file QtParamGUI.qo.h.

Definition at line 74 of file QtParamGUI.qo.h.

Definition at line 75 of file QtParamGUI.qo.h.

Definition at line 76 of file QtParamGUI.qo.h.

Definition at line 77 of file QtParamGUI.qo.h.

QDialog* casa::QtParamGUI::m_descDialog [private]

Description dialog to show/hide.

Definition at line 172 of file QtParamGUI.qo.h.

Example dialog to show/hide.

Definition at line 175 of file QtParamGUI.qo.h.

Global parameter values.

Definition at line 159 of file QtParamGUI.qo.h.

Last parameter values.

Definition at line 162 of file QtParamGUI.qo.h.

Mode.

Definition at line 169 of file QtParamGUI.qo.h.

Parameter panels for currently displayed task.

Definition at line 184 of file QtParamGUI.qo.h.

Constraints dialog to show/hide.

QDialog* m_constDialog;

Python interpreter. Never used in SIGNAL mode.

Definition at line 181 of file QtParamGUI.qo.h.

When the user clicks "reset", indicates whether to reset to globals or defaults or last.

Definition at line 166 of file QtParamGUI.qo.h.

Currently displayed task.

Definition at line 187 of file QtParamGUI.qo.h.

All tasks and their parameters/attributes.

Definition at line 156 of file QtParamGUI.qo.h.

const unsigned int casa::QtParamGUI::MAX_SHORTDESC_LENGTH [static, private]

STATIC.

After this length, move the short description to two lines instead of one.

Definition at line 214 of file QtParamGUI.qo.h.

Definition at line 78 of file QtParamGUI.qo.h.

Definition at line 80 of file QtParamGUI.qo.h.

Definition at line 79 of file QtParamGUI.qo.h.

Definition at line 81 of file QtParamGUI.qo.h.

Definition at line 83 of file QtParamGUI.qo.h.

Definition at line 82 of file QtParamGUI.qo.h.

Definition at line 84 of file QtParamGUI.qo.h.

Definition at line 85 of file QtParamGUI.qo.h.

Definition at line 86 of file QtParamGUI.qo.h.

Definition at line 87 of file QtParamGUI.qo.h.

Definition at line 88 of file QtParamGUI.qo.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines