Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxMainWindow.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #include "cxMainWindow.h"
34 
35 #include <QtWidgets>
36 #include "boost/bind.hpp"
37 
38 #include "cxConfig.h"
39 #include "cxDataLocations.h"
40 #include "cxLogicManager.h"
41 #include "cxSettings.h"
42 #include "cxPatientModelService.h"
43 #include "cxViewService.h"
45 #include "cxAudioImpl.h"
46 #include "cxLayoutInteractor.h"
47 #include "cxCameraControl.h"
48 
50 #include "cxStatusBar.h"
51 #include "cxSecondaryMainWindow.h"
53 #include "cxSamplerWidget.h"
54 #include "cxHelperWidgets.h"
55 #include "cxMainWindowActions.h"
56 
59 #include "cxToolManagerWidget.h"
60 #include "cxFrameTreeWidget.h"
61 #include "cxNavigationWidget.h"
63 #include "cxToolPropertiesWidget.h"
64 #include "cxPreferencesDialog.h"
66 #include "cxMeshInfoWidget.h"
67 #include "cxTrackPadWidget.h"
68 #include "cxConsoleWidget.h"
69 #include "cxMetricWidget.h"
70 #include "cxPlaybackWidget.h"
71 #include "cxEraserWidget.h"
72 #include "cxFiltersWidget.h"
74 #include "cxManageClippersWidget.h"
75 #include "cxBrowserWidget.h"
76 #include "cxActiveToolProxy.h"
77 
78 namespace cx
79 {
80 
82  mFullScreenAction(NULL),
83  mStandard3DViewActions(new QActionGroup(this)),
84  mControlPanel(NULL),
85  mDockWidgets(new DynamicMainWindowWidgets(this)),
86  mActions(NULL)
87 {
88  this->setObjectName("MainWindow");
89 
90  mServices = VisServices::create(logicManager()->getPluginContext());
91  mLayoutInteractor.reset(new LayoutInteractor());
92 
93  this->setCentralWidget(viewService()->createLayoutWidget(this, 0));
94 
95  mActions = new MainWindowActions(mServices, this);
96 
97  this->createActions();
98  this->createMenus();
99  this->createToolBars();
100  this->setStatusBar(new StatusBar());
101 
102  reporter()->setAudioSource(AudioPtr(new AudioImpl()));
103 
107 
108  this->updateWindowTitle();
109 
110  this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
111 
112  this->addAsDockWidget(new PlaybackWidget(this), "Browsing");
113  this->addAsDockWidget(new VideoConnectionWidget(mServices, this), "Utility");
114  this->addAsDockWidget(new EraserWidget(mServices->patient(), mServices->view(), this), "Properties");
115  this->addAsDockWidget(new MetricWidget(mServices->view(), mServices->patient(), this), "Utility");
116  this->addAsDockWidget(new SlicePropertiesWidget(mServices->patient(), mServices->view(), this), "Properties");
117  this->addAsDockWidget(new VolumePropertiesWidget(mServices, this), "Properties");
118  this->addAsDockWidget(new ActiveMeshPropertiesWidget(mServices, this), "Properties");
119  this->addAsDockWidget(new StreamPropertiesWidget(mServices->patient(), mServices->view(), this), "Properties");
120  this->addAsDockWidget(new TrackPadWidget(this), "Utility");
121  this->addAsDockWidget(new ActiveToolPropertiesWidget(mServices->tracking(), mServices->spaceProvider(), this), "Properties");
122  this->addAsDockWidget(new NavigationWidget(this), "Properties");
123  this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget", "Console"), "Utility");
124  this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget2", "Extra Console"), "Utility");
125 // this->addAsDockWidget(new ConsoleWidgetCollection(this, "ConsoleWidgets", "Consoles"), "Utility");
126  this->addAsDockWidget(new FrameTreeWidget(mServices->patient(), this), "Browsing");
127  this->addAsDockWidget(new ToolManagerWidget(this), "Debugging");
128  this->addAsDockWidget(new PluginFrameworkWidget(this), "Browsing");
129  this->addAsDockWidget(new FiltersWidget(VisServices::create(logicManager()->getPluginContext()), this), "Algorithms");
130  this->addAsDockWidget(new ClippingPropertiesWidget(mServices, this), "Properties");
131 
132  this->addAsDockWidget(new BrowserWidget(this, mServices), "Browsing");
133 
135  connect(qApp, &QApplication::focusChanged, this, &MainWindow::focusChanged);
136 
137  this->setupGUIExtenders();
138 
139  // window menu must be created after all dock widgets are created
140  QMenu* popupMenu = this->createPopupMenu();
141  popupMenu->setTitle("Window");
142  this->menuBar()->insertMenu(mHelpMenuAction, popupMenu);
143 
144  // Restore saved window states
145  // Must be done after all DockWidgets are created
146  if (restoreGeometry(settings()->value("mainWindow/geometry").toByteArray()))
147  {
148  this->show();
149  }
150  else
151  {
152  this->showMaximized();
153  }
154 
155  if (settings()->value("gui/fullscreen").toBool())
156  this->setWindowState(this->windowState() | Qt::WindowFullScreen);
157 }
158 
159 void MainWindow::changeEvent(QEvent * event)
160 {
161  QMainWindow::changeEvent(event);
162 
163  if (event->type() == QEvent::WindowStateChange)
164  {
165  if (mFullScreenAction)
166  mFullScreenAction->setChecked(this->windowState() & Qt::WindowFullScreen);
167  }
168 }
169 
170 void MainWindow::setupGUIExtenders()
171 {
172  mServiceListener.reset(new ServiceTrackerListener<GUIExtenderService>(
173  LogicManager::getInstance()->getPluginContext(),
174  boost::bind(&MainWindow::onGUIExtenderServiceAdded, this, _1),
175  boost::bind(&MainWindow::onGUIExtenderServiceModified, this, _1),
176  boost::bind(&MainWindow::onGUIExtenderServiceRemoved, this, _1)
177  ));
178  mServiceListener->open();
179 }
180 
182 {
183  std::vector<GUIExtenderService::CategorizedWidget> widgets = service->createWidgets();
184  for (unsigned j = 0; j < widgets.size(); ++j)
185  {
186  mDockWidgets->addAsDockWidget(widgets[j].mWidget, widgets[j].mCategory, service);
187  }
188 
189  std::vector<QToolBar*> toolBars = service->createToolBars();
190  for(unsigned j = 0; j < toolBars.size(); ++j)
191  {
192  mDockWidgets->registerToolBar(toolBars[j]);
193  }
194 }
195 
197 {
198 }
199 
201 {
202  mDockWidgets->owningServiceRemoved(service);
203 }
204 
206 {
207  if (val)
208  this->focusInsideDockWidget(sender());
209 }
210 
211 void MainWindow::focusChanged(QWidget * old, QWidget * now)
212 {
213  this->focusInsideDockWidget(now);
214 }
215 
216 void MainWindow::focusInsideDockWidget(QObject *dockWidget)
217 {
218  if (!dockWidget)
219  return;
220 
221 // CX_LOG_CHANNEL_DEBUG("HELP_DB") << QString(" try mw::focus [%1](%2)")
222 // .arg(dockWidget->objectName())
223 // .arg(dockWidget->metaObject()->className());
224 
225  // focusing to docked widgets is required by the help system
226 
227  // Assume structure: QDockWidget->QScrollArea->QWidget,
228  // as defined in MainWindow::addAsDockWidget()
229  QDockWidget* dw = dynamic_cast<QDockWidget*>(dockWidget);
230  if (!dw)
231  return;
232  if (dw->parent()!=this) // avoid events from other mainwindows
233  return;
234  QScrollArea* sa = dynamic_cast<QScrollArea*>(dw->widget());
235  if (!sa)
236  return;
237 
238  if (!sa->widget())
239  return;
240 
241 // CX_LOG_CHANNEL_DEBUG("HELP_DB") << QString(" do mw::focus [%1](%2)")
242 // .arg(sa->widget()->objectName())
243 // .arg(sa->widget()->metaObject()->className());
244 
245  QTimer::singleShot(0, sa->widget(), SLOT(setFocus())); // avoid loops etc by send async event.
246 }
247 
249 {
250  viewService()->deactivateLayout();
251  reporter()->setAudioSource(AudioPtr()); // important! QSound::play fires a thread, causes segfault during shutdown
252  mServiceListener.reset();
253 }
254 
256 {
257  return mDockWidgets->createPopupMenu();
258 }
259 
260 void MainWindow::createActions()
261 {
262  CameraControlPtr cameraControl = viewService()->getCameraControl();
263  if (cameraControl)
264  mStandard3DViewActions = cameraControl->createStandard3DViewActions();
265 
266  mShowContextSensitiveHelpAction = new QAction(QIcon(":/icons/open_icon_library/help-contents-5.png"),
267  "Context-sensitive help", this);
268  connect(mShowContextSensitiveHelpAction, &QAction::triggered, this, &MainWindow::onShowContextSentitiveHelp);
269 
270  mShowControlPanelAction = new QAction("Show Control Panel", this);
271  connect(mShowControlPanelAction, &QAction::triggered, this, &MainWindow::showControlPanelActionSlot);
272  mSecondaryViewLayoutWindowAction = new QAction("Show Secondary View Layout Window", this);
273  connect(mSecondaryViewLayoutWindowAction, &QAction::triggered, this, &MainWindow::showSecondaryViewLayoutWindowActionSlot);
274 
275  // Application
276  mAboutAction = new QAction(tr("About"), this);
277  mAboutAction->setStatusTip(tr("Show the application's About box"));
278  mPreferencesAction = new QAction(tr("Preferences"), this);
279  mPreferencesAction->setShortcut(tr("Ctrl+,"));
280  mPreferencesAction->setStatusTip(tr("Show the preferences dialog"));
281 
282  mFullScreenAction = new QAction(tr("Fullscreen"), this);
283  mFullScreenAction->setShortcut(tr("F11"));
284  mFullScreenAction->setStatusTip(tr("Toggle full screen"));
285  mFullScreenAction->setCheckable(true);
286  mFullScreenAction->setChecked(this->windowState() & Qt::WindowFullScreen);
287  connect(mFullScreenAction, &QAction::triggered, this, &MainWindow::toggleFullScreenSlot);
288 
289  mQuitAction = new QAction(tr("&Quit"), this);
290  mQuitAction->setShortcut(tr("Ctrl+Q"));
291  mQuitAction->setStatusTip(tr("Exit the application"));
292 
293  connect(mAboutAction, &QAction::triggered, this, &MainWindow::aboutSlot);
294  connect(mPreferencesAction, &QAction::triggered, this, &MainWindow::preferencesSlot);
295  connect(mQuitAction, &QAction::triggered, qApp, &QApplication::quit);
296 
297  mSaveDesktopAction = new QAction(QIcon(":/icons/workflow_state_save.png"), tr("Save desktop"), this);
298  mSaveDesktopAction->setToolTip("Save desktop for workflow step");
299  connect(mSaveDesktopAction, &QAction::triggered, this, &MainWindow::saveDesktopSlot);
300  mResetDesktopAction = new QAction(QIcon(":/icons/workflow_state_revert.png"), tr("Reset desktop"), this);
301  mResetDesktopAction->setToolTip("Reset desktop for workflow step");
302  connect(mResetDesktopAction, &QAction::triggered, this, &MainWindow::resetDesktopSlot);
303 
304  mInteractorStyleActionGroup = viewService()->getInteractorStyleActionGroup();
305 
306  // cross-connect save patient to save session
307  connect(mServices->session().get(), &SessionStorageService::isSaving, this, &MainWindow::saveDesktopSlot);
308 }
309 
310 
312 {
313  this->updateWindowTitle();
314 }
315 
316 void MainWindow::updateWindowTitle()
317 {
318  QString profileName = stateService()->getApplicationStateName();
319  QString versionName = stateService()->getVersionName();
320 
321  QString activePatientFolder = patientService()->getActivePatientFolder();
322  if (activePatientFolder.endsWith('/'))
323  activePatientFolder.chop(1);
324  QString patientName;
325 
326  if (!activePatientFolder.isEmpty())
327  {
328  QFileInfo info(activePatientFolder);
329  patientName = info.completeBaseName();
330  }
331 
332  QString format("%1 %2 - %3 - %4 (not approved for medical use)");
333  QString title = format
334  .arg(qApp->applicationDisplayName())
335  .arg(versionName)
336  .arg(profileName)
337  .arg(patientName);
338  this->setWindowTitle(title);
339 }
340 
342 {
343  Desktop desktop = stateService()->getActiveDesktop();
344 
345  mDockWidgets->restoreFrom(desktop);
346  viewService()->setActiveLayout(desktop.mLayoutUid, 0);
347  viewService()->setActiveLayout(desktop.mSecondaryLayoutUid, 1);
348  patientService()->autoSave();
349 
350  // moved to help plugin:
351 // // set initial focus to mainwindow in order to view it in the documentation
352 // // this is most important when starting up.
353 // QTimer::singleShot(0, this, SLOT(setFocus())); // avoid loops etc by send async event.
354 
355 //#ifdef CX_APPLE
356 // // HACK
357 // // Toolbars are not correctly refreshed on mac 10.8,
358 // // Cause is related to QVTKWidget (removing it removes the problem)
359 // // The following "force refresh by resize" solves repaint, but
360 // // inactive toolbars are still partly clickable.
361 // QSize size = this->size();
362 // this->resize(size.width()-1, size.height());
363 // this->resize(size);
364 //#endif
365 }
366 
368 {
369  Desktop desktop;
370  desktop.mMainWindowState = this->saveState();
371  desktop.mLayoutUid = viewService()->getActiveLayout(0);
372  desktop.mSecondaryLayoutUid = viewService()->getActiveLayout(1);
373  stateService()->saveDesktop(desktop);
374 
375  // save to settings file in addition
376  settings()->setValue("mainWindow/geometry", saveGeometry());
377  settings()->setValue("mainWindow/windowState", saveState());
378  settings()->sync();
379 }
380 
382 {
383  stateService()->resetDesktop();
385 }
386 
388 {
389  mDockWidgets->showWidget("Help");
390 }
391 
393 {
394  this->setWindowState(this->windowState() ^ Qt::WindowFullScreen);
395 
396  settings()->setValue("gui/fullscreen", (this->windowState() & Qt::WindowFullScreen)!=0);
397 }
398 
400 {
401  if (!mControlPanel)
402  mControlPanel = new SecondaryMainWindow(this);
403  mControlPanel->show();
404 }
405 
407 {
408  if (!mSecondaryViewLayoutWindow)
409  mSecondaryViewLayoutWindow = new SecondaryViewLayoutWindow(this);
410  mSecondaryViewLayoutWindow->tryShowOnSecondaryScreen();
411 }
412 
414 {
415  this->updateWindowTitle();
416 }
417 
418 void MainWindow::createMenus()
419 {
420 #ifdef CX_LINUX
421  // shortcuts defined on actions in the global menubar is not reachable on Qt5+Ubuntu14.04,
422  // solve by reverting to old style.
423  // This will create a double menubar: remove by autohiding menubar or using
424  // sudo apt-get autoremove appmenu-gtk appmenu-gtk3 appmenu-qt
425  // and reboot
426  this->menuBar()->setNativeMenuBar(false);
427 #endif
428  mFileMenu = new QMenu(tr("File"), this);
429  mWorkflowMenu = new QMenu(tr("Workflow"), this);
430  mToolMenu = new QMenu(tr("Tracking"), this);
431  mLayoutMenu = new QMenu(tr("Layouts"), this);
432  mNavigationMenu = new QMenu(tr("Navigation"), this);
433  mHelpMenu = new QMenu(tr("Help"), this);
434 
435  // File
436  mFileMenu->addAction(mPreferencesAction);
437  this->menuBar()->addMenu(mFileMenu);
438  mFileMenu->addAction(mActions->getAction("NewPatient"));
439  mFileMenu->addAction(mActions->getAction("SaveFile"));
440  mFileMenu->addAction(mActions->getAction("LoadFile"));
441  mFileMenu->addAction(mActions->getAction("ClearPatient"));
442  mFileMenu->addSeparator();
443  mFileMenu->addAction(mActions->getAction("ExportPatient"));
444  mFileMenu->addAction(mActions->getAction("ImportData"));
445  mFileMenu->addSeparator();
446  mFileMenu->addAction(mFullScreenAction);
447  mFileMenu->addAction(mActions->getAction("StartLogConsole"));
448  mFileMenu->addAction(mActions->getAction("ShootScreen"));
449  mFileMenu->addAction(mActions->getAction("ShootWindow"));
450  mFileMenu->addAction(mActions->getAction("RecordFullscreen"));
451  mFileMenu->addSeparator();
452  mFileMenu->addAction(mShowControlPanelAction);
453  mFileMenu->addAction(mSecondaryViewLayoutWindowAction);
454 
455  mFileMenu->addAction(mQuitAction);
456 
457  //workflow
458  this->menuBar()->addMenu(mWorkflowMenu);
459  QList<QAction*> actions = stateService()->getWorkflowActions()->actions();
460  for (int i=0; i<actions.size(); ++i)
461  {
462  mWorkflowMenu->addAction(actions[i]);
463  }
464 
465  mWorkflowMenu->addSeparator();
466  mWorkflowMenu->addAction(mSaveDesktopAction);
467  mWorkflowMenu->addAction(mResetDesktopAction);
468 
469  //tool
470  this->menuBar()->addMenu(mToolMenu);
471  mToolMenu->addAction(mActions->getAction("ConfigureTools"));
472  mToolMenu->addAction(mActions->getAction("InitializeTools"));
473  mToolMenu->addAction(mActions->getAction("TrackingTools"));
474  mToolMenu->addSeparator();
475  mToolMenu->addAction(mActions->getAction("StartStreaming"));
476  mToolMenu->addSeparator();
477 
478  //layout
479  this->menuBar()->addMenu(mLayoutMenu);
480  mLayoutInteractor->connectToMenu(mLayoutMenu);
481 
482  this->menuBar()->addMenu(mNavigationMenu);
483  mNavigationMenu->addAction(mActions->getAction("CenterToImageCenter"));
484  mNavigationMenu->addAction(mActions->getAction("CenterToTooltip"));
485  mNavigationMenu->addAction(mActions->getAction("ShowPointPicker"));
486  mNavigationMenu->addSeparator();
487  mNavigationMenu->addActions(mInteractorStyleActionGroup->actions());
488 
489  mHelpMenuAction = this->menuBar()->addMenu(mHelpMenu);
490  mHelpMenu->addAction(mAboutAction);
491  mHelpMenu->addAction(mActions->getAction("GotoDocumentation"));
492  mHelpMenu->addAction(mShowContextSensitiveHelpAction);
493 }
494 
495 void MainWindow::createToolBars()
496 {
497  mWorkflowToolBar = this->registerToolBar("Workflow");
498  QList<QAction*> actions = stateService()->getWorkflowActions()->actions();
499  for (int i=0; i<actions.size(); ++i)
500  mWorkflowToolBar->addAction(actions[i]);
501 
502  mDataToolBar = this->registerToolBar("Data");
503  mDataToolBar->addAction(mActions->getAction("NewPatient"));
504  mDataToolBar->addAction(mActions->getAction("LoadFile"));
505  mDataToolBar->addAction(mActions->getAction("SaveFile"));
506  mDataToolBar->addAction(mActions->getAction("ImportData"));
507 
508  mToolToolBar = this->registerToolBar("Tools");
509  mToolToolBar->addAction(mActions->getAction("TrackingTools"));
510  mToolToolBar->addAction(mActions->getAction("StartStreaming"));
511 
512  mNavigationToolBar = this->registerToolBar("Navigation");
513  mNavigationToolBar->addAction(mActions->getAction("CenterToImageCenter"));
514  mNavigationToolBar->addAction(mActions->getAction("CenterToTooltip"));
515  mNavigationToolBar->addAction(mActions->getAction("ShowPointPicker"));
516 
517  mInteractorStyleToolBar = this->registerToolBar("InteractorStyle");
518  mInteractorStyleToolBar->addActions(mInteractorStyleActionGroup->actions());
519 
520  mDesktopToolBar = this->registerToolBar("Desktop");
521  mDesktopToolBar->addAction(mSaveDesktopAction);
522  mDesktopToolBar->addAction(mResetDesktopAction);
523 
524  mScreenshotToolBar = this->registerToolBar("Screenshot");
525  mScreenshotToolBar->addAction(mActions->getAction("ShootScreen"));
526  mScreenshotToolBar->addAction(mActions->getAction("RecordFullscreen"));
527 
528  QToolBar* camera3DViewToolBar = this->registerToolBar("Camera 3D Views");
529  camera3DViewToolBar->addActions(mStandard3DViewActions->actions());
530 
531  QToolBar* samplerWidgetToolBar = this->registerToolBar("Sampler");
532  samplerWidgetToolBar->addWidget(new SamplerWidget(this));
533 
534  QToolBar* toolOffsetToolBar = this->registerToolBar("Tool Offset");
536  SpinBoxAndSliderGroupWidget* offsetWidget = new SpinBoxAndSliderGroupWidget(this, offset);
537  offsetWidget->showLabel(false);
538  toolOffsetToolBar->addWidget(offsetWidget);
539 
540  QToolBar* helpToolBar = this->registerToolBar("Help");
541  helpToolBar->addAction(mShowContextSensitiveHelpAction);
542 }
543 
544 QToolBar* MainWindow::registerToolBar(QString name, QString groupname)
545 {
546  QToolBar* toolbar = new QToolBar(name);
547  toolbar->setObjectName(QString(name).remove(" ")+"ToolBar");
548  mDockWidgets->registerToolBar(toolbar, groupname);
549  return toolbar;
550 }
551 
553 {
554  QString doc_path = DataLocations::getDocPath();
555  QString appName = qApp->applicationDisplayName();
556  QString url_website = DataLocations::getWebsiteURL();
557  QString url_license = QString("file://%1/License.txt").arg(doc_path);
558  QString url_config = QString("file://%1/cxConfigDescription.txt").arg(doc_path);
559 
560  QString text(""
561  "<h2>%1</h2>"
562  "<h4>%2</h4>"
563  "<p>A Research Platform for Image-Guided Therapy<p>"
564  "<p>%1 is NOT approved for medical use.<p>"
565  ""
566  "<p><a href=%3> website </a><p>"
567  "<p><a href=%4> license </a><p>"
568  "<p><a href=%5> configuration </a><p>");
569 
570  QMessageBox::about(this, tr("About %1").arg(appName), text
571  .arg(appName)
572  .arg(CustusX_VERSION_STRING)
573  .arg(url_website)
574  .arg(url_license)
575  .arg(url_config)
576  );
577 }
578 
580 {
581  PreferencesDialog prefDialog(mServices->view(), mServices->patient(), this);
582  prefDialog.exec();
583 }
584 
585 void MainWindow::closeEvent(QCloseEvent *event)
586 {
587  QMainWindow::closeEvent(event);
588  qApp->quit();
589 }
590 
591 QDockWidget* MainWindow::addAsDockWidget(QWidget* widget, QString groupname)
592 {
593  QDockWidget* dw = mDockWidgets->addAsDockWidget(widget, groupname);
594  return dw;
595 
596 }
597 
598 }//namespace cx
Widget for controlling camera follow style.
void registerToolBar(QToolBar *toolbar, QString groupname="Toolbars")
void dockWidgetVisibilityChanged(bool val)
Widget for displaying and changing clipper properties.
virtual QMenu * createPopupMenu()
ReporterPtr reporter()
Definition: cxReporter.cpp:59
void changeEvent(QEvent *event)
Statusbar with extended functionality.
Definition: cxStatusBar.h:92
void applicationStateChanged()
void showSecondaryViewLayoutWindowActionSlot()
Shows a treestructure containing the loaded images, meshes and tools.
void focusChanged(QWidget *old, QWidget *now)
void restoreFrom(const Desktop &desktop)
void patientChangedSlot()
static VisServicesPtr create(ctkPluginContext *context)
cxLogicManager_EXPORT StateServicePtr stateService()
Experimental class for IPad usage.This detached main window can be moved onto a secondary screen...
Widget for displaying status messages.
Widget for displaying and manipulating various 3D Volume properties.
void onApplicationStateChangedSlot()
void resetDesktopSlot()
static ActiveToolProxyPtr New(TrackingServicePtr trackingService)
void setValue(const QString &key, const QVariant &value)
Definition: cxSettings.cpp:79
GUI for setting up a connection to a video stream.
Widget for controlling the camera in the 3D view.This widget is designed for use on a touchpad device...
Experimental class for IPad usage.
void workflowStateAboutToChange()
void onGUIExtenderServiceAdded(GUIExtenderService *service)
void toggleFullScreenSlot()
void onGUIExtenderServiceRemoved(GUIExtenderService *service)
void preferencesSlot()
void saveDesktopSlot()
static QString getWebsiteURL()
QByteArray mMainWindowState
static LogicManager * getInstance()
Widget interface to PlaybackTime.
void onGUIExtenderServiceModified(GUIExtenderService *service)
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
void onShowContextSentitiveHelp()
Settings * settings()
Shortcut for accessing the settings instance.
Definition: cxSettings.cpp:42
Widget for displaying the FrameForest object.
Widget for displaying and manipulating TrackedStream properties.
Helper class for listening to services being added, modified and removed.
LogicManager * logicManager()
void workflowStateChanged()
Data class for CustusX desktop.
void showControlPanelActionSlot()
QAction * getAction(QString uid)
boost::shared_ptr< class CameraControl > CameraControlPtr
Definition: cxMainWindow.h:58
QString mLayoutUid
cxLogicManager_EXPORT ViewServicePtr viewService()
virtual ~MainWindow()
virtual std::vector< QToolBar * > createToolBars() const
cxLogicManager_EXPORT PatientModelServicePtr patientService()
QString mSecondaryLayoutUid
Designed as a debugging widget for the cxToolManager.
static boost::shared_ptr< DoublePropertyActiveToolOffset > create(ActiveToolProxyPtr activeTool)
virtual std::vector< CategorizedWidget > createWidgets() const =0
QDockWidget * addAsDockWidget(QWidget *widget, QString groupname, QObject *owningPlugin=NULL)
void onWorkflowStateChangedSlot()
static QString getDocPath()
return path to folder containing documentation files
Set application preferences.
boost::shared_ptr< Audio > AudioPtr
Definition: cxAudio.h:68
void isSaving(QDomElement &root)
xml storage is available
Widget for erasing parts of images/meshes.