Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
imagetaskscriptingwidget.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <memory>
5 #include <string>
6 
7 #include <QWidget>
8 
9 class QEvent;
10 
11 namespace geometrize
12 {
13 
14 namespace task
15 {
16 class ImageTask;
17 }
18 
19 }
20 
21 namespace geometrize
22 {
23 
24 namespace dialog
25 {
26 
31 void showImageTaskStopConditionMetMessage(QWidget* parent);
32 
36 class ImageTaskScriptingWidget : public QWidget
37 {
38  Q_OBJECT
39 
40 public:
41  ImageTaskScriptingWidget(QWidget* parent = nullptr);
42  virtual ~ImageTaskScriptingWidget();
43 
48  void setImageTask(task::ImageTask* task);
49 
54  void syncUserInterface();
55 
60  std::map<std::string, std::string> getScripts() const;
61 
65  void evaluateBeforeStepScripts() const;
66 
70  void evaluateAfterStepScripts() const;
71 
76  bool evaluateStopConditionScripts() const;
77 
81  void evaluateBeforeAddShapeScripts() const;
82 
86  void evaluateAfterAddShapeScripts() const;
87 
91  void evaluateOnPenInputEventScripts() const;
92 
97 
102 
106  void evaluateOnKeyDownEventScripts() const;
107 
111  void evaluateOnKeyUpEventScripts() const;
112 
116  void evaluateOnMouseDownEventScripts() const;
117 
121  void evaluateOnMouseUpEventScripts() const;
122 
126  void evaluateOnMouseMoveEventScripts() const;
127 
132 
137 
138 signals:
139  void signal_scriptChanged(const std::string& functionName, const std::string& code);
140 
141 protected:
142  void changeEvent(QEvent*) override;
143 
144 private:
146  std::unique_ptr<ImageTaskScriptingWidgetImpl> d;
147 };
148 
149 }
150 
151 }
void syncUserInterface()
syncUserInterface Syncs the user interface with the current image task. This should be called after s...
Definition: imagetaskscriptingwidget.cpp:555
std::unique_ptr< ImageTaskScriptingWidgetImpl > d
Definition: imagetaskscriptingwidget.h:145
void evaluateAfterStepScripts() const
evaluateAfterStepScripts Evaluates the scripts set to run directly after the image task is stepped (i...
Definition: imagetaskscriptingwidget.cpp:565
void evaluateOnMouseDownEventScripts() const
evaluateOnMouseDownEventScripts Evaluates the scripts set to run directly after a mouse key is presse...
Definition: imagetaskscriptingwidget.cpp:610
void showImageTaskStopConditionMetMessage(QWidget *parent)
showImageTaskStopConditionMetMessage Shows a messagebox stating that the stop conditions for geometri...
Definition: imagetaskscriptingwidget.cpp:56
std::map< std::string, std::string > getScripts() const
getScripts Gets all the scripts (shape setup/mutation scripts, and additional scripts).
Definition: imagetaskscriptingwidget.cpp:635
bool evaluateStopConditionScripts() const
evaluateStopConditionScripts Returns true if the condition(s) for stopping geometrizing the image wer...
Definition: imagetaskscriptingwidget.cpp:570
void signal_scriptChanged(const std::string &functionName, const std::string &code)
virtual ~ImageTaskScriptingWidget()
Definition: imagetaskscriptingwidget.cpp:538
void evaluateOnMouseMoveEventScripts() const
evaluateOnMouseMoveEventScripts Evaluates the scripts set to run when the mouse is moved in the conte...
Definition: imagetaskscriptingwidget.cpp:620
void evaluateOnKeyUpEventScripts() const
evaluateOnKeyUpEventScripts Evaluates the scripts set to run directly after a keyboard key is release...
Definition: imagetaskscriptingwidget.cpp:605
void evaluateOnTimedUpdateEventScripts() const
evaluateOnTimedUpdateEventScripts Evaluates the scripts that are set to run periodically (i...
Definition: imagetaskscriptingwidget.cpp:630
void evaluateBeforeStepScripts() const
evaluateBeforeStepScripts Evaluates the scripts set to run directly before the image task is stepped ...
Definition: imagetaskscriptingwidget.cpp:560
void changeEvent(QEvent *) override
Definition: imagetaskscriptingwidget.cpp:542
void evaluateBeforeAddShapeScripts() const
evaluateBeforeAddShapeScripts Evaluates the scripts set to run directly before a shape is added to th...
Definition: imagetaskscriptingwidget.cpp:575
void setImageTask(task::ImageTask *task)
setImageTask Sets the current image task used by the scripts.
Definition: imagetaskscriptingwidget.cpp:550
ImageTaskScriptingWidget(QWidget *parent=nullptr)
Definition: imagetaskscriptingwidget.cpp:532
void evaluateOnPenInputEventScripts() const
evaluateOnPenInputEventScripts Evaluates the scripts set to run directly after a pen e...
Definition: imagetaskscriptingwidget.cpp:585
The ImageTask class transforms a source image into a collection of shapes approximating the source im...
Definition: imagetask.h:50
void evaluateOnMouseUpEventScripts() const
evaluateOnMouseUpEventScripts Evaluates the scripts set to run directly after a mouse key is released...
Definition: imagetaskscriptingwidget.cpp:615
The ImageTaskScriptingWidget implements a widget for manipulating scripts that are run when an image ...
Definition: imagetaskscriptingwidget.h:36
void evaluateOnPenProximityExitEventScripts() const
evaluateOnPenProximityExitEventScripts Evaluates the scripts set to run directly after a pen e...
Definition: imagetaskscriptingwidget.cpp:595
void evaluateOnKeyDownEventScripts() const
evaluateOnKeyDownEventScripts Evaluates the scripts set to run directly after a keyboard key is press...
Definition: imagetaskscriptingwidget.cpp:600
void evaluateOnMouseWheelEventScripts() const
evaluateOnMouseWheelEventScripts Evaluates the scripts set to run when the mouse wheel is moved in th...
Definition: imagetaskscriptingwidget.cpp:625
void evaluateOnPenProximityEnterEventScripts() const
evaluateOnPenProximityEnterEventScripts Evaluates the scripts set to run directly after a pen e...
Definition: imagetaskscriptingwidget.cpp:590
void evaluateAfterAddShapeScripts() const
evaluateAfterAddShapeScripts Evaluates the scripts set to run directly after a shape is added to the ...
Definition: imagetaskscriptingwidget.cpp:580