|
Geometrize
1.0
An application for geometrizing images into geometric primitives
|
◆ ImageTaskShapeScriptingPanelImpl() [1/2]
geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::ImageTaskShapeScriptingPanelImpl |
( |
ImageTaskShapeScriptingPanel * |
pQ | ) |
|
|
inline |
29 :
ui{std::make_unique<Ui::ImageTaskShapeScriptingPanel>()},
q{pQ}
31 q->setWindowFlags(Qt::Window);
35 connect(
ui->scriptsEnabledButton, &QCheckBox::toggled, [
this](
const bool enabled) {
36 emit q->signal_scriptingToggled(enabled);
40 connect(
ui->resetScriptEngineButton, &QPushButton::pressed, [
this]() {
41 for(ScriptEditorWidget* editor : m_editors) {
42 editor->resetCodeToDefault();
53 connect(
ui->resetScriptEngineButton, &QPushButton::pressed, [
this]() {
54 for(ScriptEditorWidget* editor : m_editors) {
55 editor->resetCodeToDefault();
67 connect(
ui->scriptsPresetsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [
this](
const int idx) {
73 connect(
ui->rescanScriptFoldersButton, &QPushButton::pressed, [
this]() {
74 buildPresetsMenuAndSelectPreset();
◆ ~ImageTaskShapeScriptingPanelImpl()
geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::~ImageTaskShapeScriptingPanelImpl |
( |
| ) |
|
|
default |
◆ ImageTaskShapeScriptingPanelImpl() [2/2]
geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::ImageTaskShapeScriptingPanelImpl |
( |
const ImageTaskShapeScriptingPanelImpl & |
| ) |
|
|
delete |
◆ buildPresetsMenuAndSelectPreset()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::buildPresetsMenuAndSelectPreset |
( |
| ) |
|
|
inlineprivate |
152 ui->scriptsPresetsComboBox->clear();
156 const QStringList presetOptions = QStringList()
157 << tr(
"Default Scripts")
158 << tr(
"Area Focus Scripts");
160 ui->scriptsPresetsComboBox->addItems(presetOptions);
◆ findEditor()
dialog::ScriptEditorWidget* geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::findEditor |
( |
const std::string & |
functionName | ) |
|
|
inlineprivate |
218 auto it = std::find_if(
m_editors.begin(),
m_editors.end(), [&functionName](dialog::ScriptEditorWidget* editor) {
219 return editor->getFunctionName() == functionName;
◆ getDefaultScripts()
std::map<std::string, std::string> geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::getDefaultScripts |
( |
| ) |
const |
|
inlineprivate |
210 std::map<std::string, std::string> m;
211 for(ScriptEditorWidget* editor :
m_editors) {
212 m[editor->getFunctionName()] = editor->getDefaultCode();
◆ getScripts()
std::map<std::string, std::string> geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::getScripts |
( |
| ) |
const |
|
inline |
136 std::map<std::string, std::string> m;
137 for(ScriptEditorWidget* editor :
m_editors) {
138 m[editor->getFunctionName()] = editor->getCurrentCode();
◆ onLanguageChange()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::onLanguageChange |
( |
| ) |
|
|
inline |
130 ui->retranslateUi(
q);
◆ operator=()
◆ populateUi()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::populateUi |
( |
| ) |
|
|
inlineprivate |
◆ setImageTask()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::setImageTask |
( |
task::ImageTask * |
task | ) |
|
|
inline |
98 if(dialog::ScriptEditorWidget* editor =
findEditor(functionName)) {
99 editor->onScriptEvaluationSucceeded();
107 if(dialog::ScriptEditorWidget* editor =
findEditor(functionName)) {
108 editor->onScriptEvaluationFailed(errorMessage);
116 for(
const auto& script : scripts) {
◆ setScriptModeEnabled()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::setScriptModeEnabled |
( |
const bool |
enabled | ) |
|
|
inlineprivate |
200 ui->scriptsEnabledButton->setChecked(enabled);
201 ui->scriptsPresetsComboBox->setEnabled(enabled);
202 ui->rescanScriptFoldersButton->setEnabled(enabled);
203 ui->resetScriptEngineButton->setEnabled(enabled);
205 editor->setEnabled(enabled);
◆ setScripts()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::setScripts |
( |
const std::map< std::string, std::string > & |
scripts | ) |
|
|
inlineprivate |
230 for(
const auto& script : scripts) {
231 if(dialog::ScriptEditorWidget* editor =
findEditor(script.first)) {
232 if(script.second.length() == 0) {
233 editor->resetCodeToDefault();
235 editor->setCurrentCode(script.second);
◆ setupPreset()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::setupPreset |
( |
const int |
idx | ) |
|
|
inlineprivate |
169 const auto scripts = [idx]() -> std::map<std::string, std::string> {
176 assert(0 &&
"Bad scripts presets index");
181 for(
const auto& item : scripts) {
182 ScriptEditorWidget* editor{
new ScriptEditorWidget(item.first, item.first, item.second)};
187 ui->scriptEditorsContainer->addWidget(editor);
◆ syncUserInterface()
void geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::syncUserInterface |
( |
| ) |
|
|
inline |
◆ m_editors
std::vector<ScriptEditorWidget*> geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::m_editors |
|
private |
Connection for the scripting panel to react when a script fails to evaluate
◆ m_scriptEvaluationFailedConnection
QMetaObject::Connection geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::m_scriptEvaluationFailedConnection {} |
|
private |
Connection for the scripting panel to react when a script is successfully evaluated
◆ m_scriptEvaluationSucceededConnection
QMetaObject::Connection geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::m_scriptEvaluationSucceededConnection {} |
|
private |
◆ m_task
task::ImageTask* geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::m_task {nullptr} |
|
private |
◆ ui
std::unique_ptr<Ui::ImageTaskShapeScriptingPanel> geometrize::dialog::ImageTaskShapeScriptingPanel::ImageTaskShapeScriptingPanelImpl::ui |
|
private |
The documentation for this class was generated from the following file:
bool isScriptModeEnabled() const
Definition: imagetaskpreferences.cpp:320
std::map< std::string, std::string > getScripts() const
Definition: imagetaskshapescriptingpanel.cpp:134
std::map< std::string, std::string > getPointerAreaOfInterestShapeMutatorScripts()
getPointerAreaOfInterestScripts Gets a map of the scripts used for shape creation and mutation based ...
Definition: scriptutil.cpp:68
void setScripts(const std::map< std::string, std::string > &scripts)
Definition: imagetaskpreferences.cpp:330
std::map< std::string, std::string > getScripts() const
Definition: imagetaskpreferences.cpp:335
std::map< std::string, std::string > getDefaultShapeMutatorScripts()
getDefaultScripts Gets a map of the default scripts used for shape creation and mutation in image tas...
Definition: scriptutil.cpp:63
void signal_scriptingToggled(bool enabled)
void signal_scriptsReset()
void signal_scriptEvaluationSucceeded(const std::string &functionName, const std::string &code)
signal_scriptEvaluationSucceeded Signal dispatched when a script is successfully parsed/evaluated.
void buildPresetsMenuAndSelectPreset()
Definition: imagetaskshapescriptingpanel.cpp:150
QMetaObject::Connection m_scriptEvaluationSucceededConnection
Definition: imagetaskshapescriptingpanel.cpp:241
void setScriptModeEnabled(bool enabled)
Definition: imagetaskpreferences.cpp:315
void signal_scriptChanged(const std::string &functionName, const std::string &code)
std::vector< ScriptEditorWidget * > m_editors
Connection for the scripting panel to react when a script fails to evaluate
Definition: imagetaskshapescriptingpanel.cpp:243
ImageTaskShapeScriptingPanel * q
Definition: imagetaskshapescriptingpanel.cpp:245
QMetaObject::Connection m_scriptEvaluationFailedConnection
Connection for the scripting panel to react when a script is successfully evaluated
Definition: imagetaskshapescriptingpanel.cpp:242
task::ImageTask * m_task
Definition: imagetaskshapescriptingpanel.cpp:246
void populateUi()
Definition: imagetaskshapescriptingpanel.cpp:145
geometrize::script::GeometrizerEngine & getGeometrizer()
getGeometrizer Gets a reference to the script-based engine used to turn images into shapes.
Definition: imagetask.cpp:402
void signal_scriptEvaluationFailed(const std::string &functionName, const std::string &code, const std::string &errorMessage)
signal_scriptEvaluationFailed Signal dispatched when a script fails to parse/evaluate.
std::unique_ptr< Ui::ImageTaskShapeScriptingPanel > ui
Definition: imagetaskshapescriptingpanel.cpp:244
dialog::ScriptEditorWidget * findEditor(const std::string &functionName)
Definition: imagetaskshapescriptingpanel.cpp:217
void setScriptModeEnabled(const bool enabled)
Definition: imagetaskshapescriptingpanel.cpp:195
The GeometrizerEngine class encapsulates script-based setup and mutation methods for geometrizing sha...
Definition: geometrizerengine.h:58
void setScript(const std::string &scriptName, const std::string &code)
Definition: imagetaskpreferences.cpp:325
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:392
void setScripts(const std::map< std::string, std::string > &scripts)
Definition: imagetaskshapescriptingpanel.cpp:227