Geometrize  1.0
An application for geometrizing images into geometric primitives
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl Class Reference
Collaboration diagram for geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl:
Collaboration graph
[legend]

Public Member Functions

 ImageTaskWindowImpl (ImageTaskWindow *pQ)
 
ImageTaskWindowImploperator= (const ImageTaskWindowImpl &)=delete
 
 ImageTaskWindowImpl (const ImageTaskWindowImpl &)=delete
 
 ~ImageTaskWindowImpl ()
 
void close ()
 
task::ImageTaskgetImageTask ()
 
void setImageTask (task::ImageTask *task)
 
void revealLaunchWindow ()
 
void setConsoleVisibility (const bool visible)
 
void setPixmapViewVisibility (const bool visible)
 
void setVectorViewVisibility (const bool visible)
 
void loadSettingsTemplate ()
 
void loadSettingsTemplate (task::ImageTask *task, const std::string &path)
 
void saveSettingsTemplate () const
 
void saveSettingsTemplate (task::ImageTask *task, const std::string &path) const
 
void onLanguageChange ()
 
void handleCommand (const geometrize::script::Command &command)
 
void setCommandHandlerName (const std::string &name)
 
std::string getCommandHandlerName () const
 

Static Public Member Functions

static std::vector< ImageTaskWindow * > getExistingImageTaskWindows ()
 

Private Member Functions

void populateUi ()
 
bool isRunning () const
 
bool shouldKeepStepping () const
 
void setShouldKeepStepping (const bool stepping)
 
void updateStartStopButtonText ()
 
void stepModel ()
 
void clearModel ()
 
void switchTargetImage (Bitmap &bitmap)
 
void switchCurrentImage (Bitmap &bitmap)
 
void updateStats ()
 
void disconnectTask ()
 
void setTargetImage (const QImage &image)
 
void addPostStepCb (const std::function< void()> &f)
 
void clearPostStepCbs ()
 
void processPostStepCbs ()
 

Private Attributes

std::unique_ptr< Ui::ImageTaskWindow > ui {nullptr}
 
ImageTaskWindowq {nullptr}
 
task::ImageTaskm_task {nullptr}
 
QMetaObject::Connection m_taskPreferencesSetConnection {}
 

The image task currently set and manipulated via this window

More...
 
QMetaObject::Connection m_taskWillStepConnection {}
 

Connection for telling the dialog when the image task preferences are set

More...
 
QMetaObject::Connection m_taskDidStepConnection {}
 

Connection for the window to do work just prior the image task starts a step

More...
 
std::vector< std::function< void()> > m_onPostStepCbs
 

Connection for the window to do work just after the image task finishes a step

More...
 
geometrize::task::ShapeCollection m_shapes
 

One-shot callbacks triggered when the image task finishes a step

More...
 
geometrize::scene::ImageTaskSceneManager m_sceneManager
 

Collection of shapes added so far

More...
 
geometrize::scene::ImageTaskGraphicsViewm_pixmapView {nullptr}
 

Manager for scenes containing the pixmap/vector-based representations of the shapes etc

More...
 
geometrize::scene::ImageTaskGraphicsViewm_svgView {nullptr}
 

The view that holds the raster/pixel-based scene

More...
 
bool m_shouldKeepStepping {false}
 

The view that holds the vector-based scene

More...
 
QTimer m_timeRunningTimer
 

Whether to continually step i.e. whether to start another step after stepping once

More...
 
float m_timeRunning {0.0f}
 

Timer used to keep track of how long the image task has been in the "running" state

More...
 
const float m_timeRunningTimerResolutionMs {100.0f}
 

Total time that the image task has been in the "running" state

More...
 
QTimer m_scriptEngineUpdateTimer
 

Resolution of the time running timer in milliseconds

More...
 
float m_scriptEngineUpdateTimerResolution {100.0f}
 

Timer used to call an update function on the script engine of the associated image task

More...
 

Constructor & Destructor Documentation

◆ ImageTaskWindowImpl() [1/2]

geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::ImageTaskWindowImpl ( ImageTaskWindow pQ)
inline
84  :
85  ui{std::make_unique<Ui::ImageTaskWindow>()},
86  q{pQ}
87  {
88  ui->setupUi(q);
89  populateUi();
90  q->setAttribute(Qt::WA_DeleteOnClose);
91 
92  // Set up the dock widgets
93  q->tabifyDockWidget(ui->runnerSettingsDock, ui->scriptsDock);
94  q->tabifyDockWidget(ui->runnerSettingsDock, ui->exporterDock);
95 
96  ui->runnerSettingsDock->raise(); // Make sure runner settings dock is selected
97 
98  ui->consoleWidget->setVisible(false); // Make sure console widget is hidden by default
99 
100  // Set up the image task geometrization views
101  m_pixmapView = new geometrize::scene::ImageTaskGraphicsView(ui->imageViewContainer);
102  ui->imageViewContainer->layout()->addWidget(m_pixmapView);
103 
104  m_svgView = new geometrize::scene::ImageTaskGraphicsView(ui->imageViewContainer);
105  ui->imageViewContainer->layout()->addWidget(m_svgView);
106 
108 
109  // Set initial view visibility
111  setConsoleVisibility(prefs.shouldShowImageTaskConsoleByDefault());
112  setPixmapViewVisibility(prefs.shouldShowImageTaskPixmapViewByDefault());
113  setVectorViewVisibility(prefs.shouldShowImageTaskVectorViewByDefault());
114 
115  // Handle clicks on checkable title bar items
116  connect(ui->actionScript_Console, &QAction::toggled, [this](const bool checked) {
117  setConsoleVisibility(checked);
118  });
119  connect(ui->actionPixmap_Results_View, &QAction::toggled, [this](const bool checked) {
120  setPixmapViewVisibility(checked);
121  });
122  connect(ui->actionVector_Results_View, &QAction::toggled, [this](const bool checked) {
123  setVectorViewVisibility(checked);
124  });
125 
126  // Handle request to set the image task on the task window
127  connect(q, &ImageTaskWindow::willSwitchImageTask, [this](task::ImageTask* lastTask, task::ImageTask* nextTask) {
128  // Disconnect the last image task, which will soon be replaced by the next image task
129  disconnectTask();
130 
131  m_shapes.clear();
132  ui->imageTaskRunnerWidget->setImageTask(nextTask);
133  ui->scriptsWidget->setImageTask(nextTask);
134  ui->imageTaskExportWidget->setImageTask(nextTask, &m_shapes.getShapeVector());
135 
136  const auto taskIdForSerialization = [](const task::ImageTask& task) {
137  std::string s = std::to_string(task.getWidth()) + "_" + std::to_string(task.getHeight()) + "_";
138 
139  QCryptographicHash hash(QCryptographicHash::Md5);
140  hash.addData(reinterpret_cast<const char*>(task.getTarget().getDataRef().data()), task.getTarget().getDataRef().size());
141  const QByteArray result = hash.result().toHex();
142  const std::string hashStr = std::string(result.begin(), result.end());
143  return s + hashStr;
144  };
145 
146  // Autosave the preferences for the task being switched away from, if there was one
147  if(lastTask != nullptr && geometrize::preferences::getGlobalPreferences().shouldAutoSaveImageTaskSettings()) {
148  const std::string path{geometrize::preferences::getImageTaskPreferencesAutoSavePath(taskIdForSerialization(*lastTask))};
149  if(path.empty()) {
150  assert(0 && "Auto save path for image task file must not be empty");
151  }
152  saveSettingsTemplate(lastTask, path);
153  }
154 
155  // Autoload the preferences for the task being switched to, if there is one
156  if(nextTask != nullptr && geometrize::preferences::getGlobalPreferences().shouldAutoLoadImageTaskSettings()) {
157  const std::string path{geometrize::preferences::getImageTaskPreferencesAutoSavePath(taskIdForSerialization(*nextTask))};
158  if(path.empty()) {
159  assert(0 && "Auto load path for image task file must not be empty");
160  }
161  loadSettingsTemplate(nextTask, path);
162  }
163  });
164  connect(q, &ImageTaskWindow::didSwitchImageTask, [this](task::ImageTask* lastTask, task::ImageTask* currentTask) {
165  if(currentTask == nullptr) {
166  m_taskPreferencesSetConnection = QMetaObject::Connection{};
167  m_taskWillStepConnection = QMetaObject::Connection{};
168  return; // Don't try to connect if we're setting the current task to nothing/nullptr
169  }
170 
172  ui->imageTaskRunnerWidget->syncUserInterface();
173  ui->scriptsWidget->syncUserInterface();
174  });
175 
176  m_taskWillStepConnection = connect(currentTask, &task::ImageTask::signal_modelWillStep, [this]() {
177  ui->statsDockContents->setCurrentStatus(geometrize::dialog::ImageTaskStatsWidget::RUNNING);
178 
179  // Apply the latest scripts and engine state prior to stepping
180  auto& geometrizer = m_task->getGeometrizer();
181 
182  m_task->getPreferences().setScripts(ui->scriptsWidget->getScripts());
183 
184  chaiscript::ChaiScript* engine = geometrizer.getEngine();
185  engine->set_global(chaiscript::var(m_shapes.getShapeVector().size()), "currentShapeCount");
186 
187  ui->scriptsWidget->evaluateBeforeStepScripts();
188  });
189 
190  m_taskDidStepConnection = connect(currentTask, &task::ImageTask::signal_modelDidStep, [this](std::vector<geometrize::ShapeResult> shapes) {
192 
193  // If the first shape added background rectangle then fit the scenes to it
194  if(m_shapes.empty()) {
196  }
197  m_shapes.appendShapes(shapes);
198 
199  updateStats();
200 
201  ui->scriptsWidget->evaluateAfterStepScripts();
202 
203  if(shouldKeepStepping()) {
204  stepModel();
205  }
206  });
207 
208  const QString windowTitle = [currentTask]() {
211  if(currentTask != nullptr) {
212  title.append(" ").append(QString::fromStdString(currentTask->getDisplayName()));
213  }
214  return title;
215  }();
216  q->setWindowTitle(windowTitle);
217 
218  if(currentTask != nullptr) {
219  const QPixmap target{image::createPixmap(m_task->getTarget())};
221  } else {
222  m_sceneManager.setTargetPixmap(QPixmap());
223  }
224 
225  if(currentTask != nullptr) {
226  const auto getStartingColor = [this]() {
228  if(prefs.shouldUseCustomImageTaskBackgroundOverrideColor()) {
229  const auto color = prefs.getCustomImageTaskBackgroundOverrideColor();
230  return geometrize::rgba{ static_cast<std::uint8_t>(color[0]), static_cast<std::uint8_t>(color[1]), static_cast<std::uint8_t>(color[2]), static_cast<std::uint8_t>(color[3]) };
231  }
232  return geometrize::commonutil::getAverageImageColor(m_task->getTarget());
233  };
234  currentTask->drawBackgroundRectangle(getStartingColor());
235  }
236 
237  if(currentTask != nullptr) {
238  ui->consoleWidget->setEngine(currentTask->getGeometrizer().getEngine());
239  } else {
240  ui->consoleWidget->setEngine(nullptr);
241  }
242 
243  ui->imageTaskRunnerWidget->syncUserInterface();
244  ui->scriptsWidget->syncUserInterface();
245 
246  if(currentTask != nullptr) {
247  ui->imageTaskImageWidget->setTargetImage(image::createImage(currentTask->getTarget()));
248  } else {
249  ui->imageTaskImageWidget->setTargetImage(QImage());
250  }
251 
252  m_timeRunning = 0.0f;
253 
254  #if defined DATASLINGER_INCLUDED
255  // Bind keyboard shortcuts, setup UI for sending images out over the network etc
256  geometrize::installImageSlingerUserInterface(q);
257  #endif
258 
259  // As a final step, dispose of the old image task, if there was one
260  if(lastTask != nullptr) {
261  destroyTask(lastTask);
262  }
263  });
264 
265  // Handle requested target image overlay opacity changes
266  connect(ui->imageTaskImageWidget, &ImageTaskImageWidget::targetImageOpacityChanged, [this](const unsigned int value) {
267  const float opacity{value * (1.0f / 255.0f)};
269  });
270 
271  // Handle a request to change the target image
272  connect(ui->imageTaskImageWidget, &ImageTaskImageWidget::targetImageSelected, [this](const QImage& image) {
273  assert(!image.isNull());
274 
275  // Validate the target image size
276  const geometrize::Bitmap& target{m_task->getTarget()};
277  const int targetWidth{static_cast<int>(target.getWidth())};
278  const int targetHeight{static_cast<int>(target.getHeight())};
279  if(targetWidth != image.width() || targetHeight != image.height()) {
280  const QString selectedImageSize(tr("%1x%2", "Dimensions of an image e.g. width-x-height, 1024x800").arg(QLocale().toString(image.width())).arg(QLocale().toString(image.height())));
281  const QString targetImageSize(tr("%1x%2", "Dimensions of an image e.g. width-x-height, 1024x800").arg(QLocale().toString(targetWidth)).arg(QLocale().toString(targetHeight)));
282  QMessageBox::warning(
283  q,
284  tr("Image has incorrect dimensions", "Title of an error dialog shown when the user selects an image that was the wrong resolution/size"),
285  tr("Selected image must have the same dimensions as the current target image. Size was %1, but should have been %2",
286  "Error message shown when the user selects an image that was the wrong resolution/size").arg(selectedImageSize).arg(targetImageSize));
287 
288  return;
289  }
290 
291  setTargetImage(image);
292  });
293 
294  // Handle a request to change the target image that has passed size checks and validation
295  connect(ui->imageTaskImageWidget, &ImageTaskImageWidget::targetImageSet, [this](const QImage& image) {
296  // If the task is running then defer the target image change to the next step, else do it immediately
297  if(isRunning()) {
298  const QImage imageCopy{image.copy()};
299  addPostStepCb([this, imageCopy]() {
300  Bitmap target = geometrize::image::createBitmap(imageCopy);
301  switchTargetImage(target);
302  });
303  } else {
304  Bitmap target = geometrize::image::createBitmap(image);
305  switchTargetImage(target);
306  }
307  });
308 
309  // Handle runner button presses
310  connect(ui->imageTaskRunnerWidget, &ImageTaskRunnerWidget::runStopButtonClicked, [this]() {
311  setShouldKeepStepping(!shouldKeepStepping());
312 
313  // Request another image task step if user clicked start here
314  if(shouldKeepStepping()) {
315  stepModel();
316  }
317  });
318  connect(ui->imageTaskRunnerWidget, &ImageTaskRunnerWidget::stepButtonClicked, [this]() {
319  stepModel();
320  });
321  connect(ui->imageTaskRunnerWidget, &ImageTaskRunnerWidget::clearButtonClicked, [this]() {
322  clearModel();
323  });
324 
325  connect(q, &ImageTaskWindow::didLoadSettingsTemplate, [this]() {
326  ui->imageTaskRunnerWidget->syncUserInterface();
327  ui->scriptsWidget->syncUserInterface();
328  });
329 
330  // Track how long the task has been in the running state
331  connect(&m_timeRunningTimer, &QTimer::timeout, [this]() {
332  if(isRunning()) {
334  updateStats();
335  }
336  });
337 
338  connect(&m_scriptEngineUpdateTimer, &QTimer::timeout, [this]() {
339  ui->scriptsWidget->evaluateOnTimedUpdateEventScripts();
340  });
341 
342  // Before shapes are added, evaluate he pre-add shape callbacks
343  connect(&m_shapes, &geometrize::task::ShapeCollection::signal_beforeAppendShapes, [this](const std::vector<geometrize::ShapeResult>&) {
344  ui->scriptsWidget->evaluateBeforeAddShapeScripts();
345  });
346 
347  // After shapes are added, evaluate the post-add shape callbacks and stop conditions
348  connect(&m_shapes, &geometrize::task::ShapeCollection::signal_afterAppendShapes, [this](const std::vector<geometrize::ShapeResult>&) {
349  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
350  engine->set_global(chaiscript::var(m_shapes.back().shape->clone()), "lastAddedShape");
351  engine->set_global(chaiscript::var(m_shapes.back().score), "lastAddedShapeScore");
352  engine->set_global(chaiscript::var(m_shapes.back().color), "lastAddedShapeColor");
353 
354  ui->scriptsWidget->evaluateAfterAddShapeScripts();
355 
356  if(!ui->scriptsWidget->evaluateStopConditionScripts()) {
357  return;
358  }
359  setShouldKeepStepping(false);
360  ui->scriptsWidget->evaluateOnStopConditionMetScripts();
361  //geometrize::dialog::showImageTaskStopConditionMetMessage(q); // Letting the scripts handle notifying the user
362  });
363 
364  // Update the graphical image views after shapes are added
365  connect(&m_shapes, &geometrize::task::ShapeCollection::signal_afterAppendShapes, [this](const std::vector<geometrize::ShapeResult>& shapes) {
366  const QPixmap pixmap{image::createPixmap(m_task->getCurrent())};
367  m_sceneManager.updateScenes(pixmap, shapes);
368  });
369 
370  #if defined DATASLINGER_INCLUDED
371  // Send the newly added SVG shape data out to listening clients
372  connect(&m_shapes, &geometrize::task::ShapeCollection::signal_afterAppendShapes, [](const std::vector<geometrize::ShapeResult>& shapes) {
373 
374  // Exporting rotated ellipses as polygons, since OpenFL's SVG library can't handle regular rotated SVG ellipse or paths
375  geometrize::exporter::SVGExportOptions options;
376  options.rotatedEllipseExportMode = geometrize::exporter::RotatedEllipseSVGExportMode::POLYGON;
377 
378  for(const auto& result : shapes) {
379  geometrize::sendSvgShapeData(geometrize::exporter::getSingleShapeSVGData(result.color, *result.shape, options));
380  }
381  });
382  #endif
383 
384  // Update the graphical image views when the number of shapes changes (e.g. when cleared)
385  connect(&m_shapes, &geometrize::task::ShapeCollection::signal_sizeChanged, [this](const std::size_t size) {
386  if(size == 0) {
388  }
389  });
390 
391  // Pass the latest mouse event info to the current image task's script engine
392  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onTargetImageHoverMoveEvent, [this](double lastX, double lastY, double x, double y, bool /*ctrlModifier*/) {
393  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
394  engine->set_global(chaiscript::var(lastX), "targetImageLastMouseX");
395  engine->set_global(chaiscript::var(lastY), "targetImageLastMouseY");
396  engine->set_global(chaiscript::var(x), "targetImageMouseX");
397  engine->set_global(chaiscript::var(y), "targetImageMouseY");
398 
399  ui->scriptsWidget->evaluateOnMouseMoveEventScripts();
400  });
401  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onTargetImageMousePressEvent, [this](double x, double y, bool /*ctrlModifier*/) {
402  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
403  engine->set_global(chaiscript::var(x), "targetImageLastMouseX");
404  engine->set_global(chaiscript::var(y), "targetImageLastMouseY");
405  engine->set_global(chaiscript::var(x), "targetImageMouseX");
406  engine->set_global(chaiscript::var(y), "targetImageMouseY");
407 
408  ui->scriptsWidget->evaluateOnMouseDownEventScripts();
409  });
410  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onTargetImageMouseMoveEvent, [this](double lastX, double lastY, double x, double y, bool /*ctrlModifier*/) {
411  // NOTE not triggered currently, hover move events are used instead
412  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
413  engine->set_global(chaiscript::var(lastX), "targetImageLastMouseX");
414  engine->set_global(chaiscript::var(lastY), "targetImageLastMouseY");
415  engine->set_global(chaiscript::var(x), "targetImageMouseX");
416  engine->set_global(chaiscript::var(y), "targetImageMouseY");
417 
418  ui->scriptsWidget->evaluateOnMouseMoveEventScripts();
419  });
420  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onTargetImageMouseReleaseEvent, [this](double x, double y, bool /*ctrlModifier*/) {
421  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
422  engine->set_global(chaiscript::var(x), "targetImageLastMouseX");
423  engine->set_global(chaiscript::var(y), "targetImageLastMouseY");
424  engine->set_global(chaiscript::var(x), "targetImageMouseX");
425  engine->set_global(chaiscript::var(y), "targetImageMouseY");
426 
427  ui->scriptsWidget->evaluateOnMouseUpEventScripts();
428  });
429  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onTargetImageWheelEvent, [this](double x, double y, int amount, bool /*ctrlModifier*/) {
430  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
431  engine->set_global(chaiscript::var(x), "targetImageLastMouseX");
432  engine->set_global(chaiscript::var(y), "targetImageLastMouseY");
433  engine->set_global(chaiscript::var(x), "targetImageMouseX");
434  engine->set_global(chaiscript::var(y), "targetImageMouseY");
435  engine->set_global(chaiscript::var(amount), "targetImageWheelMoveAmount");
436 
437  ui->scriptsWidget->evaluateOnMouseWheelEventScripts();
438  });
439 
440  // Pass the latest key event info to the current image task's script engine
442  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
443  const std::string keyString = QKeySequence(key).toString().toStdString();
444 
445  // Update vars for pressed keys in the engine (cleared on key release)
446  engine->set_global(chaiscript::var(keyString), "targetImageLastKeyDown");
447  engine->set_global(chaiscript::var(true), "targetImageKeyDown_" + keyString);
448  engine->set_global(chaiscript::var(ctrlModifier), "targetImageControlModifierDown");
449 
450  // Last pressed key in the engine, not cleared on key release
451  engine->set_global(chaiscript::var(keyString), "targetImageLastKeyDownPersistent");
452 
453  ui->scriptsWidget->evaluateOnKeyDownEventScripts();
454  });
456  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
457  const std::string keyString = QKeySequence(key).toString().toStdString();
458 
459  // Update vars for pressed keys in the engine
460  engine->set_global(chaiscript::var(""), "targetImageLastKeyDown");
461  engine->set_global(chaiscript::var(false), "targetImageKeyDown_" + keyString);
462  engine->set_global(chaiscript::var(ctrlModifier), "targetImageControlModifierDown");
463 
464  ui->scriptsWidget->evaluateOnKeyUpEventScripts();
465  });
466 
467  // Pass the latest tablet event info to the current image task's script engine
469  if(!m_task) {
470  return;
471  }
472 
473  const geometrize::scene::TabletEventData data = event.getData();
474  chaiscript::ChaiScript* engine = m_task->getGeometrizer().getEngine();
475  engine->set_global(chaiscript::var(data), "lastTabletEvent");
476 
477  ui->scriptsWidget->evaluateOnPenInputEventScripts();
478 
479  try {
480  std::shared_ptr<geometrize::Shape> aoiShape = engine->eval<std::shared_ptr<geometrize::Shape>>("aoi");
481  engine->set_global(chaiscript::var(aoiShape->clone()), "aoi"); // Work around fail to assign shape to shape in the script
483  } catch(...) {
484  // The pen input scripts should setup an area of influence shape
485  }
486  });
487 
488  // Connect the global pen input proximity event filter signals
489  // Note these are separate from the other tablet events, since they are application-wide
490  // and proximity events don't seem to include useful data e.g. position etc
491  auto& sharedTabletProximityEventFilter = geometrize::getSharedTabletProximityEventFilterInstance();
492  connect(&sharedTabletProximityEventFilter, &geometrize::TabletProximityEventFilter::signal_onTabletEnterProximity, q, [this]() {
493  ui->scriptsWidget->evaluateOnPenProximityEnterEventScripts();
494  });
495  connect(&sharedTabletProximityEventFilter, &geometrize::TabletProximityEventFilter::signal_onTabletLeaveProximity, q, [this]() {
496  ui->scriptsWidget->evaluateOnPenProximityExitEventScripts();
497  });
498 
499  /*
500  // TODO do stuff with the area of influence shape, or tell the script engine, when input happens
501  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onAreaOfInfluenceShapeHoverMoveEvent, [this](const int lastX, const int lastY, const int x, const int y, const bool ctrlModifier) {
502  if(!ctrlModifier) {
503  return;
504  }
505  //translateShape(x - lastX, y - lastY);
506  });
507  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onAreaOfInfluenceShapeMouseWheelEvent, [this](const int, const int, const double amount, const bool ctrlModifier) {
508  if(!ctrlModifier) {
509  return;
510  }
511  //scaleShape(amount > 0 ? 1.03f : 0.97f);
512  });
513  connect(&m_sceneManager, &geometrize::scene::ImageTaskSceneManager::signal_onAreaOfInfluenceShapeKeyPressEvent, [this](const int key, const bool) {
514  if(key == Qt::Key_R) { // Rotate
515  //rotateShape(3);
516  }
517  if(key == Qt::Key_Q) { // Scale down
518  //scaleShape(0.97f);
519  }
520  if(key == Qt::Key_A) { // Scale up
521  //scaleShape(1.03f);
522  }
523  });
524  */
525 
526  // Set initial target image opacity
527  const float initialTargetImageOpacity{0};
528  ui->imageTaskImageWidget->setTargetImageOpacity(static_cast<unsigned int>(initialTargetImageOpacity));
529 
530  // Start the timer used to track how long the image task has been in the running state
531  m_timeRunningTimer.start(static_cast<int>(m_timeRunningTimerResolutionMs));
532 
533  // Start the timer used to regularly update the associated image task's script engine (if any)
535  }

