25 #include <QDockWidget>
26 #include <QTextBrowser>
31 #include <QMessageBox>
32 #include <QApplication>
54 #define DEFAULT_DEBUG_SUFFIX false
56 #define DEFAULT_DEBUG_SUFFIX true
62 QMainWindow(myParent),
63 _toolBar(0), _flow(0),_docGen(0),_helpDisp(0)
67 if (settings.value(
"pathDialogPopup",
false).toBool()) {
77 setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
78 setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
79 setDockNestingEnabled(
true);
82 QPixmap appicon(
":/icons/appicon.png");
83 setWindowIcon(appicon);
86 setWindowTitle(
"Tuchulcha");
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");
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);
110 QDockWidget* commentBox =
new QDockWidget(tr(
"Workflow Comments"),
this);
111 commentBox -> setObjectName(
"RTFM Box");
113 commentBox -> setWidget(commentWidget);
116 QDockWidget* selectWidget =
new QDockWidget(tr(
"Module Collection"),
this);
117 selectWidget->setObjectName(
"selectwidget");
124 showClassDoc(QString)));
128 statusBar(), SLOT(
showMessage(
const QString&,
int)));
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);
148 #if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
153 connect(
_centralArea, SIGNAL(subWindowActivated (QMdiSubWindow*)),
155 connect(
_centralArea, SIGNAL(filesDropped(QStringList)),
156 SLOT(
open(QStringList)));
162 _toolBar->setToolButtonStyle((Qt::ToolButtonStyle)
163 settings.value(
"toolButtonStyle",Qt::ToolButtonFollowStyle).toInt());
164 _toolBar->setIconSize(QSize(32, 32));
167 connect(
_selector, SIGNAL(addNode(QString)),
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"));
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"));
181 QIcon::fromTheme(
"document-save",QIcon(
":/icons/document-save.png")),
182 tr(
"save\nfile"),
_inspector, SLOT(saveFile()));
183 action->setToolTip(tr(
"save current document"));
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"));
191 QIcon::fromTheme(
"document-export",QIcon(
":/icons/document-export.png")),
193 action->setToolTip(tr(
"export flowchart to an image file"));
197 QIcon::fromTheme(
"view-refresh",QIcon(
":/icons/view-refresh.png")),
200 tr(
"update classes informations reading all plugins"));
203 QIcon::fromTheme(
"media-playback-start",QIcon(
":/icons/execute.png")),
204 tr(
"Execute\n&Workflow"),
this, SLOT(
runWorkflow()));
206 tr(
"execute workflow that is shown in the current window"));
212 QIcon::fromTheme(
"zoom-in",QIcon(
":/icons/zoom-in.png")),
213 tr(
"zoom\nin"),
this, SLOT(
zoomIn()));
214 action->setToolTip(tr(
"enlarge flowchart items"));
217 QIcon::fromTheme(
"zoom-out",QIcon(
":/icons/zoom-out.png")),
218 tr(
"zoom\nout"),
this, SLOT(
zoomOut()));
219 action->setToolTip(tr(
"shrink flowchart items"));
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"));
228 QIcon::fromTheme(
"help-faq",QIcon(
":/icons/help-info.png")),
229 tr(
"intro"),
_docGen, SLOT(showIntro()));
230 action->setToolTip(tr(
"show introductin page"));
233 QIcon::fromTheme(
"help-contents",QIcon(
":/icons/help-contents.png")),
235 action->setToolTip(tr(
"show help page"));
241 QMenu* fileMenu = menuBar()->addMenu(tr(
"&File"));
243 QIcon::fromTheme(
"document-new",QIcon(
":/icons/document-new.png")),
244 tr(
"&New"),
this, SLOT(
openNew()),
247 QIcon::fromTheme(
"document-open",QIcon(
":/icons/document-open.png")),
248 tr(
"&Open"),
this, SLOT(
open()),
251 QIcon::fromTheme(
"document-save",QIcon(
":/icons/document-save.png")),
255 QIcon::fromTheme(
"document-save-as",QIcon(
":/icons/document-save-as.png")),
256 tr(
"Save &as..."),
_inspector, SLOT(saveFileAs()),
257 QKeySequence::SaveAs);
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")),
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);
271 QIcon::fromTheme(
"document-export",QIcon(
":/icons/document-export.png")),
275 QIcon::fromTheme(
"application-exit",QIcon(
":/icons/application-exit.png")),
276 tr(
"&Exit"),
this, SLOT(close()),
280 QMenu* editMenu = menuBar()->addMenu(tr(
"&Edit"));
282 QIcon::fromTheme(
"document-revert",QIcon(
":/icons/revert.png")),
283 tr(
"&reset selected parameters"),
_inspector, SLOT(delParam()),
284 QKeySequence::DeleteStartOfWord);
286 QIcon::fromTheme(
"configure",QIcon(
":/icons/configure.png")),
287 tr(
"&Options"),
this, SLOT(
options()),
288 QKeySequence::Preferences);
291 QMenu* viewMenu = menuBar()->addMenu(tr(
"&View"));
293 QIcon::fromTheme(
"zoom-in",QIcon(
":/icons/zoom-in.png")),
294 tr(
"zoom &in"),
this, SLOT(
zoomIn()),
295 QKeySequence::ZoomIn);
297 QIcon::fromTheme(
"zoom-out",QIcon(
":/icons/zoom-out.png")),
298 tr(
"zoom &out"),
this, SLOT(
zoomOut()),
299 QKeySequence::ZoomOut);
301 QIcon::fromTheme(
"zoom-fit-best",QIcon(
":/icons/zoom-fit.png")),
302 tr(
"zoom &fit"),
this, SLOT(
zoomFit()),
303 QKeySequence(tr(
"Ctrl+0")));
305 QIcon::fromTheme(
"view-split-left-right",
306 QIcon(
":/icons/view-split-left-right.png")),
307 tr(
"&tile windows"),
_centralArea, SLOT(tileSubWindows()),
310 QIcon::fromTheme(
"window-duplicate",
311 QIcon(
":/icons/window-duplicate.png")),
312 tr(
"&cascade windows"),
_centralArea, SLOT(cascadeSubWindows()),
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());
326 QMenu* helpMenu = menuBar()->addMenu(tr(
"&Help"));
328 QIcon::fromTheme(
"help-contents",QIcon(
":/icons/help-contents.png")),
329 tr(
"&Help"),
this, SLOT(
_showHelp()), QKeySequence::HelpContents);
331 QIcon::fromTheme(
"help-faq",QIcon(
":/icons/help-info.png")),
332 tr(
"&Introduction"),
_docGen, SLOT(showIntro()),
333 QKeySequence::WhatsThis);
335 QIcon::fromTheme(
"help-about",appicon),
336 tr(
"&About Tuchulcha"),
this, SLOT(
_showAbout()));
338 QIcon(
":/icons/qt.png"),
342 QSettings defaultS(
":/config/default.ini",QSettings::IniFormat);
343 restoreGeometry(settings.value(
"MainWindow/geometry").toByteArray());
345 defaultS.value(
"MainWindow/windowState").toByteArray(),
348 settings.value(
"MainWindow/windowState").toByteArray(),
352 if (settings.value(
"reloadOnStartup",
false).toBool() ||
358 TuchulchaWindow::~TuchulchaWindow() {
368 settings.beginGroup(
"MainWindow");
369 settings.setValue(
"geometry", saveGeometry());
376 QMainWindow::closeEvent(cEvent);
380 QMessageBox aboutBox(
this);
381 aboutBox.setWindowTitle(tr(
"About Tuchulcha"));
382 aboutBox.setTextFormat(Qt::RichText);
383 aboutBox.setIcon(QMessageBox::Information);
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")
394 .arg(__GNUC_PATCHLEVEL__))
395 .arg(
sizeof(
void*)*8)
402 +
"\n"+tr(
"unknown compiler (%1bit)").arg(
sizeof(*
void)*8)+
"\n";
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 © %1 Heidelberg Collaboratory for Image Processing")
412 +QString(
"<br /><br />")
413 +tr(
"Built %1 %2<br />with %3")
414 .arg(__DATE__).arg(__TIME__).arg(buildSystem)
421 +tr(
"Built against libraries:")
422 +QString(
"<ul><li>charon-core %1</li>"
423 "<li>Qt %3</li></ul>")
426 +tr(
"Build info: %1").arg(BUILD_INFO)+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>.")
449 QMessageBox::aboutQt(
this, tr(
"About Qt"));
454 static QString collectionPath;
455 if (collectionPath.isNull()) {
458 hPaths << QCoreApplication::applicationDirPath();
459 #ifdef TUCHULCHA_QHC_DIR
460 hPaths << TUCHULCHA_QHC_DIR;
462 foreach (QString path, hPaths) {
463 if (QDir(path).
exists(
"tuchulcha.qhc")) {
464 collectionPath = path;
468 if (collectionPath.isEmpty()) {
479 _helpDisp->setProcessChannelMode(QProcess::ForwardedChannels);
481 SIGNAL(finished(
int,QProcess::ExitStatus)),
482 SLOT(deleteLater()));
484 SIGNAL(error(QProcess::ProcessError)),
485 SLOT(deleteLater()));
487 args << QLatin1String(
"-collectionFile")
488 << QLatin1String(
"tuchulcha.qhc")
489 << QLatin1String(
"-enableRemoteControl");
490 _helpDisp->setWorkingDirectory(collectionPath);
491 _helpDisp->start(QLatin1String(
"assistant"), args);
499 pout.append(
"show contents;expandToc 1;\n");
503 if (page.isEmpty()) {
504 page =
"tuchulcha-usage.html";
507 pout.append(QString(
"setSource qthelp://org.doxygen.tuchulcha/doc/%1;syncContents;\n").arg(page));
519 if (model->
load(fileName)) {
523 QTimer::singleShot(0,flowWidget,SLOT(showMaximized()));
527 model->deleteLater();
532 foreach (
const QString& cur, files) {
543 flowWidget->showMaximized();
548 connect(mm, SIGNAL(fileNameChanged (QString)),
555 connect(fw,SIGNAL(destroyed()), mm, SLOT(deleteLater()));
559 connect(fw, SIGNAL(nodeTypeSelected(QString)),
560 _docGen, SLOT(showClassDoc(QString)));
566 statusBar()->showMessage(msg, 5000);
612 QString fName = QString::null;
620 connect(&dialog, SIGNAL(helpRequested(QString)), SLOT(
_showHelp(QString)));
625 if (!fName.isEmpty()) {
626 QCoreApplication::processEvents();
638 QString oldPref = model->
prefix();
640 dec,SIGNAL(highlightObject(QString)),
641 model,SLOT(setPrefix(QString)));
643 connect(&dialog, SIGNAL(helpRequested(QString)), SLOT(
_showHelp(QString)));
645 model->setPrefix(oldPref);
651 connect(&dialog,SIGNAL(helpRequested(QString)),
657 (Qt::ToolButtonStyle) settings.value(
658 "toolButtonStyle",Qt::ToolButtonFollowStyle).toInt());
virtual void closeEvent(QCloseEvent *event)
Close event handler.
void statusMessage(const QString &) const
status message
class for logging display and communication with external processes
DocGenerator * _docGen
Documentation Generator.
Declaration of class FileManager.
This model wraps a ParameterFile instance and provides access to the data interpreted as a (directed)...
void activeGraphModelChanged(ParameterFileModel *model)
inform about changed graph to edit
#define CHARON_CORE_VERSION
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
FlowWidget * _flow
current flow widget
ObjectInspector * _inspector
object inspector
CentralMdiArea * _centralArea
Central widget to manage multiple windows.
static const FileManager & instance()
get a reference to the file Manager instance
provide list of recent files
NodeTreeView * _selector
selector widget
Declaration of class GraphModel.
decorator for update dialog
Declaration of class DocGenerator.
QString prefix() const
Get property _prefix.
void setTab(int tab=-1)
set shown tab
void saveFlowChart() const
save current flowchart
RecentFileHandler * _rfHandler
recent file handler
void _showAbout()
show about dialog
Declaration of classes in the LogDecorators namespace.
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 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.
virtual void saveFile() const
Save File to it's old location.
handle documentation page generation
void _showAboutQt()
show about Qt dialog
void registerRecentFileEntries(QMenu *menu)
add entries to the given menu
QWidget * getViewer()
get inspector viewer widget
QToolBar * _toolBar
tool bar
static const int _saveStateVersion
window state version identifier
Declaration of class ObjectInspector.
QTreeView for module selection.
static bool check()
Configures plugin paths.
void open(const QString &fileName=QString())
open parameterfile and display flowchart content
void runWorkflow()
runn current workflow