Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::LaunchWindow Class Reference

The LaunchWindow class models the UI for a launchpad for opening new task templates and recent tasks. More...

#include <launchwindow.h>

Inheritance diagram for geometrize::dialog::LaunchWindow:
Inheritance graph
[legend]
Collaboration diagram for geometrize::dialog::LaunchWindow:
Collaboration graph
[legend]

Classes

class  LaunchWindowImpl
 

Public Member Functions

 LaunchWindow ()
 
virtual ~LaunchWindow ()
 
virtual void dragEnterEvent (QDragEnterEvent *event) override
 
virtual void dropEvent (QDropEvent *event) override
 

Static Public Member Functions

static std::vector
< LaunchWindow * > 
getTopLevelLaunchWindows ()
 getTopLevelLaunchWindows Gets all of the existing top level launch windows. More...
 

Protected Member Functions

void changeEvent (QEvent *) override
 

Private Slots

void on_actionGlobal_Preferences_triggered ()
 
void on_actionLoad_Global_Preferences_triggered ()
 
void on_actionSave_Global_Preferences_triggered ()
 
void on_actionClear_Recents_triggered ()
 
void on_actionExit_triggered ()
 
void on_actionTutorials_triggered ()
 
void on_actionSupport_triggered ()
 
void on_actionAbout_triggered ()
 
void on_openImageButton_clicked ()
 
void on_openLinkButton_clicked ()
 
void on_runScriptButton_clicked ()
 
void on_openTaskQueueButton_clicked ()
 

Private Member Functions

void closeEvent (QCloseEvent *bar) override
 

Private Attributes

std::unique_ptr< LaunchWindowImpld
 

Detailed Description

The LaunchWindow class models the UI for a launchpad for opening new task templates and recent tasks.

Constructor & Destructor Documentation

geometrize::dialog::LaunchWindow::LaunchWindow ( )
explicit
212  :
213  QMainWindow(nullptr),
214  d{std::make_unique<LaunchWindow::LaunchWindowImpl>(this)}
215 {
216 }
std::unique_ptr< LaunchWindowImpl > d
Definition: launchwindow.h:56
geometrize::dialog::LaunchWindow::~LaunchWindow ( )
virtual
219 {
220 }

Member Function Documentation

void geometrize::dialog::LaunchWindow::changeEvent ( QEvent *  event)
overrideprotected
336 {
337  if (event->type() == QEvent::LanguageChange) {
338  d->onLanguageChange();
339  }
340  QMainWindow::changeEvent(event);
341 }
std::unique_ptr< LaunchWindowImpl > d
Definition: launchwindow.h:56
void geometrize::dialog::LaunchWindow::closeEvent ( QCloseEvent *  bar)
overrideprivate
259 {
260  d->saveConsoleHistory();
261 }
std::unique_ptr< LaunchWindowImpl > d
Definition: launchwindow.h:56
void geometrize::dialog::LaunchWindow::dragEnterEvent ( QDragEnterEvent *  event)
overridevirtual
228 {
229  event->acceptProposedAction();
230 }
void geometrize::dialog::LaunchWindow::dropEvent ( QDropEvent *  event)
overridevirtual
233 {
234  const QList<QUrl> urls{geometrize::format::getUrls(event->mimeData())};
235  QStringList scripts;
236  QStringList tasks;
237  for(const QUrl& url : urls) {
238  const QString urlString{url.toString()};
239 
240  if(urlString.endsWith(".chai") && url.isLocalFile()) {
241  scripts.push_back(url.toLocalFile());
242  } else {
243  tasks.push_back(urlString);
244  }
245  }
246 
247  if(!scripts.empty()) {
248  for(const QString& scriptPath : scripts) {
249  geometrize::script::runScript(util::readFileAsString(scriptPath.toStdString()));
250  }
251  }
252 
253  if(!tasks.empty()) {
254  util::openTasks(tasks, true);
255  }
256 }
std::string readFileAsString(const std::string &filePath)
readFileAsString Reads a file, returning a string containing the contents.
Definition: util.cpp:112
void runScript(const std::string &code, chaiscript::ChaiScript &runner)
runScript Evaluates the provided script code.
Definition: scriptrunner.cpp:16
void openTasks(const QStringList &urls, const bool addToRecents)
Definition: taskutil.cpp:56
QList< QUrl > getUrls(const QMimeData *const data)
getUrls Gets a list of URLs from a Qt MimeData item.
Definition: formatsupport.cpp:35

Here is the call graph for this function:

std::vector< LaunchWindow * > geometrize::dialog::LaunchWindow::getTopLevelLaunchWindows ( )
static

getTopLevelLaunchWindows Gets all of the existing top level launch windows.

Returns
The top level launch windows. Should only be empty if there are no launch windows open.
223 {
225 }
static std::vector< LaunchWindow * > getTopLevelLaunchWindows()
Definition: launchwindow.cpp:82

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::LaunchWindow::on_actionAbout_triggered ( )
privateslot
331 {
333 }
void openAboutPage(QWidget *parent)
Definition: uiactions.cpp:86

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_actionClear_Recents_triggered ( )
privateslot
279 {
281 }
RecentItems & getRecentItems()
getRecentItems Gets a reference to the recent files list.
Definition: recentitems.cpp:206
void clear()
clear Removes all items from the recent items.
Definition: recentitems.cpp:196

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_actionExit_triggered ( )
privateslot
284 {
285  close();
286 }
void geometrize::dialog::LaunchWindow::on_actionGlobal_Preferences_triggered ( )
privateslot
264 {
266 }
void openGlobalPreferences(QWidget *parent)
Definition: uiactions.cpp:92

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_actionLoad_Global_Preferences_triggered ( )
privateslot
269 {
270  d->loadGlobalSettingsTemplate();
271 }
std::unique_ptr< LaunchWindowImpl > d
Definition: launchwindow.h:56
void geometrize::dialog::LaunchWindow::on_actionSave_Global_Preferences_triggered ( )
privateslot
274 {
275  d->saveGlobalSettingsTemplate();
276 }
std::unique_ptr< LaunchWindowImpl > d
Definition: launchwindow.h:56
void geometrize::dialog::LaunchWindow::on_actionSupport_triggered ( )
privateslot
326 {
328 }
void openTechnicalSupport()
Definition: uiactions.cpp:197

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_actionTutorials_triggered ( )
privateslot
321 {
323 }
void openOnlineTutorials()
Definition: uiactions.cpp:202

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_openImageButton_clicked ( )
privateslot
289 {
290  const QString imagePath{common::ui::openImagePathPickerDialog(this)};
291  QFileInfo imageFileInfo(imagePath);
292  if(imagePath.isEmpty() || (imageFileInfo.isSymLink() && !QFileInfo(imageFileInfo.symLinkTarget()).exists())) {
293  return;
294  }
295 
296  geometrize::util::openTasks({ imagePath }, true);
297 }
void openTasks(const QStringList &urls, const bool addToRecents)
Definition: taskutil.cpp:56
QString openImagePathPickerDialog(QWidget *parent)
Definition: uiactions.cpp:103

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_openLinkButton_clicked ( )
privateslot
300 {
301  const QUrl url{common::ui::openGetUrlDialog(this)};
302  if(url.isEmpty() || !url.isValid()) {
303  return;
304  }
305 
306  geometrize::util::openTasks({ url.toString() }, true);
307 }
QUrl openGetUrlDialog(QWidget *parent)
Definition: uiactions.cpp:173
void openTasks(const QStringList &urls, const bool addToRecents)
Definition: taskutil.cpp:56

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_openTaskQueueButton_clicked ( )
privateslot
316 {
318 }
void openTaskQueueWindow()
Definition: uiactions.cpp:71

Here is the call graph for this function:

void geometrize::dialog::LaunchWindow::on_runScriptButton_clicked ( )
privateslot
310 {
311  const std::string result{common::ui::openGetScriptDialog(this).toStdString()};
313 }
QString openGetScriptDialog(QWidget *parent)
Definition: uiactions.cpp:182
std::string readFileAsString(const std::string &filePath)
readFileAsString Reads a file, returning a string containing the contents.
Definition: util.cpp:112
void runScript(const std::string &code, chaiscript::ChaiScript &runner)
runScript Evaluates the provided script code.
Definition: scriptrunner.cpp:16

Here is the call graph for this function:

Member Data Documentation

std::unique_ptr<LaunchWindowImpl> geometrize::dialog::LaunchWindow::d
private

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