◆ ImageTaskWindowImpl() [2/2]

geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::ImageTaskWindowImpl ( const ImageTaskWindowImpl )
delete

◆ ~ImageTaskWindowImpl()

geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::~ImageTaskWindowImpl ( )
inline
539  {
540  // Sets the task in the UI etc to nothing (potentially autosaving stuff etc), then dispose of the task
541  task::ImageTask* lastTask = getImageTask();
542  setImageTask(nullptr);
543 
544  if(lastTask != nullptr) {
545  destroyTask(lastTask);
546  }
547  }

Member Function Documentation

◆ addPostStepCb()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::addPostStepCb ( const std::function< void()> &  f)
inlineprivate
830  {
831  m_onPostStepCbs.push_back(f);
832  }

◆ clearModel()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::clearModel ( )
inlineprivate
773  {
775  task->setPreferences(m_task->getPreferences());
776  setImageTask(task);
777  }
Here is the call graph for this function:

◆ clearPostStepCbs()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::clearPostStepCbs ( )
inlineprivate
835  {
836  m_onPostStepCbs.clear();
837  }

◆ close()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::close ( )
inline
562  {
563  q->close();
564  }

◆ disconnectTask()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::disconnectTask ( )
inlineprivate
812  {
814  disconnect(m_taskPreferencesSetConnection);
815  }
817  disconnect(m_taskWillStepConnection);
818  }
820  disconnect(m_taskDidStepConnection);
821  }
822  }

