tuchulcha  0.10.1
Graphical Workflow Configuration Editor
TuchulchaWindow.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2009 Jens-Malte Gottfried
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17  */
25 #include <QDockWidget>
26 #include <QTextBrowser>
27 #include <QSettings>
28 #include <QStatusBar>
29 #include <QAction>
30 #include <QMenuBar>
31 #include <QMessageBox>
32 #include <QApplication>
33 #include <QTimer>
34 #include "DocGenerator.h"
35 
36 #include "WorkflowComments.h"
37 
38 #include "TuchulchaWindow.h"
39 #include "ObjectInspector.h"
40 #include "FlowWidget.h"
41 #include "NodeTreeView.h"
42 #include "GraphModel.h"
43 #include "ModelToolBar.h"
44 #include "FileManager.h"
45 #include "LogDialog.h"
46 #include "LogDecorators.h"
47 #include "OptionsDialog.h"
48 #include "RecentFileHandler.h"
49 
51 
53 #ifdef NDEBUG
54  #define DEFAULT_DEBUG_SUFFIX false
55 #else
56  #define DEFAULT_DEBUG_SUFFIX true
57 #endif
58 
60 
62  QMainWindow(myParent),
63  _toolBar(0), _flow(0),_docGen(0),_helpDisp(0)
64 {
65  QSettings settings;
66  if (OptionsDialog::check()) {
67  if (settings.value("pathDialogPopup",false).toBool()) {
68  options(1); // show path settings tab
69  }
70  else {
71  // apply default options if empty
72  OptionsDialog dialog;
73  dialog.hide();
74  }
75  }
76 
77  setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
78  setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
79  setDockNestingEnabled(true);
80 
81  // simple application icon
82  QPixmap appicon(":/icons/appicon.png");
83  setWindowIcon(appicon);
84 
85  // Application Title
86  setWindowTitle("Tuchulcha");
87 
88  // object inspector
89  QDockWidget* inspectorTools = new QDockWidget(
90  tr("ObjectInspector Tools"), this);
91  QDockWidget* inspectorWidget = new QDockWidget(
92  tr("ObjectInspector"), inspectorTools);
93  inspectorWidget->setObjectName("inspectorwidget");
94  inspectorTools->setObjectName("inspectortools");
95  _inspector = new ObjectInspector(inspectorWidget);
96  inspectorTools->setWidget(_inspector);
97  inspectorWidget->setWidget(_inspector->getViewer());
98 
99  // help viewer
100  QDockWidget* helpWidget = new QDockWidget(tr("Help Browser"), this);
101  helpWidget->setObjectName("helpwidget");
102  QTextBrowser* helpBrowser = new QTextBrowser(helpWidget);
103  helpBrowser->setOpenExternalLinks(true);
104  helpWidget->setWidget(helpBrowser);
105  _docGen = new DocGenerator(helpBrowser, this);
106  _docGen->showIntro();
107  connect(this, SIGNAL(metaDataUpdated()), _docGen, SLOT(updateMetaData()));
108 
109  // workflow comments
110  QDockWidget* commentBox = new QDockWidget(tr("Workflow Comments"), this);
111  commentBox -> setObjectName("RTFM Box");
112  WorkflowComments* commentWidget = new WorkflowComments(commentBox);
113  commentBox -> setWidget(commentWidget);
114 
115  // select widget
116  QDockWidget* selectWidget = new QDockWidget(tr("Module Collection"), this);
117  selectWidget->setObjectName("selectwidget");
118  _selector = new NodeTreeView(selectWidget);
119  selectWidget->setWidget(_selector);
120  connect(this, SIGNAL(metaDataUpdated()), _selector, SLOT(reload()));
121 
122  // help browser connections
123  connect(_selector, SIGNAL(showClassDoc(QString)), _docGen, SLOT(
124  showClassDoc(QString)));
125 
126  // object inspector connections
127  connect(_inspector, SIGNAL(statusMessage(const QString&, int)),
128  statusBar(), SLOT(showMessage(const QString&, int)));
129  connect(this, SIGNAL(activeGraphModelChanged(ParameterFileModel*)),
130  _inspector, SLOT(setModel(ParameterFileModel*)));
131 
132  // comment widget connections
133  connect(_inspector,
134  SIGNAL(modelChanged(ParameterFileModel*)),
135  commentWidget,
136  SLOT(update(ParameterFileModel*)));
137 
138  // add widgets to dock area
139  addDockWidget(Qt::RightDockWidgetArea, helpWidget);
140  addDockWidget(Qt::BottomDockWidgetArea, selectWidget);
141  addDockWidget(Qt::BottomDockWidgetArea, inspectorWidget);
142  addDockWidget(Qt::BottomDockWidgetArea, inspectorTools);
143  addDockWidget(Qt::BottomDockWidgetArea, commentBox);
144  _centralArea = new CentralMdiArea(this);
145  _centralArea->setViewMode(QMdiArea::TabbedView);
146  _centralArea->setDocumentMode(true);
147  _centralArea->setTabsMovable(true);
148 #if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
149  _centralArea->setTabsClosable(true);
150 #endif
151  setCentralWidget(_centralArea);
152 
153  connect(_centralArea, SIGNAL(subWindowActivated (QMdiSubWindow*)),
154  SLOT(_updateFlowLinks()));
155  connect(_centralArea, SIGNAL(filesDropped(QStringList)),
156  SLOT(open(QStringList)));
157 
158  // toolbar
159  _toolBar = new ModelToolBar(tr("toolbar"));
160  _toolBar->setObjectName("toolbar");
161  addToolBar(_toolBar);
162  _toolBar->setToolButtonStyle((Qt::ToolButtonStyle)
163  settings.value("toolButtonStyle",Qt::ToolButtonFollowStyle).toInt());
164  _toolBar->setIconSize(QSize(32, 32));
165  QAction* action;
166 
167  connect(_selector, SIGNAL(addNode(QString)), // handle double clicks
168  _toolBar, SLOT(addNode(QString))); // on selector widget
169 
170  action = _toolBar->addAction(
171  QIcon::fromTheme("document-new",QIcon(":/icons/document-new.png")),
172  tr("new\nfile"), this, SLOT(openNew()));
173  action->setToolTip(tr("create a new file"));
174 
175  action = _toolBar->addAction(
176  QIcon::fromTheme("document-open",QIcon(":/icons/document-open.png")),
177  tr("open\nfile"),this, SLOT(open()));
178  action->setToolTip(tr("open an existing file"));
179 
180  action = _toolBar->addAction(
181  QIcon::fromTheme("document-save",QIcon(":/icons/document-save.png")),
182  tr("save\nfile"), _inspector, SLOT(saveFile()));
183  action->setToolTip(tr("save current document"));
184 
185  action = _toolBar->addAction(
186  QIcon::fromTheme("document-save-as",QIcon(":/icons/document-save-as.png")),
187  tr("save\nfile as"), _inspector, SLOT(saveFileAs()));
188  action->setToolTip(tr("save current document to a new location"));
189 
190  action = _toolBar->addAction(
191  QIcon::fromTheme("document-export",QIcon(":/icons/document-export.png")),
192  tr("export\nflowchart"), this, SLOT(saveFlowChart()));
193  action->setToolTip(tr("export flowchart to an image file"));
194 
195  _toolBar->addSeparator();
196  action = _toolBar->addAction(
197  QIcon::fromTheme("view-refresh",QIcon(":/icons/view-refresh.png")),
198  tr("&Update\nPlugins"), this, SLOT(updateMetadata()));
199  action->setToolTip(
200  tr("update classes informations reading all plugins"));
201 
202  action = _toolBar->addAction(
203  QIcon::fromTheme("media-playback-start",QIcon(":/icons/execute.png")),
204  tr("Execute\n&Workflow"), this, SLOT(runWorkflow()));
205  action->setToolTip(
206  tr("execute workflow that is shown in the current window"));
207 
208  _toolBar->addSeparator();
209  qobject_cast<ModelToolBar*>(_toolBar)->addModelActions();
210  _toolBar->addSeparator();
211  action = _toolBar->addAction(
212  QIcon::fromTheme("zoom-in",QIcon(":/icons/zoom-in.png")),
213  tr("zoom\nin"), this, SLOT(zoomIn()));
214  action->setToolTip(tr("enlarge flowchart items"));
215 
216  action = _toolBar->addAction(
217  QIcon::fromTheme("zoom-out",QIcon(":/icons/zoom-out.png")),
218  tr("zoom\nout"), this, SLOT(zoomOut()));
219  action->setToolTip(tr("shrink flowchart items"));
220 
221  action = _toolBar->addAction(
222  QIcon::fromTheme("zoom-fit-best",QIcon(":/icons/zoom-fit-best.png")),
223  tr("zoom\nfit"), this, SLOT(zoomFit()));
224  action->setToolTip(tr("fit flowchart in view"));
225 
226  _toolBar->addSeparator();
227  action = _toolBar->addAction(
228  QIcon::fromTheme("help-faq",QIcon(":/icons/help-info.png")),
229  tr("intro"), _docGen, SLOT(showIntro()));
230  action->setToolTip(tr("show introductin page"));
231 
232  action = _toolBar->addAction(
233  QIcon::fromTheme("help-contents",QIcon(":/icons/help-contents.png")),
234  tr("help"), this, SLOT(_showHelp()));
235  action->setToolTip(tr("show help page"));
236 
237  connect(this, SIGNAL(activeGraphModelChanged(ParameterFileModel*)),
238  _toolBar, SLOT(setModel(ParameterFileModel*)));
239 
240  // file menu
241  QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
242  fileMenu->addAction(
243  QIcon::fromTheme("document-new",QIcon(":/icons/document-new.png")),
244  tr("&New"), this, SLOT(openNew()),
245  QKeySequence::New);
246  fileMenu->addAction(
247  QIcon::fromTheme("document-open",QIcon(":/icons/document-open.png")),
248  tr("&Open"), this, SLOT(open()),
249  QKeySequence::Open);
250  fileMenu->addAction(
251  QIcon::fromTheme("document-save",QIcon(":/icons/document-save.png")),
252  tr("&Save"), _inspector, SLOT(saveFile()),
253  QKeySequence::Save);
254  fileMenu->addAction(
255  QIcon::fromTheme("document-save-as",QIcon(":/icons/document-save-as.png")),
256  tr("Save &as..."), _inspector, SLOT(saveFileAs()),
257  QKeySequence::SaveAs);
258  _rfHandler = new RecentFileHandler(this);
260  connect(_rfHandler,SIGNAL(openFile(QString)),SLOT(open(QString)));
261  fileMenu->addSeparator();
262  action = fileMenu->addAction(
263  QIcon::fromTheme("view-refresh",QIcon(":/icons/view-refresh.png")),
264  tr("&Update Plugins"),this, SLOT(updateMetadata()));
265  action->setShortcuts(QKeySequence::Refresh);
266  action = fileMenu->addAction(
267  QIcon::fromTheme("media-playback-start",QIcon(":/icons/execute.png")),
268  tr("Execute &Workflow"),this, SLOT(runWorkflow()));
269  action->setShortcuts(QKeySequence::FindNext);
270  fileMenu->addAction(
271  QIcon::fromTheme("document-export",QIcon(":/icons/document-export.png")),
272  tr("Export &flowchart"),this,SLOT(saveFlowChart()),
273  QKeySequence::Find);
274  fileMenu->addAction(
275  QIcon::fromTheme("application-exit",QIcon(":/icons/application-exit.png")),
276  tr("&Exit"), this, SLOT(close()),
277  QKeySequence::Quit);
278 
279  // edit menu
280  QMenu* editMenu = menuBar()->addMenu(tr("&Edit"));
281  editMenu->addAction(
282  QIcon::fromTheme("document-revert",QIcon(":/icons/revert.png")),
283  tr("&reset selected parameters"), _inspector, SLOT(delParam()),
284  QKeySequence::DeleteStartOfWord);
285  editMenu->addAction(
286  QIcon::fromTheme("configure",QIcon(":/icons/configure.png")),
287  tr("&Options"), this, SLOT(options()),
288  QKeySequence::Preferences);
289 
290  // view menu
291  QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
292  viewMenu->addAction(
293  QIcon::fromTheme("zoom-in",QIcon(":/icons/zoom-in.png")),
294  tr("zoom &in"), this, SLOT(zoomIn()),
295  QKeySequence::ZoomIn);
296  viewMenu->addAction(
297  QIcon::fromTheme("zoom-out",QIcon(":/icons/zoom-out.png")),
298  tr("zoom &out"), this, SLOT(zoomOut()),
299  QKeySequence::ZoomOut);
300  viewMenu->addAction(
301  QIcon::fromTheme("zoom-fit-best",QIcon(":/icons/zoom-fit.png")),
302  tr("zoom &fit"), this, SLOT(zoomFit()),
303  QKeySequence(tr("Ctrl+0")));
304  viewMenu->addAction(
305  QIcon::fromTheme("view-split-left-right",
306  QIcon(":/icons/view-split-left-right.png")),
307  tr("&tile windows"), _centralArea, SLOT(tileSubWindows()),
308  QKeySequence::Undo);
309  viewMenu->addAction(
310  QIcon::fromTheme("window-duplicate",
311  QIcon(":/icons/window-duplicate.png")),
312  tr("&cascade windows"), _centralArea, SLOT(cascadeSubWindows()),
313  QKeySequence::Redo);
314 
315  // window menu
316  QMenu* windowMenu = menuBar()->addMenu(tr("&Window"));
317  windowMenu->addAction(inspectorWidget->toggleViewAction());
318  windowMenu->addAction(inspectorTools->toggleViewAction());
319  windowMenu->addAction(helpWidget->toggleViewAction());
320  windowMenu->addAction(selectWidget->toggleViewAction());
321  windowMenu->addAction(commentBox->toggleViewAction());
322  windowMenu->addSeparator();
323  windowMenu->addAction(_toolBar->toggleViewAction());
324 
325  // help menu
326  QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
327  helpMenu->addAction(
328  QIcon::fromTheme("help-contents",QIcon(":/icons/help-contents.png")),
329  tr("&Help"), this, SLOT(_showHelp()), QKeySequence::HelpContents);
330  helpMenu->addAction(
331  QIcon::fromTheme("help-faq",QIcon(":/icons/help-info.png")),
332  tr("&Introduction"), _docGen, SLOT(showIntro()),
333  QKeySequence::WhatsThis);
334  helpMenu->addAction(
335  QIcon::fromTheme("help-about",appicon),
336  tr("&About Tuchulcha"), this, SLOT(_showAbout()));
337  helpMenu->addAction(
338  QIcon(":/icons/qt.png"),
339  tr("About &Qt"), this, SLOT(_showAboutQt()));
340 
341  // load window state config
342  QSettings defaultS(":/config/default.ini",QSettings::IniFormat);
343  restoreGeometry(settings.value("MainWindow/geometry").toByteArray());
344  restoreState(
345  defaultS.value("MainWindow/windowState").toByteArray(),
347  restoreState(
348  settings.value("MainWindow/windowState").toByteArray(),
350 
351  // rescan plugin metadata if needed
352  if (settings.value("reloadOnStartup",false).toBool() ||
353  !QFileInfo(FileManager::instance().classesFile()).exists()) {
354  updateMetadata();
355  }
356 }
357 
358 TuchulchaWindow::~TuchulchaWindow() {
359  if (_helpDisp) {
360  _helpDisp->terminate();
361  _helpDisp->waitForFinished(1e3);
362  }
363 }
364 
365 void TuchulchaWindow::closeEvent(QCloseEvent *cEvent) {
366  // save window state config
367  QSettings settings;
368  settings.beginGroup("MainWindow");
369  settings.setValue("geometry", saveGeometry());
370  settings.setValue("windowState", saveState(_saveStateVersion));
371  settings.endGroup();
372 
373  _centralArea->closeAllSubWindows();
374 
375  // inherited version
376  QMainWindow::closeEvent(cEvent);
377 }
378 
380  QMessageBox aboutBox(this);
381  aboutBox.setWindowTitle(tr("About Tuchulcha"));
382  aboutBox.setTextFormat(Qt::RichText);
383  aboutBox.setIcon(QMessageBox::Information);
384 
385  QString buildSystem =
386 #if defined (_MSC_VER)
387  tr("MSVC") + " " +tr("%1 (%2bit, %3)").arg(_MSC_VER)
388  .arg(sizeof(void*)*8).arg(CMAKE_INTDIR)+"\n";
389 #elif defined (__GNUC__)
390  tr("GCC") + " " +tr("%1 (%2bit, %3)")
391  .arg(QString("%1.%2.%3")
392  .arg(__GNUC__)
393  .arg(__GNUC_MINOR__)
394  .arg(__GNUC_PATCHLEVEL__))
395  .arg(sizeof(void*)*8)
396  #ifdef QT_DEBUG
397  .arg("Debug");
398  #else
399  .arg("Release");
400  #endif
401 #else
402  +"\n"+tr("unknown compiler (%1bit)").arg(sizeof(*void)*8)+"\n";
403 #endif
404 
405  aboutBox.setText(
406  tr("This is <b>Tuchulcha %1</b><br />written by %2 and others")
407  .arg(TUCHULCHA_VERSION)
408  .arg("<a href=\"mailto:jmgottfriedATweb.de\">Jens-Malte Gottfried</a>")
409  +QString("<br /><br />")
410  +tr("Copyright &copy; %1 Heidelberg Collaboratory for Image Processing")
411  .arg("2009-2013")
412  +QString("<br /><br />")
413  +tr("Built %1 %2<br />with %3")
414  .arg(__DATE__).arg(__TIME__).arg(buildSystem)
415  +QString("<br />")
416 #ifdef VCSINFO
417  +tr("VCS Info: %1")
418  .arg(VCSINFO)
419  +QString("<br />")
420 #endif
421  +tr("Built against libraries:")
422  +QString("<ul><li>charon-core %1</li>"
423  "<li>Qt %3</li></ul>")
424  .arg(CHARON_CORE_VERSION).arg(QT_VERSION_STR)
425 #ifdef BUILD_INFO
426  +tr("Build info: %1").arg(BUILD_INFO)+QString("<br />")
427 #endif
428  +QString("<br />")
429  +tr("This program is part of tuchulcha.")
430  +QString("<br /><br />")
431  +tr("tuchulcha is free software; you can redistribute it and/or "
432  "modify it under the terms of the GNU Lesser General Public License as "
433  "published by the Free Software Foundation; either version 3 of "
434  "the License, or (at your option) any later version.")
435  +QString("<br /><br />")
436  +tr("This program is distributed in the hope that it will be useful, "
437  "but WITHOUT ANY WARRANTY; without even the implied warranty of "
438  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
439  "GNU Lesser General Public License for more details.")
440  +QString("<br /><br />")
441  +tr("A copy of the GNU Lesser General Public License can be found at "
442  "<a href=\"http://www.gnu.org/licenses/\">"
443  "www.gnu.org/licenses/</a>.")
444  );
445  aboutBox.exec();
446 }
447 
449  QMessageBox::aboutQt(this, tr("About Qt"));
450 }
451 
452 void TuchulchaWindow::_showHelp(QString page) {
453 #ifdef USE_ASSISTANT
454  static QString collectionPath;
455  if (collectionPath.isNull()) {
456  // look for collection file
457  QStringList hPaths;
458  hPaths << QCoreApplication::applicationDirPath();
459 #ifdef TUCHULCHA_QHC_DIR
460  hPaths << TUCHULCHA_QHC_DIR;
461 #endif
462  foreach (QString path, hPaths) {
463  if (QDir(path).exists("tuchulcha.qhc")) {
464  collectionPath = path;
465  break;
466  }
467  }
468  if (collectionPath.isEmpty()) {
469  // fallback
470  _docGen->showHelp();
471  return;
472  }
473  }
474  if (_helpDisp && _helpDisp->state() != QProcess::Running) {
475  delete _helpDisp;
476  }
477  if (_helpDisp.isNull()) {
478  _helpDisp = new QProcess(this);
479  _helpDisp->setProcessChannelMode(QProcess::ForwardedChannels);
480  _helpDisp->connect(_helpDisp,
481  SIGNAL(finished(int,QProcess::ExitStatus)),
482  SLOT(deleteLater()));
483  _helpDisp->connect(_helpDisp,
484  SIGNAL(error(QProcess::ProcessError)),
485  SLOT(deleteLater()));
486  QStringList args;
487  args << QLatin1String("-collectionFile")
488  << QLatin1String("tuchulcha.qhc")
489  << QLatin1String("-enableRemoteControl");
490  _helpDisp->setWorkingDirectory(collectionPath);
491  _helpDisp->start(QLatin1String("assistant"), args);
492  if (!_helpDisp->waitForStarted()) {
493  // fallback
494  _docGen->showHelp();
495  return;
496  }
497  _helpDisp->waitForReadyRead(150); // no output, equivalent to sleep(150)
498  QByteArray pout;
499  pout.append("show contents;expandToc 1;\n");
500  _helpDisp->write(pout);
501  _helpDisp->waitForReadyRead(150);
502  }
503  if (page.isEmpty()) {
504  page = "tuchulcha-usage.html";
505  }
506  QByteArray pout;
507  pout.append(QString("setSource qthelp://org.doxygen.tuchulcha/doc/%1;syncContents;\n").arg(page));
508  _helpDisp->write(pout);
509 #else
510  Q_UNUSED(page);
511  _docGen->showHelp();
512 #endif
513 }
514 
515 void TuchulchaWindow::open(const QString& fileName) {
516  GraphModel* model = new GraphModel(
517  QString(), this, FileManager::instance().classesFile());
518  _setupConnections(model,0);
519  if (model->load(fileName)) {
520  FlowWidget* flowWidget = new FlowWidget(model, _centralArea);
521  _centralArea->addSubWindow(flowWidget);
522  _setupConnections(model, flowWidget);
523  QTimer::singleShot(0,flowWidget,SLOT(showMaximized()));
524  QTimer::singleShot(0,this,SLOT(_updateFlowLinks()));
525  }
526  else {
527  model->deleteLater();
528  }
529 }
530 
531 void TuchulchaWindow::open(const QStringList& files) {
532  foreach (const QString& cur, files) {
533  open(cur);
534  }
535 }
536 
538  GraphModel* model = new GraphModel(
539  QString(), this, FileManager::instance().classesFile());
540  FlowWidget* flowWidget = new FlowWidget(model, _centralArea);
541  _centralArea->addSubWindow(flowWidget);
542  _setupConnections(model, flowWidget);
543  flowWidget->showMaximized();
544 }
545 
547  if (mm) {
548  connect(mm, SIGNAL(fileNameChanged (QString)),
549  _rfHandler, SLOT(setCurrentFile(QString)));
550  connect(mm, SIGNAL(statusMessage(QString)),
551  SLOT(showMessage(QString)));
552  }
553  if (fw) {
554  if (mm) {
555  connect(fw,SIGNAL(destroyed()), mm, SLOT(deleteLater()));
556  }
557  connect(fw, SIGNAL(statusMessage(QString)),
558  SLOT(showMessage(QString)));
559  connect(fw, SIGNAL(nodeTypeSelected(QString)),
560  _docGen, SLOT(showClassDoc(QString)));
561  }
562 }
563 
564 void TuchulchaWindow::showMessage(QString msg) const {
565  emit statusMessage(msg);
566  statusBar()->showMessage(msg, 5000);
567 }
568 
570  FlowWidget* active = qobject_cast<FlowWidget*> (
571  _centralArea->activeSubWindow());
572  if (active)
573  active->saveFlowChart();
574 }
575 
577  FlowWidget* flow = qobject_cast<FlowWidget*> (
578  _centralArea->currentSubWindow());
579 
580  if (_flow == flow)
581  return;
582 
583  _flow = flow;
584 
585  if (flow) {
586  ParameterFileModel* model = flow->model();
587  emit activeGraphModelChanged(model);
588  } else {
589  emit activeGraphModelChanged(0);
590  }
591 }
592 
594  FlowWidget* flow = qobject_cast<FlowWidget*> (_flow);
595  if (flow)
596  flow->zoomIn();
597 }
598 
600  FlowWidget* flow = qobject_cast<FlowWidget*> (_flow);
601  if (flow)
602  flow->zoomOut();
603 }
604 
606  FlowWidget* flow = qobject_cast<FlowWidget*> (_flow);
607  if (flow)
608  flow->zoomFit();
609 }
610 
612  QString fName = QString::null;
613  if(_flow) {
614  fName = _flow->model()->fileName();
615  }
616 
617  // close first, window will ask for saving if needed
618  _centralArea->closeAllSubWindows();
619  LogDialog dialog(new LogDecorators::Update);
620  connect(&dialog, SIGNAL(helpRequested(QString)), SLOT(_showHelp(QString)));
621  dialog.exec();
622  emit metaDataUpdated();
623 
624  // restore recent workflow, if any
625  if (!fName.isEmpty()) {
626  QCoreApplication::processEvents();
627  open(fName);
628  }
629 }
630 
632  if (!_flow)
633  return;
634  _inspector->saveFile();
637  ParameterFileModel* model = _inspector->model();
638  QString oldPref = model->prefix();
639  connect(
640  dec,SIGNAL(highlightObject(QString)),
641  model,SLOT(setPrefix(QString)));
642  LogDialog dialog(dec);
643  connect(&dialog, SIGNAL(helpRequested(QString)), SLOT(_showHelp(QString)));
644  dialog.exec();
645  model->setPrefix(oldPref);
646 }
647 
649  OptionsDialog dialog(isVisible()?this:0);
650  dialog.setTab(tab);
651  connect(&dialog,SIGNAL(helpRequested(QString)),
652  SLOT(_showHelp(QString)));
653  dialog.exec();
654  if(_toolBar) {
655  QSettings settings;
656  _toolBar->setToolButtonStyle(
657  (Qt::ToolButtonStyle) settings.value(
658  "toolButtonStyle",Qt::ToolButtonFollowStyle).toInt());
659  }
660 }
virtual void closeEvent(QCloseEvent *event)
Close event handler.
void statusMessage(const QString &) const
status message
class for logging display and communication with external processes
Definition: LogDialog.h:47
DocGenerator * _docGen
Documentation Generator.
Declaration of class FileManager.
This model wraps a ParameterFile instance and provides access to the data interpreted as a (directed)...
Definition: GraphModel.h:32
void activeGraphModelChanged(ParameterFileModel *model)
inform about changed graph to edit
#define CHARON_CORE_VERSION
void zoomIn()
zoom in
Definition: FlowWidget.cpp:82
void options(int tab=-1)
edit options dialog
TuchulchaWindow(QWidget *parent=0)
Default constructor.
QPointer< QProcess > _helpDisp
help display process
Declaration of class MainWindow.
decorator for run workspace dialog
Central Mdi Area.
FlowWidget * _flow
current flow widget
Declaration of class ModelToolBar.
ObjectInspector * _inspector
object inspector
A widget to display comments for the current workflow.
GraphModel * model()
Get used model.
Definition: FlowWidget.cpp:70
CentralMdiArea * _centralArea
Central widget to manage multiple windows.
static const FileManager & instance()
get a reference to the file Manager instance
Definition: FileManager.cpp:70
provide list of recent files
NodeTreeView * _selector
selector widget
Declaration of class GraphModel.
Object inspector widget.
decorator for update dialog
Definition: LogDecorators.h:83
Declaration of class DocGenerator.
void zoomFit()
fit in view
Definition: FlowWidget.cpp:90
bool charon_core_DLL_PUBLIC exists(const std::string &file)
QString prefix() const
Get property _prefix.
void setTab(int tab=-1)
set shown tab
option dialog widget
Definition: OptionsDialog.h:35
void saveFlowChart() const
save current flowchart
RecentFileHandler * _rfHandler
recent file handler
void _showAbout()
show about dialog
Declaration of classes in the LogDecorators namespace.
void saveFlowChart() const
Save flowchart diagram to graphics file.
Definition: FlowWidget.cpp:78
Declaration of class LogDialog.
void showHelp()
show help page in help browser
Declaration of class OptionsDialog.
This model serves to provide a model frontend to access a ParameterFile instance. ...
void showMessage(QString msg) const
print status message
void openNew()
create new empty flowchart
void _setupConnections(GraphModel *model, FlowWidget *fWidget)
setup model and view connections (for open and new)
void _showHelp(QString page=QString())
show help browser
RecentFileHandler declaration.
ParameterFileModel * model() const
Get value of property _model.
Declaration of class NodeTreeView.
void showIntro()
show introduction message in help browser
void zoomFit()
fit in view
void zoomIn()
zoom in
void metaDataUpdated()
meta data has been updated, plugins reloaded
void _updateFlowLinks()
update links when new flowchart has been selected
void updateMetadata()
update plugin information
virtual bool load(const QString &fName="")
Load model content from parameterFile.
QString fileName() const
Get property _fileName.
Widget to display data flow diagram.
Definition: FlowWidget.h:36
void zoomOut()
zoom out
Definition: FlowWidget.cpp:86
virtual void saveFile() const
Save File to it's old location.
handle documentation page generation
Definition: DocGenerator.h:35
void _showAboutQt()
show about Qt dialog
void registerRecentFileEntries(QMenu *menu)
add entries to the given menu
QWidget * getViewer()
get inspector viewer widget
Declaration of class FlowWidget.
QToolBar * _toolBar
tool bar
Toolbar specialized for graph model handling.
Definition: ModelToolBar.h:36
static const int _saveStateVersion
window state version identifier
Declaration of class ObjectInspector.
Declarations of class WorkflowComments.
QTreeView for module selection.
Definition: NodeTreeView.h:42
static bool check()
Configures plugin paths.
void open(const QString &fileName=QString())
open parameterfile and display flowchart content
void zoomOut()
zoom out
void runWorkflow()
runn current workflow