void MainWindow::onWorkflowStateChangedSlot() { Desktop desktop = stateService()->getActiveDesktop(); mDockWidgets->restoreFrom(desktop); viewService()->setActiveLayout(desktop.mLayoutUid, 0); viewService()->setActiveLayout(desktop.mSecondaryLayoutUid, 1); patientService()->autoSave(); // moved to help plugin: // // set initial focus to mainwindow in order to view it in the documentation // // this is most important when starting up. // QTimer::singleShot(0, this, SLOT(setFocus())); // avoid loops etc by send async event. //#ifdef CX_APPLE // // HACK // // Toolbars are not correctly refreshed on mac 10.8, // // Cause is related to QVTKWidget (removing it removes the problem) // // The following "force refresh by resize" solves repaint, but // // inactive toolbars are still partly clickable. // QSize size = this->size(); // this->resize(size.width()-1, size.height()); // this->resize(size); //#endif }
void MainWindowActions::updatePointPickerActionSlot() { if (!viewService()->getGroup(0)) return; bool show = viewService()->getGroup(0)->getOptions().mShowPointPickerProbe; mShowPointPickerAction->setChecked(show); }
void MainWindowActions::createActions() { this->createAction("GotoDocumentation", "Web Documentation", QIcon(":/icons/open_icon_library/applications-internet.png"), QKeySequence(""), "", &MainWindowActions::onGotoDocumentation); this->createAction("StartLogConsole", "Start Log Console", QIcon(), QKeySequence("Ctrl+D"), "Open Log Console as external application", &MainWindowActions::onStartLogConsole); this->createAction("ShootScreen", "Shoot Screen", QIcon(":/icons/screenshot-screen.png"), QKeySequence("Ctrl+f"), "Save a screenshot to the patient folder.", &MainWindowActions::shootScreen); this->createAction("ShootWindow", "Shoot Window", QIcon(":/icons/screenshot-window.png"), QKeySequence("Ctrl+Shift+f"), "Save an image of the application to the patient folder.", &MainWindowActions::shootWindow); mRecordFullscreenStreamingAction = this->createAction("RecordFullscreen", "Record Fullscreen", QIcon(), QKeySequence("F8"), "Record a video of the full screen.", &MainWindowActions::recordFullscreen); connect(vlc(), &VLCRecorder::stateChanged, this, &MainWindowActions::updateRecordFullscreenActionSlot); this->updateRecordFullscreenActionSlot(); mShowPointPickerAction = this->createAction("ShowPointPicker", "Point Picker", QIcon(":/icons/point_picker.png"), QKeySequence(""), "Activate the 3D Point Picker Probe", &MainWindowActions::togglePointPickerActionSlot); mShowPointPickerAction->setCheckable(true); if (viewService()->getGroup(0)) connect(viewService()->getGroup(0).get(), &ViewGroupData::optionsChanged, this, &MainWindowActions::updatePointPickerActionSlot); this->updatePointPickerActionSlot(); mStartStreamingAction = this->createAction("StartStreaming", "Start Streaming", QIcon(":/icons/open_icon_library/.png"), QKeySequence("Ctrl+V"), "", &MainWindowActions::toggleStreamingSlot); connect(videoService().get(), &VideoService::connected, this, &MainWindowActions::updateStreamingActionSlot); this->updateStreamingActionSlot(); this->createAction("CenterToImageCenter", "Center Image", QIcon(":/icons/center_image.png"), QKeySequence(), "", &MainWindowActions::centerToImageCenterSlot); this->createAction("CenterToTooltip", "Center Tool", QIcon(":/icons/center_tool.png"), QKeySequence(""), "", &MainWindowActions::centerToTooltipSlot); this->createPatientActions(); this->createTrackingActions(); }
void MainWindow::saveDesktopSlot() { Desktop desktop; desktop.mMainWindowState = this->saveState(); desktop.mLayoutUid = viewService()->getActiveLayout(0); desktop.mSecondaryLayoutUid = viewService()->getActiveLayout(1); stateService()->saveDesktop(desktop); // save to settings file in addition settings()->setValue("mainWindow/geometry", saveGeometry()); settings()->setValue("mainWindow/windowState", saveState()); settings()->sync(); }
void MainWindow::createActions() { CameraControlPtr cameraControl = viewService()->getCameraControl(); if (cameraControl) mStandard3DViewActions = cameraControl->createStandard3DViewActions(); mShowContextSensitiveHelpAction = new QAction(QIcon(":/icons/open_icon_library/help-contents-5.png"), "Context-sensitive help", this); connect(mShowContextSensitiveHelpAction, &QAction::triggered, this, &MainWindow::onShowContextSentitiveHelp); mShowControlPanelAction = new QAction("Show Control Panel", this); connect(mShowControlPanelAction, &QAction::triggered, this, &MainWindow::showControlPanelActionSlot); mSecondaryViewLayoutWindowAction = new QAction("Show Secondary View Layout Window", this); connect(mSecondaryViewLayoutWindowAction, &QAction::triggered, this, &MainWindow::showSecondaryViewLayoutWindowActionSlot); // Application mAboutAction = new QAction(tr("About"), this); mAboutAction->setStatusTip(tr("Show the application's About box")); mPreferencesAction = new QAction(tr("Preferences"), this); mPreferencesAction->setShortcut(tr("Ctrl+,")); mPreferencesAction->setStatusTip(tr("Show the preferences dialog")); mFullScreenAction = new QAction(tr("Fullscreen"), this); mFullScreenAction->setShortcut(tr("F11")); mFullScreenAction->setStatusTip(tr("Toggle full screen")); mFullScreenAction->setCheckable(true); mFullScreenAction->setChecked(this->windowState() & Qt::WindowFullScreen); connect(mFullScreenAction, &QAction::triggered, this, &MainWindow::toggleFullScreenSlot); mQuitAction = new QAction(tr("&Quit"), this); mQuitAction->setShortcut(tr("Ctrl+Q")); mQuitAction->setStatusTip(tr("Exit the application")); connect(mAboutAction, &QAction::triggered, this, &MainWindow::aboutSlot); connect(mPreferencesAction, &QAction::triggered, this, &MainWindow::preferencesSlot); connect(mQuitAction, &QAction::triggered, qApp, &QApplication::quit); mSaveDesktopAction = new QAction(QIcon(":/icons/workflow_state_save.png"), tr("Save desktop"), this); mSaveDesktopAction->setToolTip("Save desktop for workflow step"); connect(mSaveDesktopAction, &QAction::triggered, this, &MainWindow::saveDesktopSlot); mResetDesktopAction = new QAction(QIcon(":/icons/workflow_state_revert.png"), tr("Reset desktop"), this); mResetDesktopAction->setToolTip("Reset desktop for workflow step"); connect(mResetDesktopAction, &QAction::triggered, this, &MainWindow::resetDesktopSlot); mInteractorStyleActionGroup = viewService()->getInteractorStyleActionGroup(); // cross-connect save patient to save session connect(mServices->session().get(), &SessionStorageService::isSaving, this, &MainWindow::saveDesktopSlot); }
void MainWindowActions::togglePointPickerActionSlot() { ViewGroupDataPtr data = viewService()->getGroup(0); ViewGroupData::Options options = data->getOptions(); options.mShowPointPickerProbe = !options.mShowPointPickerProbe; data->setOptions(options); }
void ImportDataDialog::acceptedSlot() { this->importParentTransform(); this->convertFromNifti1Coordinates(); this->convertToUnsigned(); mPatientModelService->autoSave(); viewService()->autoShowData(mData); this->finishedSlot(); }
NavigationWidget::NavigationWidget(QWidget* parent) : BaseWidget(parent, "NavigationWidget", "Navigation Properties"), mVerticalLayout(new QVBoxLayout(this)), mCameraGroupBox(new QGroupBox(tr("Camera Style"), this)), mCameraGroupLayout(new QVBoxLayout()) { this->setToolTip("Camera follow style"); //camera setttings mCameraGroupBox->setLayout(mCameraGroupLayout); QToolBar* toolBar = new QToolBar(this); mCameraGroupLayout->addWidget(toolBar); toolBar->addActions(viewService()->createInteractorStyleActionGroup()->actions()); QWidget* toolOffsetWidget = new SliderGroupWidget(this, DoublePropertyActiveToolOffset::create()); //layout this->setLayout(mVerticalLayout); mVerticalLayout->addWidget(mCameraGroupBox); mVerticalLayout->addWidget(toolOffsetWidget); mVerticalLayout->addStretch(); }
void SecondaryViewLayoutWindow::closeEvent(QCloseEvent *event) { viewService()->setActiveLayout("", 1); }
void SecondaryViewLayoutWindow::showEvent(QShowEvent* event) { this->setCentralWidget(viewService()->getLayoutWidget(this, 1)); if (viewService()->getActiveLayout(1).isEmpty()) viewService()->setActiveLayout("LAYOUT_OBLIQUE_3DAnyDual_x1", 1); }
MainWindow::MainWindow() : mFullScreenAction(NULL), mStandard3DViewActions(new QActionGroup(this)), mControlPanel(NULL), mDockWidgets(new DynamicMainWindowWidgets(this)), mActions(NULL) { this->setObjectName("MainWindow"); mServices = VisServices::create(logicManager()->getPluginContext()); mLayoutInteractor.reset(new LayoutInteractor()); this->setCentralWidget(viewService()->createLayoutWidget(this, 0)); mActions = new MainWindowActions(mServices, this); this->createActions(); this->createMenus(); this->createToolBars(); this->setStatusBar(new StatusBar()); reporter()->setAudioSource(AudioPtr(new AudioImpl())); connect(stateService().get(), &StateService::applicationStateChanged, this, &MainWindow::onApplicationStateChangedSlot); connect(stateService().get(), &StateService::workflowStateChanged, this, &MainWindow::onWorkflowStateChangedSlot); connect(stateService().get(), &StateService::workflowStateAboutToChange, this, &MainWindow::saveDesktopSlot); this->updateWindowTitle(); this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); this->addAsDockWidget(new PlaybackWidget(this), "Browsing"); this->addAsDockWidget(new VideoConnectionWidget(mServices, this), "Utility"); this->addAsDockWidget(new EraserWidget(mServices->patient(), mServices->view(), this), "Properties"); this->addAsDockWidget(new MetricWidget(mServices->view(), mServices->patient(), this), "Utility"); this->addAsDockWidget(new SlicePropertiesWidget(mServices->patient(), mServices->view(), this), "Properties"); this->addAsDockWidget(new VolumePropertiesWidget(mServices, this), "Properties"); this->addAsDockWidget(new ActiveMeshPropertiesWidget(mServices, this), "Properties"); this->addAsDockWidget(new StreamPropertiesWidget(mServices->patient(), mServices->view(), this), "Properties"); this->addAsDockWidget(new TrackPadWidget(this), "Utility"); this->addAsDockWidget(new ActiveToolPropertiesWidget(mServices->tracking(), mServices->spaceProvider(), this), "Properties"); this->addAsDockWidget(new NavigationWidget(this), "Properties"); this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget", "Console"), "Utility"); this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget2", "Extra Console"), "Utility"); // this->addAsDockWidget(new ConsoleWidgetCollection(this, "ConsoleWidgets", "Consoles"), "Utility"); this->addAsDockWidget(new FrameTreeWidget(mServices->patient(), this), "Browsing"); this->addAsDockWidget(new ToolManagerWidget(this), "Debugging"); this->addAsDockWidget(new PluginFrameworkWidget(this), "Browsing"); this->addAsDockWidget(new FiltersWidget(VisServices::create(logicManager()->getPluginContext()), this), "Algorithms"); this->addAsDockWidget(new ClippingPropertiesWidget(mServices, this), "Properties"); this->addAsDockWidget(new BrowserWidget(this, mServices), "Browsing"); connect(patientService().get(), &PatientModelService::patientChanged, this, &MainWindow::patientChangedSlot); connect(qApp, &QApplication::focusChanged, this, &MainWindow::focusChanged); this->setupGUIExtenders(); // window menu must be created after all dock widgets are created QMenu* popupMenu = this->createPopupMenu(); popupMenu->setTitle("Window"); this->menuBar()->insertMenu(mHelpMenuAction, popupMenu); // show after window has been initialized QTimer::singleShot(0, this, SLOT(delayedShow())); }
MainWindow::~MainWindow() { viewService()->deactivateLayout(); reporter()->setAudioSource(AudioPtr()); // important! QSound::play fires a thread, causes segfault during shutdown mServiceListener.reset(); }
MainWindow::MainWindow() : mFullScreenAction(NULL), mStandard3DViewActions(new QActionGroup(this)), mControlPanel(NULL), mDockWidgets(new DynamicMainWindowWidgets(this)), mActions(NULL) { this->setObjectName("MainWindow"); mServices = VisServices::create(logicManager()->getPluginContext()); mLayoutInteractor.reset(new LayoutInteractor()); this->setCentralWidget(viewService()->getLayoutWidget(this, 0)); mActions = new MainWindowActions(mServices, this); this->createActions(); this->createMenus(); this->createToolBars(); this->setStatusBar(new StatusBar()); reporter()->setAudioSource(AudioPtr(new AudioImpl())); connect(stateService().get(), &StateService::applicationStateChanged, this, &MainWindow::onApplicationStateChangedSlot); connect(stateService().get(), &StateService::workflowStateChanged, this, &MainWindow::onWorkflowStateChangedSlot); connect(stateService().get(), &StateService::workflowStateAboutToChange, this, &MainWindow::saveDesktopSlot); this->updateWindowTitle(); this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); this->addAsDockWidget(new PlaybackWidget(this), "Browsing"); this->addAsDockWidget(new VideoConnectionWidget(mServices, this), "Utility"); this->addAsDockWidget(new EraserWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties"); this->addAsDockWidget(new MetricWidget(mServices->visualizationService, mServices->patientModelService, this), "Utility"); this->addAsDockWidget(new SlicePropertiesWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties"); this->addAsDockWidget(new VolumePropertiesWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties"); this->addAsDockWidget(new MeshInfoWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties"); this->addAsDockWidget(new StreamPropertiesWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties"); this->addAsDockWidget(new TrackPadWidget(this), "Utility"); this->addAsDockWidget(new ToolPropertiesWidget(this), "Properties"); this->addAsDockWidget(new NavigationWidget(this), "Properties"); this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget", "Console"), "Utility"); this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget2", "Extra Console"), "Utility"); // this->addAsDockWidget(new ConsoleWidgetCollection(this, "ConsoleWidgets", "Consoles"), "Utility"); this->addAsDockWidget(new FrameTreeWidget(mServices->patientModelService, this), "Browsing"); this->addAsDockWidget(new ToolManagerWidget(this), "Debugging"); this->addAsDockWidget(new PluginFrameworkWidget(this), "Browsing"); this->addAsDockWidget(new AllFiltersWidget(VisServices::create(logicManager()->getPluginContext()), this), "Algorithms"); connect(patientService().get(), &PatientModelService::patientChanged, this, &MainWindow::patientChangedSlot); connect(qApp, &QApplication::focusChanged, this, &MainWindow::focusChanged); this->setupGUIExtenders(); // window menu must be created after all dock widgets are created QMenu* popupMenu = this->createPopupMenu(); popupMenu->setTitle("Window"); this->menuBar()->insertMenu(mHelpMenuAction, popupMenu); // Restore saved window states // Must be done after all DockWidgets are created if (restoreGeometry(settings()->value("mainWindow/geometry").toByteArray())) { this->show(); } else { this->showMaximized(); } if (settings()->value("gui/fullscreen").toBool()) this->setWindowState(this->windowState() | Qt::WindowFullScreen); }
void MainWindowActions::centerToTooltipSlot() { NavigationPtr nav = viewService()->getNavigation(); nav->centerToTooltip(); }
void MainWindowActions::centerToImageCenterSlot() { viewService()->centerToImageCenterInActiveViewGroup(); }
void MainWindowActions::centerToImageCenterSlot() { viewService()->getNavigation()->centerToDataInActiveViewGroup(); }