◆ getCommandHandlerName()

std::string geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::getCommandHandlerName ( ) const
inline
728  {
729  return q->objectName().toStdString();
730  }

◆ getExistingImageTaskWindows()

static std::vector<ImageTaskWindow*> geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::getExistingImageTaskWindows ( )
inlinestatic
550  {
551  std::vector<ImageTaskWindow*> windows;
552  const QWidgetList allWidgets = QApplication::allWidgets();
553  for (QWidget* widget : allWidgets) {
554  if(ImageTaskWindow* w = dynamic_cast<ImageTaskWindow*>(widget)) {
555  windows.push_back(w);
556  }
557  }
558  return windows;
559  }
Here is the caller graph for this function:

◆ getImageTask()

task::ImageTask* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::getImageTask ( )
inline
567  {
568  return m_task;
569  }

◆ handleCommand()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::handleCommand ( const geometrize::script::Command command)
inline
670  {
671  const QString s = QString::fromStdString(command.getCommand());
672 
673  if(s == "start") {
674  setShouldKeepStepping(true);
675  stepModel();
676  }
677  if(s == "stop") {
678  setShouldKeepStepping(false);
679  }
680 
681  if(s == "click_start_stop_button") {
682  ui->imageTaskRunnerWidget->runStopButtonClicked();
683  }
684  if(s == "click_step_button") {
685  ui->imageTaskRunnerWidget->stepButtonClicked();
686  }
687  if(s == "click_clear_button") {
688  ui->imageTaskRunnerWidget->clearButtonClicked();
689  }
690 
691  if(s == "toggle_script_console") {
692  ui->actionScript_Console->toggle();
693  }
694  if(s == "show_script_console") {
695  ui->actionScript_Console->setChecked(true);
696  }
697  if(s == "hide_script_console") {
698  ui->actionScript_Console->setChecked(false);
699  }
700 
701  if(s == "toggle_pixmap_view") {
702  ui->actionPixmap_Results_View->toggle();
703  }
704  if(s == "show_pixmap_view") {
705  ui->actionPixmap_Results_View->setChecked(true);
706  }
707  if(s == "hide_pixmap_view") {
708  ui->actionPixmap_Results_View->setChecked(false);
709  }
710 
711  if(s == "toggle_vector_view") {
712  ui->actionVector_Results_View->toggle();
713  }
714  if(s == "show_vector_view") {
715  ui->actionVector_Results_View->setChecked(true);
716  }
717  if(s == "hide_vector_view") {
718  ui->actionVector_Results_View->setChecked(false);
719  }
720  }
Here is the call graph for this function:

