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::TaskQueueWindow::TaskQueueWindowImpl Class Reference
Collaboration diagram for geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl:
Collaboration graph
[legend]

Public Member Functions

 TaskQueueWindowImpl (TaskQueueWindow *pQ)
 
TaskQueueWindowImploperator= (const TaskQueueWindowImpl &)=delete
 
 TaskQueueWindowImpl (const TaskQueueWindowImpl &)=delete
 
 ~TaskQueueWindowImpl ()
 
void addItems (const QStringList &tasks)
 
void close ()
 
void onLanguageChange ()
 

Private Member Functions

void runScript (const std::string &imagePath) const
 
void addItem (const QString &itemPath, const QString &itemDisplayName) const
 
void setMenuItemKey (QListWidgetItem *item, const QString &key) const
 
void setupScriptEditor ()
 
void populateUi ()
 

Private Attributes

std::unique_ptr
< Ui::TaskQueueWindow > 
ui {nullptr}
 
TaskQueueWindowq {nullptr}
 
geometrize::dialog::ScriptEditorWidgetm_scriptEditorWidget
 

Constructor & Destructor Documentation

geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::TaskQueueWindowImpl ( TaskQueueWindow pQ)
inline
87  :
88  ui{std::make_unique<Ui::TaskQueueWindow>()},
89  q{pQ}
90  {
91  ui->setupUi(q);
92  populateUi();
93  q->setAttribute(Qt::WA_DeleteOnClose);
94 
96 
97  connect(ui->runTasksButton, &QPushButton::clicked, [this]() {
98  for(int i = 0; i < ui->taskList->count(); ++i) {
99  QListWidgetItem* item = ui->taskList->item(i);
100  QString data = item->data(Qt::UserRole).toString();
101  runScript(data.toStdString());
102  }
103  });
104  connect(ui->clearTaskListButton, &QPushButton::clicked, [this]() {
105  ui->taskList->clear();
106  });
107  }
void setupScriptEditor()
Definition: taskqueuewindow.cpp:170
void runScript(const std::string &imagePath) const
Definition: taskqueuewindow.cpp:133
void populateUi()
Definition: taskqueuewindow.cpp:184
std::unique_ptr< Ui::TaskQueueWindow > ui
Definition: taskqueuewindow.cpp:188
TaskQueueWindow * q
Definition: taskqueuewindow.cpp:189

Here is the call graph for this function:

geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::TaskQueueWindowImpl ( const TaskQueueWindowImpl )
delete
geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::~TaskQueueWindowImpl ( )
inline
111  {
112  }

Member Function Documentation

void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::addItem ( const QString &  itemPath,
const QString &  itemDisplayName 
) const
inlineprivate
149  {
150  QListWidgetItem* item{new QListWidgetItem()};
151  dialog::TaskItemWidget* button{new dialog::TaskItemWidget(itemPath, itemDisplayName,
152  [this](const QString& taskItemId) {
153  runScript(taskItemId.toStdString());
154  },
155  [item](const QString& /*taskItemId*/) {
156  delete item;
157  })};
158  item->setToolTip(itemPath);
159  item->setSizeHint(button->sizeHint());
160  setMenuItemKey(item, itemPath);
161  ui->taskList->addItem(item);
162  ui->taskList->setItemWidget(item, button);
163  }
void runScript(const std::string &imagePath) const
Definition: taskqueuewindow.cpp:133
void setMenuItemKey(QListWidgetItem *item, const QString &key) const
Definition: taskqueuewindow.cpp:165
std::unique_ptr< Ui::TaskQueueWindow > ui
Definition: taskqueuewindow.cpp:188

Here is the call graph for this function:

void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::addItems ( const QStringList &  tasks)
inline
115  {
116  for(const auto& task : tasks) {
117  addItem(task, task);
118  }
119  }
void addItem(const QString &itemPath, const QString &itemDisplayName) const
Definition: taskqueuewindow.cpp:148
void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::close ( )
inline
122  {
123  q->close();
124  }
TaskQueueWindow * q
Definition: taskqueuewindow.cpp:189
void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::onLanguageChange ( )
inline
127  {
128  ui->retranslateUi(q);
129  populateUi();
130  }
void populateUi()
Definition: taskqueuewindow.cpp:184
std::unique_ptr< Ui::TaskQueueWindow > ui
Definition: taskqueuewindow.cpp:188
TaskQueueWindow * q
Definition: taskqueuewindow.cpp:189
TaskQueueWindowImpl& geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::operator= ( const TaskQueueWindowImpl )
delete
void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::populateUi ( )
inlineprivate
185  {
186  }

Here is the caller graph for this function:

void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::runScript ( const std::string &  imagePath) const
inlineprivate
134  {
135  const auto engine = script::createBatchImageTaskEngine();
136  engine->set_global(chaiscript::var(imagePath), "inputPath");
137  const auto& code = m_scriptEditorWidget->getCurrentCode();
138  try {
139  engine->eval(code);
141  } catch(const chaiscript::exception::eval_error& e) {
143  } catch(...) {
144  m_scriptEditorWidget->onScriptEvaluationFailed("Unknown script evaluation error");
145  }
146  }
geometrize::dialog::ScriptEditorWidget * m_scriptEditorWidget
Definition: taskqueuewindow.cpp:191
void onScriptEvaluationFailed(const std::string &errorMessage)
Definition: scripteditorwidget.cpp:215
std::string getCurrentCode() const
Definition: scripteditorwidget.cpp:200
std::unique_ptr< chaiscript::ChaiScript > createBatchImageTaskEngine()
createBatchImageTaskEngine Creates a Chaiscript engine for creating and processing multiple image tas...
Definition: chaiscriptcreator.cpp:66
void onScriptEvaluationSucceeded()
Definition: scripteditorwidget.cpp:210

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::setMenuItemKey ( QListWidgetItem *  item,
const QString &  key 
) const
inlineprivate
166  {
167  item->setData(Qt::UserRole, key);
168  }
void geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::setupScriptEditor ( )
inlineprivate
171  {
172  const std::string functionName = "task_queue_processing_script" + QUuid::createUuid().toString().toStdString();
173  const std::string scriptEditorWidgetTitle = tr("Script Editor").toStdString();
174 
175  m_scriptEditorWidget = new geometrize::dialog::ScriptEditorWidget(scriptEditorWidgetTitle, functionName, defaultScriptCode, ui->taskListScriptContainer);
176 
177  connect(m_scriptEditorWidget, &ScriptEditorWidget::signal_scriptChanged, [this](ScriptEditorWidget* /*self*/, const std::string& functionName, const std::string& code) {
178  emit q->signal_scriptChanged(functionName, code);
179  });
180 
181  ui->taskListScriptLayout->addWidget(m_scriptEditorWidget);
182  }
void signal_scriptChanged(ScriptEditorWidget *self, const std::string &functionName, const std::string &code)
signal_scriptChanged Signal emitted when the user change the script code of a function.
geometrize::dialog::ScriptEditorWidget * m_scriptEditorWidget
Definition: taskqueuewindow.cpp:191
The ScriptEditorWidget class implements a widget for interactively editing a Chaiscript function...
Definition: scripteditorwidget.h:19
void signal_scriptChanged(const std::string &functionName, const std::string &code)
std::unique_ptr< Ui::TaskQueueWindow > ui
Definition: taskqueuewindow.cpp:188
TaskQueueWindow * q
Definition: taskqueuewindow.cpp:189

Here is the caller graph for this function:

Member Data Documentation

geometrize::dialog::ScriptEditorWidget* geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::m_scriptEditorWidget
private
TaskQueueWindow* geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::q {nullptr}
private
std::unique_ptr<Ui::TaskQueueWindow> geometrize::dialog::TaskQueueWindow::TaskQueueWindowImpl::ui {nullptr}
private

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