DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Defines the configuration dialog. The dialog must be displayed by calling ParamsConfigDialog::Display(). Do not use methods of QDialog! More...
Classes | |
struct | Param |
Collection of data defining a single parameter to be managed by a ParamsConfigDialog instance. Used by ParamsConfigDialog::InsertWidget(). More... | |
Public Types | |
using | NumberType = double |
Number type used for numeric parameters (DynExp::ParamsBase::Param) More... | |
using | TextType = Util::TextType |
String type of text-type parameters (DynExp::ParamsBase::Param) More... | |
using | TextRefType = Util::TextRefType |
Reference-to-string type of text-type parameters (DynExp::ParamsBase::Param) More... | |
using | TextListType = Util::TextListType |
List type of text-type parameters. More... | |
using | TextListIndexType = Util::TextListIndexType |
List index type of Util::TextListType . More... | |
using | IndexType = qulonglong |
ID type of objects/items managed by DynExp. More... | |
Public Member Functions | |
ParamsConfigDialog (QWidget *parent, const DynExp::DynExpCore &Core, std::string Title) | |
Constructs a ParamsConfigDialog instance. More... | |
~ParamsConfigDialog ()=default | |
void | AddParam (ParamInfo &&Info, const std::any Destiny, const NumberType Value, const NumberType MinValue, const NumberType MaxValue, const NumberType Precision, const NumberType Increment) |
Appends a parameter to the configuration dialog. More... | |
void | AddParam (ParamInfo &&Info, const std::any Destiny, const TextType Value, const DynExp::TextUsageType TextUsage) |
Appends a parameter to the configuration dialog. More... | |
void | AddParam (ParamInfo &&Info, const std::any Destiny, const TextRefType Value, const TextListType &TextList, const bool AllowResetToDefault) |
Appends a parameter to the configuration dialog. More... | |
void | AddParam (ParamInfo &&Info, const std::any Destiny, const TextListIndexType Value, const TextListIndexType DefaultValue, const TextListType &TextList) |
Appends a parameter to the configuration dialog. More... | |
template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0> | |
void | AddParam (ParamInfo &&Info, const std::any Destiny, const EnumType Value, const EnumType DefaultValue, const Util::TextValueListType< EnumType > &TextValueList) |
Appends a parameter to the configuration dialog. More... | |
void | AddParam (ParamInfo &&Info, const std::any Destiny, const DynExp::ItemIDType Value, bool IsOptional, std::string_view IconResourcePath, FunctionsToCallIfAcceptedType FunctionToCallIfAccepted, Util::TextValueListType< IndexType > &&ItemIDsWithLabels) |
Appends a parameter to the configuration dialog. More... | |
void | AddParam (ParamInfo &&Info, const std::any Destiny, const std::vector< DynExp::ItemIDType > &Values, bool IsOptional, std::string_view IconResourcePath, FunctionsToCallIfAcceptedType FunctionToCallIfAccepted, Util::TextValueListType< IndexType > &&ItemIDsWithLabels) |
Appends a parameter to the configuration dialog. More... | |
size_t | GetNumParams () const noexcept |
Returns the number of parameters added to the configuration dialog. More... | |
bool | IsResetRequired () const noexcept |
Determines whether the DynExp::Object instance whose parameters have been edited needs to be reset to apply the changes. More... | |
bool | Display (DynExp::Object *Object=nullptr) |
Displays the configuration dialog. More... | |
Private Types | |
using | FunctionsToCallIfAcceptedType = std::function< void(void)> |
Signature of a function which is called when the ParamsConfigDialog is closed by the user by clicking the 'accept' button. More... | |
Private Slots | |
void | OnOpenParam () |
Called when clicking the 'Browse' button for a DynExp::TextUsageType::Path or DynExp::TextUsageType::Code parameter. More... | |
void | OnEditParam () |
Called when opening a TextEditor for a DynExp::TextUsageType::Code parameter. More... | |
void | OnResetParam () |
Called when resetting a parameter to its default value. More... | |
virtual void | accept () override |
Called when the settings dialog is accepted clicking its 'OK' button. More... | |
virtual void | reject () override |
Called when the settings dialog is rejected clicking its 'Cancel' button. More... | |
Private Member Functions | |
void | InsertWidget (ParamInfo &&Info, Param &&ParamData) |
Creates Qt widgets for editing a parameter and inserts them into the configuration dialog. More... | |
template<typename ParamT > | |
void | Assign (ParamT &Param, typename ParamT::UnderlyingType Value) |
When the settings dialog is closed by accepting it, assign a single value from the user interface to the actual parameter retrieved from ParamsConfigDialog::Param::Destiny. Updates ResetRequired. More... | |
template<typename ParamT > | |
void | Assign (ParamT &Param, const std::vector< typename ParamT::UnderlyingType::value_type > &Values) |
When the settings dialog is closed by accepting it, assign a list of values from the user interface to the actual parameter retrieved from ParamsConfigDialog::Param::Destiny. Updates ResetRequired. More... | |
void | HandleTextEditorDialogsOnClose () |
Called when the settings dialog is closed. Removes the parent widget of text editors listed in TextEditorDialogs to keep them open after closing this dialog. More... | |
Private Attributes | |
const DynExp::DynExpCore & | Core |
Reference to DynExp's core. More... | |
std::vector< Param > | ParamList |
List of all parameters assigned to this ParamsConfigDialog instance. More... | |
std::vector< FunctionsToCallIfAcceptedType > | FunctionsToCallIfAccepted |
List of functions to be called when acceptig the dialog. Refer to ParamsConfigDialog::FunctionsToCallIfAcceptedType. More... | |
DynExp::Object * | Object |
DynExp::Object whose parameters are edited. nullptr if a new DynExp::Object is created and synchronization to achieve thread-safety does not apply. More... | |
bool | ResetRequired |
Becomes true if an existing DynExp::Object is edited and needs to be reset to apply changes after clicking the dialog's 'accept' button. More... | |
std::vector< TextEditor * > | TextEditorDialogs |
Keeps a list of text editor dialogs so that their ownership can be removed when the ParamsConfigDialog instance is closed. More... | |
Ui::ParamsConfig | ui |
Bundles Qt widgets of the ParamsConfigDialog instance's user interface. More... | |
Defines the configuration dialog. The dialog must be displayed by calling ParamsConfigDialog::Display(). Do not use methods of QDialog!
Definition at line 71 of file ParamsConfig.h.
|
private |
Signature of a function which is called when the ParamsConfigDialog
is closed by the user by clicking the 'accept' button.
Definition at line 94 of file ParamsConfig.h.
using ParamsConfigDialog::IndexType = qulonglong |
ID type of objects/items managed by DynExp.
It would be better to use DynExp::ItemIDType here, but this is incompatible with the g++ compiler. IndexType
should equal ChoiceListDialog::IndexType.
Definition at line 87 of file ParamsConfig.h.
using ParamsConfigDialog::NumberType = double |
Number type used for numeric parameters (DynExp::ParamsBase::Param)
Definition at line 76 of file ParamsConfig.h.
List index type of Util::TextListType
.
Definition at line 80 of file ParamsConfig.h.
List type of text-type parameters.
Definition at line 79 of file ParamsConfig.h.
Reference-to-string type of text-type parameters (DynExp::ParamsBase::Param)
Definition at line 78 of file ParamsConfig.h.
String type of text-type parameters (DynExp::ParamsBase::Param)
Definition at line 77 of file ParamsConfig.h.
ParamsConfigDialog::ParamsConfigDialog | ( | QWidget * | parent, |
const DynExp::DynExpCore & | Core, | ||
std::string | Title | ||
) |
Constructs a ParamsConfigDialog
instance.
parent | QWidget acting as a parent of this modal dialog |
Core | Reference to DynExp's core |
Title | Title to be displayed in the dialog's title bar |
Definition at line 34 of file ParamsConfig.cpp.
|
default |
|
overrideprivatevirtualslot |
Called when the settings dialog is accepted clicking its 'OK' button.
Definition at line 304 of file ParamsConfig.cpp.
void ParamsConfigDialog::AddParam | ( | ParamInfo && | Info, |
const std::any | Destiny, | ||
const DynExp::ItemIDType | Value, | ||
bool | IsOptional, | ||
std::string_view | IconResourcePath, | ||
FunctionsToCallIfAcceptedType | FunctionToCallIfAccepted, | ||
Util::TextValueListType< IndexType > && | ItemIDsWithLabels | ||
) |
Appends a parameter to the configuration dialog.
Info | Parameter title and description to be displayed in the dialog |
Destiny | Parameter holding the value to be edited. Expects the type LinkParamRefWrapperType. |
Value | Index of the entry in ItemIDsWithLabels to select initially |
IsOptional | Determines whether this parameter is optional. Optional parameters do not have to point to a valid object ID. If true, a 'None' entry with value DynExp::ItemIDNotSet is appended to ItemIDsWithLabels . |
IconResourcePath | Qt resource path describing an icon being displayed along with this parameter |
FunctionToCallIfAccepted | Refer to FunctionsToCallIfAccepted. |
ItemIDsWithLabels | List mapping the IDs of selectable DynExp::Object instances to text entries |
Definition at line 108 of file ParamsConfig.cpp.
void ParamsConfigDialog::AddParam | ( | ParamInfo && | Info, |
const std::any | Destiny, | ||
const EnumType | Value, | ||
const EnumType | DefaultValue, | ||
const Util::TextValueListType< EnumType > & | TextValueList | ||
) |
Appends a parameter to the configuration dialog.
EnumType | Enumeration type which is convertible to a numeric type (only unscoped enumerations) |
Info | Parameter title and description to be displayed in the dialog |
Destiny | Parameter holding the value to be edited. Expects the type ParamRefWrapperType instantiated with DestinyType as DynExp::ParamsBase::EnumParamSignedIntegerType if EnumType's underlying type is signed or with DestinyType as DynExp::ParamsBase::EnumParamUnsignedIntegerType if EnumType's underlying type is unsigned. |
Value | Initial enum value to be displayed in the configuration dialog for this parameter. |
DefaultValue | DefaultValue Refer to ParamsConfigDialog::Param::DefaultIndex. |
TextValueList | List mapping the enum items' values to text entries |
Definition at line 379 of file ParamsConfig.h.
void ParamsConfigDialog::AddParam | ( | ParamInfo && | Info, |
const std::any | Destiny, | ||
const NumberType | Value, | ||
const NumberType | MinValue, | ||
const NumberType | MaxValue, | ||
const NumberType | Precision, | ||
const NumberType | Increment | ||
) |
Appends a parameter to the configuration dialog.
Info | Parameter title and description to be displayed in the dialog |
Destiny | Parameter holding the value to be edited. Expects the type ParamRefWrapperType instantiated with DestinyType as NumberType. |
Value | Initial value to be displayed in the configuration dialog for this parameter |
MinValue | Minimal allowed value |
MaxValue | Maximal allowed value |
Precision | Value precision |
Increment | Value increment |
Definition at line 43 of file ParamsConfig.cpp.
void ParamsConfigDialog::AddParam | ( | ParamInfo && | Info, |
const std::any | Destiny, | ||
const std::vector< DynExp::ItemIDType > & | Values, | ||
bool | IsOptional, | ||
std::string_view | IconResourcePath, | ||
FunctionsToCallIfAcceptedType | FunctionToCallIfAccepted, | ||
Util::TextValueListType< IndexType > && | ItemIDsWithLabels | ||
) |
Appends a parameter to the configuration dialog.
Info | Parameter title and description to be displayed in the dialog |
Destiny | Parameter holding the value to be edited. Expects the type LinkListParamRefWrapperType. |
Values | Indices of the entries in ItemIDsWithLabels to select initially |
IsOptional | Determines whether this parameter is optional. Optional parameters do not have to point to valid object IDs. |
IconResourcePath | Qt resource path describing an icon being displayed along with this parameter |
FunctionToCallIfAccepted | Refer to FunctionsToCallIfAccepted. |
ItemIDsWithLabels | List mapping the IDs of selectable DynExp::Object instances to text entries |
Definition at line 136 of file ParamsConfig.cpp.
void ParamsConfigDialog::AddParam | ( | ParamInfo && | Info, |
const std::any | Destiny, | ||
const TextListIndexType | Value, | ||
const TextListIndexType | DefaultValue, | ||
const TextListType & | TextList | ||
) |
Appends a parameter to the configuration dialog.
Info | Parameter title and description to be displayed in the dialog |
Destiny | Parameter holding the value to be edited. Expects the type ParamRefWrapperType instantiated with DestinyType as IndexType. |
Value | Index of the entry in TextList to select initially |
DefaultValue | Refer to ParamsConfigDialog::Param::DefaultIndex. |
TextList | List of text entries from which the user can select one |
Util::EmptyException | is thrown if TextList is empty. |
Util::OutOfRangeException | is thrown if Value or DefaultValue are larger than the amount of entries in TextList . |
Definition at line 89 of file ParamsConfig.cpp.
void ParamsConfigDialog::AddParam | ( | ParamInfo && | Info, |
const std::any | Destiny, | ||
const TextRefType | Value, | ||
const TextListType & | TextList, | ||
const bool | AllowResetToDefault | ||
) |
Appends a parameter to the configuration dialog.
Info | Parameter title and description to be displayed in the dialog |
Destiny | Parameter holding the value to be edited. Expects the type ParamRefWrapperType instantiated with DestinyType as TextType. |
Value | Initial value to be displayed in the configuration dialog for this parameter. The text must match one of the entries in TextList . If it does not match any entry, the first entry of TextList will be selected. |
TextList | List of text entries from which the user can select one |
AllowResetToDefault | Refer to ParamsConfigDialog::Param::AllowResetToDefault. |
Util::EmptyException | is thrown if TextList is empty. |
Definition at line 67 of file ParamsConfig.cpp.
void ParamsConfigDialog::AddParam | ( | ParamInfo && | Info, |
const std::any | Destiny, | ||
const TextType | Value, | ||
const DynExp::TextUsageType | TextUsage | ||
) |
Appends a parameter to the configuration dialog.
Info | Parameter title and description to be displayed in the dialog |
Destiny | Parameter holding the value to be edited. Expects the type ParamRefWrapperType instantiated with DestinyType as TextType. |
Value | Initial value to be displayed in the configuration dialog for this parameter |
TextUsage | Refer to DynExp::TextUsageType. |
Definition at line 57 of file ParamsConfig.cpp.
|
private |
When the settings dialog is closed by accepting it, assign a list of values from the user interface to the actual parameter retrieved from ParamsConfigDialog::Param::Destiny. Updates ResetRequired.
ParamT | Parameter type derived from DynExp::ParamsBase::TypedParamBase |
Param | Parameter to update |
Values | List of value to set the parameter to |
Definition at line 412 of file ParamsConfig.h.
|
private |
When the settings dialog is closed by accepting it, assign a single value from the user interface to the actual parameter retrieved from ParamsConfigDialog::Param::Destiny. Updates ResetRequired.
ParamT | Parameter type derived from DynExp::ParamsBase::TypedParamBase |
Param | Parameter to update |
Value | Value to set the parameter to |
Definition at line 405 of file ParamsConfig.h.
bool ParamsConfigDialog::Display | ( | DynExp::Object * | Object = nullptr | ) |
Displays the configuration dialog.
Object | DynExp::Object whose parameters are edited. Refer to ParamsConfigDialog::Object. |
Definition at line 155 of file ParamsConfig.cpp.
|
inlinenoexcept |
Returns the number of parameters added to the configuration dialog.
Definition at line 279 of file ParamsConfig.h.
|
private |
Called when the settings dialog is closed. Removes the parent widget of text editors listed in TextEditorDialogs to keep them open after closing this dialog.
Definition at line 221 of file ParamsConfig.cpp.
Creates Qt widgets for editing a parameter and inserts them into the configuration dialog.
Info | Parameter title and description to be displayed in the dialog |
ParamData | Type and properties of the parameter to add controls to the user interface for |
Definition at line 168 of file ParamsConfig.cpp.
|
inlinenoexcept |
Determines whether the DynExp::Object instance whose parameters have been edited needs to be reset to apply the changes.
Definition at line 286 of file ParamsConfig.h.
|
privateslot |
Called when opening a TextEditor
for a DynExp::TextUsageType::Code parameter.
Definition at line 252 of file ParamsConfig.cpp.
|
privateslot |
Called when clicking the 'Browse' button for a DynExp::TextUsageType::Path or DynExp::TextUsageType::Code parameter.
Definition at line 239 of file ParamsConfig.cpp.
|
privateslot |
Called when resetting a parameter to its default value.
Definition at line 269 of file ParamsConfig.cpp.
|
overrideprivatevirtualslot |
Called when the settings dialog is rejected clicking its 'Cancel' button.
Definition at line 377 of file ParamsConfig.cpp.
|
private |
Reference to DynExp's core.
Definition at line 334 of file ParamsConfig.h.
|
private |
List of functions to be called when acceptig the dialog. Refer to ParamsConfigDialog::FunctionsToCallIfAcceptedType.
Definition at line 345 of file ParamsConfig.h.
|
private |
DynExp::Object whose parameters are edited. nullptr if a new DynExp::Object is created and synchronization to achieve thread-safety does not apply.
Definition at line 351 of file ParamsConfig.h.
|
private |
List of all parameters assigned to this ParamsConfigDialog
instance.
Definition at line 339 of file ParamsConfig.h.
|
private |
Becomes true if an existing DynExp::Object is edited and needs to be reset to apply changes after clicking the dialog's 'accept' button.
Definition at line 357 of file ParamsConfig.h.
|
private |
Keeps a list of text editor dialogs so that their ownership can be removed when the ParamsConfigDialog
instance is closed.
Definition at line 363 of file ParamsConfig.h.
|
private |
Bundles Qt widgets of the ParamsConfigDialog
instance's user interface.
Definition at line 368 of file ParamsConfig.h.