casa
$Rev:20696$
|
#include <QtParamGUI.qo.h>
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 ¶ms) |
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, String > | recordIsValid (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. |
Definition at line 49 of file QtParamGUI.qo.h.
Possible reset values.
Definition at line 61 of file QtParamGUI.qo.h.
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.
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.
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.
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.
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".
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.
Trims the given String of leading newlines and trailing whitespace, where newlines are '
' or '' and whitespace is ' ', '', '
', or ''.
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.
const String casa::QtParamGUI::ALLOWED [static] |
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.
const String casa::QtParamGUI::CONSTRAINTS [static] |
Definition at line 69 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::DEFAULTS [static] |
Definition at line 70 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::DESCRIPTION [static] |
Definition at line 71 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::EXAMPLE [static] |
Definition at line 72 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::KIND [static] |
Definition at line 73 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::KIND_FILE [static] |
Definition at line 74 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::KIND_MS [static] |
Definition at line 75 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::KIND_TABLE [static] |
Definition at line 76 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::LIMITTYPES [static] |
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.
QDialog* casa::QtParamGUI::m_exampleDialog [private] |
Example dialog to show/hide.
Definition at line 175 of file QtParamGUI.qo.h.
Record casa::QtParamGUI::m_globals [private] |
Global parameter values.
Definition at line 159 of file QtParamGUI.qo.h.
Record casa::QtParamGUI::m_last [private] |
Last parameter values.
Definition at line 162 of file QtParamGUI.qo.h.
Mode casa::QtParamGUI::m_mode [private] |
Mode.
Definition at line 169 of file QtParamGUI.qo.h.
vector<ParamPanel*> casa::QtParamGUI::m_panels [private] |
Parameter panels for currently displayed task.
Definition at line 184 of file QtParamGUI.qo.h.
PythonInterpreter casa::QtParamGUI::m_python [private] |
Constraints dialog to show/hide.
QDialog* m_constDialog;
Python interpreter. Never used in SIGNAL mode.
Definition at line 181 of file QtParamGUI.qo.h.
ResetMode casa::QtParamGUI::m_resetMode [private] |
When the user clicks "reset", indicates whether to reset to globals or defaults or last.
Definition at line 166 of file QtParamGUI.qo.h.
String casa::QtParamGUI::m_taskName [private] |
Currently displayed task.
Definition at line 187 of file QtParamGUI.qo.h.
Record casa::QtParamGUI::m_tasks [private] |
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.
const String casa::QtParamGUI::MUSTEXIST [static] |
Definition at line 78 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::PARAMETER_ORDER [static] |
Definition at line 80 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::PARAMETERS [static] |
Definition at line 79 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::RANGE [static] |
Definition at line 81 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::RANGE_MAX [static] |
Definition at line 83 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::RANGE_MIN [static] |
Definition at line 82 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::SHORT_DESCRIPTION [static] |
Definition at line 84 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::SUBPARAMETERS [static] |
Definition at line 85 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::TYPE [static] |
Definition at line 86 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::UNITS [static] |
Definition at line 87 of file QtParamGUI.qo.h.
const String casa::QtParamGUI::VALUE [static] |
Definition at line 88 of file QtParamGUI.qo.h.