◆ isRunning()

bool geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::isRunning ( ) const
inlineprivate
740  {
741  if(!m_task) {
742  return false;
743  }
744  return m_task->isStepping();
745  }

◆ loadSettingsTemplate() [1/2]

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::loadSettingsTemplate ( )
inline
622  {
623  const QString path{common::ui::openLoadImageTaskSettingsDialog(q)};
624  if(path.isEmpty()) {
625  return;
626  }
627  loadSettingsTemplate(m_task, path.toStdString());
628  }
Here is the call graph for this function:

◆ loadSettingsTemplate() [2/2]

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::loadSettingsTemplate ( task::ImageTask task,
const std::string &  path 
)
inline
631  {
632  if(task == nullptr) {
633  return; // Can't load settings for a non-existent task
634  }
635  if(path.empty()) {
636  assert(0 && "Auto load path for image task file must not be empty");
637  }
638  task->getPreferences().load(path);
639  emit q->didLoadSettingsTemplate();
640  }
Here is the call graph for this function:

◆ onLanguageChange()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::onLanguageChange ( )
inline
664  {
665  ui->retranslateUi(q);
666  populateUi();
667  }

◆ operator=()

ImageTaskWindowImpl& geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::operator= ( const ImageTaskWindowImpl )
delete

◆ populateUi()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::populateUi ( )
inlineprivate
734  {
737  }
Here is the call graph for this function:

◆ processPostStepCbs()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::processPostStepCbs ( )
inlineprivate
840  {
841  for(const auto& f : m_onPostStepCbs) {
842  f();
843  }
845  }

◆ revealLaunchWindow()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::revealLaunchWindow ( )
inline
581  {
584  } else {
586  }
587  }
Here is the call graph for this function:

◆ saveSettingsTemplate() [1/2]

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::saveSettingsTemplate ( ) const
inline
643  {
644  const QString path{common::ui::openSaveImageTaskSettingsDialog(q)};
645  if(path.isEmpty()) {
646  return;
647  }
648  saveSettingsTemplate(m_task, path.toStdString());
649  }
Here is the call graph for this function:

◆ saveSettingsTemplate() [2/2]

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::saveSettingsTemplate ( task::ImageTask task,
const std::string &  path 
) const
inline
652  {
653  if(task == nullptr) {
654  return; // Can't save settings for a non-existent task
655  }
656  if(path.empty()) {
657  assert(0 && "Auto save path for image task file must not be empty");
658  }
659  task->getPreferences().save(path);
660  emit q->didSaveSettingsTemplate();
661  }
Here is the call graph for this function:

◆ setCommandHandlerName()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setCommandHandlerName ( const std::string &  name)
inline
723  {
724  q->setObjectName(QString::fromStdString(name));
725  }

◆ setConsoleVisibility()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setConsoleVisibility ( const bool  visible)
inline
590  {
591  if(ui->actionScript_Console->isChecked() != visible) {
592  ui->actionScript_Console->setChecked(visible);
593  }
594  ui->consoleWidget->setVisible(visible);
595  }

◆ setImageTask()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setImageTask ( task::ImageTask task)
inline
572  {
573  task::ImageTask* lastTask{m_task};
574  task::ImageTask* nextTask{task};
575  q->willSwitchImageTask(lastTask, nextTask);
576  m_task = nextTask;
577  q->didSwitchImageTask(lastTask, nextTask);
578  }

◆ setPixmapViewVisibility()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setPixmapViewVisibility ( const bool  visible)
inline
598  {
599  if(ui->actionPixmap_Results_View->isChecked() != visible) {
600  ui->actionPixmap_Results_View->setChecked(visible);
601  }
602 
603  m_pixmapView->setVisible(visible);
604  if(visible) {
606  }
607  }

◆ setShouldKeepStepping()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setShouldKeepStepping ( const bool  stepping)
inlineprivate
753  {
754  m_shouldKeepStepping = stepping;
756  }

◆ setTargetImage()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setTargetImage ( const QImage &  image)
inlineprivate
825  {
826  ui->imageTaskImageWidget->setTargetImage(image);
827  }

◆ setVectorViewVisibility()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setVectorViewVisibility ( const bool  visible)
inline
610  {
611  if(ui->actionVector_Results_View->isChecked() != visible) {
612  ui->actionVector_Results_View->setChecked(visible);
613  }
614 
615  m_svgView->setVisible(visible);
616  if(visible) {
618  }
619  }

◆ shouldKeepStepping()

bool geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::shouldKeepStepping ( ) const
inlineprivate
748  {
749  return m_shouldKeepStepping;
750  }

◆ stepModel()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::stepModel ( )
inlineprivate
768  {
769  m_task->stepModel();
770  }

◆ switchCurrentImage()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::switchCurrentImage ( Bitmap &  bitmap)
inlineprivate
786  {
787  Bitmap& currentBitmap{m_task->getCurrentMutable()};
788  currentBitmap = bitmap;
789  }

◆ switchTargetImage()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::switchTargetImage ( Bitmap &  bitmap)
inlineprivate
780  {
781  Bitmap& targetBitmap{m_task->getTargetMutable()};
782  targetBitmap = bitmap;
783  }

◆ updateStartStopButtonText()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::updateStartStopButtonText ( )
inlineprivate
759  {
760  if(!shouldKeepStepping()) {
761  ui->imageTaskRunnerWidget->setRunStopButtonText(tr("Start", "Text on a button that the user presses to make the app start/begin transforming an image into shapes"));
762  } else {
763  ui->imageTaskRunnerWidget->setRunStopButtonText(tr("Stop", "Text on a button that the user presses to make the app stop/pause transforming an image into shapes"));
764  }
765  }

◆ updateStats()

void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::updateStats ( )
inlineprivate
792  {
793  ui->statsDockContents->setTaskId(m_task->getTaskId());
794  ui->statsDockContents->setImageDimensions(m_task->getWidth(), m_task->getHeight());
795 
796  // Note this is "stopped" when !isRunning alone, but this prevents flashing while
797  // the user has it continually adding shapes
798  if(!isRunning() && !shouldKeepStepping()) {
799  ui->statsDockContents->setCurrentStatus(geometrize::dialog::ImageTaskStatsWidget::STOPPED);
800  }
801 
802  ui->statsDockContents->setShapeCount(m_shapes.size());
803 
804  if(!m_shapes.empty()) {
805  ui->statsDockContents->setSimilarity(m_shapes.back().score * 100.0f);
806  }
807 
808  ui->statsDockContents->setTimeRunning(static_cast<int>(m_timeRunning / 1000.0f));
809  }

Member Data Documentation

◆ m_onPostStepCbs

std::vector<std::function<void()> > geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_onPostStepCbs
private

Connection for the window to do work just after the image task finishes a step

◆ m_pixmapView

geometrize::scene::ImageTaskGraphicsView* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_pixmapView {nullptr}
private

Manager for scenes containing the pixmap/vector-based representations of the shapes etc

◆ m_sceneManager

geometrize::scene::ImageTaskSceneManager geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_sceneManager
private

Collection of shapes added so far

◆ m_scriptEngineUpdateTimer

QTimer geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_scriptEngineUpdateTimer
private

Resolution of the time running timer in milliseconds

◆ m_scriptEngineUpdateTimerResolution

float geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_scriptEngineUpdateTimerResolution {100.0f}
private

Timer used to call an update function on the script engine of the associated image task

◆ m_shapes

geometrize::task::ShapeCollection geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_shapes
private

One-shot callbacks triggered when the image task finishes a step

◆ m_shouldKeepStepping

bool geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_shouldKeepStepping {false}
private

The view that holds the vector-based scene

◆ m_svgView

geometrize::scene::ImageTaskGraphicsView* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_svgView {nullptr}
private

The view that holds the raster/pixel-based scene

◆ m_task

task::ImageTask* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_task {nullptr}
private

◆ m_taskDidStepConnection

QMetaObject::Connection geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskDidStepConnection {}
private

Connection for the window to do work just prior the image task starts a step

◆ m_taskPreferencesSetConnection

QMetaObject::Connection geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskPreferencesSetConnection {}
private

The image task currently set and manipulated via this window

◆ m_taskWillStepConnection

QMetaObject::Connection geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskWillStepConnection {}
private

Connection for telling the dialog when the image task preferences are set

◆ m_timeRunning

float geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunning {0.0f}
private

Timer used to keep track of how long the image task has been in the "running" state

◆ m_timeRunningTimer

QTimer geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunningTimer
private

Whether to continually step i.e. whether to start another step after stepping once

◆ m_timeRunningTimerResolutionMs

const float geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunningTimerResolutionMs {100.0f}
private

Total time that the image task has been in the "running" state

◆ q

ImageTaskWindow* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::q {nullptr}
private

◆ ui

std::unique_ptr<Ui::ImageTaskWindow> geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::ui {nullptr}
private

The documentation for this class was generated from the following file:
geometrize::scene::ImageTaskSceneManager::reset
void reset()
reset Resets the state of the scenes, removing shapes etc.
Definition: imagetaskscenemanager.cpp:173
geometrize::dialog::ImageTaskWindow::didSwitchImageTask
void didSwitchImageTask(task::ImageTask *lastTask, task::ImageTask *currentTask)
didSwitchImageTask Signal dispatched immediately after an image task is set on the image task window.
geometrize::task::ImageTask::signal_modelWillStep
void signal_modelWillStep()
signal_modelWillStep Signal that is emitted immediately before the underlying image task model is ste...
geometrize::task::ShapeCollection::clear
void clear()
Definition: shapecollection.cpp:23
geometrize::common::ui::openLoadImageTaskSettingsDialog
QString openLoadImageTaskSettingsDialog(QWidget *parent)
Definition: uiactions.cpp:212
geometrize::task::ImageTask::getTarget
const Bitmap & getTarget() const
getTarget Gets the target bitmap, const-edition.
Definition: imagetask.cpp:332
geometrize::dialog::ImageTaskImageWidget::targetImageSelected
void targetImageSelected(const QImage &image)
targetImageSelected Signal dispatched when a candidate target image is selected, typically by the use...
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageMouseMoveEvent
void signal_onTargetImageMouseMoveEvent(double lastX, double lastY, double x, double y, bool ctrlModifier)
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::updateStartStopButtonText
void updateStartStopButtonText()
Definition: imagetaskwindow.cpp:758
geometrize::scene::TabletEventData
The TabletEventData class represents data produced from a Wacom pen/tablet event (in the context of a...
Definition: customtabletevent.h:56
geometrize::common::ui::openLaunchWindow
void openLaunchWindow()
Definition: uiactions.cpp:42
geometrize::common::ui::isLaunchWindowOpen
bool isLaunchWindowOpen()
Definition: uiactions.cpp:51
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setImageTask
void setImageTask(task::ImageTask *task)
Definition: imagetaskwindow.cpp:571
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::shouldKeepStepping
bool shouldKeepStepping() const
Definition: imagetaskwindow.cpp:747
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::getImageTask
task::ImageTask * getImageTask()
Definition: imagetaskwindow.cpp:566
geometrize::dialog::ImageTaskStatsWidget::RUNNING
@ RUNNING
Definition: imagetaskstatswidget.h:25
geometrize::getSharedTabletProximityEventFilterInstance
TabletProximityEventFilter & getSharedTabletProximityEventFilterInstance()
getSharedTabletProximityEventFilterInstance Gets a reference to the shared instance of the tablet pro...
Definition: tabletproximityeventfilter.cpp:32
geometrize::task::ImageTask::getCurrent
const Bitmap & getCurrent() const
getCurrent Gets the current bitmap, const-edition.
Definition: imagetask.cpp:337
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setVectorViewVisibility
void setVectorViewVisibility(const bool visible)
Definition: imagetaskwindow.cpp:609
geometrize::scene::ImageTaskSceneManager::updateScenes
void updateScenes(const QPixmap &pixmap, const std::vector< geometrize::ShapeResult > &shapes)
updateScenes Updates the scenes to show the latest image/shapes.
Definition: imagetaskscenemanager.cpp:168
geometrize::common::ui::openSaveImageTaskSettingsDialog
QString openSaveImageTaskSettingsDialog(QWidget *parent)
Definition: uiactions.cpp:220
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunningTimer
QTimer m_timeRunningTimer
Whether to continually step i.e. whether to start another step after stepping once
Definition: imagetaskwindow.cpp:863
geometrize::dialog::ImageTaskRunnerWidget::runStopButtonClicked
void runStopButtonClicked()
geometrize::task::ImageTask::getHeight
std::uint32_t getHeight() const
getHeight Gets the height of the images used by the image task.
Definition: imagetask.cpp:347
geometrize::image::createImage
QImage createImage(const Bitmap &data)
createImage Creates an image from the bitmap data object. Assumes RGBA8888 format.
Definition: imageloader.cpp:48
geometrize::preferences::getImageTaskPreferencesAutoSavePath
std::string getImageTaskPreferencesAutoSavePath(const std::string &hashOfFirstTargetImage)
getImageTaskPreferencesAutoSavePath Gets the absolute path to where the image task preferences config...
Definition: imagetaskpreferences.cpp:24
geometrize::dialog::ImageTaskRunnerWidget::stepButtonClicked
void stepButtonClicked()
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_onPostStepCbs
std::vector< std::function< void()> > m_onPostStepCbs
Connection for the window to do work just after the image task finishes a step
Definition: imagetaskwindow.cpp:854
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::disconnectTask
void disconnectTask()
Definition: imagetaskwindow.cpp:811
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setPixmapViewVisibility
void setPixmapViewVisibility(const bool visible)
Definition: imagetaskwindow.cpp:597
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageMousePressEvent
void signal_onTargetImageMousePressEvent(double x, double y, bool ctrlModifier)
geometrize::task::ImageTask::getTaskId
std::size_t getTaskId() const
getTaskId Gets the unique id of the image task.
Definition: imagetask.cpp:357
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::populateUi
void populateUi()
Definition: imagetaskwindow.cpp:733
geometrize::scene::ImageTaskSceneManager::fitVectorSceneInView
void fitVectorSceneInView(ImageTaskGraphicsView &svgView)
fitVectorSceneInView Fits the SVG/vector scene into the given view.
Definition: imagetaskscenemanager.cpp:183
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_shapes
geometrize::task::ShapeCollection m_shapes
One-shot callbacks triggered when the image task finishes a step
Definition: imagetaskwindow.cpp:856
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::processPostStepCbs
void processPostStepCbs()
Definition: imagetaskwindow.cpp:839
geometrize::version::getApplicationVersionString
QString getApplicationVersionString()
getApplicationVersionString Gets the application version as a string in VERSION.MAJOR....
Definition: versioninfo.cpp:13
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageMouseReleaseEvent
void signal_onTargetImageMouseReleaseEvent(double x, double y, bool ctrlModifier)
geometrize::scene::ImageTaskSceneManager::setTargetPixmapOpacity
void setTargetPixmapOpacity(float opacity)
setTargetPixmapOpacity Sets the opacity of the target pixmap.
Definition: imagetaskscenemanager.cpp:163
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageKeyPressEvent
void signal_onTargetImageKeyPressEvent(int key, bool ctrlModifier)
geometrize::scene::CustomTabletEvent
The CustomTabletEvent class represents a tablet event (specifically from a Wacom Pro pen) that can be...
Definition: customtabletevent.h:88
geometrize::dialog::ImageTaskImageWidget::targetImageSet
void targetImageSet(const QImage &image)
targetImageSet Signal dispatched when a target image is set and made visible in this widget (and is p...
geometrize::dialog::ImageTaskWindow::ImageTaskWindow
ImageTaskWindow()
Definition: imagetaskwindow.cpp:871
geometrize::preferences::GlobalPreferences::getCustomImageTaskBackgroundOverrideColor
std::array< std::int32_t, 4 > getCustomImageTaskBackgroundOverrideColor() const
getCustomImageTaskBackgroundOverrideColor Gets the preference for the custom image task background ov...
Definition: globalpreferences.cpp:498
geometrize::scene::ImageTaskSceneManager::fitScenesInViews
void fitScenesInViews(ImageTaskGraphicsView &pixmapView, ImageTaskGraphicsView &svgView)
fitScenesInViews Fits the scenes into their respective views.
Definition: imagetaskscenemanager.cpp:188
geometrize::task::ShapeCollection::getShapeVector
const std::vector< geometrize::ShapeResult > & getShapeVector() const
Definition: shapecollection.cpp:29
geometrize::scene::ImageTaskGraphicsView
The ImageTaskGraphicsView class models a graphics view for viewing the images and shapes used and/or ...
Definition: imagetaskgraphicsview.h:22
geometrize::strings::Strings::getApplicationName
static QString getApplicationName()
getApplicationName Gets the name of the application.
Definition: strings.cpp:9
geometrize::task::ImageTask::getCurrentMutable
Bitmap & getCurrentMutable()
getCurrent Gets the current bitmap, non-const edition.
Definition: imagetask.cpp:327
geometrize::image::createPixmap
QPixmap createPixmap(const Bitmap &data)
createPixmap Creates a pixmap from the bitmap data object. Assumes RGBA8888 format.
Definition: imageloader.cpp:59
geometrize::preferences::GlobalPreferences
The GlobalPreferences class models the preferences associated with the application as a whole....
Definition: globalpreferences.h:44
geometrize::dialog::ImageTaskWindow::didLoadSettingsTemplate
void didLoadSettingsTemplate()
didLoadSettingsTemplate Signal dispatched immediately after a settings template is applied to the ima...
geometrize::script::Command::getCommand
std::string getCommand() const
Definition: command.cpp:15
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageTabletEvent
void signal_onTargetImageTabletEvent(const geometrize::scene::CustomTabletEvent &event)
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskDidStepConnection
QMetaObject::Connection m_taskDidStepConnection
Connection for the window to do work just prior the image task starts a step
Definition: imagetaskwindow.cpp:853
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::loadSettingsTemplate
void loadSettingsTemplate()
Definition: imagetaskwindow.cpp:621
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageWheelEvent
void signal_onTargetImageWheelEvent(double x, double y, int amount, bool ctrlModifier)
geometrize::dialog::ImageTaskWindow::willSwitchImageTask
void willSwitchImageTask(task::ImageTask *lastTask, task::ImageTask *nextTask)
willSwitchImageTask Signal dispatched immediately before an image task is set on the image task windo...
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_scriptEngineUpdateTimerResolution
float m_scriptEngineUpdateTimerResolution
Timer used to call an update function on the script engine of the associated image task
Definition: imagetaskwindow.cpp:868
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunningTimerResolutionMs
const float m_timeRunningTimerResolutionMs
Total time that the image task has been in the "running" state
Definition: imagetaskwindow.cpp:865
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::isRunning
bool isRunning() const
Definition: imagetaskwindow.cpp:739
geometrize::dialog::ImageTaskStatsWidget::STOPPED
@ STOPPED
Definition: imagetaskstatswidget.h:24
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageKeyReleaseEvent
void signal_onTargetImageKeyReleaseEvent(int key, bool ctrlModifier)
geometrize::task::ImageTask::getTargetMutable
Bitmap & getTargetMutable()
getTarget Gets the target bitmap, non-const edition.
Definition: imagetask.cpp:322
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::q
ImageTaskWindow * q
Definition: imagetaskwindow.cpp:848
geometrize::task::ImageTask::getGeometrizer
geometrize::script::GeometrizerEngine & getGeometrizer()
getGeometrizer Gets a reference to the script-based engine used to turn images into shapes.
Definition: imagetask.cpp:402
geometrize::dialog::ImageTaskWindow::didSaveSettingsTemplate
void didSaveSettingsTemplate()
didSaveSettingsTemplate Signal dispatched immediately after a settings template based on the current ...
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_scriptEngineUpdateTimer
QTimer m_scriptEngineUpdateTimer
Resolution of the time running timer in milliseconds
Definition: imagetaskwindow.cpp:867
geometrize::task::ShapeCollection::signal_afterAppendShapes
void signal_afterAppendShapes(const std::vector< geometrize::ShapeResult > &)
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_shouldKeepStepping
bool m_shouldKeepStepping
The view that holds the vector-based scene
Definition: imagetaskwindow.cpp:862
geometrize::TabletProximityEventFilter::signal_onTabletEnterProximity
void signal_onTabletEnterProximity()
signal_onTabletEnterProximity Signal dispatched when a Wacom tablet enter proximity event is received
geometrize::task::ShapeCollection::size
std::size_t size() const
Definition: shapecollection.cpp:18
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::ui
std::unique_ptr< Ui::ImageTaskWindow > ui
Definition: imagetaskwindow.cpp:847
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::stepModel
void stepModel()
Definition: imagetaskwindow.cpp:767
geometrize::task::ImageTask::getWidth
std::uint32_t getWidth() const
getWidth Gets the width of the images used by the image task.
Definition: imagetask.cpp:342
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_svgView
geometrize::scene::ImageTaskGraphicsView * m_svgView
The view that holds the raster/pixel-based scene
Definition: imagetaskwindow.cpp:860
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::clearPostStepCbs
void clearPostStepCbs()
Definition: imagetaskwindow.cpp:834
geometrize::TabletProximityEventFilter::signal_onTabletLeaveProximity
void signal_onTabletLeaveProximity()
signal_onTabletLeaveProximity Signal dispatched when a Wacom tablet leave proximity event is received
geometrize::dialog::ImageTaskRunnerWidget::clearButtonClicked
void clearButtonClicked()
geometrize::task::ShapeCollection::empty
bool empty() const
Definition: shapecollection.cpp:13
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskPreferencesSetConnection
QMetaObject::Connection m_taskPreferencesSetConnection
The image task currently set and manipulated via this window
Definition: imagetaskwindow.cpp:851
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskWillStepConnection
QMetaObject::Connection m_taskWillStepConnection
Connection for telling the dialog when the image task preferences are set
Definition: imagetaskwindow.cpp:852
geometrize::scene::ImageTaskSceneManager::signal_onTargetImageHoverMoveEvent
void signal_onTargetImageHoverMoveEvent(double lastX, double lastY, double x, double y, bool ctrlModifier)
geometrize::scene::ImageTaskSceneManager::fitPixmapSceneInView
void fitPixmapSceneInView(ImageTaskGraphicsView &pixmapView)
fitPixmapSceneInView Fits the pixmap scene into the given view.
Definition: imagetaskscenemanager.cpp:178
geometrize::dialog::ImageTaskImageWidget::targetImageOpacityChanged
void targetImageOpacityChanged(unsigned int opacity)
targetImageOpacityChanged Signal dispatched when the target image opacity is changed.
geometrize::task::ShapeCollection::signal_beforeAppendShapes
void signal_beforeAppendShapes(const std::vector< geometrize::ShapeResult > &)
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_pixmapView
geometrize::scene::ImageTaskGraphicsView * m_pixmapView
Manager for scenes containing the pixmap/vector-based representations of the shapes etc
Definition: imagetaskwindow.cpp:859
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::saveSettingsTemplate
void saveSettingsTemplate() const
Definition: imagetaskwindow.cpp:642
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_task
task::ImageTask * m_task
Definition: imagetaskwindow.cpp:850
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setConsoleVisibility
void setConsoleVisibility(const bool visible)
Definition: imagetaskwindow.cpp:589
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setShouldKeepStepping
void setShouldKeepStepping(const bool stepping)
Definition: imagetaskwindow.cpp:752
geometrize::task::ImageTask
The ImageTask class transforms a source image into a collection of shapes approximating the source im...
Definition: imagetask.h:53
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunning
float m_timeRunning
Timer used to keep track of how long the image task has been in the "running" state
Definition: imagetaskwindow.cpp:864
geometrize::task::ShapeCollection::signal_sizeChanged
void signal_sizeChanged(std::size_t to)
geometrize::scene::ImageTaskSceneManager::setViews
void setViews(ImageTaskGraphicsView &pixmapView, ImageTaskGraphicsView &svgView)
setViews Associates the given views with the scenes managed by this class.
Definition: imagetaskscenemanager.cpp:153
geometrize::task::ShapeCollection::appendShapes
void appendShapes(const std::vector< geometrize::ShapeResult > &shapes)
Definition: shapecollection.cpp:34
geometrize::task::ImageTask::isStepping
bool isStepping() const
isStepping Returns true if the internal model is currently stepping.
Definition: imagetask.cpp:362
geometrize::preferences::getGlobalPreferences
geometrize::preferences::GlobalPreferences & getGlobalPreferences()
getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object...
Definition: globalpreferences.cpp:32
geometrize::task::ImageTask::signal_modelDidStep
void signal_modelDidStep(std::vector< geometrize::ShapeResult > shapes)
signal_modelDidStep Signal that is emitted immediately after the underlying image task model is stepp...
geometrize::task::ShapeCollection::back
geometrize::ShapeResult & back()
Definition: shapecollection.cpp:42
geometrize::task::ImageTask::getPreferences
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:392
geometrize::task::ImageTask::signal_preferencesSet
void signal_preferencesSet()
signal_preferencesSet Signal that is emitted immediately after the image task preferences are set.
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::updateStats
void updateStats()
Definition: imagetaskwindow.cpp:791
geometrize::scene::ImageTaskSceneManager::setAreaOfInfluenceShape
void setAreaOfInfluenceShape(const geometrize::Shape &shape)
setAreaOfInfluenceShape Sets up a area of influence visual for the given shape.
Definition: imagetaskscenemanager.cpp:193
geometrize::task::ImageTask::stepModel
void stepModel()
stepModel Steps the internal model, typically adding a shape.
Definition: imagetask.cpp:367
geometrize::common::ui::bringLaunchWindowToFront
void bringLaunchWindowToFront()
Definition: uiactions.cpp:56
geometrize::task::ImageTask::getDisplayName
std::string getDisplayName() const
getDisplayName Gets the display name of the image task.
Definition: imagetask.cpp:352
geometrize::scene::ImageTaskSceneManager::setTargetPixmap
void setTargetPixmap(const QPixmap &pixmap)
setTargetPixmap Sets the pixmap that provides the target/goal image visualization.
Definition: imagetaskscenemanager.cpp:158
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_sceneManager
geometrize::scene::ImageTaskSceneManager m_sceneManager
Collection of shapes added so far
Definition: imagetaskwindow.cpp:858
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setTargetImage
void setTargetImage(const QImage &image)
Definition: imagetaskwindow.cpp:824