Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl Class Reference
Collaboration diagram for geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl:
Collaboration graph
[legend]

Public Member Functions

 ImageTaskRunnerWidgetImpl (ImageTaskRunnerWidget *pQ)
 
 ~ImageTaskRunnerWidgetImpl ()=default
 
ImageTaskRunnerWidgetImpl operator= (const ImageTaskRunnerWidgetImpl &)=delete
 
 ImageTaskRunnerWidgetImpl (const ImageTaskRunnerWidgetImpl &)=delete
 
void setImageTask (task::ImageTask *task)
 
void setRunStopButtonText (const QString &text)
 
void syncUserInterface ()
 
void toggleRunning ()
 
void stepModel ()
 
void clearModel ()
 
void setShapes (const geometrize::ShapeTypes shapeTypes, const bool enable)
 
void setShapeOpacity (const int opacity)
 
void setCandidateShapesPerStep (const int value)
 
void setMutationsPerCandidateShape (const int value)
 
void setRandomSeed (const int value)
 
void setMaxThreads (const int value)
 
void onLanguageChange ()
 

Private Member Functions

void populateUi ()
 

Private Attributes

geometrize::task::ImageTaskm_task
 
ImageTaskRunnerWidgetq
 
std::unique_ptr
< Ui::ImageTaskRunnerWidget > 
ui
 

Constructor & Destructor Documentation

geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::ImageTaskRunnerWidgetImpl ( ImageTaskRunnerWidget pQ)
inline
23  : q{pQ}, ui{std::make_unique<Ui::ImageTaskRunnerWidget>()}
24  {
25  ui->setupUi(q);
26 
27  auto shapeLayout = new geometrize::layout::FlowLayout();
28  shapeLayout->addWidget(ui->usesCircles);
29  shapeLayout->addWidget(ui->usesEllipses);
30  shapeLayout->addWidget(ui->usesLines);
31  shapeLayout->addWidget(ui->usesPolylines);
32  shapeLayout->addWidget(ui->usesQuadraticBeziers);
33  shapeLayout->addWidget(ui->usesRectangles);
34  shapeLayout->addWidget(ui->usesRotatedEllipses);
35  shapeLayout->addWidget(ui->usesRotatedRectangles);
36  shapeLayout->addWidget(ui->usesTriangles);
37  ui->shapeTypesContainer->setLayout(shapeLayout);
38 
39  auto runnerButtonsLayout = new geometrize::layout::FlowLayout();
40  runnerButtonsLayout->addWidget(ui->runStopButton);
41  runnerButtonsLayout->addWidget(ui->stepButton);
42  runnerButtonsLayout->addWidget(ui->clearButton);
43 
44  ui->bottomButtonsContainer->setLayout(runnerButtonsLayout);
45 
46  populateUi();
47  }
The FlowLayout class implements a layout that arranges components in a directional flow...
Definition: flowlayout.h:52
std::unique_ptr< Ui::ImageTaskRunnerWidget > ui
Definition: imagetaskrunnerwidget.cpp:167
void populateUi()
Definition: imagetaskrunnerwidget.cpp:160
ImageTaskRunnerWidget * q
Definition: imagetaskrunnerwidget.cpp:166
geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::~ImageTaskRunnerWidgetImpl ( )
default
geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::ImageTaskRunnerWidgetImpl ( const ImageTaskRunnerWidgetImpl )
delete

Member Function Documentation

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::clearModel ( )
inline
109  {
110  emit q->clearButtonClicked();
111  }
ImageTaskRunnerWidget * q
Definition: imagetaskrunnerwidget.cpp:166
void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::onLanguageChange ( )
inline
154  {
155  ui->retranslateUi(q);
156  populateUi();
157  }
std::unique_ptr< Ui::ImageTaskRunnerWidget > ui
Definition: imagetaskrunnerwidget.cpp:167
void populateUi()
Definition: imagetaskrunnerwidget.cpp:160
ImageTaskRunnerWidget * q
Definition: imagetaskrunnerwidget.cpp:166

Here is the call graph for this function:

ImageTaskRunnerWidgetImpl geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::operator= ( const ImageTaskRunnerWidgetImpl )
delete
void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::populateUi ( )
inlineprivate
161  {
162 
163  }

Here is the caller graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setCandidateShapesPerStep ( const int  value)
inline
130  {
131  ui->candidateShapesPerStepCountLabel->setText(QLocale().toString(value));
132 
134  }
void setCandidateShapeCount(std::uint32_t shapeCount)
Definition: imagetaskpreferences.cpp:222
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:330
std::unique_ptr< Ui::ImageTaskRunnerWidget > ui
Definition: imagetaskrunnerwidget.cpp:167

Here is the call graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setImageTask ( task::ImageTask task)
inline
53  {
54  m_task = task;
55  }
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setMaxThreads ( const int  value)
inline
149  {
151  }
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
void setMaxThreads(std::uint32_t maxThreads)
Definition: imagetaskpreferences.cpp:237
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:330

Here is the call graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setMutationsPerCandidateShape ( const int  value)
inline
137  {
138  ui->mutationsPerCandidateShapeCountLabel->setText(QLocale().toString(value));
139 
141  }
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:330
std::unique_ptr< Ui::ImageTaskRunnerWidget > ui
Definition: imagetaskrunnerwidget.cpp:167
void setMaxShapeMutations(std::uint32_t maxMutations)
Definition: imagetaskpreferences.cpp:227

Here is the call graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setRandomSeed ( const int  value)
inline
144  {
145  m_task->getPreferences().setSeed(value);
146  }
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:330
void setSeed(std::uint32_t seed)
Definition: imagetaskpreferences.cpp:232

Here is the call graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setRunStopButtonText ( const QString &  text)
inline
58  {
59  ui->runStopButton->setText(text);
60  }
std::unique_ptr< Ui::ImageTaskRunnerWidget > ui
Definition: imagetaskrunnerwidget.cpp:167
void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setShapeOpacity ( const int  opacity)
inline
123  {
124  ui->shapeOpacityValueLabel->setText(QLocale().toString(opacity));
125 
126  m_task->getPreferences().setShapeAlpha(opacity);
127  }
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:330
std::unique_ptr< Ui::ImageTaskRunnerWidget > ui
Definition: imagetaskrunnerwidget.cpp:167
void setShapeAlpha(std::uint8_t alpha)
Definition: imagetaskpreferences.cpp:217

Here is the call graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::setShapes ( const geometrize::ShapeTypes  shapeTypes,
const bool  enable 
)
inline
114  {
115  if(enable) {
116  m_task->getPreferences().enableShapeTypes(shapeTypes);
117  } else {
118  m_task->getPreferences().disableShapeTypes(shapeTypes);
119  }
120  }
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:330
void enableShapeTypes(geometrize::ShapeTypes shapes)
Definition: imagetaskpreferences.cpp:202
void disableShapeTypes(geometrize::ShapeTypes shapes)
Definition: imagetaskpreferences.cpp:207

Here is the call graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::stepModel ( )
inline
104  {
105  emit q->stepButtonClicked();
106  }
ImageTaskRunnerWidget * q
Definition: imagetaskrunnerwidget.cpp:166
void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::syncUserInterface ( )
inline
63  {
64  if(m_task == nullptr) {
65  return;
66  }
67 
69 
70  const geometrize::ImageRunnerOptions opts{prefs.getImageRunnerOptions()}; // Geometrize library options
71 
72  const auto usesShape = [&opts](const geometrize::ShapeTypes type) -> bool {
73  const std::uint32_t shapes{static_cast<std::uint32_t>(opts.shapeTypes)};
74  return shapes & type;
75  };
76 
77  ui->usesRectangles->setChecked(usesShape(geometrize::RECTANGLE));
78  ui->usesRotatedRectangles->setChecked(usesShape(geometrize::ROTATED_RECTANGLE));
79  ui->usesTriangles->setChecked(usesShape(geometrize::TRIANGLE));
80  ui->usesEllipses->setChecked(usesShape(geometrize::ELLIPSE));
81  ui->usesRotatedEllipses->setChecked(usesShape(geometrize::ROTATED_ELLIPSE));
82  ui->usesCircles->setChecked(usesShape(geometrize::CIRCLE));
83  ui->usesLines->setChecked(usesShape(geometrize::LINE));
84  ui->usesQuadraticBeziers->setChecked(usesShape(geometrize::QUADRATIC_BEZIER));
85  ui->usesPolylines->setChecked(usesShape(geometrize::POLYLINE));
86 
87  ui->shapeOpacitySlider->setValue(opts.alpha);
88  ui->candidateShapesPerStepSlider->setValue(opts.shapeCount);
89  ui->mutationsPerCandidateShapeSlider->setValue(opts.maxShapeMutations);
90  ui->randomSeedSpinBox->setValue(opts.seed);
91 
92  // Constrain max threads based on global settings
93  ui->maxThreadsSpinBox->setMaximum(geometrize::preferences::getGlobalPreferences().getImageTaskMaxThreads());
94 
95  ui->maxThreadsSpinBox->setValue(opts.maxThreads);
96  }
The ImageTaskPreferences class models the preferences associated with an image task.
Definition: imagetaskpreferences.h:28
geometrize::task::ImageTask * m_task
Definition: imagetaskrunnerwidget.cpp:165
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:330
std::unique_ptr< Ui::ImageTaskRunnerWidget > ui
Definition: imagetaskrunnerwidget.cpp:167
geometrize::preferences::GlobalPreferences & getGlobalPreferences()
getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object...
Definition: globalpreferences.cpp:32
geometrize::ImageRunnerOptions getImageRunnerOptions() const
getImageRunnerOptions Gets a copy of the image runner options.
Definition: imagetaskpreferences.cpp:197

Here is the call graph for this function:

void geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::toggleRunning ( )
inline
99  {
100  emit q->runStopButtonClicked();
101  }
ImageTaskRunnerWidget * q
Definition: imagetaskrunnerwidget.cpp:166

Member Data Documentation

geometrize::task::ImageTask* geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::m_task
private
ImageTaskRunnerWidget* geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::q
private
std::unique_ptr<Ui::ImageTaskRunnerWidget> geometrize::dialog::ImageTaskRunnerWidget::ImageTaskRunnerWidgetImpl::ui
private

The documentation for this class was generated from the following file: